From 863a1dc413902ede7e86d27a6e0c5b305c9ec96b Mon Sep 17 00:00:00 2001 From: Kyle Kurz Date: Tue, 26 Nov 2019 15:11:02 -0800 Subject: [PATCH] DeviceID is a UInt64 I mistakenly thought the JSON key error was our only issue and didn't get this end-to-end verified at lunch. This completes the circuit, I verified that the func didReceive(deviceId: UInt64) callback is correctly called in the example code as well. --- Example/Podfile.lock | 10 +++++----- Example/Wildlink/AppDelegate.swift | 2 +- README.md | 4 ++-- Wildlink.podspec | 2 +- Wildlink/Classes/Wildlink.swift | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 7717f79..e0cf5e5 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,8 +1,8 @@ PODS: - Alamofire (4.8.2) - - Wildlink (1.0.5): + - Wildlink (1.0.6): - Alamofire (~> 4.8.2) - - Wildlink/Tests (1.0.5): + - Wildlink/Tests (1.0.6): - Alamofire (~> 4.8.2) DEPENDENCIES: @@ -10,7 +10,7 @@ DEPENDENCIES: - Wildlink/Tests (from `../`) SPEC REPOS: - https://github.com/cocoapods/specs.git: + trunk: - Alamofire EXTERNAL SOURCES: @@ -19,8 +19,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3 - Wildlink: 068f19c459aa8d5780c684ab08de1a2bf091ee35 + Wildlink: 1698c8bde239ea342722aa7633b851354e3f530f PODFILE CHECKSUM: ebc74e7f624558182cd7f10e0ae346ced9843b6a -COCOAPODS: 1.7.4 +COCOAPODS: 1.8.4 diff --git a/Example/Wildlink/AppDelegate.swift b/Example/Wildlink/AppDelegate.swift index 6fa3c8e..ddef10d 100644 --- a/Example/Wildlink/AppDelegate.swift +++ b/Example/Wildlink/AppDelegate.swift @@ -61,7 +61,7 @@ extension AppDelegate : WildlinkDelegate { defaults.set(deviceToken, forKey: "wildlinkDeviceToken") } - func didReceive(deviceId: String) { + func didReceive(deviceId: UInt64) { let defaults = UserDefaults.standard defaults.set(deviceId, forKey: "wildlinkDeviceId") } diff --git a/README.md b/README.md index ca84ce0..f9e0a7e 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ platform:ios, '10.0' target 'Wildlink_Example' do - pod 'Wildlink', '~> 1.0.5' + pod 'Wildlink', '~> 1.0.6' end ``` @@ -100,7 +100,7 @@ extension AppDelegate : WildlinkDelegate { defaults.set(deviceToken, forKey: "wildlinkDeviceToken") } - func didReceive(deviceId: String) { + func didReceive(deviceId: UInt64) { let defaults = UserDefaults.standard defaults.set(deviceId, forKey: "wildlinkDeviceId") } diff --git a/Wildlink.podspec b/Wildlink.podspec index 1ef7c59..49b78d5 100644 --- a/Wildlink.podspec +++ b/Wildlink.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Wildlink' - s.version = '1.0.5' + s.version = '1.0.6' s.summary = 'You can use this CocoaPod to interact with the Wildlink API' s.homepage = 'https://wildlink.me' diff --git a/Wildlink/Classes/Wildlink.swift b/Wildlink/Classes/Wildlink.swift index 16d3de8..1034afe 100644 --- a/Wildlink/Classes/Wildlink.swift +++ b/Wildlink/Classes/Wildlink.swift @@ -16,7 +16,7 @@ protocol JSONSerializable { public protocol WildlinkDelegate : class { func didReceive(deviceToken: String) func didReceive(deviceKey: String) - func didReceive(deviceId: String) + func didReceive(deviceId: UInt64) } // List of possible Error cases from the Wildlink SDK. @@ -54,7 +54,7 @@ public enum WildlinkSortOrder: String { public class Wildlink: RequestAdapter, RequestRetrier { //private variables/methods - private typealias RefreshCompletion = (_ succeeded: Bool, _ deviceToken: String?, _ deviceKey: String?, _ deviceId: String?) -> Void + private typealias RefreshCompletion = (_ succeeded: Bool, _ deviceToken: String?, _ deviceKey: String?, _ deviceId: UInt64?) -> Void private let sessionManager: SessionManager = { let configuration = URLSessionConfiguration.default @@ -67,7 +67,7 @@ public class Wildlink: RequestAdapter, RequestRetrier { private var baseUrl: URL private var deviceToken = "" private var deviceKey: String? - private var deviceId: String? + private var deviceId: UInt64? private var senderToken = "" static var apiKey = "" static var appID = "" @@ -454,7 +454,7 @@ public class Wildlink: RequestAdapter, RequestRetrier { if let json = value as? [String: Any], let deviceToken = json["DeviceToken"] as? String { let deviceKey = json["DeviceKey"] as? String - let deviceId = json["DeviceID"] as? String + let deviceId = json["DeviceID"] as? UInt64 completion(true, deviceToken, deviceKey, deviceId) } else { Logger.error("Failed to refresh device token: \(String(describing: response.result))") @@ -497,7 +497,7 @@ public class Wildlink: RequestAdapter, RequestRetrier { // Helper function to store an updated device identifier in memory and tell the delegate about it (if set) // // - parameter id: The new device ID - func update(id: String) { + func update(id: UInt64) { self.deviceId = id Wildlink.shared.delegate?.didReceive(deviceId: id) }