Skip to content
Snippets Groups Projects
Commit 0d54030c authored by poka's avatar poka
Browse files

can't revoke if smith member and explain why

parent 147557f5
No related branches found
No related tags found
1 merge request!29Revocation mechanisme
...@@ -189,5 +189,7 @@ ...@@ -189,5 +189,7 @@
"identityMigration": "Identity migration", "identityMigration": "Identity migration",
"areYouSureMigrateIdentity": "Are you sure you want to permanently migrate identity **{}** with balance of **{}** ?", "areYouSureMigrateIdentity": "Are you sure you want to permanently migrate identity **{}** with balance of **{}** ?",
"someoneCreatedYourIdentity": "Someone created your {} identity !", "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"
} }
\ No newline at end of file
...@@ -189,5 +189,7 @@ ...@@ -189,5 +189,7 @@
"identityMigration": "Identity migration", "identityMigration": "Identity migration",
"areYouSureMigrateIdentity": "Are you sure you want to permanently migrate identity **{}** with balance of **{}** ?", "areYouSureMigrateIdentity": "Are you sure you want to permanently migrate identity **{}** with balance of **{}** ?",
"someoneCreatedYourIdentity": "Someone created your {} identity !", "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"
} }
\ No newline at end of file
...@@ -190,5 +190,7 @@ ...@@ -190,5 +190,7 @@
"identityMigration": "Migration de l'identité", "identityMigration": "Migration de l'identité",
"areYouSureMigrateIdentity": "Êtes-vous certain de vouloir migrer définitivement l'identité **{}** et son solde de **{}** ?", "areYouSureMigrateIdentity": "Êtes-vous certain de vouloir migrer définitivement l'identité **{}** et son solde de **{}** ?",
"someoneCreatedYourIdentity": "Quelqu'un a créé votre identité {} !", "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"
} }
\ No newline at end of file
...@@ -242,6 +242,19 @@ class SubstrateSdk with ChangeNotifier { ...@@ -242,6 +242,19 @@ class SubstrateSdk with ChangeNotifier {
return await idtyStatus(address) == 'Validated'; 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 { Future<Map<String, int>> certState(String from, String to) async {
Map<String, int> result = {}; Map<String, int> result = {};
final toStatus = await idtyStatus(to); final toStatus = await idtyStatus(to);
......
...@@ -28,7 +28,7 @@ class ManageMembership extends StatelessWidget { ...@@ -28,7 +28,7 @@ class ManageMembership extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context); final sub = Provider.of<SubstrateSdk>(context);
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
...@@ -43,7 +43,41 @@ class ManageMembership extends StatelessWidget { ...@@ -43,7 +43,41 @@ class ManageMembership extends StatelessWidget {
const SizedBox(height: 20), const SizedBox(height: 20),
migrateIdentity(context), migrateIdentity(context),
const SizedBox(height: 10), 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), // const SizedBox(height: 20),
]), ]),
)); ));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment