From 044b5d7643c15bf9495b6a094b8f4355babf1fae Mon Sep 17 00:00:00 2001 From: Orlando Aliaga Date: Wed, 17 Jan 2024 15:01:14 -0300 Subject: [PATCH] Add attributes change Add attributes change --- Prey/Classes/PreyDevice.swift | 2 +- Prey/Classes/PreyNotification.swift | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Prey/Classes/PreyDevice.swift b/Prey/Classes/PreyDevice.swift index e10dc8c..dcfedc6 100644 --- a/Prey/Classes/PreyDevice.swift +++ b/Prey/Classes/PreyDevice.swift @@ -30,7 +30,7 @@ class PreyDevice { // MARK: Functions // Init function - fileprivate init() { + init() { name = UIDevice.current.name type = (IS_IPAD) ? "Tablet" : "Phone" os = "iOS" diff --git a/Prey/Classes/PreyNotification.swift b/Prey/Classes/PreyNotification.swift index b134958..963eba4 100644 --- a/Prey/Classes/PreyNotification.swift +++ b/Prey/Classes/PreyNotification.swift @@ -80,7 +80,29 @@ class PreyNotification { PreyLogger("Did register device token") let tokenAsString = deviceToken.reduce("") { $0 + String(format: "%02x", $1) } PreyLogger(tokenAsString) - let params:[String: String] = ["notification_id" : tokenAsString, "name" : UIDevice.current.name] + let preyDevice = PreyDevice() + let firmwareInfo : [String:String] = [ + "model_name": preyDevice.model!, + "vendor_name": preyDevice.vendor!, + ] + let processorInfo : [String:String] = [ + "speed": preyDevice.cpuSpeed!, + "cores": preyDevice.cpuCores!, + "model": preyDevice.cpuModel!, + ] + let specs : [String: Any] = [ + "processor_info": processorInfo, + "firmware_info": firmwareInfo, + ] + let hardwareAttributes : [String:String] = [ + "ram_size" : preyDevice.ramSize! + ] + let params:[String: Any] = [ + "notification_id" : tokenAsString, + "name" : UIDevice.current.name, + "specs": specs, + "hardware_attributes":hardwareAttributes + ] // Check userApiKey isn't empty if let username = PreyConfig.sharedInstance.userApiKey {