From 3b5fd3d833d124f76a2f65313d348fb033324615 Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Mon, 6 May 2024 15:59:51 +0300 Subject: [PATCH] Added identify method with callback. (#183) * Added identify method with callback. * Added identify method with callback. --- .github/workflows/checks.yml | 2 +- .github/workflows/publish_sdks.yml | 2 +- QonversionSandwich.podspec | 2 +- android/sandwich/build.gradle | 2 +- .../qonversion/sandwich/QonversionSandwich.kt | 25 +++++++++++-------- ios/Podfile | 2 +- ios/Podfile.lock | 18 ++++++------- .../xcschemes/xcschememanagement.plist | 2 +- ios/sandwich/QonversionSandwich.swift | 12 +++++++-- 9 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ad8c04f..758ab91 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '13.4.1' + xcode-version: '15.3.0' - uses: actions/checkout@v2 - name: Validation diff --git a/.github/workflows/publish_sdks.yml b/.github/workflows/publish_sdks.yml index 0efeb27..f2598ac 100644 --- a/.github/workflows/publish_sdks.yml +++ b/.github/workflows/publish_sdks.yml @@ -40,7 +40,7 @@ jobs: steps: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '13.4.1' + xcode-version: '15.3.0' - name: Check out code uses: actions/checkout@v2 diff --git a/QonversionSandwich.podspec b/QonversionSandwich.podspec index fbe85a9..4fba810 100644 --- a/QonversionSandwich.podspec +++ b/QonversionSandwich.podspec @@ -19,5 +19,5 @@ Pod::Spec.new do |s| s.source_files = 'ios/sandwich/**/*.{h,m,swift}' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } - s.dependency "Qonversion", "5.8.4" + s.dependency "Qonversion", "5.9.0" end diff --git a/android/sandwich/build.gradle b/android/sandwich/build.gradle index 038b04f..f03774f 100644 --- a/android/sandwich/build.gradle +++ b/android/sandwich/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.qonversion_version = '7.3.2' + ext.qonversion_version = '7.4.0' } plugins { diff --git a/android/sandwich/src/main/kotlin/io/qonversion/sandwich/QonversionSandwich.kt b/android/sandwich/src/main/kotlin/io/qonversion/sandwich/QonversionSandwich.kt index 1ca41c0..15328ba 100644 --- a/android/sandwich/src/main/kotlin/io/qonversion/sandwich/QonversionSandwich.kt +++ b/android/sandwich/src/main/kotlin/io/qonversion/sandwich/QonversionSandwich.kt @@ -201,19 +201,11 @@ class QonversionSandwich( // region User Info fun userInfo(resultListener: ResultListener) { - Qonversion.shared.userInfo(object : QonversionUserCallback { - override fun onSuccess(user: QUser) { - resultListener.onSuccess(user.toMap()) - } - - override fun onError(error: QonversionError) { - resultListener.onError(error.toSandwichError()) - } - }) + Qonversion.shared.userInfo(getUserCallback(resultListener)) } - fun identify(userId: String) { - Qonversion.shared.identify(userId) + fun identify(userId: String, resultListener: ResultListener) { + Qonversion.shared.identify(userId, getUserCallback(resultListener)) } fun setDefinedProperty(propertyKey: String, value: String) { @@ -454,5 +446,16 @@ class QonversionSandwich( } } + private fun getUserCallback(resultListener: ResultListener) = + object : QonversionUserCallback { + override fun onSuccess(user: QUser) { + resultListener.onSuccess(user.toMap()) + } + + override fun onError(error: QonversionError) { + resultListener.onError(error.toSandwichError()) + } + } + // endregion } \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 34fef03..c41f323 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -6,7 +6,7 @@ platform :ios, '9.0' use_frameworks! target 'QonversionSandwich' do - pod 'Qonversion', '5.8.4' + pod 'Qonversion', '5.9.0' end target 'Sample' do diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ddc2a1c..d734606 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,12 +1,12 @@ PODS: - - Qonversion (5.8.3): - - Qonversion/Main (= 5.8.3) - - Qonversion/Main (5.8.3) - - QonversionSandwich (4.3.0): - - Qonversion (= 5.8.3) + - Qonversion (5.9.0): + - Qonversion/Main (= 5.9.0) + - Qonversion/Main (5.9.0) + - QonversionSandwich (4.3.2): + - Qonversion (= 5.9.0) DEPENDENCIES: - - Qonversion (= 5.8.3) + - Qonversion (= 5.9.0) - QonversionSandwich (from `../`) SPEC REPOS: @@ -18,9 +18,9 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - Qonversion: 336218b8b6776f415b5b8219e6b3e71faea47ff0 - QonversionSandwich: 97aa110ea1647114ee1bb5b375e75861f30d033b + Qonversion: 2bba69076355a256e12ef372ff7ea4c1a3d5a054 + QonversionSandwich: 7d6f636d56d7c528e69583daa7f326f087da3985 -PODFILE CHECKSUM: 522d4e0323c4312578e0c88f93053b3fb7b882e4 +PODFILE CHECKSUM: 753d63bea09faa4a3992e32875b4a89660c6dc82 COCOAPODS: 1.13.0 diff --git a/ios/QonversionSandwich.xcodeproj/xcuserdata/kamospertsyan.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/QonversionSandwich.xcodeproj/xcuserdata/kamospertsyan.xcuserdatad/xcschemes/xcschememanagement.plist index 1c64c8d..311182c 100644 --- a/ios/QonversionSandwich.xcodeproj/xcuserdata/kamospertsyan.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/ios/QonversionSandwich.xcodeproj/xcuserdata/kamospertsyan.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ Sample.xcscheme_^#shared#^_ orderHint - 5 + 6 sandwich.xcscheme_^#shared#^_ diff --git a/ios/sandwich/QonversionSandwich.swift b/ios/sandwich/QonversionSandwich.swift index 0af20ac..eda48fc 100644 --- a/ios/sandwich/QonversionSandwich.swift +++ b/ios/sandwich/QonversionSandwich.swift @@ -175,8 +175,16 @@ public class QonversionSandwich : NSObject { // MARK: User Info - @objc public func identify(_ userId: String) { - Qonversion.shared().identify(userId) + @objc public func identify(_ userId: String, _ completion: @escaping BridgeCompletion) { + Qonversion.shared().identify(userId) { userInfo, error in + if let error = error as NSError? { + return completion(nil, error.toSandwichError()) + } + + let bridgeData: [String: Any]? = userInfo?.toMap().clearEmptyValues() + + completion(bridgeData, nil) + } } @objc public func setDefinedProperty(_ property: String, value: String) {