From d44ad8e8a3183bc5529dea612cd1ae66cfff39d2 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 16 Jun 2021 16:58:13 +0400 Subject: [PATCH] Version 0.2.6 deviceProperties --- AppboosterSDK.podspec | 2 +- AppboosterSDK/Classes/AppboosterSDK.swift | 5 ++++- AppboosterSDK/Classes/JWTToken.swift | 2 ++ README.md | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/AppboosterSDK.podspec b/AppboosterSDK.podspec index 4e89de7..944f496 100644 --- a/AppboosterSDK.podspec +++ b/AppboosterSDK.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'AppboosterSDK' - s.version = '0.2.5' + s.version = '0.2.6' s.summary = 'Mobile framework for Appbooster platform.' # This description is used to generate tags and improve search results. diff --git a/AppboosterSDK/Classes/AppboosterSDK.swift b/AppboosterSDK/Classes/AppboosterSDK.swift index 157df09..d0d22b2 100644 --- a/AppboosterSDK/Classes/AppboosterSDK.swift +++ b/AppboosterSDK/Classes/AppboosterSDK.swift @@ -15,6 +15,7 @@ public final class AppboosterSDK: NSObject { private let sdkToken: String private let appId: String private let deviceId: String + private let deviceProperties: [String: Any] private let appsFlyerId: String? private let amplitudeId: String? private let knownKeys: [String] @@ -25,6 +26,7 @@ public final class AppboosterSDK: NSObject { sdkToken: String, appId: String, deviceId: String? = nil, + deviceProperties: [String: Any] = [:], appsFlyerId: String? = nil, amplitudeUserId: String? = nil, usingShake: Bool = true, @@ -43,6 +45,7 @@ public final class AppboosterSDK: NSObject { self.deviceId = deviceId ?? AppboosterKeychain.getDeviceId() ?? AppboosterKeychain.setNewDeviceId() + self.deviceProperties = deviceProperties AppboosterDebugMode.usingShake = usingShake @@ -135,7 +138,7 @@ public final class AppboosterSDK: NSObject { } private func createHeaders() -> [String: String] { - let token = JWTToken.generate(deviceId: deviceId, appsFlyerId: appsFlyerId, amplitudeId: amplitudeId, sdkToken: sdkToken) ?? "" + let token = JWTToken.generate(deviceId: deviceId, deviceProperties: deviceProperties, appsFlyerId: appsFlyerId, amplitudeId: amplitudeId, sdkToken: sdkToken) ?? "" let headers = [ "Content-Type": "application/json", "Authorization": "Bearer \(token)", diff --git a/AppboosterSDK/Classes/JWTToken.swift b/AppboosterSDK/Classes/JWTToken.swift index 186fb10..a8c4248 100644 --- a/AppboosterSDK/Classes/JWTToken.swift +++ b/AppboosterSDK/Classes/JWTToken.swift @@ -13,6 +13,7 @@ public struct JWTToken { public static func generate( deviceId: String, + deviceProperties: [String: Any], appsFlyerId: String?, amplitudeId: String?, sdkToken: String @@ -23,6 +24,7 @@ public struct JWTToken { ] let payload: [String: Any] = [ "deviceId": deviceId, + "deviceProperties": deviceProperties, "appsFlyerId": appsFlyerId ?? "", "amplitudeId": amplitudeId ?? "" ] diff --git a/README.md b/README.md index 71b32db..c73a144 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,9 @@ import AppboosterSDK let ab = AppboosterSDK(sdkToken: "", appId: "", deviceId: "", // optional, UUID generated by default + deviceProperties: [ + "installedAt": "2021-05-20T09:55:05.000+03:00" + ], // optional, additional information about device appsFlyerId: AppsFlyerTracker.shared().getAppsFlyerUID(), // optional, if AppsFlyer integration is needed (import AppsFlyerLib before) amplitudeUserId: Amplitude.instance().userId, // optional, if Amplitude integration is needed (import Amplitude before) usingShake: false, // true by default for debug mode, turn it off if you are already using shake motion in your app for other purposes