Skip to content

Commit

Permalink
rename variable to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
brianp committed Oct 24, 2024
1 parent 702fdeb commit ca345c7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src-tauri/src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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?;
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ async fn get_monero_seed_words(
) -> Result<Vec<String>, 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(),
);
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Settings/sections/wallet/WalletSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<WalletAddressMarkup />
<SeedWordsMarkup />
<MoneroAddressMarkup />
{monero_address_is_provided ? <MoneroSeedWordSettings /> : null}
{monero_address_is_generated ? <MoneroSeedWordSettings /> : null}
</>
);
};
2 changes: 1 addition & 1 deletion src/store/useAppConfigStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AppConfigStoreState>()((set) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/types/app-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ca345c7

Please sign in to comment.