@circle-fin/w3s-pw-react-native-sdk 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # @circle-fin/w3s-pw-react-native-sdk
2
-
3
2
  React Native SDK for Circle Programmable Wallet
4
3
  ## Install NVM
5
4
 
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
  s.source = { :git => package["repository"], :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
- s.dependency 'CircleProgrammableWalletSDK', '1.0.14'
18
+ s.dependency 'CircleProgrammableWalletSDK', '1.0.15'
19
19
 
20
20
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
21
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -28,6 +28,7 @@ class ReactNativeEventEmitter: RCTEventEmitter {
28
28
  @objc override func supportedEvents() -> [String] {
29
29
  return EventEmitter.sharedInstance.allEvents
30
30
  }
31
+
31
32
  @objc override static func requiresMainQueueSetup() -> Bool {
32
33
  return true
33
34
  }
@@ -88,7 +88,7 @@ extension RNWalletSdk {
88
88
  guard let cell = cell as? SecurityQuestionTableViewCell else { continue }
89
89
 
90
90
  if let configs = self.sTextsMap[.securityQuestionHeaders],
91
- let config = configs[safe: i] { // A5
91
+ let config = configs[safe: i] { // A5
92
92
  self.setText(label: cell.questionTitleLabel, textConfig: config)
93
93
  }
94
94
  if let textConfig = self.sTextMap[.circlepw_security_questions_required_mark] { // C13
@@ -96,7 +96,7 @@ extension RNWalletSdk {
96
96
  self.setText(label: cell.answerMarkLabel, textConfig: textConfig)
97
97
  }
98
98
  if let textConfig = self.sTextMap[.circlepw_security_questions_question_placeholder],
99
- let label = cell.questionView.subviews.first as? UILabel { // C15
99
+ let label = cell.questionView.subviews.first as? UILabel { // C15
100
100
  self.setText(label: label, textConfig: textConfig)
101
101
  }
102
102
 
@@ -138,9 +138,8 @@ extension RNWalletSdk {
138
138
  if let textConfig = sTextMap[.circlepw_select_question_item_config] { // C25
139
139
  DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
140
140
  for cell in controller.tableView.visibleCells {
141
- // TODO: make SelectQuestionTableViewCell class public from SDK
142
- // guard let cell = cell as? SelectQuestionTableViewCell else { continue }
143
- // setText(label: cell.titleLabel, textConfig: textConfig, shouldReplaceText: false)
141
+ guard let cell = cell as? SelectQuestionTableViewCell else { continue }
142
+ self.setText(label: cell.titleLabel, textConfig: textConfig, shouldReplaceText: false)
144
143
  }
145
144
  }
146
145
  }
@@ -156,7 +155,7 @@ extension RNWalletSdk {
156
155
  guard let cell = cell as? SecuritySummaryTableViewCell else { continue }
157
156
 
158
157
  if let configs = self.sTextsMap[.securitySummaryQuestionHeaders],
159
- let config = configs[safe: i] { // A6
158
+ let config = configs[safe: i] { // A6
160
159
  self.setText(label: cell.titleLabel, textConfig: config)
161
160
  }
162
161
 
@@ -94,22 +94,22 @@ public class RNWalletSdk: NSObject {
94
94
  }
95
95
  }
96
96
 
97
- // TODO
98
97
  @objc public func executeWithUserSecret(_ userToken: String,
99
- encryptionKey: String,
100
- userSecret: String,
101
- challengeIds: NSArray,
102
- resolve: @escaping RCTPromiseResolveBlock,
103
- reject: @escaping RCTPromiseRejectBlock) {
98
+ encryptionKey: String,
99
+ userSecret: String,
100
+ challengeIds: NSArray,
101
+ resolve: @escaping RCTPromiseResolveBlock,
102
+ reject: @escaping RCTPromiseRejectBlock) {
104
103
  guard let challengeIdArr = challengeIds as? [String] else {
105
104
  reject(nil, "[unknown format] challengeIds", nil)
106
105
  return
107
106
  }
108
- // copied from execute()
107
+
109
108
  DispatchQueue.main.async {
110
- WalletSdk.shared.execute(userToken: userToken,
111
- encryptionKey: encryptionKey,
112
- challengeIds: challengeIdArr) { response in
109
+ WalletSdk.shared.executeWithUserSecret(userToken: userToken,
110
+ encryptionKey: encryptionKey,
111
+ userSecret: userSecret,
112
+ challengeIds: challengeIdArr) { response in
113
113
  switch response.result {
114
114
  case .success(let result):
115
115
  self._handleSuccessResult(result: result,
@@ -209,22 +209,10 @@ public class RNWalletSdk: NSObject {
209
209
  @objc public func setImageMap(_ map: NSDictionary) {
210
210
  for (key, value) in map {
211
211
  guard let key = key as? String,
212
- let value = value as? String else { continue }
213
-
214
- if let imgKey = BridgeHelper.getImageKey(rnKey: key) {
215
- if value.starts(with: "http") {
216
- sRemote[imgKey] = URL(string: value)
217
- } else {
218
- var url = URL(string: value)
219
- if let url = url {
220
- if #available(iOS 16.0, *) {
221
- sLocal[imgKey] = UIImage.init(contentsOfFile: url.path())
222
- } else {
223
- // TODO
224
- }
225
- }
226
- }
227
- }
212
+ let value = value as? String,
213
+ let imgUrl = URL(string: value),
214
+ let imgKey = BridgeHelper.getImageKey(rnKey: key) else { continue }
215
+ sRemote[imgKey] = imgUrl
228
216
  }
229
217
  }
230
218
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@circle-fin/w3s-pw-react-native-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "React Native SDK for Circle Programmable Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -26,7 +26,7 @@
26
26
  "!**/.*"
27
27
  ],
28
28
  "scripts": {
29
- "example": "yarn workspace @circle-fin/programmablewallet-rn-sdk-example",
29
+ "example": "yarn workspace @circle-fin/w3s-pw-react-native-sdk-example",
30
30
  "test": "jest",
31
31
  "npm": "npm",
32
32
  "typecheck": "tsc --noEmit",