Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed hot realod #201

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ios/Components/AdyenDropIn.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ final internal class AdyenDropIn: BaseModule {

private var dropInComponent: DropInComponent?

override func invalidate() {
hide(false, event: [:])
}

override func supportedEvents() -> [String]! { super.supportedEvents() }

@objc
func hide(_ success: NSNumber, event: NSDictionary) {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }

self.dropInComponent?.finalizeIfNeeded(with: success.boolValue) {
self.cleanUp()
self.dropInComponent = nil
Expand Down
7 changes: 6 additions & 1 deletion ios/Components/ApplePayComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import React
@objc(AdyenApplePay)
final internal class ApplePayComponent: BaseModule {

override func invalidate() {
hide(false, event: [:])
}

override func supportedEvents() -> [String]! { super.supportedEvents() }

@objc
func hide(_ success: NSNumber, event: NSDictionary) {
DispatchQueue.main.async {[weak self] in
Expand Down Expand Up @@ -41,7 +46,7 @@ final internal class ApplePayComponent: BaseModule {
} catch {
return sendEvent(error: error)
}


let apiContext = APIContext(environment: parser.environment, clientKey: clientKey)
let applePayComponent: Adyen.ApplePayComponent
Expand Down
11 changes: 8 additions & 3 deletions ios/Components/InstantComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ import React

@objc(AdyenInstant)
final internal class InstantComponent: BaseModule {

override func invalidate() {
hide(false, event: [:])
}

override func supportedEvents() -> [String]! { super.supportedEvents() }

@objc
func hide(_ success: NSNumber, event: NSDictionary) {
DispatchQueue.main.async {[weak self] in
guard let self = self else { return }

self.currentComponent?.finalizeIfNeeded(with: success.boolValue) {
self.cleanUp()
}
Expand Down Expand Up @@ -47,7 +52,7 @@ final internal class InstantComponent: BaseModule {
component.payment = parser.payment
component.delegate = self
currentComponent = component

DispatchQueue.main.async {
component.initiatePayment()
}
Expand All @@ -61,7 +66,7 @@ final internal class InstantComponent: BaseModule {
} catch {
return sendEvent(error: error)
}

DispatchQueue.main.async { [weak self] in
self?.actionHandler?.handle(action)
}
Expand Down