From ca345c7cbc6b44574c374613d42a17d7be363787 Mon Sep 17 00:00:00 2001 From: brianp Date: Fri, 25 Oct 2024 00:27:11 +0200 Subject: [PATCH] rename variable to avoid confusion --- src-tauri/src/app_config.rs | 20 +++++++++---------- src-tauri/src/main.rs | 2 +- .../sections/wallet/WalletSettings.tsx | 4 ++-- src/store/useAppConfigStore.ts | 2 +- src/types/app-status.ts | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src-tauri/src/app_config.rs b/src-tauri/src/app_config.rs index d538ae243..2ffc59c1e 100644 --- a/src-tauri/src/app_config.rs +++ b/src-tauri/src/app_config.rs @@ -37,7 +37,7 @@ pub struct AppConfigFromFile { #[serde(default = "default_monero_address")] monero_address: String, #[serde(default = "default_false")] - monero_address_is_provided: bool, + monero_address_is_generated: bool, #[serde(default = "default_true")] gpu_mining_enabled: bool, #[serde(default = "default_true")] @@ -85,7 +85,7 @@ impl Default for AppConfigFromFile { allow_telemetry: false, anon_id: default_anon_id(), monero_address: default_monero_address(), - monero_address_is_provided: false, + monero_address_is_generated: false, gpu_mining_enabled: true, cpu_mining_enabled: true, has_system_language_been_proposed: false, @@ -171,7 +171,7 @@ pub(crate) struct AppConfig { allow_telemetry: bool, anon_id: String, monero_address: String, - monero_address_is_provided: bool, + monero_address_is_generated: bool, gpu_mining_enabled: bool, cpu_mining_enabled: bool, has_system_language_been_proposed: bool, @@ -206,7 +206,7 @@ impl AppConfig { allow_telemetry: true, anon_id: generate_password(20), monero_address: default_monero_address(), - monero_address_is_provided: false, + monero_address_is_generated: false, gpu_mining_enabled: true, cpu_mining_enabled: true, has_system_language_been_proposed: false, @@ -240,7 +240,7 @@ impl AppConfig { info!(target: LOG_TARGET, "App config does not exist or is corrupt. Creating new one"); if let Ok(address) = create_monereo_address(config_path).await { self.monero_address = address; - self.monero_address_is_provided = true; + self.monero_address_is_generated = true; } } self.update_config_file().await?; @@ -261,7 +261,7 @@ impl AppConfig { self.allow_telemetry = config.allow_telemetry; self.anon_id = config.anon_id; self.monero_address = config.monero_address; - self.monero_address_is_provided = config.monero_address_is_provided; + self.monero_address_is_generated = config.monero_address_is_generated; self.gpu_mining_enabled = config.gpu_mining_enabled; self.cpu_mining_enabled = config.cpu_mining_enabled; self.has_system_language_been_proposed = config.has_system_language_been_proposed; @@ -439,14 +439,14 @@ impl AppConfig { } pub async fn set_monero_address(&mut self, address: String) -> Result<(), anyhow::Error> { - self.monero_address_is_provided = false; + self.monero_address_is_generated = false; self.monero_address = address; self.update_config_file().await?; Ok(()) } - pub fn monero_address_is_provided(&self) -> bool { - self.monero_address_is_provided + pub fn monero_address_is_generated(&self) -> bool { + self.monero_address_is_generated } pub fn last_binaries_update_timestamp(&self) -> SystemTime { @@ -533,7 +533,7 @@ impl AppConfig { allow_telemetry: self.allow_telemetry, anon_id: self.anon_id.clone(), monero_address: self.monero_address.clone(), - monero_address_is_provided: self.monero_address_is_provided, + monero_address_is_generated: self.monero_address_is_generated, gpu_mining_enabled: self.gpu_mining_enabled, cpu_mining_enabled: self.cpu_mining_enabled, has_system_language_been_proposed: self.has_system_language_been_proposed, diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0f596ef35..8b7fd4ead 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1078,7 +1078,7 @@ async fn get_monero_seed_words( ) -> Result, String> { let timer = Instant::now(); - if !state.config.read().await.monero_address_is_provided() { + if !state.config.read().await.monero_address_is_generated() { return Err( "Monero seed words are not available when a Monero address is provided".to_string(), ); diff --git a/src/containers/Settings/sections/wallet/WalletSettings.tsx b/src/containers/Settings/sections/wallet/WalletSettings.tsx index 2e0c9041b..d51ffd8b4 100644 --- a/src/containers/Settings/sections/wallet/WalletSettings.tsx +++ b/src/containers/Settings/sections/wallet/WalletSettings.tsx @@ -5,14 +5,14 @@ import SeedWordsMarkup from './SeedWordsMarkup/SeedWordsMarkup.tsx'; import MoneroSeedWordSettings from './MoneroSeedWords/MoneroSeedWordSettings.tsx'; export const WalletSettings = () => { - const monero_address_is_provided = useAppConfigStore((s) => s.monero_address_is_provided); + const monero_address_is_generated = useAppConfigStore((s) => s.monero_address_is_generated); return ( <> - {monero_address_is_provided ? : null} + {monero_address_is_generated ? : null} ); }; diff --git a/src/store/useAppConfigStore.ts b/src/store/useAppConfigStore.ts index 9bc22634b..3d2b38e8f 100644 --- a/src/store/useAppConfigStore.ts +++ b/src/store/useAppConfigStore.ts @@ -45,7 +45,7 @@ const initialState: State = { paper_wallet_enabled: false, use_tor: true, auto_update: false, - monero_address_is_provided: false, + monero_address_is_generated: false, }; export const useAppConfigStore = create()((set) => ({ diff --git a/src/types/app-status.ts b/src/types/app-status.ts index a81b817f5..a145fca10 100644 --- a/src/types/app-status.ts +++ b/src/types/app-status.ts @@ -29,7 +29,7 @@ export interface AppConfig { paper_wallet_enabled: boolean; use_tor: boolean; auto_update: boolean; - monero_address_is_provided?: boolean; + monero_address_is_generated?: boolean; } export enum ExternalDependencyStatus {