diff --git a/assets/translations/en.json b/assets/translations/en.json index bca3f5c..cfcd2e3 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -147,6 +147,7 @@ "execTimeoutOver": "Execution timeout is over", "seeAWallet": "See a wallet", "mustWaitXBeforeCertify": "You have to wait\n{} before\ncertifying again", + "mustConfirmHisIdentity": "This person must confirm\nhis identity before can be\ncertified", "canRenewCertInX": "You can renew\nthis certification\nin {}", "executeATransfer": "Execute a transfer", "executeTheTransfer": "Execute the transfer", diff --git a/assets/translations/es.json b/assets/translations/es.json index 7d985e9..99f6f1b 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -147,6 +147,7 @@ "execTimeoutOver": "Execution timeout is over", "seeAWallet": "See a wallet", "mustWaitXBeforeCertify": "You have to wait\n{} before\ncertifying again", + "mustConfirmHisIdentity": "This person must confirm\nhis identity before can be\ncertified", "canRenewCertInX": "You can renew\nthis certification\nin {}", "executeATransfer": "Execute a transfer", "executeTheTransfer": "Execute the transfer", diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 9f03953..120c128 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -148,6 +148,7 @@ "execTimeoutOver": "Le délais d'éxecution est dépassé", "seeAWallet": "Voir un portefeuille", "mustWaitXBeforeCertify": "Vous devez attendre\n{} avant\nde pouvoir certifier", + "mustConfirmHisIdentity": "Cette personne doit confirmer\nson identité avant de pouvoir\nêtre certifié", "canRenewCertInX": "Vous pourrez renouveller\ncette certification\ndans {}", "executeATransfer": "Effectuer un virement", "executeTheTransfer": "Effectuer le virement", diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart index d814bb7..c06d102 100644 --- a/lib/providers/substrate_sdk.dart +++ b/lib/providers/substrate_sdk.dart @@ -227,9 +227,13 @@ class SubstrateSdk with ChangeNotifier { } else { result.putIfAbsent('canCert', () => 0); } - // log.d('tatatatata: ${nextIssuableOn - blocNumber}'); } + final toStatus = await idtyStatus(to); + // log.d('certMeta: $toStatus'); + + if (toStatus == 'Created') result.putIfAbsent('toStatus', () => 1); + return result; } @@ -797,8 +801,7 @@ class AddressInfo { void snackNode(BuildContext context, bool isConnected) { String message; if (!isConnected) { - message = - "noDuniterNodeAvailableTryLater".tr(); + message = "noDuniterNodeAvailableTryLater".tr(); } else { SubstrateSdk sub = Provider.of(context, listen: false); diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index 1593780..994cdec 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -191,6 +191,8 @@ class WalletViewScreen extends StatelessWidget { } } + final toStatus = snapshot.data!['toStatus'] ?? 0; + return Visibility( visible: (snapshot.data != {}), child: Column(children: [ @@ -269,66 +271,13 @@ class WalletViewScreen extends StatelessWidget { fontWeight: FontWeight.w500), ), ]), - if (snapshot.data!['certDelay'] != null) - Column(children: [ - SizedBox( - height: buttonSize, - child: Padding( - padding: const EdgeInsets.only(bottom: 0), - child: Container( - foregroundDecoration: const BoxDecoration( - color: Colors.grey, - backgroundBlendMode: BlendMode.saturation, - ), - child: const Opacity( - opacity: 0.5, - child: Image( - image: AssetImage( - 'assets/gecko_certify.png')), - ), - ), - ), - ), - Text( - "mustWaitXBeforeCertify" - .tr(args: [duration.toString()]), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: buttonFontSize - 4, - fontWeight: FontWeight.w400, - color: Colors.grey[600]), - ), - ]), - if (snapshot.data!['certRenewable'] != null && + if (toStatus == 1) + waitToCert('mustConfirmHisIdentity', duration) + else if (snapshot.data!['certRenewable'] != null && duration != 'seconds'.tr(args: ['0'])) - Column(children: [ - SizedBox( - height: buttonSize, - child: Padding( - padding: const EdgeInsets.only(bottom: 0), - child: Container( - foregroundDecoration: const BoxDecoration( - color: Colors.grey, - backgroundBlendMode: BlendMode.saturation, - ), - child: const Opacity( - opacity: 0.5, - child: Image( - image: AssetImage( - 'assets/gecko_certify.png')), - ), - ), - ), - ), - Text( - "canRenewCertInX".tr(args: [duration.toString()]), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: buttonFontSize - 4, - fontWeight: FontWeight.w400, - color: Colors.grey[600]), - ), - ]), + waitToCert('canRenewCertInX', duration) + else if (snapshot.data!['certDelay'] != null) + waitToCert('mustWaitXBeforeCertify', duration) ]), ); }, @@ -415,6 +364,35 @@ class WalletViewScreen extends StatelessWidget { )); } + Widget waitToCert(String status, String duration) { + return Column(children: [ + SizedBox( + height: buttonSize, + child: Padding( + padding: const EdgeInsets.only(bottom: 0), + child: Container( + foregroundDecoration: const BoxDecoration( + color: Colors.grey, + backgroundBlendMode: BlendMode.saturation, + ), + child: const Opacity( + opacity: 0.5, + child: Image(image: AssetImage('assets/gecko_certify.png')), + ), + ), + ), + ), + Text( + status.tr(args: [duration]), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: buttonFontSize - 4, + fontWeight: FontWeight.w400, + color: Colors.grey[600]), + ), + ]); + } + void paymentPopup( BuildContext context, WalletsProfilesProvider walletViewProvider) { // WalletsProfilesProvider _walletViewProvider =