Skip to content

Commit

Permalink
Added identify method with callback. (#183)
Browse files Browse the repository at this point in the history
* Added identify method with callback.

* Added identify method with callback.
  • Loading branch information
SpertsyanKM authored May 6, 2024
1 parent 4e55a06 commit 3b5fd3d
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion QonversionSandwich.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion android/sandwich/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.qonversion_version = '7.3.2'
ext.qonversion_version = '7.4.0'
}

plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<key>Sample.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
<integer>6</integer>
</dict>
<key>sandwich.xcscheme_^#shared#^_</key>
<dict>
Expand Down
12 changes: 10 additions & 2 deletions ios/sandwich/QonversionSandwich.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3b5fd3d

Please sign in to comment.