diff --git a/README.md b/README.md index 7bd54f6..fd6e2c3 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Note that starting version 3.10.0, it requires minimum version of iOS 11. If you Add this to your Podfile. ```ruby -pod 'Xendit', '~> 3.10.3' +pod 'Xendit', '~> 3.10.4' ``` **Important:** Import SDK in Objective-C project with CocoaPods integration, you can do as following diff --git a/Sources/Xendit/Info.plist b/Sources/Xendit/Info.plist index 92463dd..9a4c082 100755 --- a/Sources/Xendit/Info.plist +++ b/Sources/Xendit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.10.3 + 3.10.4 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/Sources/Xendit/WebViewController/AuthenticationWebviewController.swift b/Sources/Xendit/WebViewController/AuthenticationWebviewController.swift index b321dfe..149eb08 100644 --- a/Sources/Xendit/WebViewController/AuthenticationWebviewController.swift +++ b/Sources/Xendit/WebViewController/AuthenticationWebviewController.swift @@ -76,6 +76,7 @@ class AuthenticationWebViewController: UIViewController, WKScriptMessageHandler, webView = WKWebView(frame: view.frame, configuration: webConfiguration) webView.navigationDelegate = self + webView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(webView) @@ -134,4 +135,14 @@ class AuthenticationWebViewController: UIViewController, WKScriptMessageHandler, Log.shared.verbose("web auth: navigation error \(error)") authenticateCompletion(nil, XenditError(errorCode: "WEBVIEW_ERROR", message: error.localizedDescription)) } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // Remove script message handler + webView.configuration.userContentController.removeAllUserScripts() + webView.configuration.userContentController.removeScriptMessageHandler(forName: "callbackHandler") + // Clear any other references + webView.navigationDelegate = nil + webView = nil + } } diff --git a/Sources/Xendit/WebViewController/WebViewController.swift b/Sources/Xendit/WebViewController/WebViewController.swift index c32e4a7..f411eca 100755 --- a/Sources/Xendit/WebViewController/WebViewController.swift +++ b/Sources/Xendit/WebViewController/WebViewController.swift @@ -82,6 +82,7 @@ class WebViewController: UIViewController, WKScriptMessageHandler, WKNavigationD webConfiguration.userContentController = contentController webView = WKWebView(frame: view.frame, configuration: webConfiguration) webView.navigationDelegate = self + webView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(webView) NSLayoutConstraint.activate([ @@ -139,4 +140,14 @@ class WebViewController: UIViewController, WKScriptMessageHandler, WKNavigationD Log.shared.verbose("web auth: navigation error \(error)") authenticateCompletion(nil, XenditError(errorCode: "WEBVIEW_ERROR", message: error.localizedDescription)) } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // Remove script message handler + webView.configuration.userContentController.removeAllUserScripts() + webView.configuration.userContentController.removeScriptMessageHandler(forName: "callbackHandler") + // Clear any other references + webView.navigationDelegate = nil + webView = nil + } } diff --git a/Sources/Xendit/XDTApiClient.swift b/Sources/Xendit/XDTApiClient.swift index d455616..38c3860 100644 --- a/Sources/Xendit/XDTApiClient.swift +++ b/Sources/Xendit/XDTApiClient.swift @@ -38,7 +38,7 @@ class XDTApiClient { internal static let CLIENT_TYPE = "SDK"; internal static let CLIENT_API_VERSION = "2.0.0"; internal static let CLIENT_IDENTIFIER = "Xendit iOS SDK"; - internal static let CLIENT_SDK_VERSION = "3.10.3"; + internal static let CLIENT_SDK_VERSION = "3.10.4"; private static let WEBAPI_FLEX_BASE_URL = "https://sandbox.webapi.visa.com" diff --git a/Xendit.podspec b/Xendit.podspec index 4e6c72a..2e77083 100755 --- a/Xendit.podspec +++ b/Xendit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Xendit' - s.version = '3.10.3' + s.version = '3.10.4' s.license = 'MIT' s.homepage = 'https://www.xendit.co' s.author = { 'Juan Gonzalez’' => 'juan@xendit.co' }