Skip to content

Commit

Permalink
Show device name instead of model
Browse files Browse the repository at this point in the history
  • Loading branch information
zqqf16 committed Feb 7, 2017
1 parent 2076137 commit 1ce4c79
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
68 changes: 67 additions & 1 deletion SYM/CrashInfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class CrashInfoViewController: NSViewController {
self.version.stringValue = crash.version ?? ""
self.osVersion.stringValue = crash.osVersion ?? ""
if let device = crash.device {
self.device.stringValue = "\(device) (\(crash.arch))"
let name = self.deviceName(device) ?? device
self.device.stringValue = "\(name) (\(crash.arch))"
} else {
self.device.stringValue = "Unknow device (\(crash.arch))"
}
Expand All @@ -71,6 +72,71 @@ class CrashInfoViewController: NSViewController {
}
}

func deviceName(_ fromModel: String) -> String? {
let models: [String: String] = [
"i386": "i386 Simulator",
"x86_64": "x86_64 Simulator",

"iPhone1,1": "iPhone",
"iPhone1,2": "iPhone 3G",
"iPhone2,1": "iPhone 3GS",
"iPhone3,1": "iPhone 4",
"iPhone3,2": "iPhone 4(Rev A)",
"iPhone3,3": "iPhone 4(CDMA)",
"iPhone4,1": "iPhone 4S",
"iPhone5,1": "iPhone 5(GSM)",
"iPhone5,2": "iPhone 5(GSM+CDMA)",
"iPhone5,3": "iPhone 5c(GSM)",
"iPhone5,4": "iPhone 5c(GSM+CDMA)",
"iPhone6,1": "iPhone 5s(GSM)",
"iPhone6,2": "iPhone 5s(GSM+CDMA)",
"iPhone7,1": "iPhone 6+(GSM+CDMA)",
"iPhone7,2": "iPhone 6(GSM+CDMA)",
"iPhone8,1": "iPhone 6S(GSM+CDMA)",
"iPhone8,2": "iPhone 6S+(GSM+CDMA)",
"iPhone8,4": "iPhone SE(GSM+CDMA)",
"iPhone9,1": "iPhone 7(GSM+CDMA)",
"iPhone9,2": "iPhone 7+(GSM+CDMA)",
"iPhone9,3": "iPhone 7(GSM+CDMA)",
"iPhone9,4": "iPhone 7+(GSM+CDMA)",

"iPad1,1": "iPad",
"iPad2,1": "iPad 2(WiFi)",
"iPad2,2": "iPad 2(GSM)",
"iPad2,3": "iPad 2(CDMA)",
"iPad2,4": "iPad 2(WiFi Rev A)",
"iPad2,5": "iPad Mini 1G (WiFi)",
"iPad2,6": "iPad Mini 1G (GSM)",
"iPad2,7": "iPad Mini 1G (GSM+CDMA)",
"iPad3,1": "iPad 3(WiFi)",
"iPad3,2": "iPad 3(GSM+CDMA)",
"iPad3,3": "iPad 3(GSM)",
"iPad3,4": "iPad 4(WiFi)",
"iPad3,5": "iPad 4(GSM)",
"iPad3,6": "iPad 4(GSM+CDMA)",
"iPad4,1": "iPad Air(WiFi)",
"iPad4,2": "iPad Air(GSM)",
"iPad4,3": "iPad Air(GSM+CDMA)",
"iPad5,3": "iPad Air 2 (WiFi)",
"iPad5,4": "iPad Air 2 (GSM+CDMA)",
"iPad4,4": "iPad Mini 2G (WiFi)",
"iPad4,5": "iPad Mini 2G (GSM)",
"iPad4,6": "iPad Mini 2G (GSM+CDMA)",
"iPad4,7": "iPad Mini 3G (WiFi)",
"iPad4,8": "iPad Mini 3G (GSM)",
"iPad4,9": "iPad Mini 3G (GSM+CDMA)",

"iPod1,1": "iPod 1st Gen",
"iPod2,1": "iPod 2nd Gen",
"iPod3,1": "iPod 3rd Gen",
"iPod4,1": "iPod 4th Gen",
"iPod5,1": "iPod 5th Gen",
"iPod7,1": "iPod 6th Gen",
]

return models[fromModel]
}

@IBAction func showInFinder(_ sender: AnyObject?) {
let dSym = self.dSym.stringValue
if dSym == "" || dSym == "Not found" {
Expand Down
2 changes: 1 addition & 1 deletion SYM/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>23</string>
<string>24</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 1ce4c79

Please sign in to comment.