can't revoke if smith member and explain why
This commit is contained in:
parent
147557f545
commit
0d54030c1a
|
@ -189,5 +189,7 @@
|
|||
"identityMigration": "Identity migration",
|
||||
"areYouSureMigrateIdentity": "Are you sure you want to permanently migrate identity **{}** with balance of **{}** ?",
|
||||
"someoneCreatedYourIdentity": "Someone created your {} identity !",
|
||||
"confirmMyIdentity": "Confirm my identity"
|
||||
"confirmMyIdentity": "Confirm my identity",
|
||||
"revokeMyIdentity": "Revoke my identity",
|
||||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web"
|
||||
}
|
|
@ -189,5 +189,7 @@
|
|||
"identityMigration": "Identity migration",
|
||||
"areYouSureMigrateIdentity": "Are you sure you want to permanently migrate identity **{}** with balance of **{}** ?",
|
||||
"someoneCreatedYourIdentity": "Someone created your {} identity !",
|
||||
"confirmMyIdentity": "Confirm my identity"
|
||||
"confirmMyIdentity": "Confirm my identity",
|
||||
"revokeMyIdentity": "Revoke my identity",
|
||||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web"
|
||||
}
|
|
@ -190,5 +190,7 @@
|
|||
"identityMigration": "Migration de l'identité",
|
||||
"areYouSureMigrateIdentity": "Êtes-vous certain de vouloir migrer définitivement l'identité **{}** et son solde de **{}** ?",
|
||||
"someoneCreatedYourIdentity": "Quelqu'un a créé votre identité {} !",
|
||||
"confirmMyIdentity": "Confirmer mon identité"
|
||||
"confirmMyIdentity": "Confirmer mon identité",
|
||||
"revokeMyIdentity": "Révoquer mon identité",
|
||||
"youCannotRevokeThisIdentity": "Vous ne pouvez pas révoquer cette identité tant\nqu'elle fait partie de la toile forgerons"
|
||||
}
|
|
@ -242,6 +242,19 @@ class SubstrateSdk with ChangeNotifier {
|
|||
return await idtyStatus(address) == 'Validated';
|
||||
}
|
||||
|
||||
Future<bool> isSmithGet(String address) async {
|
||||
var idtyIndex = await _getIdentityIndexOf(address);
|
||||
|
||||
final Map smithExpireOn =
|
||||
(await _getStorage('smithsMembership.membership($idtyIndex)')) ?? {};
|
||||
|
||||
if (smithExpireOn.isEmpty) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, int>> certState(String from, String to) async {
|
||||
Map<String, int> result = {};
|
||||
final toStatus = await idtyStatus(to);
|
||||
|
|
|
@ -28,7 +28,7 @@ class ManageMembership extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||
final sub = Provider.of<SubstrateSdk>(context);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
|
@ -43,7 +43,41 @@ class ManageMembership extends StatelessWidget {
|
|||
const SizedBox(height: 20),
|
||||
migrateIdentity(context),
|
||||
const SizedBox(height: 10),
|
||||
revokeMyIdentity(context)
|
||||
FutureBuilder(
|
||||
future: sub.isSmithGet(address),
|
||||
builder: (BuildContext context, AsyncSnapshot<bool> isSmith) {
|
||||
if (isSmith.data ?? false) {
|
||||
return SizedBox(
|
||||
height: 70,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
const SizedBox(width: 20),
|
||||
Image.asset(
|
||||
'assets/skull_Icon.png',
|
||||
color: Colors.grey[500],
|
||||
height: 30,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('revokeMyIdentity'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.grey[500])),
|
||||
const SizedBox(height: 5),
|
||||
Text("youCannotRevokeThisIdentity".tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[500])),
|
||||
]),
|
||||
],
|
||||
));
|
||||
} else {
|
||||
return revokeMyIdentity(context);
|
||||
}
|
||||
})
|
||||
// const SizedBox(height: 20),
|
||||
]),
|
||||
));
|
||||
|
|
Loading…
Reference in New Issue