Skip to content

Commit

Permalink
Run format and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Dec 1, 2024
1 parent a0f7d2e commit 981073d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
10 changes: 10 additions & 0 deletions ios/Cove/Cove.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6709,6 +6709,8 @@ public protocol RustWalletViewModelProtocol: AnyObject {

func transactionDetails(txId: TxId) async throws -> TransactionDetails

func validateMetadata()

func walletMetadata() -> WalletMetadata

func wordValidator() throws -> WordValidator
Expand Down Expand Up @@ -7201,6 +7203,11 @@ open class RustWalletViewModel:
)
}

open func validateMetadata() { try! rustCall {
uniffi_cove_fn_method_rustwalletviewmodel_validate_metadata(self.uniffiClonePointer(), $0)
}
}

open func walletMetadata() -> WalletMetadata {
try! FfiConverterTypeWalletMetadata.lift(try! rustCall {
uniffi_cove_fn_method_rustwalletviewmodel_wallet_metadata(self.uniffiClonePointer(), $0)
Expand Down Expand Up @@ -18869,6 +18876,9 @@ private let initializationResult: InitializationResult = {
if uniffi_cove_checksum_method_rustwalletviewmodel_transaction_details() != 62006 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_cove_checksum_method_rustwalletviewmodel_validate_metadata() != 62915 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_cove_checksum_method_rustwalletviewmodel_wallet_metadata() != 44518 {
return InitializationResult.apiChecksumMismatch
}
Expand Down
38 changes: 25 additions & 13 deletions ios/Cove/WalletSettingsSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@ struct WalletSettingsSheet: View {
}

Section(header: Text("Basic Settings")) {
TextField("Wallet Name", text: Binding(
get: { model.walletMetadata.name },
set: { model.dispatch(action: .updateName($0)) }
))
TextField(
"Wallet Name",
text: Binding(
get: { model.walletMetadata.name },
set: { model.dispatch(action: .updateName($0)) }
)
)

Picker("Wallet Color", selection: Binding(
get: { model.walletMetadata.color },
set: { model.dispatch(action: .updateColor($0)) }
)) {
Picker(
"Wallet Color",
selection: Binding(
get: { model.walletMetadata.color },
set: { model.dispatch(action: .updateColor($0)) }
)
) {
ForEach(colors, id: \.self) { color in
Text(color.toColor().description)
.tag(color)
Expand Down Expand Up @@ -89,18 +95,22 @@ struct WalletSettingsSheet: View {
}
.listStyle(InsetGroupedListStyle())
.navigationTitle("Wallet Settings")
.navigationBarItems(leading:
.navigationBarItems(
leading:
Button {
dismiss()
model.validateMetadata()
navigate(Route.settings)
} label: {
Label("App Settings", systemImage: "gear")
.foregroundColor(.blue)
}
)
.navigationBarItems(trailing: Button("Done") {
dismiss()
})
.navigationBarItems(
trailing: Button("Done") {
dismiss()
}
)
.foregroundColor(.primary)
.confirmationDialog("Are you sure?", isPresented: $showingDeleteConfirmation) {
Button("Delete", role: .destructive) {
Expand All @@ -122,7 +132,9 @@ struct WalletSettingsSheet: View {
}
Button("Cancel", role: .cancel) {}
} message: {
Text("Whoever has access to your secret words, has access to your bitcoin. Please keep these safe, don't show them to anyone.")
Text(
"Whoever has access to your secret words, has access to your bitcoin. Please keep these safe, don't show them to anyone."
)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions ios/Cove/WalletViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ extension WeakReconciler: WalletViewModelReconciler where Reconciler == WalletVi
walletMetadata.swiftColor
}

func validateMetadata() {
rust.validateMetadata()
}

func firstAddress() async throws -> AddressInfo {
try await rust.addressAt(index: 0)
}
Expand Down
2 changes: 1 addition & 1 deletion rust/src/cove_nfc/parser/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub trait StreamExt {
fn to_vec(self) -> Vec<u8>;
}

impl<'a> StreamExt for Stream<'a> {
impl StreamExt for Stream<'_> {
fn len(&self) -> usize {
self.as_ref().len()
}
Expand Down

0 comments on commit 981073d

Please sign in to comment.