feat: enhance system info in support email with CPU and memory details

This commit is contained in:
Beingpax 2025-05-02 11:59:41 +05:45
parent 0f70d9fc05
commit 5074510761

View File

@ -9,6 +9,8 @@ struct EmailSupport {
App Version: \(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown")
macOS Version: \(ProcessInfo.processInfo.operatingSystemVersionString)
Device: \(getMacModel())
CPU: \(getCPUInfo())
Memory: \(getMemoryInfo())
"""
let body = """
@ -53,4 +55,18 @@ struct EmailSupport {
sysctlbyname("hw.model", &machine, &size, nil, 0)
return String(cString: machine)
}
private static func getCPUInfo() -> String {
var size = 0
sysctlbyname("machdep.cpu.brand_string", nil, &size, nil, 0)
var buffer = [CChar](repeating: 0, count: size)
sysctlbyname("machdep.cpu.brand_string", &buffer, &size, nil, 0)
return String(cString: buffer)
}
private static func getMemoryInfo() -> String {
let totalMemory = ProcessInfo.processInfo.physicalMemory
return ByteCountFormatter.string(fromByteCount: Int64(totalMemory), countStyle: .memory)
}
}