From 776a0f8c75305b090a21b01914ce9a9fc4e22787 Mon Sep 17 00:00:00 2001 From: poka Date: Sun, 11 Sep 2022 07:53:34 +0200 Subject: [PATCH] improve migration text infos --- assets/translations/en.json | 2 +- assets/translations/es.json | 2 +- assets/translations/fr.json | 2 +- .../scenarios/identity_revocation.dart | 16 +++++++++++++++- integration_test/utility/tests_utility.dart | 4 +++- lib/providers/substrate_sdk.dart | 6 ------ lib/screens/myWallets/migrate_identity.dart | 4 ++++ 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index d9f6bdb..90236ab 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -178,7 +178,7 @@ "youAreOffline": "You are offline...", "importG1v1": "Import old G1v1 account", "selectDestWallet": "Select a target wallet:", - "youMustWaitBeforeCashoutThisAccount": "You have to wait {} minutes\nbefore migrate this account", + "youMustWaitBeforeCashoutThisAccount": "You have to wait a few moment before migrate this account", "thisAccountIsEmpty": "This account is empty", "youCannotMigrateIdentityToExistingIdentity": "You cannot migrate an identity\nto an account that already has an identity", "importOldAccount": "Import your old account", diff --git a/assets/translations/es.json b/assets/translations/es.json index 64fa82e..89d9f46 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -178,7 +178,7 @@ "youAreOffline": "You are offline...", "importG1v1": "Import old G1v1 account", "selectDestWallet": "Select a target wallet:", - "youMustWaitBeforeCashoutThisAccount": "You have to wait {} minutes\nbefore migrate this account", + "youMustWaitBeforeCashoutThisAccount": "You have to wait a few moment before migrate this account", "thisAccountIsEmpty": "This account is empty", "youCannotMigrateIdentityToExistingIdentity": "You cannot migrate an identity\nto an account that already has an identity", "importOldAccount": "Import your old account", diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 1861a8f..ed7b11e 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -179,7 +179,7 @@ "youAreOffline": "Vous êtes hors ligne...", "importG1v1": "Importer un ancien compte G1v1", "selectDestWallet": "Sélectionnez un portefeuille cible:", - "youMustWaitBeforeCashoutThisAccount": "Vous devez attendre {} minutes\navant de pouvoir migrer ce compte", + "youMustWaitBeforeCashoutThisAccount": "Vous devez attendre quelques minutes avant de pouvoir migrer ce compte", "thisAccountIsEmpty": "Ce compte est vide", "youCannotMigrateIdentityToExistingIdentity": "Vous ne pouvez pas migrer une identité\nvers un compte disposant déjà d'une identité", "importOldAccount": "Importer son ancien compte", diff --git a/integration_test/scenarios/identity_revocation.dart b/integration_test/scenarios/identity_revocation.dart index 189a56c..8fff4c7 100644 --- a/integration_test/scenarios/identity_revocation.dart +++ b/integration_test/scenarios/identity_revocation.dart @@ -46,8 +46,22 @@ void main() async { // Check test1 cannot be revoked await goBack(); - await tapKey(keyOpenWallet(test1.address)); + await tapKey(keyAddDerivation); + await tapKey(keyOpenWallet(test1.address), duration: 500); await tapKey(keyManageMembership, duration: 1000); await waitFor('Vous ne pouvez pas révoquer cette identité'); + + // // Try migrate test1 identity to test6 address + // await tapKey(keyMigrateIdentity); + // await tapKey(keySelectWallet); + // await tapKey(keySelectThisWallet(test6.address), selectLast: true); + // await spawnBlock(number: 100); + // await waitFor('Vous devez attendre', reverse: true); + // await waitForButtonEnabled(keyConfirm); + // await tapKey(keyConfirm, duration: 500); + // await spawnBlock(duration: 2000); + // await waitFor('validé !'); + // await tapKey(keyCloseTransactionScreen, duration: 0); + // await sleep(5000); }, timeout: testTimeout()); } diff --git a/integration_test/utility/tests_utility.dart b/integration_test/utility/tests_utility.dart index 5aecdae..99b327b 100644 --- a/integration_test/utility/tests_utility.dart +++ b/integration_test/utility/tests_utility.dart @@ -135,9 +135,11 @@ Future waitFor(String text, Finder finder = exactMatch ? find.text(text) : find.textContaining(text); log.d('INTEGRATION TEST: Wait for: $text'); + final String searchType = reverse ? 'reversed text' : 'text'; + do { if (DateTime.now().isAfter(end)) { - throw Exception('Timed out waiting for text $text'); + throw Exception('Timed out waiting for $searchType : "$text"'); } await tester.pumpAndSettle(); diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart index 03ff57f..3b3f6ec 100644 --- a/lib/providers/substrate_sdk.dart +++ b/lib/providers/substrate_sdk.dart @@ -879,8 +879,6 @@ newKeySig: $newKeySig"""); final genesisHashString = await getGenesisHash(); final genesisHash = HEX.decode(genesisHashString.substring(2)) as Uint8List; final idtyIndexBytes = _int32bytes(idtyIndex); - // final pubkey = await addressToPubkey(address); - // final pubkeyHexa = '0x${HEX.encode(pubkey)}'; final messageToSign = Uint8List.fromList(prefix + genesisHash + idtyIndexBytes); final revocationSig = @@ -893,10 +891,6 @@ newKeySig: $newKeySig"""); sender, ); - log.d('''DEBUGG: messageToSign: $messageToSign -revocationSig: $revocationSig -revocationSigTyped: $revocationSigTyped'''); - final txOptions = [idtyIndex, address, revocationSigTyped]; return await _executeCall(txInfo, txOptions, password); } diff --git a/lib/screens/myWallets/migrate_identity.dart b/lib/screens/myWallets/migrate_identity.dart index 535f6d3..e3dfc75 100644 --- a/lib/screens/myWallets/migrate_identity.dart +++ b/lib/screens/myWallets/migrate_identity.dart @@ -6,6 +6,7 @@ import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:gecko/globals.dart'; import 'package:flutter/material.dart'; import 'package:gecko/models/wallet_data.dart'; +import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/substrate_sdk.dart'; @@ -163,12 +164,14 @@ class MigrateIdentityScreen extends StatelessWidget { Text('selectDestWallet'.tr()), const SizedBox(height: 5), DropdownButtonHideUnderline( + key: keySelectWallet, child: DropdownButton( // alignment: AlignmentDirectional.topStart, value: selectedWallet, icon: const Icon(Icons.keyboard_arrow_down), items: walletsList.map((wallet) { return DropdownMenuItem( + key: keySelectThisWallet(wallet.address!), value: wallet, child: Text( wallet.name!, @@ -187,6 +190,7 @@ class MigrateIdentityScreen extends StatelessWidget { width: 380 * ratio, height: 60 * ratio, child: ElevatedButton( + key: keyConfirm, style: ElevatedButton.styleFrom( foregroundColor: Colors.white, elevation: 4, backgroundColor: orangeC, // foreground