From 8b4e1887e5e47b99e8fecc7952a1c5608dcb8dae Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 8 Apr 2023 08:37:14 +0000 Subject: [PATCH] fix: iOS/Android uses latest native libraries + iOS identify improvenets --- android/build.gradle | 2 +- example/ios/Podfile.lock | 8 ++++---- extole-mobile-sdk.podspec | 2 +- ios/ExtoleMobileSdk.m | 4 ++++ ios/ExtoleMobileSdk.swift | 12 ++++++++++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index ab57a10..8bcc200 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -148,7 +148,7 @@ dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'com.extole.mobile:android-sdk:1.0.39' + implementation 'com.extole.mobile:android-sdk:1.0.44' implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") // From node_modules } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 92a120a..ed2c876 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -4,11 +4,11 @@ PODS: - CocoaAsyncSocket (7.6.5) - DoubleConversion (1.1.6) - extole-mobile-sdk (0.0.2): - - ExtoleMobileSDK (~> 0.0.38) + - ExtoleMobileSDK (~> 0.0.42) - React-Core - ExtoleConsumerAPI (0.0.17): - Alamofire (~> 5.1.0) - - ExtoleMobileSDK (0.0.40): + - ExtoleMobileSDK (0.0.42): - ExtoleConsumerAPI (~> 0.0.17) - Logging (~> 1.4) - ObjectMapper (~> 4.1.0) @@ -568,9 +568,9 @@ SPEC CHECKSUMS: boost: a7c83b31436843459a1961bfd74b96033dc77234 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 - extole-mobile-sdk: d7fea7f913a83d40af6ce497d01f836f9bc31f36 + extole-mobile-sdk: 3b5e13fe33f4334064b025b28507745e551c0b46 ExtoleConsumerAPI: 4e512cfee398d5fba446ca04076ee382cbf0979b - ExtoleMobileSDK: 616055899db4c427eae135d99b9f1f54d6c1eb39 + ExtoleMobileSDK: a8f9dda3f9ffa42e67a603a6e95cae16b90c48d5 FBLazyVector: a7a655862f6b09625d11c772296b01cd5164b648 FBReactNativeSpec: 81ce99032d5b586fddd6a38d450f8595f7e04be4 Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0 diff --git a/extole-mobile-sdk.podspec b/extole-mobile-sdk.podspec index 7061b92..7bcab7f 100644 --- a/extole-mobile-sdk.podspec +++ b/extole-mobile-sdk.podspec @@ -17,7 +17,7 @@ Pod::Spec.new do |s| s.source_files = "ios/**/*.{h,m,mm,swift}" s.dependency "React-Core" - s.dependency "ExtoleMobileSDK", '~> 0.0.38' + s.dependency "ExtoleMobileSDK", '~> 0.0.42' # Don't install the dependencies when we run `pod install` in the old architecture. if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then diff --git a/ios/ExtoleMobileSdk.m b/ios/ExtoleMobileSdk.m index 7f3dca2..63fe468 100644 --- a/ios/ExtoleMobileSdk.m +++ b/ios/ExtoleMobileSdk.m @@ -15,6 +15,10 @@ @interface RCT_EXTERN_MODULE(ExtoleMobileSdk, NSObject) withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) +RCT_EXTERN_METHOD(identify:(NSString *)email withData:(NSDictionary *)data + withResolver:(RCTPromiseResolveBlock)resolve + withRejecter:(RCTPromiseRejectBlock)reject) + RCT_EXTERN_METHOD(fetchZone:(NSString *)zoneName withData:(NSDictionary *)data withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) diff --git a/ios/ExtoleMobileSdk.swift b/ios/ExtoleMobileSdk.swift index e81352a..1a7acf5 100644 --- a/ios/ExtoleMobileSdk.swift +++ b/ios/ExtoleMobileSdk.swift @@ -31,6 +31,18 @@ class ExtoleMobileSdk: NSObject { } } + @objc(identify:withData:withResolver:withRejecter:) + func identify(email: NSString, data: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { + extole?.identify(email as String, (data as! [String: String]?) ?? [:]) { [self] (idEvent, error) in + if error != nil { + self.extole?.getLogger().error(error?.localizedDescription ?? "Unable to send identify event") + reject("identify_failed", error?.localizedDescription ?? "Unable to send identify event", error) + } else { + resolve(idEvent?.getValue()) + } + } + } + @objc(fetchZone:withData:withResolver:withRejecter:) func fetchZone(zoneName: NSString, data: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { extole?.fetchZone(zoneName as String, (data as! [String: String]?) ?? [:]) { (zone: Zone?, campaign: Campaign?, error: Error?) in