Skip to content

Commit

Permalink
Version 0.2.6
Browse files Browse the repository at this point in the history
deviceProperties
  • Loading branch information
nickpodryvnik authored Jun 16, 2021
1 parent 9e4d0cc commit d44ad8e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AppboosterSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion AppboosterSDK/Classes/AppboosterSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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,
Expand All @@ -43,6 +45,7 @@ public final class AppboosterSDK: NSObject {
self.deviceId = deviceId
?? AppboosterKeychain.getDeviceId()
?? AppboosterKeychain.setNewDeviceId()
self.deviceProperties = deviceProperties

AppboosterDebugMode.usingShake = usingShake

Expand Down Expand Up @@ -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)",
Expand Down
2 changes: 2 additions & 0 deletions AppboosterSDK/Classes/JWTToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public struct JWTToken {

public static func generate(
deviceId: String,
deviceProperties: [String: Any],
appsFlyerId: String?,
amplitudeId: String?,
sdkToken: String
Expand All @@ -23,6 +24,7 @@ public struct JWTToken {
]
let payload: [String: Any] = [
"deviceId": deviceId,
"deviceProperties": deviceProperties,
"appsFlyerId": appsFlyerId ?? "",
"amplitudeId": amplitudeId ?? ""
]
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import AppboosterSDK
let ab = AppboosterSDK(sdkToken: "<YOUR_SDK_TOKEN>",
appId: "<YOUR_APP_ID>",
deviceId: "<YOUR_DEVICE_ID>", // 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
Expand Down

0 comments on commit d44ad8e

Please sign in to comment.