diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ZcashAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ZcashAdapter.swift index bc591b6309..8c6f4f27d3 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ZcashAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ZcashAdapter.swift @@ -606,7 +606,12 @@ extension ZcashAdapter: IAdapter { } var statusInfo: [(String, Any)] { - [] + [ + ("Last Block Info", lastBlockHeight), + ("Sync State", state.description), + ("Birthday Height", birthday.description), + ("Init Mode", initMode.description), + ] } var debugInfo: String { @@ -799,8 +804,6 @@ enum ZCashAdapterState: Equatable { case syncing(progress: Int?, lastBlockDate: Date?) case downloadingSapling(progress: Int) case downloadingBlocks(progress: Float, lastBlock: Int) - case scanningBlocks(number: Int, lastBlock: Int) - case enhancingTransactions(number: Int, count: Int) case notSynced(error: Error) public static func == (lhs: ZCashAdapterState, rhs: ZCashAdapterState) -> Bool { @@ -811,8 +814,6 @@ enum ZCashAdapterState: Equatable { case let (.syncing(lProgress, lLastBlockDate), .syncing(rProgress, rLastBlockDate)): return lProgress == rProgress && lLastBlockDate == rLastBlockDate case let (.downloadingSapling(lProgress), .downloadingSapling(rProgress)): return lProgress == rProgress case let (.downloadingBlocks(lNumber, lLast), .downloadingBlocks(rNumber, rLast)): return lNumber == rNumber && lLast == rLast - case let (.scanningBlocks(lNumber, lLast), .scanningBlocks(rNumber, rLast)): return lNumber == rNumber && lLast == rLast - case let (.enhancingTransactions(lNumber, lCount), .enhancingTransactions(rNumber, rCount)): return lNumber == rNumber && lCount == rCount case (.notSynced, .notSynced): return true default: return false } @@ -829,25 +830,27 @@ enum ZCashAdapterState: Equatable { case let .downloadingBlocks(progress, _): let percentValue = ValueFormatter.instance.format(percentValue: Decimal(Double(progress * 100)), showSign: false) return .customSyncing(main: "balance.downloading_blocks".localized, secondary: percentValue, progress: Int(progress * 100)) - case let .scanningBlocks(number, lastBlock): - return .customSyncing(main: "Scanning Blocks", secondary: "\(number)/\(lastBlock)", progress: nil) - case let .enhancingTransactions(number, count): - let progress: String? = count == 0 ? nil : "\(number)/\(count)" - return .customSyncing(main: "Enhancing Transactions", secondary: progress, progress: nil) case let .notSynced(error): return .notSynced(error: error) } } - var isDownloading: Bool { + var description: String { switch self { - case .downloadingBlocks: return true - default: return false + case .idle: return "Idle" + case .preparing: return "Preparing..." + case .synced: return "Synced" + case let .syncing(progress, lastDate): return "Syncing: progress = \(progress?.description ?? "N/A"), lastBlockDate: \(lastDate?.description ?? "N/A")" + case let .downloadingSapling(progress): return "downloadingSapling: progress = \(progress)" + case let .downloadingBlocks(progress, _): + let percentValue = ValueFormatter.instance.format(percentValue: Decimal(Double(progress * 100)), showSign: false) + return "Downloading Blocks: \(percentValue?.description ?? "N/A") : \(Int(progress * 100))" + case let .notSynced(error): return "Not synced \(error.localizedDescription)" } } - var isScanning: Bool { + var isDownloading: Bool { switch self { - case .scanningBlocks: return true + case .downloadingBlocks: return true default: return false } } @@ -858,11 +861,14 @@ enum ZCashAdapterState: Equatable { default: return false } } +} - var lastProcessedBlockHeight: Int? { +extension WalletInitMode { + var description: String { switch self { - case let .downloadingBlocks(_, last), let .scanningBlocks(_, last): return last - default: return nil + case .newWallet: return "New Wallet" + case .existingWallet: return "Existing Wallet" + case .restoreWallet: return "Restored Wallet" } } } diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Managers/RateAppManager.swift b/UnstoppableWallet/UnstoppableWallet/Core/Managers/RateAppManager.swift index 3c54adbe2e..a4305fe451 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Managers/RateAppManager.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Managers/RateAppManager.swift @@ -50,8 +50,12 @@ class RateAppManager { } private func show() { - SKStoreReviewController.requestReview() - + if let scene = UIApplication.shared.connectedScenes + .first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { + DispatchQueue.main.async { + SKStoreReviewController.requestReview(in: scene) + } + } localStorage.rateAppLastRequestDate = Date() isRequestAllowed = false } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/RestoreAccount/RestoreCloud/RestoreCloudService.swift b/UnstoppableWallet/UnstoppableWallet/Modules/RestoreAccount/RestoreCloud/RestoreCloudService.swift index 342e48807d..c2d1562546 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/RestoreAccount/RestoreCloud/RestoreCloudService.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/RestoreAccount/RestoreCloud/RestoreCloudService.swift @@ -60,7 +60,7 @@ class RestoreCloudService { } self.fullBackupItems = items.sorted { (item1: Item, item2: Item) in - if item1.source.timestamp == nil, item2.source == nil { + if item1.source.timestamp == nil, item2.source.timestamp == nil { return item1.name > item2.name } return (item1.source.timestamp ?? 0) > (item2.source.timestamp ?? 0) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewModel.swift index 634cc8794c..a345eb239d 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewModel.swift @@ -119,7 +119,6 @@ extension SendTronService.AddressError: LocalizedError { var errorDescription: String? { switch self { case .ownAddress: return "send.address_error.own_address".localized - default: return "\(self)" } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainViewModel.swift index 30580818f1..aad9d35164 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainViewModel.swift @@ -77,12 +77,7 @@ class WalletConnectMainViewModel { reconnectButtonRelay.accept(stateForReconnectButton ? (connectionState == .disconnected ? .enabled : .hidden) : .hidden) closeVisibleRelay.accept(state == .ready) - var address: String? - var network: String? - var networkEditable = false - var blockchains: [BlockchainViewItem]? - - blockchains = allowedBlockchains + let blockchains = allowedBlockchains .map { item in BlockchainViewItem( chainId: item.chainId, @@ -96,9 +91,9 @@ class WalletConnectMainViewModel { dAppMeta: service.appMetaItem.map { dAppMetaViewItem(appMetaItem: $0) }, status: status(connectionState: connectionState), activeAccountName: service.activeAccountName, - address: address, - network: network, - networkEditable: networkEditable, + address: nil, + network: nil, + networkEditable: false, blockchains: blockchains, hint: service.hint ) diff --git a/UnstoppableWallet/UnstoppableWallet/UserInterface/SwiftUI/InputTextView.swift b/UnstoppableWallet/UnstoppableWallet/UserInterface/SwiftUI/InputTextView.swift index 77e076ea1d..2a7cdfeea7 100644 --- a/UnstoppableWallet/UnstoppableWallet/UserInterface/SwiftUI/InputTextView.swift +++ b/UnstoppableWallet/UnstoppableWallet/UserInterface/SwiftUI/InputTextView.swift @@ -75,7 +75,7 @@ struct InputTextView: View { } extension InputTextView { - @ViewBuilder func secure(_ secured: Binding) -> some View { + func secure(_ secured: Binding) -> some View { var selfView = self selfView._secured = secured