From 52df48aa4d885f441fdc04132df46357a4330a5d Mon Sep 17 00:00:00 2001 From: Hwee-Boon Yar Date: Wed, 5 Jan 2022 16:15:29 +0800 Subject: [PATCH] Fix (no functional change): returning value in void function --- .../ViewControllers/BrowserViewController.swift | 12 ++++++++---- AlphaWallet/Core/Enjin/EnjinAuthorization.swift | 3 ++- .../Export/Coordinators/BackupCoordinator.swift | 3 ++- .../Coordinators/ENSReverseLookupCoordinator.swift | 3 ++- .../ViewControllers/StaticHTMLViewController.swift | 6 ++++-- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/AlphaWallet/Browser/ViewControllers/BrowserViewController.swift b/AlphaWallet/Browser/ViewControllers/BrowserViewController.swift index 305860d3c..224f999f6 100644 --- a/AlphaWallet/Browser/ViewControllers/BrowserViewController.swift +++ b/AlphaWallet/Browser/ViewControllers/BrowserViewController.swift @@ -221,20 +221,24 @@ extension BrowserViewController: WKNavigationDelegate { func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { guard let url = navigationAction.request.url, let scheme = url.scheme else { - return decisionHandler(.allow) + decisionHandler(.allow) + return } let app = UIApplication.shared if ["tel", "mailto"].contains(scheme), app.canOpenURL(url) { app.open(url) - return decisionHandler(.cancel) + decisionHandler(.cancel) + return } if MagicLinkURL(url: url) != nil { delegate?.handleUniversalLink(url, inBrowserViewController: self) - return decisionHandler(.cancel) + decisionHandler(.cancel) + return } if url.scheme == ShareContentAction.scheme { delegate?.handleCustomUrlScheme(url, inBrowserViewController: self) - return decisionHandler(.cancel) + decisionHandler(.cancel) + return } decisionHandler(.allow) diff --git a/AlphaWallet/Core/Enjin/EnjinAuthorization.swift b/AlphaWallet/Core/Enjin/EnjinAuthorization.swift index c6a08ed60..85c5b50ad 100644 --- a/AlphaWallet/Core/Enjin/EnjinAuthorization.swift +++ b/AlphaWallet/Core/Enjin/EnjinAuthorization.swift @@ -246,7 +246,8 @@ class UserManagementInterceptor: ApolloInterceptor { } guard let token = UserManager.shared.accessToken else { - return authorizeEnjinUser() + authorizeEnjinUser() + return } addTokenAndProceed(token, to: request, chain: chain, response: response, completion: overridenCompletion) diff --git a/AlphaWallet/Export/Coordinators/BackupCoordinator.swift b/AlphaWallet/Export/Coordinators/BackupCoordinator.swift index e0cd9a823..40ced9294 100644 --- a/AlphaWallet/Export/Coordinators/BackupCoordinator.swift +++ b/AlphaWallet/Export/Coordinators/BackupCoordinator.swift @@ -56,7 +56,8 @@ class BackupCoordinator: Coordinator { do { try value.data(using: .utf8)!.write(to: url) } catch { - return completion(.failure(AnyError(error))) + completion(.failure(AnyError(error))) + return } let activityViewController = UIActivityViewController( diff --git a/AlphaWallet/Tokens/Coordinators/ENSReverseLookupCoordinator.swift b/AlphaWallet/Tokens/Coordinators/ENSReverseLookupCoordinator.swift index 48d2d0a86..7d0447262 100644 --- a/AlphaWallet/Tokens/Coordinators/ENSReverseLookupCoordinator.swift +++ b/AlphaWallet/Tokens/Coordinators/ENSReverseLookupCoordinator.swift @@ -43,7 +43,8 @@ class ENSReverseLookupCoordinator { ) { let node = "\(input.eip55String.drop0x).addr.reverse".lowercased().nameHash if let cachedResult = cachedResult(forNode: node) { - return completion(.success(cachedResult)) + completion(.success(cachedResult)) + return } let function = GetENSResolverEncode() diff --git a/AlphaWallet/Tokens/ViewControllers/StaticHTMLViewController.swift b/AlphaWallet/Tokens/ViewControllers/StaticHTMLViewController.swift index cb735be21..d7cc7da83 100644 --- a/AlphaWallet/Tokens/ViewControllers/StaticHTMLViewController.swift +++ b/AlphaWallet/Tokens/ViewControllers/StaticHTMLViewController.swift @@ -66,12 +66,14 @@ class StaticHTMLViewController: UIViewController { extension StaticHTMLViewController: WKNavigationDelegate { func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { guard let url = navigationAction.request.url, url.scheme != nil else { - return decisionHandler(.allow) + decisionHandler(.allow) + return } if url.absoluteString.hasPrefix("http") { delegate?.didPressOpenWebPage(url, in: self) - return decisionHandler(.cancel) + decisionHandler(.cancel) + return } decisionHandler(.allow)