2026-05-23 01:20:57 +08:00
|
|
|
import XuqmCoreSDK
|
2026-05-16 02:25:26 +08:00
|
|
|
#if canImport(UIKit)
|
|
|
|
|
import UIKit
|
|
|
|
|
#endif
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
enum DeviceInfoProvider {
|
|
|
|
|
|
|
|
|
|
static func getDeviceId(store: LicenseStore) -> String {
|
|
|
|
|
if let existing = store.deviceId { return existing }
|
|
|
|
|
#if canImport(UIKit)
|
|
|
|
|
let id = UIDevice.current.identifierForVendor?.uuidString ?? UUID().uuidString
|
|
|
|
|
#else
|
|
|
|
|
let id = UUID().uuidString
|
|
|
|
|
#endif
|
|
|
|
|
store.deviceId = id
|
|
|
|
|
return id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static func getDeviceName() -> String {
|
|
|
|
|
#if canImport(UIKit)
|
|
|
|
|
return UIDevice.current.name
|
|
|
|
|
#else
|
|
|
|
|
return Host.current().localizedName ?? "Mac"
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static func getDeviceModel() -> String {
|
|
|
|
|
#if canImport(UIKit)
|
|
|
|
|
return UIDevice.current.model
|
|
|
|
|
#else
|
|
|
|
|
return "Mac"
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static func getDeviceVendor() -> String { "Apple" }
|
|
|
|
|
|
|
|
|
|
static func getOsVersion() -> String {
|
|
|
|
|
#if canImport(UIKit)
|
|
|
|
|
return "iOS \(UIDevice.current.systemVersion)"
|
|
|
|
|
#else
|
|
|
|
|
let v = ProcessInfo.processInfo.operatingSystemVersion
|
|
|
|
|
return "macOS \(v.majorVersion).\(v.minorVersion).\(v.patchVersion)"
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|