From 419cd288cf926246323012bdceb6971d3db75218 Mon Sep 17 00:00:00 2001 From: Praveen Perera Date: Sun, 8 Dec 2024 21:34:59 -0600 Subject: [PATCH] Run format swift and rust --- ios/Cove/CoveApp.swift | 38 +++++++++---------- .../HotWallet/HotWalletImportScreen.swift | 17 ++++----- .../VerifyWords/VerifyWordsScreen.swift | 3 +- .../PendingWalletViewModel.swift | 2 +- .../SelectedWalletScreen.swift | 2 +- .../TransactionsDetailScreen.swift | 3 +- .../Flows/SendFlow/SendRouteContainer.swift | 3 +- rust/src/manager/pending_wallet.rs | 4 +- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ios/Cove/CoveApp.swift b/ios/Cove/CoveApp.swift index d571d7c..eb0a526 100644 --- a/ios/Cove/CoveApp.swift +++ b/ios/Cove/CoveApp.swift @@ -35,8 +35,8 @@ struct SafeAreaInsetsKey: EnvironmentKey { } } -extension EnvironmentValues { - public var safeAreaInsets: EdgeInsets { +public extension EnvironmentValues { + var safeAreaInsets: EdgeInsets { self[SafeAreaInsetsKey.self] } } @@ -73,7 +73,7 @@ struct CoveApp: App { ): "The address \(address) is on the wrong network. You are on \(currentNetwork), and the address was for \(network)." case let .noWalletSelected(address), - let .foundAddress(address, _): + let .foundAddress(address, _): String(address) case .noCameraPermission: "Please allow camera access in Settings to use this feature." @@ -95,11 +95,11 @@ struct CoveApp: App { try? manager.rust.selectWallet(id: walletId) } case .invalidWordGroup, - .errorImportingHotWallet, - .importedSuccessfully, - .unableToSelectWallet, - .errorImportingHardwareWallet, - .invalidFileFormat: + .errorImportingHotWallet, + .importedSuccessfully, + .unableToSelectWallet, + .errorImportingHardwareWallet, + .invalidFileFormat: Button("OK") { manager.alertState = .none } @@ -442,20 +442,20 @@ struct CoveApp: App { .gesture( manager.router.routes.isEmpty ? DragGesture() - .onChanged { gesture in - if gesture.startLocation.x < 25, gesture.translation.width > 100 { - withAnimation(.spring()) { - manager.isSidebarVisible = true - } + .onChanged { gesture in + if gesture.startLocation.x < 25, gesture.translation.width > 100 { + withAnimation(.spring()) { + manager.isSidebarVisible = true } } - .onEnded { gesture in - if gesture.startLocation.x < 20, gesture.translation.width > 50 { - withAnimation(.spring()) { - manager.isSidebarVisible = true - } + } + .onEnded { gesture in + if gesture.startLocation.x < 20, gesture.translation.width > 50 { + withAnimation(.spring()) { + manager.isSidebarVisible = true } - } : nil + } + } : nil ) .task { await manager.rust.initOnStart() diff --git a/ios/Cove/Flows/NewWalletFlow/HotWallet/HotWalletImportScreen.swift b/ios/Cove/Flows/NewWalletFlow/HotWallet/HotWalletImportScreen.swift index 4f43acc..da0fa3c 100644 --- a/ios/Cove/Flows/NewWalletFlow/HotWallet/HotWalletImportScreen.swift +++ b/ios/Cove/Flows/NewWalletFlow/HotWallet/HotWalletImportScreen.swift @@ -111,11 +111,11 @@ struct HotWalletImportScreen: View { do { let multiQr: MultiQr = try multiQr - ?? { - let newMultiQr = try MultiQr.tryNew(qr: qr) - self.multiQr = newMultiQr - return newMultiQr - }() + ?? { + let newMultiQr = try MultiQr.tryNew(qr: qr) + self.multiQr = newMultiQr + return newMultiQr + }() // see if its single qr or seed qr if let words = try multiQr.getGroupedWords(qr: qr, groupsOf: UInt8(6)) { @@ -175,8 +175,7 @@ struct HotWalletImportScreen: View { outerIndex = outerIndex - 1 } - if innerIndex > 5 || outerIndex > lastIndex || outerIndex < 0 || innerIndex < 0 - { + if innerIndex > 5 || outerIndex > lastIndex || outerIndex < 0 || innerIndex < 0 { Log.error( "Something went wrong: innerIndex: \(innerIndex), outerIndex: \(outerIndex), lastIndex: \(lastIndex), focusField: \(focusField)" ) @@ -367,7 +366,7 @@ struct HotWalletImportScreen: View { // if its the last word on the non last card and all words are valid words, then go to next tab // focusField will already have changed by now if let focusField, - !buttonIsDisabled, tabIndex < lastIndex, focusField % 6 == 1 + !buttonIsDisabled, tabIndex < lastIndex, focusField % 6 == 1 { withAnimation { tabIndex += 1 @@ -607,7 +606,7 @@ private struct AutocompleteField: View { // then auto select the first selection, because we want auto selection // but also allow the user to fix a wrong word if let word = filteredSuggestions.last, - filteredSuggestions.count == 1, oldText.count < newText.count + filteredSuggestions.count == 1, oldText.count < newText.count { state = .valid filteredSuggestions = [] diff --git a/ios/Cove/Flows/NewWalletFlow/HotWallet/VerifyWords/VerifyWordsScreen.swift b/ios/Cove/Flows/NewWalletFlow/HotWallet/VerifyWords/VerifyWordsScreen.swift index 4db5d22..4c1a277 100644 --- a/ios/Cove/Flows/NewWalletFlow/HotWallet/VerifyWords/VerifyWordsScreen.swift +++ b/ios/Cove/Flows/NewWalletFlow/HotWallet/VerifyWords/VerifyWordsScreen.swift @@ -189,7 +189,8 @@ struct VerifyWordsScreen: View { .spring().speed(3), completion: { incorrectGuesses += 1 - }) + } + ) } } } diff --git a/ios/Cove/Flows/NewWalletFlow/PendingWalletViewModel.swift b/ios/Cove/Flows/NewWalletFlow/PendingWalletViewModel.swift index 3d2fa43..b0bb9d2 100644 --- a/ios/Cove/Flows/NewWalletFlow/PendingWalletViewModel.swift +++ b/ios/Cove/Flows/NewWalletFlow/PendingWalletViewModel.swift @@ -1,5 +1,5 @@ // -// PendingWalletManager.swift +// PendingWalletViewModel.swift // Cove // // Created by Praveen Perera on 6/18/24. diff --git a/ios/Cove/Flows/SelectedWalletFlow/SelectedWalletScreen.swift b/ios/Cove/Flows/SelectedWalletFlow/SelectedWalletScreen.swift index 4674cf3..f615477 100644 --- a/ios/Cove/Flows/SelectedWalletFlow/SelectedWalletScreen.swift +++ b/ios/Cove/Flows/SelectedWalletFlow/SelectedWalletScreen.swift @@ -210,7 +210,7 @@ struct SelectedWalletScreen: View { .ignoresSafeArea(edges: .top) .onChange(of: manager.walletMetadata.discoveryState) { _, - newValue in setSheetState(newValue) + newValue in setSheetState(newValue) } .onAppear { setSheetState(manager.walletMetadata.discoveryState) } .onAppear(perform: manager.validateMetadata) diff --git a/ios/Cove/Flows/SelectedWalletFlow/TransactionDetails/TransactionsDetailScreen.swift b/ios/Cove/Flows/SelectedWalletFlow/TransactionDetails/TransactionsDetailScreen.swift index b3bd0da..161f516 100644 --- a/ios/Cove/Flows/SelectedWalletFlow/TransactionDetails/TransactionsDetailScreen.swift +++ b/ios/Cove/Flows/SelectedWalletFlow/TransactionDetails/TransactionsDetailScreen.swift @@ -37,7 +37,8 @@ struct TransactionsDetailScreen: View { Group { if let manager { TransactionDetailsView( - id: id, transactionDetails: transactionDetails, manager: manager) + id: id, transactionDetails: transactionDetails, manager: manager + ) } else { Text("Loading...") } diff --git a/ios/Cove/Flows/SendFlow/SendRouteContainer.swift b/ios/Cove/Flows/SendFlow/SendRouteContainer.swift index 6eaff8e..f06cba1 100644 --- a/ios/Cove/Flows/SendFlow/SendRouteContainer.swift +++ b/ios/Cove/Flows/SendFlow/SendRouteContainer.swift @@ -40,7 +40,8 @@ public struct SendRouteContainer: View { switch sendRoute { case let .setAmount(id: id, address: address, amount: amount): SendFlowSetAmountScreen( - id: id, manager: manager, address: address?.string() ?? "", amount: amount) + id: id, manager: manager, address: address?.string() ?? "", amount: amount + ) case let .confirm(id: id, details: details): SendFlowConfirmScreen(id: id, manager: manager, details: details) case let .hardwareExport(id: id, details: details): diff --git a/rust/src/manager/pending_wallet.rs b/rust/src/manager/pending_wallet.rs index b387bd7..5458975 100644 --- a/rust/src/manager/pending_wallet.rs +++ b/rust/src/manager/pending_wallet.rs @@ -78,9 +78,7 @@ impl RustPendingWalletManager { let (sender, receiver) = crossbeam::channel::bounded(1000); Self { - state: Arc::new(RwLock::new(PendingWalletManagerState::new( - number_of_words, - ))), + state: Arc::new(RwLock::new(PendingWalletManagerState::new(number_of_words))), reconciler: sender, reconcile_receiver: Arc::new(receiver), }