Enforce Rust and Swift ownership boundary
This commit is contained in:
@@ -151,39 +151,19 @@ func showRepositoryContent(
|
||||
context: context,
|
||||
owner: owner,
|
||||
repository: repository,
|
||||
path: row.path
|
||||
path: row.path,
|
||||
name: row.name
|
||||
)
|
||||
: RepositoryFileViewController(
|
||||
context: context,
|
||||
owner: owner,
|
||||
repository: repository,
|
||||
path: row.path
|
||||
path: row.path,
|
||||
name: row.name
|
||||
)
|
||||
navigationController?.pushViewController(destination, animated: true)
|
||||
}
|
||||
|
||||
func sourceLanguage(_ path: String) -> String? {
|
||||
let filename = (path as NSString).lastPathComponent.lowercased()
|
||||
let filenames = [
|
||||
"cmakelists.txt": "cmake", "dockerfile": "dockerfile", "gemfile": "ruby",
|
||||
"makefile": "makefile", "podfile": "ruby",
|
||||
]
|
||||
if let language = filenames[filename] { return language }
|
||||
let languages = [
|
||||
"asm": "x86asm", "c": "c", "cc": "cpp", "clj": "clojure", "cpp": "cpp",
|
||||
"cs": "csharp", "css": "css", "dart": "dart", "ex": "elixir", "exs": "elixir",
|
||||
"fs": "fsharp", "go": "go", "groovy": "groovy", "h": "cpp", "hpp": "cpp",
|
||||
"hs": "haskell", "html": "xml", "java": "java", "jl": "julia", "js": "javascript",
|
||||
"json": "json", "jsx": "javascript", "kt": "kotlin", "kts": "kotlin", "lua": "lua",
|
||||
"m": "objectivec", "md": "markdown", "mm": "objectivec", "php": "php", "pl": "perl",
|
||||
"plist": "xml", "ps1": "powershell", "py": "python", "r": "r", "rb": "ruby",
|
||||
"rs": "rust", "scala": "scala", "scss": "scss", "sh": "bash", "sql": "sql",
|
||||
"swift": "swift", "toml": "ini", "ts": "typescript", "tsx": "typescript",
|
||||
"txt": "plaintext", "xml": "xml", "yaml": "yaml", "yml": "yaml",
|
||||
]
|
||||
return languages[(path as NSString).pathExtension.lowercased()]
|
||||
}
|
||||
|
||||
func symbolText(_ symbol: String, text: String, font: UIFont, color: UIColor) -> NSAttributedString {
|
||||
let output = NSMutableAttributedString()
|
||||
if let image = UIImage(systemName: symbol)?.withTintColor(color, renderingMode: .alwaysOriginal) {
|
||||
|
||||
Reference in New Issue
Block a user