fix: can't cert if identity is not confirmed

This commit is contained in:
poka 2022-08-17 23:28:19 +02:00
parent 0983c1d01e
commit 5ce381b174
5 changed files with 46 additions and 62 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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<SubstrateSdk>(context, listen: false);

View File

@ -191,6 +191,8 @@ class WalletViewScreen extends StatelessWidget {
}
}
final toStatus = snapshot.data!['toStatus'] ?? 0;
return Visibility(
visible: (snapshot.data != {}),
child: Column(children: <Widget>[
@ -269,66 +271,13 @@ class WalletViewScreen extends StatelessWidget {
fontWeight: FontWeight.w500),
),
]),
if (snapshot.data!['certDelay'] != null)
Column(children: <Widget>[
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: <Widget>[
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: <Widget>[
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 =