UX: improve certification popup

This commit is contained in:
poka 2022-12-04 23:18:30 +01:00
parent 2ae32982f8
commit b924d644b7
7 changed files with 123 additions and 16 deletions

View File

@ -71,7 +71,8 @@
"areYouSureToDeleteWallet": "Are you sure you want to delete the chest \"{}\"?",
"areYouSureForgetAllChests": "Are you sure you want to forget all your chests?",
"areYouSureToForgetWallet": "Are you sure you wan to forget the wallet \"{}\"?",
"areYouSureYouWantToCertify": "Are you sure you want to certify the address:\n\n{}",
"areYouSureYouWantToCertify1": "Are you sure you want to certify the identity :",
"areYouSureYouWantToCertify2": "having the address :",
"yes": "Yes",
"no": "No",
"keepYourMnemonicSecret": "Try to keep this phrase a secret, as it allows anyone who knows it to access all your wallets.",
@ -156,7 +157,7 @@
"hours": "{} hours {}",
"days": "{} days",
"months": "{} months",
"certify": "Certify",
"certify": "Certify this\nidentity",
"from": "From:",
"to": "To:",
"amount": "Amount:",
@ -199,5 +200,6 @@
"thisMnemonicHasBeenCopiedToClipboard": "This mnemonic has been copied to clipboard",
"smithCantMigrateIdentity":"You can't migrate this identity while you're member of smith web",
"received": "Received",
"sent": "Sent"
"sent": "Sent",
"createIdentity": "Create a new \nidentity"
}

View File

@ -72,6 +72,8 @@
"areYouSureForgetAllChests": "¿Seguro de que quieres olvidar todos tus cofres?",
"areYouSureToForgetWallet": "¿Seguro de que quieres olvidar el monedero \"{}\"?",
"areYouSureYouWantToCertify": "¿Seguro de que quiere certificar a la dirección\n\n{}?",
"areYouSureYouWantToCertify1": "¿Seguro de que quiere certificar a la identidad :",
"areYouSureYouWantToCertify2": " a la dirección :",
"yes": "Sí",
"no": "No",
"keepYourMnemonicSecret": "Intenta mantener esta frase de restauración en secreto, ya que permite a cualquiera que la conozca acceder a todas tus monederos.",
@ -156,7 +158,7 @@
"hours": "{} horas {}",
"days": "{} dias",
"months": "{} meses",
"certify": "Certificar",
"certify": "Certificar esta\nidentidad",
"from": "De:",
"to": "A:",
"amount": "Importe:",
@ -199,5 +201,6 @@
"thisMnemonicHasBeenCopiedToClipboard": "This mnemonic has been copied to clipboard",
"smithCantMigrateIdentity":"You can't migrate this identity while you're member of smith web",
"received": "Received",
"sent": "Sent"
"sent": "Sent",
"createIdentity": "Create a new \nidentity"
}

View File

@ -71,7 +71,8 @@
"areYouSureToDeleteWallet": "Êtes-vous sûr de vouloir supprimer le coffre \"{}\" ?",
"areYouSureForgetAllChests": "Êtes-vous sûr de vouloir oublier tous vos coffres ?",
"areYouSureToForgetWallet": "Êtes-vous sûr de vouloir oublier le portefeuille \"{}\" ?",
"areYouSureYouWantToCertify": "Êtes-vous certain de vouloir certifier l'adresse:\n\n{}",
"areYouSureYouWantToCertify1": "Êtes-vous certain de vouloir certifier l'identité :",
"areYouSureYouWantToCertify2": "ayant pour adresse :",
"yes": "Oui",
"no": "Non",
"keepYourMnemonicSecret": "Tâchez de garder cette phrase bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.",
@ -157,7 +158,7 @@
"hours": "{} heures {}",
"days": "{} jours",
"months": "{} mois",
"certify": "Certifier",
"certify": "Certifier cette\nidentité",
"from": "Depuis:",
"to": "Vers:",
"amount": "Montant:",
@ -200,5 +201,6 @@
"thisMnemonicHasBeenCopiedToClipboard": "Cette phrase secrète viens d'être copié dans votre presse-papier.",
"smithCantMigrateIdentity":"Vous ne pouvez pas migrer cette identité\ntant que vous êtes dans la toile forgerons",
"received": "Reçus",
"sent": "Envoyés"
"sent": "Envoyés",
"createIdentity": "Créer sa nouvelle\nidentité"
}

View File

@ -288,6 +288,9 @@ class SubstrateSdk with ChangeNotifier {
result.putIfAbsent('certDelay', () => certDelayDuration);
} else if (toStatus == 'Created') {
result.putIfAbsent('toStatus', () => 1);
} else if (toStatus == 'noid') {
result.putIfAbsent('toStatus', () => 2);
result.putIfAbsent('canCert', () => 0);
} else {
result.putIfAbsent('canCert', () => 0);
}

View File

@ -279,6 +279,92 @@ Future<bool?> confirmPopup(BuildContext context, String title) async {
);
}
Future<bool?> confirmPopupCertification(BuildContext context, String question1,
String username, String question2, String address) async {
return showDialog<bool>(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return AlertDialog(
// actionsPadding: const EdgeInsets.all(0.0),
backgroundColor: backgroundColor,
content: SizedBox(
height: 240,
child: Column(
children: [
const SizedBox(height: 15),
Text(
question1,
textAlign: TextAlign.center,
style:
const TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
),
const SizedBox(height: 20),
Text(
username,
textAlign: TextAlign.center,
style:
const TextStyle(fontSize: 24, fontWeight: FontWeight.w500),
),
const SizedBox(height: 20),
Text(
question2,
textAlign: TextAlign.center,
style:
const TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
),
const SizedBox(height: 20),
Text(
address,
textAlign: TextAlign.center,
style:
const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
),
const SizedBox(height: 20),
const Text(
'?',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
),
],
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
key: keyConfirm,
child: Text(
"yes".tr(),
style: const TextStyle(
fontSize: 25,
color: Color(0xffD80000),
),
),
onPressed: () {
Navigator.pop(context, true);
},
),
const SizedBox(width: 35),
TextButton(
child: Text(
"no".tr(),
style: const TextStyle(fontSize: 25),
),
onPressed: () {
Navigator.pop(context, false);
},
),
const SizedBox(height: 120)
],
)
],
);
},
);
}
Future<void> infoPopup(BuildContext context, String title) async {
return showDialog<void>(
context: context,

View File

@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/cesium_plus.dart';
import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/home.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/providers/wallet_options.dart';
@ -148,6 +149,8 @@ class WalletViewScreen extends StatelessWidget {
]),
Consumer<SubstrateSdk>(builder: (context, sub, _) {
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
final duniterIndexer =
Provider.of<DuniterIndexer>(context, listen: false);
return FutureBuilder(
future: sub.certState(defaultWallet.address!, address),
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
@ -211,12 +214,18 @@ class WalletViewScreen extends StatelessWidget {
'assets/gecko_certify.png')),
),
onTap: () async {
final bool? result = await confirmPopup(
context,
"areYouSureYouWantToCertify".tr(
args: [
getShortPubkey(address)
]));
final bool? result =
await confirmPopupCertification(
context,
'areYouSureYouWantToCertify1'
.tr(),
duniterIndexer
.walletNameIndexer[
address] ??
"noIdentity".tr(),
'areYouSureYouWantToCertify2'
.tr(),
getShortPubkey(address));
if (result ?? false) {
String? pin;
@ -260,7 +269,9 @@ class WalletViewScreen extends StatelessWidget {
),
const SizedBox(height: 9),
Text(
"certify".tr(),
toStatus == 0
? "certify".tr()
: "createIdentity".tr(),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: buttonFontSize,

View File

@ -5,7 +5,7 @@ description: Pay with G1.
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.13+41
version: 0.0.13+42
environment:
sdk: '>=2.12.0 <3.0.0'