@rownd/react-native 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/ios/RowndPlugin.swift +65 -48
- package/package.json +1 -1
- package/rownd-react-native.podspec +2 -1
package/android/build.gradle
CHANGED
|
@@ -136,7 +136,7 @@ dependencies {
|
|
|
136
136
|
//noinspection GradleDynamicVersion
|
|
137
137
|
implementation "com.facebook.react:react-native:+"
|
|
138
138
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
139
|
-
implementation 'io.rownd:android:2.
|
|
139
|
+
implementation 'io.rownd:android:2.16.2'
|
|
140
140
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
|
|
141
141
|
implementation 'androidx.compose.ui:ui-unit:1.3.0'
|
|
142
142
|
implementation 'androidx.compose.ui:ui-graphics:1.3.0'
|
package/ios/RowndPlugin.swift
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Rownd
|
|
2
|
-
import SwiftUI
|
|
3
|
-
import Combine
|
|
4
1
|
import AnyCodable
|
|
2
|
+
import Combine
|
|
5
3
|
import Lottie
|
|
4
|
+
import Rownd
|
|
5
|
+
import SwiftUI
|
|
6
6
|
|
|
7
7
|
@objc(RowndPlugin)
|
|
8
8
|
class RowndPlugin: NSObject {
|
|
@@ -16,7 +16,8 @@ class RowndPlugin: NSObject {
|
|
|
16
16
|
|
|
17
17
|
stateCancellable = state.$current.sink { newState in
|
|
18
18
|
do {
|
|
19
|
-
RowndPluginEventEmitter.emitter.sendEvent(
|
|
19
|
+
RowndPluginEventEmitter.emitter.sendEvent(
|
|
20
|
+
withName: "update_state", body: try newState.toDictionary())
|
|
20
21
|
} catch {
|
|
21
22
|
print("Failed to encode Rownd state: \(String(describing: error))")
|
|
22
23
|
}
|
|
@@ -24,33 +25,40 @@ class RowndPlugin: NSObject {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
@objc(configure:withResolver:withRejecter:)
|
|
27
|
-
func configure(
|
|
28
|
-
|
|
28
|
+
func configure(
|
|
29
|
+
config: NSDictionary, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock
|
|
30
|
+
) {
|
|
31
|
+
|
|
29
32
|
if let apiUrl = config.value(forKey: "apiUrl") as? String {
|
|
30
33
|
Rownd.config.apiUrl = apiUrl
|
|
31
34
|
}
|
|
32
|
-
|
|
35
|
+
|
|
33
36
|
if let baseUrl = config.value(forKey: "baseUrl") as? String {
|
|
34
37
|
Rownd.config.baseUrl = baseUrl
|
|
35
38
|
}
|
|
36
|
-
|
|
39
|
+
|
|
37
40
|
if let appKey = config.value(forKey: "appKey") as? String {
|
|
38
41
|
Task {
|
|
39
|
-
await Rownd.configure(launchOptions: nil, appKey: appKey)
|
|
42
|
+
await Rownd.configure(launchOptions: nil, appKey: appKey)
|
|
40
43
|
}
|
|
41
44
|
resolve(appKey)
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
@objc(customizations:)
|
|
46
|
-
func customizations(customizations: NSDictionary)
|
|
49
|
+
func customizations(customizations: NSDictionary) {
|
|
47
50
|
let appCustomizations = AppCustomizations()
|
|
48
51
|
|
|
49
|
-
if let sheetBackgroundColor = customizations.value(forKey: "sheetBackgroundHexColor")
|
|
50
|
-
|
|
52
|
+
if let sheetBackgroundColor = customizations.value(forKey: "sheetBackgroundHexColor")
|
|
53
|
+
as? String
|
|
54
|
+
{
|
|
55
|
+
appCustomizations.reactNativeSheetBackgroundColor = colorWithHexString(
|
|
56
|
+
hexString: sheetBackgroundColor)
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
if let sheetCornerBorderRadius = customizations.value(forKey: "sheetCornerBorderRadius")
|
|
59
|
+
if let sheetCornerBorderRadius = customizations.value(forKey: "sheetCornerBorderRadius")
|
|
60
|
+
as? String
|
|
61
|
+
{
|
|
54
62
|
if let doubleValue = Double(sheetCornerBorderRadius) {
|
|
55
63
|
appCustomizations.sheetCornerBorderRadius = CGFloat(doubleValue)
|
|
56
64
|
}
|
|
@@ -71,14 +79,14 @@ class RowndPlugin: NSObject {
|
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
@objc(requestSignIn:)
|
|
74
|
-
func requestSignIn(signInConfig: NSDictionary)
|
|
75
|
-
|
|
82
|
+
func requestSignIn(signInConfig: NSDictionary) {
|
|
83
|
+
|
|
76
84
|
var rowndSignInOptions = RowndSignInOptions()
|
|
77
|
-
|
|
85
|
+
|
|
78
86
|
if let postSignInRedirect = signInConfig.value(forKey: "postSignInRedirect") as? String {
|
|
79
87
|
rowndSignInOptions.postSignInRedirect = postSignInRedirect
|
|
80
88
|
}
|
|
81
|
-
|
|
89
|
+
|
|
82
90
|
if let intentString = signInConfig.value(forKey: "intent") as? String {
|
|
83
91
|
if let intent = RowndSignInIntent(rawValue: intentString) {
|
|
84
92
|
rowndSignInOptions.intent = intent
|
|
@@ -86,9 +94,8 @@ class RowndPlugin: NSObject {
|
|
|
86
94
|
print("Rownd plugin. An incorrect intent type was used: \(intentString)")
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
|
-
|
|
90
97
|
|
|
91
|
-
func requestSignInHub()
|
|
98
|
+
func requestSignInHub() {
|
|
92
99
|
DispatchQueue.main.async {
|
|
93
100
|
Rownd.requestSignIn(rowndSignInOptions)
|
|
94
101
|
}
|
|
@@ -97,19 +104,23 @@ class RowndPlugin: NSObject {
|
|
|
97
104
|
switch method {
|
|
98
105
|
case "apple":
|
|
99
106
|
DispatchQueue.main.async {
|
|
100
|
-
Rownd.requestSignIn(
|
|
107
|
+
Rownd.requestSignIn(
|
|
108
|
+
with: RowndSignInHint.appleId, signInOptions: rowndSignInOptions)
|
|
101
109
|
}
|
|
102
110
|
case "google":
|
|
103
111
|
DispatchQueue.main.async {
|
|
104
|
-
Rownd.requestSignIn(
|
|
112
|
+
Rownd.requestSignIn(
|
|
113
|
+
with: RowndSignInHint.googleId, signInOptions: rowndSignInOptions)
|
|
105
114
|
}
|
|
106
115
|
case "guest":
|
|
107
116
|
DispatchQueue.main.async {
|
|
108
|
-
Rownd.requestSignIn(
|
|
117
|
+
Rownd.requestSignIn(
|
|
118
|
+
with: RowndSignInHint.guest, signInOptions: rowndSignInOptions)
|
|
109
119
|
}
|
|
110
120
|
case "passkey":
|
|
111
121
|
DispatchQueue.main.async {
|
|
112
|
-
Rownd.requestSignIn(
|
|
122
|
+
Rownd.requestSignIn(
|
|
123
|
+
with: RowndSignInHint.passkey, signInOptions: rowndSignInOptions)
|
|
113
124
|
}
|
|
114
125
|
default:
|
|
115
126
|
requestSignInHub()
|
|
@@ -120,24 +131,27 @@ class RowndPlugin: NSObject {
|
|
|
120
131
|
}
|
|
121
132
|
|
|
122
133
|
@objc
|
|
123
|
-
func signOut()
|
|
134
|
+
func signOut() {
|
|
124
135
|
DispatchQueue.main.async {
|
|
125
136
|
Rownd.signOut()
|
|
126
137
|
}
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
@objc
|
|
130
|
-
func manageAccount()
|
|
141
|
+
func manageAccount() {
|
|
131
142
|
DispatchQueue.main.async {
|
|
132
143
|
Rownd.manageAccount()
|
|
133
144
|
}
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
@objc(getAccessToken:withResolver:withRejecter:)
|
|
137
|
-
func getAccessToken(
|
|
148
|
+
func getAccessToken(
|
|
149
|
+
token: String?, resolve: @escaping RCTPromiseResolveBlock,
|
|
150
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
151
|
+
) {
|
|
138
152
|
Task {
|
|
139
153
|
do {
|
|
140
|
-
|
|
154
|
+
var accessToken: String?
|
|
141
155
|
if let token = token {
|
|
142
156
|
accessToken = try await Rownd.getAccessToken(token: token)
|
|
143
157
|
} else {
|
|
@@ -145,49 +159,52 @@ class RowndPlugin: NSObject {
|
|
|
145
159
|
}
|
|
146
160
|
resolve(accessToken ?? "")
|
|
147
161
|
} catch {
|
|
148
|
-
reject("Error","\(error)",error)
|
|
162
|
+
reject("Error", "\(error)", error)
|
|
149
163
|
}
|
|
150
164
|
}
|
|
151
165
|
}
|
|
152
|
-
|
|
166
|
+
|
|
153
167
|
@objc(getFirebaseIdToken:withRejecter:)
|
|
154
|
-
func getFirebaseIdToken(
|
|
168
|
+
func getFirebaseIdToken(
|
|
169
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
170
|
+
) {
|
|
155
171
|
Task {
|
|
156
172
|
do {
|
|
157
173
|
let idToken = try await Rownd.firebase.getIdToken()
|
|
158
174
|
resolve(idToken)
|
|
159
175
|
} catch {
|
|
160
|
-
reject("Error","\(error)",error)
|
|
176
|
+
reject("Error", "\(error)", error)
|
|
161
177
|
}
|
|
162
178
|
}
|
|
163
179
|
}
|
|
164
180
|
|
|
165
181
|
@objc(setUserData:)
|
|
166
|
-
func setUserData(data:
|
|
182
|
+
func setUserData(data: [String: Any]) {
|
|
167
183
|
do {
|
|
168
|
-
|
|
169
|
-
let
|
|
170
|
-
let
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
// Convert to JSON and back to get proper types
|
|
185
|
+
let jsonData = try JSONSerialization.data(withJSONObject: data, options: [])
|
|
186
|
+
let jsonObject = try JSONSerialization.jsonObject(with: jsonData, options: [])
|
|
187
|
+
|
|
188
|
+
// Try to cast to the expected type
|
|
189
|
+
if let dictionary = jsonObject as? [String: Any] {
|
|
190
|
+
// Convert each value to AnyCodable and set individually
|
|
191
|
+
for (key, value) in dictionary {
|
|
192
|
+
Rownd.user.set(field: key, value: AnyCodable(value))
|
|
193
|
+
}
|
|
194
|
+
}
|
|
173
195
|
} catch {
|
|
174
|
-
print("FAILED TO SET USER DATA: ",error)
|
|
196
|
+
print("FAILED TO SET USER DATA: ", error)
|
|
175
197
|
}
|
|
176
198
|
}
|
|
177
199
|
|
|
178
200
|
@objc(setUserDataValue:withValue:)
|
|
179
|
-
func setUserDataValue(key: String, value: Any)
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
""".data(using: .utf8)!
|
|
183
|
-
|
|
184
|
-
let decoder = JSONDecoder()
|
|
185
|
-
let dictionary = try! decoder.decode(AnyCodable.self, from: json)
|
|
186
|
-
Rownd.user.set(field: key, value: dictionary)
|
|
201
|
+
func setUserDataValue(key: String, value: Any) {
|
|
202
|
+
// Convert value to AnyCodable
|
|
203
|
+
Rownd.user.set(field: key, value: AnyCodable(value))
|
|
187
204
|
}
|
|
188
205
|
|
|
189
206
|
@objc(handleSignInLink:)
|
|
190
|
-
func handleSignInLink(url: String)
|
|
191
|
-
Rownd.
|
|
207
|
+
func handleSignInLink(url: String) {
|
|
208
|
+
Rownd.handleSmartLink(url: URL(string: url))
|
|
192
209
|
}
|
|
193
210
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,8 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
|
-
s.dependency "Rownd", "~> 3.
|
|
20
|
+
s.dependency "Rownd", "~> 3.14.2"
|
|
21
|
+
s.dependency "lottie-ios", "~> 4.3.3"
|
|
21
22
|
|
|
22
23
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
23
24
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|