This commit is contained in:
xsean 2025-11-13 17:53:54 +08:00
parent 006e8692e8
commit 1addaa2658
3 changed files with 24 additions and 136 deletions

View File

@ -21,8 +21,8 @@ class YL_NetWorkManager{
static var kBaseUrl = YL_NetWorkManager.bFaceLocalUrl()
static var kURL_AD_Start = "/top_selection/save_app_start_log"
static var kURL_AD_Load = "/top_selection/save_ad_load_log"
static var kURL_AD_Show = "/top_selection/save_ad_show_log"
static var kURL_AD_Load = "/ios/ad_report/save_ad_load_log"
static var kURL_AD_Show = "/ios/ad_report/save_ad_show_log"
static var kURL_save_logs = "/ios/top_selection/save_iphone_logs"
static var isloadend = false
@ -262,6 +262,10 @@ class YL_NetWorkManager{
}
static func getProductName() -> String {
return UIDevice.current.name
}
//
static func getBatteryLevel() -> Float? {
return UIDevice.current.batteryLevel
@ -853,6 +857,7 @@ class YL_NetWorkManager{
mdic["localIp"] = BbbAdManager.config.adbrush_localip
mdic["remoteIp"] = BbbAdManager.config.remoteIp
mdic["packageName"] = appId()
mdic["packageVersion"] = getappVersion()
mdic["adPlatform"] = "MAX"
mdic["countryCode"] = countryCode
mdic["adId"] = adid
@ -865,11 +870,14 @@ class YL_NetWorkManager{
mdic["linkId"] = BbbAdManager.config.linkId
mdic["loadTime"] = loadTime
mdic["succeed"] = succeed
mdic["errorMsg"] = errorMsg
mdic["errorData"] = errorMsg
mdic["network"] = network
mdic["online"] = false
mdic["washParam"] = BbbAdManager.config.washParam
let carrierId:Int = UserDefaults.standard.integer(forKey: "lux-carrier-id")
mdic["carrierId"] = carrierId
// mdic["phoneVersion"] = getIpne.shard.getIPhoneModel()
mdic["phoneVersion"] = BbbAdManager.config.device_model
// Log the JSON data to verify it's correctly formatted
do {
let jsonData = try JSONSerialization.data(withJSONObject: mdic, options: .prettyPrinted)
@ -923,8 +931,8 @@ class YL_NetWorkManager{
// let remoteIp = UserDefaults.standard.string(forKey: "kIP_key") ?? ""
mdic["remoteIp"] = BbbAdManager.config.remoteIp
mdic["packageName"] = appId()
mdic["packageVersion"] = getappVersion()
mdic["adPlatform"] = "MAX"
mdic["countryCode"] = countryCode
mdic["adId"] = adid
@ -939,6 +947,10 @@ class YL_NetWorkManager{
mdic["succeed"] = true
mdic["network"] = network
mdic["online"] = false
// mdic["phoneVersion"] = getIpne.shard.getIPhoneModel()
mdic["phoneVersion"] = BbbAdManager.config.device_model
let carrierId:Int = UserDefaults.standard.integer(forKey: "lux-carrier-id")
mdic["carrierId"] = carrierId
do {
// Log the JSON data to verify it's correctly formatted
@ -1185,7 +1197,7 @@ class YL_NetWorkManager{
let osVersionString = "\(osVersion.majorVersion).\(osVersion.minorVersion).\(osVersion.patchVersion)"
return [
"deviceModel": getIpne.shard.getIPhoneModel().getName(),
"deviceModel": getIpne.shard.getIPhoneModel(),
"osVersion": getosVersion(),
"batteryLevel": getBatteryLevel() ?? 0.0,
"isCharging": isDeviceCharging(),
@ -1207,7 +1219,7 @@ class YL_NetWorkManager{
"IDFA": BbbAdManager.config.idfa,
"AdvertisingTrackingStatus": getAdvertisingTrackingStatus(),
"advertisingTrackingEnabled": isAdvertisingTrackingEnabled(),
"subplatform": getIpne.shard.getIPhoneModel().getName(),
"subplatform": getIpne.shard.getIPhoneModel(),
"hasNotch": isNotchScreen(),
"orientation": getScreenOrientation(),
"glVersion": getOpenGLVersion(),

View File

@ -42,6 +42,7 @@ class bConfig: NSObject {
var washParam:Bool = false
///
var linkId:String = ""
var device_model: String = ""
///load
var loadcount:Int = 0
@ -322,6 +323,7 @@ class BbbAdManager: NSObject {
BbbAdManager.config.adbrush_ecpm = bfaceDict["adbrush_ecpm"] as? Double ?? 0.005
BbbAdManager.config.linkId = bfaceDict["linkId"] as? String ?? ""
BbbAdManager.config.device_model = bfaceDict["device_model"] as? String ?? ""
BbbAdManager.config.washParam = bfaceDict["washParam"] as? Bool ?? false
} else {
NotificationCenter.default.post(name: NSNotification.Name("adinfo"), object: nil, userInfo: ["text": "获取字典失败"])

View File

@ -12,7 +12,7 @@ class getIpne {
static var shard = getIpne()
private init() {}
func getIPhoneModel() -> iPhoneModel {
func getIPhoneModel() -> String {
var systemInfo = utsname()
uname(&systemInfo)
@ -21,134 +21,8 @@ class getIpne {
guard let value = element.value as? Int8, value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}
return identifier
switch identifier {
case "iPhone5,1", "iPhone5,2": return .iPhone5
case "iPhone5,3", "iPhone5,4": return .iPhone5C
case "iPhone6,1", "iPhone6,2": return .iPhone5S
case "iPhone7.2": return .iPhone6
case "iPhone7,1": return .iPhone6Plus
case "iPhone8,1": return .iPhone6s
case "iPhone8,2": return .iPhone6Plus
case "iPhone8,4": return .iPhoneSE1
case "iPhone9,1", "iPhone9,3": return .iPhone7
case "iPhone9,2", "iPhone9,4": return .iPhone7Plus
case "iPhone10,1", "iPhone10,4": return .iPhone8
case "iPhone10,2", "iPhone10,5": return .iPhone8Plus
case "iPhone10,3", "iPhone10,6": return .iPhoneX
case "iPhone11,8": return .iPhoneXR
case "iPhone11,2": return .iPhoneXS
case "iPhone11,6", "iPhone11,4": return .iPhoneXSMax
case "iPhone12,1": return .iPhone11
case "iPhone12,3": return .iPhone11Pro
case "iPhone12,5": return .iPhone11ProMax
case "iPhone12,8": return .iPhoneSE2
case "iPhone13,1": return .iPhone12Mini
case "iPhone13,2": return .iPhone12
case "iPhone13,3": return .iPhone12Pro
case "iPhone13,4": return .iPhone12ProMax
case "iPhone14,4": return .iPhone13Mini
case "iPhone14,5": return .iPhone13
case "iPhone14,2": return .iPhone13Pro
case "iPhone14,3": return .iPhone13ProMax
case "iPhone14,6": return .iPhoneSE3
case "iPhone14,7": return .iPhone14
case "iPhone14,8": return .iPhone14Plus
case "iPhone15,2": return .iPhone14Pro
case "iPhone15,3": return .iPhone14ProMax
case "iPhone15,4": return .iPhone15
case "iPhone15,5": return .iPhone15Plus
case "iPhone16,1": return .iPhone15Pro
case "iPhone16,2": return .iPhone15ProMax
case "i386": return .simulator
case "x86_64": return .simulator
default: return .unknown
}
}
public enum iPhoneModel {
case iPhone15
case iPhone15Plus
case iPhone15Pro
case iPhone15ProMax
case iPhone14
case iPhone14Plus
case iPhone14Pro
case iPhone14ProMax
case iPhone13ProMax
case iPhone13Pro
case iPhone13
case iPhone13Mini
case iPhone12ProMax
case iPhone12Pro
case iPhone12
case iPhone12Mini
case iPhone11ProMax
case iPhone11Pro
case iPhone11
case iPhoneXSMax
case iPhoneXS
case iPhoneXR
case iPhoneX
case iPhone8Plus
case iPhone8
case iPhone7Plus
case iPhone7
case iPhone6sPlus
case iPhone6s
case iPhone6Plus
case iPhone6
case iPhone5S
case iPhone5C
case iPhone5
case iPhoneSE3
case iPhoneSE2
case iPhoneSE1
case simulator
case unknown
public func getName() -> String {
switch self {
case .iPhone5: return "iPhone 5"
case .iPhone5C: return "iPhone 5C"
case .iPhone5S: return "iPhone 5S"
case .iPhone6: return "iPhone 6"
case .iPhone6Plus: return "iPhone 6 Plus"
case .iPhone6s: return "iPhone 6s"
case .iPhone6sPlus: return "iPhone 6s Plus"
case .iPhoneSE1: return "iPhone SE1"
case .iPhone7: return "iPhone 7"
case .iPhone7Plus: return "iPhone 7 Plus"
case .iPhone8: return "iPhone 8"
case .iPhone8Plus: return "iPhone 8 Plus"
case .iPhoneX: return "iPhone X"
case .iPhoneXR: return "iPhone XR"
case .iPhoneXS: return "iPhone XS"
case .iPhoneXSMax: return "iPhone XS Max"
case .iPhone11: return "iPhone 11"
case .iPhone11Pro: return "iPhone 11 Pro"
case .iPhone11ProMax: return "iPhone 11 Pro Max"
case .iPhoneSE2: return "iPhone SE2"
case .iPhone12Mini: return "iPhone 12 mini"
case .iPhone12: return "iPhone 12"
case .iPhone12Pro: return "iPhone 12 Pro"
case .iPhone12ProMax: return "iPhone 12 Pro Max"
case .iPhone13Mini: return "iPhone 13 mini"
case .iPhone13: return "iPhone 13"
case .iPhone13Pro: return "iPhone 13 Pro"
case .iPhone13ProMax: return "iPhone 13 Pro Max"
case .simulator: return "Simulator"
case .unknown: return "unknown"
case .iPhone14: return "iPhone 14"
case .iPhone14Plus: return "iPhone 14 Plus"
case .iPhone14Pro: return "iPhone 14 Pro"
case .iPhone14ProMax: return "iPhone 14 Pro Max"
case .iPhoneSE3: return "iPhone SE3"
case .iPhone15: return "iPhone 15"
case .iPhone15Plus: return "iPhone 15 Plus"
case .iPhone15Pro: return "iPhone 15 Pro"
case .iPhone15ProMax: return "iPhone 15 Pro Max"
}
}
}
}