From eed760b147b2f39bf016dc749c2432c81ca07f42 Mon Sep 17 00:00:00 2001 From: Hwee-Boon Yar Date: Sun, 28 Oct 2018 00:16:14 +0800 Subject: [PATCH] Remove build warnings --- AlphaWallet/AppCoordinator.swift | 2 +- .../AssetDefinition/AssetDefinitionDiskBackingStore.swift | 2 +- .../Coordinators/AssetDefinitionStoreCoordinator.swift | 2 +- AlphaWallet/EtherClient/OpenSea.swift | 2 +- .../Market/Coordinators/UniversalLinkCoordinator.swift | 2 +- AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift | 2 +- AlphaWallet/Tokens/Types/TokensDataStore.swift | 4 ++-- AlphaWallet/Tokens/ViewControllers/TokensViewController.swift | 2 +- .../OpenSea/OpenSeaNonFungibleTokenDisplayHelper.swift | 2 -- .../Transfer/ViewControllers/RequestViewController.swift | 2 +- AlphaWallet/Transfer/ViewControllers/SendViewController.swift | 2 +- .../ConfirmSignMessageViewControllerViewModel.swift | 2 +- 12 files changed, 12 insertions(+), 14 deletions(-) diff --git a/AlphaWallet/AppCoordinator.swift b/AlphaWallet/AppCoordinator.swift index 305767868..342eed1ff 100644 --- a/AlphaWallet/AppCoordinator.swift +++ b/AlphaWallet/AppCoordinator.swift @@ -163,7 +163,7 @@ class AppCoordinator: NSObject, Coordinator { WalletCoordinator(keystore: keystore).createInitialWallet() } - func handleUniversalLink(url: URL) -> Bool { + @discardableResult func handleUniversalLink(url: URL) -> Bool { createInitialWallet() closeWelcomeWindow() guard let ethPrice = self.ethPrice, let ethBalance = self.ethBalance else { return false } diff --git a/AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStore.swift b/AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStore.swift index 13d736b1b..a74fb0f16 100644 --- a/AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStore.swift +++ b/AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStore.swift @@ -83,7 +83,7 @@ class AssetDefinitionDiskBackingStore: AssetDefinitionBackingStore { directoryWatcher = DirectoryContentsWatcher.Local(path: directory.path) do { try directoryWatcher?.start { [weak self] results in - guard let strongSelf = self else { return } + guard self != nil else { return } switch results { case .noChanges: break diff --git a/AlphaWallet/AssetDefinition/Coordinators/AssetDefinitionStoreCoordinator.swift b/AlphaWallet/AssetDefinition/Coordinators/AssetDefinitionStoreCoordinator.swift index f109f3fb2..407a37bf6 100644 --- a/AlphaWallet/AssetDefinition/Coordinators/AssetDefinitionStoreCoordinator.swift +++ b/AlphaWallet/AssetDefinition/Coordinators/AssetDefinitionStoreCoordinator.swift @@ -109,7 +109,7 @@ class AssetDefinitionStoreCoordinator: Coordinator { directoryWatcher = DirectoryContentsWatcher.Local(path: directory.path) do { try directoryWatcher?.start { [weak self] results in - guard let strongSelf = self else { return } + guard self != nil else { return } switch results { case .noChanges: break diff --git a/AlphaWallet/EtherClient/OpenSea.swift b/AlphaWallet/EtherClient/OpenSea.swift index ae4870d42..ee8194d55 100644 --- a/AlphaWallet/EtherClient/OpenSea.swift +++ b/AlphaWallet/EtherClient/OpenSea.swift @@ -72,7 +72,7 @@ class OpenSea { headers: ["X-API-KEY": Constants.openseaAPIKEY] ).responseJSON { response in guard let data = response.data, let json = try? JSON(data: data) else { - completion(.failure(AnyError(OpenSeaError(localizedDescription: "Error calling \(Constants.openseaAPI) API: \(response.error)")))) + completion(.failure(AnyError(OpenSeaError(localizedDescription: "Error calling \(Constants.openseaAPI) API: \(String(describing: response.error))")))) return } DispatchQueue.global(qos: .userInitiated).async { diff --git a/AlphaWallet/Market/Coordinators/UniversalLinkCoordinator.swift b/AlphaWallet/Market/Coordinators/UniversalLinkCoordinator.swift index 9fb142af6..31334b548 100644 --- a/AlphaWallet/Market/Coordinators/UniversalLinkCoordinator.swift +++ b/AlphaWallet/Market/Coordinators/UniversalLinkCoordinator.swift @@ -395,7 +395,7 @@ class UniversalLinkCoordinator: Coordinator { } } - guard let vc = strongSelf.importTokenViewController, case .ready(var viewModel) = vc.state else { return } + guard let vc = strongSelf.importTokenViewController, case .ready = vc.state else { return } // TODO handle http response print(result) if successful { diff --git a/AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift b/AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift index 1e5f02a66..e7c1691f4 100644 --- a/AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift +++ b/AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift @@ -97,7 +97,7 @@ class TokensCoordinator: Coordinator { let contractsToAdd = detectedContracts - alreadyAddedContracts - deletedContracts - hiddenContracts - delegateContracts var contractsPulled = 0 var hasRefreshedAfterAddingAllContracts = false - DispatchQueue.global().async { [weak strongSelf] in + DispatchQueue.global().async { [weak self] in guard let strongSelf = self else { return } for eachContract in contractsToAdd { strongSelf.addToken(for: eachContract) { diff --git a/AlphaWallet/Tokens/Types/TokensDataStore.swift b/AlphaWallet/Tokens/Types/TokensDataStore.swift index 5cc3f2972..ea76ea315 100644 --- a/AlphaWallet/Tokens/Types/TokensDataStore.swift +++ b/AlphaWallet/Tokens/Types/TokensDataStore.swift @@ -222,7 +222,7 @@ class TokensDataStore { var knownToBeNotERC721 = false var knownToBeNotERC875 = false getIsERC875ContractCoordinator.getIsERC875Contract(for: address!) { [weak self] result in - guard let strongSelf = self else { return } + guard self != nil else { return } switch result { case .success(let isERC875): if isERC875 { @@ -240,7 +240,7 @@ class TokensDataStore { } getIsERC721ContractCoordinator.getIsERC721Contract(for: address!) { [weak self] result in - guard let strongSelf = self else { return } + guard self != nil else { return } switch result { case .success(let isERC721): if isERC721 { diff --git a/AlphaWallet/Tokens/ViewControllers/TokensViewController.swift b/AlphaWallet/Tokens/ViewControllers/TokensViewController.swift index 02f56b30a..79dd8f569 100644 --- a/AlphaWallet/Tokens/ViewControllers/TokensViewController.swift +++ b/AlphaWallet/Tokens/ViewControllers/TokensViewController.swift @@ -144,7 +144,7 @@ class TokensViewController: UIViewController { tableView.reloadData() } if viewModel.shouldShowCollectiblesCollectionView { - var contractsForCollectibles = contractsForCollectiblesFromViewModel() + let contractsForCollectibles = contractsForCollectiblesFromViewModel() if contractsForCollectibles != currentCollectiblesContractsDisplayed { currentCollectiblesContractsDisplayed = contractsForCollectibles collectiblesCollectionView.reloadData() diff --git a/AlphaWallet/Tokens/ViewModels/OpenSea/OpenSeaNonFungibleTokenDisplayHelper.swift b/AlphaWallet/Tokens/ViewModels/OpenSea/OpenSeaNonFungibleTokenDisplayHelper.swift index 09e4bde30..8dd976b4f 100644 --- a/AlphaWallet/Tokens/ViewModels/OpenSea/OpenSeaNonFungibleTokenDisplayHelper.swift +++ b/AlphaWallet/Tokens/ViewModels/OpenSea/OpenSeaNonFungibleTokenDisplayHelper.swift @@ -502,8 +502,6 @@ enum OpenSeaNonFungibleTokenDisplayHelper: String { return "exp" case .bc: return "generation" - case .bc: - return nil case .cbt: return "generation" case .ck: diff --git a/AlphaWallet/Transfer/ViewControllers/RequestViewController.swift b/AlphaWallet/Transfer/ViewControllers/RequestViewController.swift index a687e2bdd..ff610b8de 100644 --- a/AlphaWallet/Transfer/ViewControllers/RequestViewController.swift +++ b/AlphaWallet/Transfer/ViewControllers/RequestViewController.swift @@ -155,7 +155,7 @@ class RequestViewController: UIViewController { DispatchQueue.global(qos: .background).async { [weak self] in guard let strongSelf = self else { return } let image = strongSelf.generateQRCode(from: string) - DispatchQueue.main.async { [weak self] in + DispatchQueue.main.async { strongSelf.imageView.image = image } } diff --git a/AlphaWallet/Transfer/ViewControllers/SendViewController.swift b/AlphaWallet/Transfer/ViewControllers/SendViewController.swift index 43fd5e32f..878f68c59 100644 --- a/AlphaWallet/Transfer/ViewControllers/SendViewController.swift +++ b/AlphaWallet/Transfer/ViewControllers/SendViewController.swift @@ -353,7 +353,7 @@ class SendViewController: UIViewController, CanScanQRCode, TokenVerifiableStatus // EIP67 format not being used much yet, use hex value for now // let string = "ethereum:\(account.address.address)?value=\(value)" let image = strongSelf.generateQRCode(from: string) - DispatchQueue.main.async { [weak self] in + DispatchQueue.main.async { strongSelf.imageView.image = image } } diff --git a/AlphaWallet/Transfer/ViewModels/ConfirmSignMessageViewControllerViewModel.swift b/AlphaWallet/Transfer/ViewModels/ConfirmSignMessageViewControllerViewModel.swift index d1a1be6f3..2fc0afe5e 100644 --- a/AlphaWallet/Transfer/ViewModels/ConfirmSignMessageViewControllerViewModel.swift +++ b/AlphaWallet/Transfer/ViewModels/ConfirmSignMessageViewControllerViewModel.swift @@ -78,7 +78,7 @@ struct ConfirmSignMessageViewControllerViewModel { return data.hexEncoded } return message - case .typedMessage(let (typedData)): + case .typedMessage: return nil } }