framepayments-react-native 2.0.1 → 2.0.2

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.
@@ -180,21 +180,24 @@ public class FrameSDKBridge: NSObject {
180
180
  }
181
181
 
182
182
  private func presentOnboardingOnMain(from top: UIViewController, accountId: String?, capabilities: [FrameObjects.Capabilities], resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
183
- let hosting = OnboardingHostingController(
183
+ var hosting: OnboardingHostingController<OnboardingContainerView>!
184
+ var delegate: OnboardingDismissDelegate!
185
+ hosting = OnboardingHostingController(
184
186
  rootView: OnboardingContainerView(
185
187
  accountId: accountId,
186
- requiredCapabilities: capabilities
188
+ requiredCapabilities: capabilities,
189
+ onComplete: { [weak top] in
190
+ delegate?.finish(completed: true)
191
+ top?.dismiss(animated: true)
192
+ }
187
193
  )
188
194
  )
189
195
  hosting.modalPresentationStyle = UIModalPresentationStyle.pageSheet
190
196
  if let sheet = hosting.sheetPresentationController {
191
197
  sheet.detents = [UISheetPresentationController.Detent.large()]
192
198
  }
193
- let delegate = OnboardingDismissDelegate(hosting: hosting, resolve: resolve)
199
+ delegate = OnboardingDismissDelegate(resolve: resolve)
194
200
  objc_setAssociatedObject(hosting, &onboardingDismissKey, delegate, .OBJC_ASSOCIATION_RETAIN)
195
- hosting.onProgrammaticDismiss = { [weak delegate] in
196
- delegate?.finish(completed: true)
197
- }
198
201
  top.present(hosting, animated: true) {
199
202
  hosting.presentationController?.delegate = delegate
200
203
  }
@@ -226,18 +229,7 @@ private final class CheckoutHostingController: UIHostingController<FrameCheckout
226
229
 
227
230
  // MARK: - OnboardingHostingController
228
231
 
229
- private final class OnboardingHostingController<V: View>: UIHostingController<V> {
230
- var programmaticDismiss = false
231
- var onProgrammaticDismiss: (() -> Void)?
232
-
233
- override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
234
- programmaticDismiss = true
235
- super.dismiss(animated: flag, completion: { [weak self] in
236
- self?.onProgrammaticDismiss?()
237
- completion?()
238
- })
239
- }
240
- }
232
+ private final class OnboardingHostingController<V: View>: UIHostingController<V> {}
241
233
 
242
234
  // MARK: - Delegates
243
235
 
@@ -255,7 +247,7 @@ private final class OnboardingDismissDelegate: NSObject, UIAdaptivePresentationC
255
247
  let resolve: RCTPromiseResolveBlock
256
248
  var didFinish = false
257
249
 
258
- init(hosting: OnboardingHostingController<OnboardingContainerView>, resolve: @escaping RCTPromiseResolveBlock) {
250
+ init(resolve: @escaping RCTPromiseResolveBlock) {
259
251
  self.resolve = resolve
260
252
  }
261
253
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framepayments-react-native",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "React Native SDK for Frame Payments - modal checkout and cart, with API usage via frame-node.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",