Generic fixes (#1605)

* minor fixes

* fix not saving wallet password to secure storage

* cache linux deps as well
This commit is contained in:
Omar Hatem 2024-08-13 22:51:25 +03:00 committed by GitHub
parent 4e7e00b975
commit 525df820c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 27 deletions

View file

@ -60,7 +60,7 @@ jobs:
path: | path: |
/opt/android/cake_wallet/cw_haven/android/.cxx /opt/android/cake_wallet/cw_haven/android/.cxx
/opt/android/cake_wallet/scripts/monero_c/release /opt/android/cake_wallet/scripts/monero_c/release
key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh') }} key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}
- if: ${{ steps.cache-externals.outputs.cache-hit != 'true' }} - if: ${{ steps.cache-externals.outputs.cache-hit != 'true' }}
name: Generate Externals name: Generate Externals
@ -68,3 +68,6 @@ jobs:
cd /opt/android/cake_wallet/scripts/android/ cd /opt/android/cake_wallet/scripts/android/
source ./app_env.sh cakewallet source ./app_env.sh cakewallet
./build_monero_all.sh ./build_monero_all.sh
cd ../linux/
source ./app_env.sh cakewallet
./build_monero_all.sh

View file

@ -8,10 +8,7 @@ import 'package:cw_monero/api/exceptions/wallet_opening_exception.dart';
import 'package:cw_monero/api/exceptions/wallet_restore_from_keys_exception.dart'; import 'package:cw_monero/api/exceptions/wallet_restore_from_keys_exception.dart';
import 'package:cw_monero/api/exceptions/wallet_restore_from_seed_exception.dart'; import 'package:cw_monero/api/exceptions/wallet_restore_from_seed_exception.dart';
import 'package:cw_monero/api/wallet.dart'; import 'package:cw_monero/api/wallet.dart';
import 'package:flutter/foundation.dart';
import 'package:cw_monero/api/transaction_history.dart'; import 'package:cw_monero/api/transaction_history.dart';
import 'package:cw_monero/api/wallet.dart';
import 'package:flutter/foundation.dart';
import 'package:monero/monero.dart' as monero; import 'package:monero/monero.dart' as monero;
class MoneroCException implements Exception { class MoneroCException implements Exception {

View file

@ -1,4 +1,3 @@
import 'package:cake_wallet/core/secure_storage.dart';
import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
@ -57,9 +56,9 @@ class WalletCreationService {
if (credentials.password == null) { if (credentials.password == null) {
credentials.password = generateWalletPassword(); credentials.password = generateWalletPassword();
}
await keyService.saveWalletPassword( await keyService.saveWalletPassword(
password: credentials.password!, walletName: credentials.name); password: credentials.password!, walletName: credentials.name);
}
if (_hasSeedPhraseLengthOption) { if (_hasSeedPhraseLengthOption) {
credentials.seedPhraseLength = settingsStore.seedPhraseLength.value; credentials.seedPhraseLength = settingsStore.seedPhraseLength.value;
@ -99,9 +98,9 @@ class WalletCreationService {
if (credentials.password == null) { if (credentials.password == null) {
credentials.password = generateWalletPassword(); credentials.password = generateWalletPassword();
}
await keyService.saveWalletPassword( await keyService.saveWalletPassword(
password: credentials.password!, walletName: credentials.name); password: credentials.password!, walletName: credentials.name);
}
final wallet = await _service!.restoreFromKeys(credentials, isTestnet: isTestnet); final wallet = await _service!.restoreFromKeys(credentials, isTestnet: isTestnet);
@ -118,9 +117,9 @@ class WalletCreationService {
if (credentials.password == null) { if (credentials.password == null) {
credentials.password = generateWalletPassword(); credentials.password = generateWalletPassword();
}
await keyService.saveWalletPassword( await keyService.saveWalletPassword(
password: credentials.password!, walletName: credentials.name); password: credentials.password!, walletName: credentials.name);
}
final wallet = await _service!.restoreFromSeed(credentials, isTestnet: isTestnet); final wallet = await _service!.restoreFromSeed(credentials, isTestnet: isTestnet);

View file

@ -75,7 +75,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
_walletNewVM.hasWalletPassword ? TextEditingController() : null; _walletNewVM.hasWalletPassword ? TextEditingController() : null;
static const aspectRatioImage = 1.22; static const aspectRatioImage = 1.22;
static bool formProcessing = false; bool _formProcessing = false;
final GlobalKey<FormState> _formKey; final GlobalKey<FormState> _formKey;
final GlobalKey<SeedLanguageSelectorState> _languageSelectorKey; final GlobalKey<SeedLanguageSelectorState> _languageSelectorKey;
@ -350,11 +350,11 @@ class _WalletNameFormState extends State<WalletNameForm> {
} }
void _confirmForm() async { void _confirmForm() async {
if (formProcessing) return; if (_formProcessing) return;
formProcessing = true; _formProcessing = true;
try { try {
if (_formKey.currentState != null && !_formKey.currentState!.validate()) { if (_formKey.currentState != null && !_formKey.currentState!.validate()) {
formProcessing = false; _formProcessing = false;
return; return;
} }
if (_walletNewVM.nameExists(_walletNewVM.name)) { if (_walletNewVM.nameExists(_walletNewVM.name)) {
@ -374,10 +374,10 @@ class _WalletNameFormState extends State<WalletNameForm> {
: null); : null);
} }
} catch (e) { } catch (e) {
formProcessing = false; _formProcessing = false;
rethrow; rethrow;
} }
formProcessing = false; _formProcessing = false;
} }
bool get isPolyseed => widget._seedTypeViewModel.moneroSeedType == SeedType.polyseed; bool get isPolyseed => widget._seedTypeViewModel.moneroSeedType == SeedType.polyseed;

View file

@ -2,7 +2,6 @@ import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/new_wallet/new_wallet_page.dart';
import 'package:cake_wallet/src/screens/restore/wallet_restore_from_keys_form.dart'; import 'package:cake_wallet/src/screens/restore/wallet_restore_from_keys_form.dart';
import 'package:cake_wallet/src/screens/restore/wallet_restore_from_seed_form.dart'; import 'package:cake_wallet/src/screens/restore/wallet_restore_from_seed_form.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
@ -81,7 +80,7 @@ class WalletRestorePage extends BasePage {
}); });
} }
static bool formProcessing = false; bool _formProcessing = false;
@override @override
Widget middle(BuildContext context) => Observer( Widget middle(BuildContext context) => Observer(
@ -353,8 +352,8 @@ class WalletRestorePage extends BasePage {
} }
Future<void> _confirmForm(BuildContext context) async { Future<void> _confirmForm(BuildContext context) async {
if (formProcessing) return; if (_formProcessing) return;
formProcessing = true; _formProcessing = true;
try { try {
// Dismissing all visible keyboard to provide context for navigation // Dismissing all visible keyboard to provide context for navigation
FocusManager.instance.primaryFocus?.unfocus(); FocusManager.instance.primaryFocus?.unfocus();
@ -373,13 +372,13 @@ class WalletRestorePage extends BasePage {
} }
if (!formKey!.currentState!.validate()) { if (!formKey!.currentState!.validate()) {
formProcessing = false; _formProcessing = false;
return; return;
} }
if (walletRestoreViewModel.nameExists(name)) { if (walletRestoreViewModel.nameExists(name)) {
showNameExistsAlert(formContext!); showNameExistsAlert(formContext!);
formProcessing = false; _formProcessing = false;
return; return;
} }
@ -428,10 +427,10 @@ class WalletRestorePage extends BasePage {
await walletRestoreViewModel.create(options: _credentials()); await walletRestoreViewModel.create(options: _credentials());
} catch (e) { } catch (e) {
formProcessing = false; _formProcessing = false;
rethrow; rethrow;
} }
formProcessing = false; _formProcessing = false;
} }
Future<void> showNameExistsAlert(BuildContext context) { Future<void> showNameExistsAlert(BuildContext context) {

View file

@ -110,8 +110,6 @@ abstract class WalletCreationVMBase with Store {
_appStore.authenticationStore.allowed(); _appStore.authenticationStore.allowed();
state = ExecutedSuccessfullyState(); state = ExecutedSuccessfullyState();
} catch (e, s) { } catch (e, s) {
print("@@@@@@@@");
print(s);
state = FailureState(e.toString()); state = FailureState(e.toString());
} }
} }