Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add product names to report metadata. #61

Merged
merged 2 commits into from
Feb 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion Sources/Reporters/AppSystemMetadataReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,44 @@ public struct AppSystemMetadataReporter: DiagnosticsReporting {
case appLanguage = "App Language"
}

static let hardwareName: [String: String] = [
"iPhone7,1": "iPhone 6 Plus",
"iPhone7,2": "iPhone 6",
"iPhone8,1": "iPhone 6s",
"iPhone8,2": "iPhone 6s Plus",
"iPhone8,4": "iPhone SE",
"iPhone9,1": "iPhone 7",
"iPhone9,2": "iPhone 7 Plus",
"iPhone9,3": "iPhone 7",
"iPhone9,4": "iPhone 7 Plus",
"iPhone10,1": "iPhone 8",
"iPhone10,2": "iPhone 8 Plus",
"iPhone10,3": "iPhone X",
"iPhone10,4": "iPhone 8",
"iPhone10,5": "iPhone 8 Plus",
"iPhone10,6": "iPhone X",
"iPhone11,2": "iPhone XS",
"iPhone11,4": "iPhone XS Max",
"iPhone11,6": "iPhone XS Max",
"iPhone11,8": "iPhone XR",
"iPhone12,1": "iPhone 11",
"iPhone12,3": "iPhone 11 Pro",
"iPhone12,5": "iPhone 11 Pro Max"
]

static var title: String = "App & System Details"
static var diagnostics: [String: String] {
var systemInfo = utsname()
uname(&systemInfo)
let hardware = Mirror(reflecting: systemInfo.machine).children.reduce("") { identifier, element in
var hardware = Mirror(reflecting: systemInfo.machine).children.reduce("") { identifier, element in
guard let value = element.value as? Int8, value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}

if let hardwareName = hardwareName[hardware] {
hardware += " (\(hardwareName))"
}

let system = "\(UIDevice.current.systemName) \(UIDevice.current.systemVersion)"

let metadata: [String: String] = [
Expand Down