From f2c709b3776376c3e4103bad83a475f937ba9d84 Mon Sep 17 00:00:00 2001 From: Vishwa Raghavendra K S Date: Tue, 26 Apr 2022 18:50:29 +0530 Subject: [PATCH] BugFixes --- .../wallet/domain/action/wallet/CalcIncomeExpenseAct.kt | 2 +- .../wallet/domain/action/wallet/CalcWalletBalanceAct.kt | 2 +- .../java/com/ivy/wallet/ui/settings/SettingsViewModel.kt | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcIncomeExpenseAct.kt b/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcIncomeExpenseAct.kt index 589568cfc0..d22a13912d 100644 --- a/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcIncomeExpenseAct.kt +++ b/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcIncomeExpenseAct.kt @@ -55,7 +55,7 @@ class CalcIncomeExpenseAct @Inject constructor( ExchangeAct.Input( data = ExchangeData( baseCurrency = baseCurrency, - fromCurrency = acc.currency.toOption() + fromCurrency = (acc.currency ?: baseCurrency).toOption() ), amount = it ), diff --git a/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcWalletBalanceAct.kt b/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcWalletBalanceAct.kt index 67e18f12d5..22bfa2abf1 100644 --- a/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcWalletBalanceAct.kt +++ b/app/src/main/java/com/ivy/wallet/domain/action/wallet/CalcWalletBalanceAct.kt @@ -33,7 +33,7 @@ class CalcWalletBalanceAct @Inject constructor( ExchangeAct.Input( data = ExchangeData( baseCurrency = baseCurrency, - fromCurrency = it.account.currency.toOption(), + fromCurrency = (it.account.currency ?: baseCurrency).toOption(), toCurrency = balanceCurrency ), amount = it.balance diff --git a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt index 32a60654a6..6b5d7819f1 100644 --- a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt @@ -101,6 +101,9 @@ class SettingsViewModel @Inject constructor( _showNotifications.value = sharedPrefs.getBoolean(SharedPrefs.SHOW_NOTIFICATIONS, true) + _treatTransfersAsIncomeExpense.value = + sharedPrefs.getBoolean(SharedPrefs.TRANSFERS_AS_INCOME_EXPENSE, false) + _opSync.value = OpResult.success(ioThread { ivySync.isSynced() }) TestIdlingResource.decrement() @@ -315,7 +318,10 @@ class SettingsViewModel @Inject constructor( viewModelScope.launch { TestIdlingResource.increment() - sharedPrefs.putBoolean(SharedPrefs.TRANSFERS_AS_INCOME_EXPENSE, treatTransfersAsIncomeExpense) + sharedPrefs.putBoolean( + SharedPrefs.TRANSFERS_AS_INCOME_EXPENSE, + treatTransfersAsIncomeExpense + ) _treatTransfersAsIncomeExpense.value = treatTransfersAsIncomeExpense TestIdlingResource.decrement()