diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1061e9e..91a21cb 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -19,6 +19,8 @@ - + android:icon="@mipmap/ic_launcher" + /> --> - - diff --git a/assets/onBoarding/coffre-fort-code-secret-dans-telephone.png b/assets/onBoarding/coffre-fort-code-secret-dans-telephone.png new file mode 100644 index 0000000..3cc870e Binary files /dev/null and b/assets/onBoarding/coffre-fort-code-secret-dans-telephone.png differ diff --git a/assets/onBoarding/coffre-fort-protege-les-portefeuilles.png b/assets/onBoarding/coffre-fort-protege-les-portefeuilles.png new file mode 100644 index 0000000..aec07f2 Binary files /dev/null and b/assets/onBoarding/coffre-fort-protege-les-portefeuilles.png differ diff --git a/assets/onBoarding/coffre-voleur-perplexe.png b/assets/onBoarding/coffre-voleur-perplexe.png new file mode 100644 index 0000000..2f5b6ee Binary files /dev/null and b/assets/onBoarding/coffre-voleur-perplexe.png differ diff --git a/assets/onBoarding/fabrication-de-portefeuille-impossible-sans-phrase.png b/assets/onBoarding/fabrication-de-portefeuille-impossible-sans-phrase.png new file mode 100644 index 0000000..7f78701 Binary files /dev/null and b/assets/onBoarding/fabrication-de-portefeuille-impossible-sans-phrase.png differ diff --git a/assets/onBoarding/fabrication-de-portefeuille.png b/assets/onBoarding/fabrication-de-portefeuille.png new file mode 100644 index 0000000..0984ccc Binary files /dev/null and b/assets/onBoarding/fabrication-de-portefeuille.png differ diff --git a/assets/onBoarding/gecko-oublie-aussi.png b/assets/onBoarding/gecko-oublie-aussi.png new file mode 100644 index 0000000..b4e165a Binary files /dev/null and b/assets/onBoarding/gecko-oublie-aussi.png differ diff --git a/assets/onBoarding/good-bad-passphrase.png b/assets/onBoarding/good-bad-passphrase.png deleted file mode 100755 index edbda62..0000000 Binary files a/assets/onBoarding/good-bad-passphrase.png and /dev/null differ diff --git a/assets/onBoarding/keys-and-wallets-horizontal.png b/assets/onBoarding/keys-and-wallets-horizontal.png deleted file mode 100755 index e94e57d..0000000 Binary files a/assets/onBoarding/keys-and-wallets-horizontal.png and /dev/null differ diff --git a/assets/onBoarding/mot-de-passe-oublie.png b/assets/onBoarding/mot-de-passe-oublie.png new file mode 100644 index 0000000..8d80bc9 Binary files /dev/null and b/assets/onBoarding/mot-de-passe-oublie.png differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 4297642..f5b3c15 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -492,4 +492,4 @@ /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; -} \ No newline at end of file +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index a65cade..d08d914 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index c081abb..6cb6241 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index bdb5fed..3e54e80 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index 9708740..a544812 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 3b4e54e..db4c932 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index 0506604..4005a0d 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index 7168d21..852aa31 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index bdb5fed..3e54e80 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index 475acee..b6fb505 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index 9ed9156..aad11e2 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index 9ed9156..aad11e2 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 3f1ee21..afc4220 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index f32e892..3c6974e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index f6dd010..7740bbd 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index 97d30a6..2b683d0 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/lib/providers/generate_wallets.dart b/lib/providers/generate_wallets.dart index dd3b4bc..8d4c267 100644 --- a/lib/providers/generate_wallets.dart +++ b/lib/providers/generate_wallets.dart @@ -155,25 +155,6 @@ class GenerateWalletsProvider with ChangeNotifier { notifyListeners(); } - Future generateWallet(String generatedMnemonic, - {required bool isImport}) async { - try { - actualWallet = await durt.Dewif().generateDewif( - generatedMnemonic, durt.randomSecretCode(pinLength), - lang: appLang); - } catch (e) { - log.e(e); - } - - if (!isImport) { - mnemonicController.text = generatedMnemonic; - pin.text = actualWallet!.password; - } - // notifyListeners(); - - return actualWallet; - } - String changePinCode({required bool reload}) { pin.text = durt.randomSecretCode(pinLength); if (reload) { @@ -229,56 +210,6 @@ class GenerateWalletsProvider with ChangeNotifier { log.d(_walletPubkey); } - // Future importCesiumWallet() async { - // // String _walletPubkey = await DubpRust.getLegacyPublicKey( - // // salt: _cesiumID, password: _cesiumPWD); - // // String shortPubkey = truncate(_walletPubkey, 9, - // // omission: "...", position: TruncatePosition.end); - // // await storeWallet( - // // actualWallet, 'Portefeuille Cesium - $shortPubkey', context); - // // NewWallet myCesiumWallet = await DubpRust.genWalletFromDeprecatedSaltPassword(salt: _cesiumID, password: _cesiumPWD); - - // cesiumID.text = ''; - // cesiumPWD.text = ''; - // cesiumPubkey.text = ''; - // canImport = false; - // isCesiumIDVisible = false; - // isCesiumPWDVisible = false; - - // int chestNumber = 0; - // chestBox.toMap().forEach((key, value) { - // if (value.isCesium!) { - // chestNumber++; - // } - // }); - - // String chestName; - // if (chestNumber == 0) { - // chestName = 'Coffre à Césium'; - // } else { - // chestName = 'Coffre à Césium ${chestNumber + 1}'; - // } - - // log.d(pin.text); - // durt.NewWallet cesiumDewif = - // await durt.Dewif().generateCesiumDewif(cesiumWallet.seed, pin.text); - - // ChestData cesiumChest = ChestData( - // dewif: cesiumDewif.dewif, - // name: chestName, - // imageName: 'cesium.png', - // defaultWallet: 0, - // isCesium: true); - - // await chestBox.add(cesiumChest).then((value) => null); - // int? chestKey = await chestBox.toMap().keys.last; - // // chestBox.toMap(). - // await configBox.put('currentChest', chestKey); - - // pin.text = ''; - // return chestKey; - // } - void cesiumIDisVisible() { isCesiumIDVisible = !isCesiumIDVisible; notifyListeners(); @@ -371,25 +302,6 @@ class GenerateWalletsProvider with ChangeNotifier { } } - Future isSentenceValid() async { - String inputMnemonic = - '${cellController0.text} ${cellController1.text} ${cellController2.text} ${cellController3.text} ${cellController4.text} ${cellController5.text} ${cellController6.text} ${cellController7.text} ${cellController8.text} ${cellController9.text} ${cellController10.text} ${cellController11.text}'; - - // Needed for bad encoding of UTF-8 - inputMnemonic = inputMnemonic.replaceAll('é', 'é'); - inputMnemonic = inputMnemonic.replaceAll('è', 'è'); - - durt.NewWallet? generatedWallet = - await generateWallet(inputMnemonic, isImport: true); - - if (generatedWallet == null) { - return false; - } else { - generatedMnemonic = inputMnemonic; - return true; - } - } - Future pasteMnemonic(BuildContext context) async { final sentence = await Clipboard.getData('text/plain'); int nbr = 0; diff --git a/lib/providers/my_wallets.dart b/lib/providers/my_wallets.dart index 953b446..2f12bae 100644 --- a/lib/providers/my_wallets.dart +++ b/lib/providers/my_wallets.dart @@ -26,7 +26,7 @@ class MyWalletsProvider with ChangeNotifier { // configBox.delete('endpoint'); if (!configBox.containsKey('endpoint') || configBox.get('endpoint') == '') { log.d('No endpoint, configure...'); - configBox.put('endpoint', 'ws://192.168.1.72:9944'); + configBox.put('endpoint', 'ws://127.0.0.1:9944'); } if (chestBox.isEmpty) { diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart index 902bf62..d865caf 100644 --- a/lib/providers/substrate_sdk.dart +++ b/lib/providers/substrate_sdk.dart @@ -315,6 +315,14 @@ class SubstrateSdk with ChangeNotifier { return await importAccount(fromMnemonic: true, derivePath: '//$number'); } + + Future isMnemonicValid(String mnemonic) async { + // Needed for bad encoding of UTF-8 + mnemonic = mnemonic.replaceAll('é', 'é'); + mnemonic = mnemonic.replaceAll('è', 'è'); + + return await sdk.api.keyring.checkMnemonicValid(mnemonic); + } } void snack(BuildContext context, String message, {int duration = 2}) { @@ -339,8 +347,10 @@ void snackNode(BuildContext context, bool isConnected) { _message = "Vous êtes connecté au noeud\n${configBox.get('endpoint').split('//')[1]}"; } - final snackBar = - SnackBar(content: Text(_message), duration: const Duration(seconds: 2)); + final snackBar = SnackBar( + padding: const EdgeInsets.all(20), + content: Text(_message, style: const TextStyle(fontSize: 16)), + duration: const Duration(seconds: 2)); ScaffoldMessenger.of(context).showSnackBar(snackBar); } diff --git a/lib/providers/wallet_options.dart b/lib/providers/wallet_options.dart index d2e918f..9f2c4a1 100644 --- a/lib/providers/wallet_options.dart +++ b/lib/providers/wallet_options.dart @@ -4,10 +4,11 @@ import 'package:fast_base58/fast_base58.dart'; import 'package:flutter/material.dart'; import 'dart:async'; import 'package:gecko/globals.dart'; -import 'package:gecko/models/chest_data.dart'; import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/models/wallet_data.dart'; +import 'package:gecko/providers/substrate_sdk.dart'; import 'package:image_picker/image_picker.dart'; +import 'package:provider/provider.dart'; import 'package:truncate/truncate.dart'; class WalletOptionsProvider with ChangeNotifier { @@ -25,33 +26,16 @@ class WalletOptionsProvider with ChangeNotifier { Future? get badWallet => null; int getPinLenght(_walletNbr) { - // TODOo: Get real Dewif lenght - // String _localDewif; - // if (_walletNbr is int || _walletNbr == null) { - // _localDewif = chestBox.get(configBox.get('currentChest')).dewif; - // } else { - // _localDewif = _walletNbr; - // } - - // final int _pinLenght = DubpRust.getDewifSecretCodeLen( - // dewif: _localDewif, secretCodeType: SecretCodeType.letters); - return pinLength; } - void _renameWallet(List _walletID, _newName, + void _renameWallet(List _walletID, String _newName, {required bool isCesium}) async { - if (isCesium) { - ChestData _chestTarget = chestBox.get(_walletID[0])!; - _chestTarget.name = _newName; - await chestBox.put(_chestTarget.key, _chestTarget); - } else { - MyWalletsProvider myWalletClass = MyWalletsProvider(); + MyWalletsProvider myWalletClass = MyWalletsProvider(); - WalletData _walletTarget = myWalletClass.getWalletData(_walletID)!; - _walletTarget.name = _newName; - await walletBox.put(_walletTarget.key, _walletTarget); - } + WalletData _walletTarget = myWalletClass.getWalletData(_walletID)!; + _walletTarget.name = _newName; + await walletBox.put(_walletTarget.key, _walletTarget); _newWalletName.text = ''; } @@ -124,14 +108,6 @@ class WalletOptionsProvider with ChangeNotifier { ); } - snackCopyKey(context) { - const snackBar = SnackBar( - content: - Text("Cette clé publique a été copié dans votre presse-papier."), - duration: Duration(seconds: 2)); - ScaffoldMessenger.of(context).showSnackBar(snackBar); - } - String getShortPubkey(String pubkey) { List pubkeyByte = Base58Decode(pubkey); Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes); @@ -161,10 +137,14 @@ class WalletOptionsProvider with ChangeNotifier { if (pickedFile != null) { _image = File(pickedFile.path); + + ////TODO: Store image on disk, store path in walletBox.imagePath + log.i(pickedFile.path); return _image; } else { log.w('No image selected.'); + return null; } } @@ -186,3 +166,30 @@ class WalletOptionsProvider with ChangeNotifier { return _address; } } + +Widget balance(BuildContext context, String address, double size) { + String balanceCache = ''; + + return Column(children: [ + Consumer(builder: (context, _sdk, _) { + return FutureBuilder( + future: _sdk.getBalance(address), + builder: (BuildContext context, AsyncSnapshot _balance) { + if (_balance.connectionState != ConnectionState.done || + _balance.hasError) { + return Text(balanceCache, + style: TextStyle( + fontSize: isTall ? size : size * 0.9, + )); + } + balanceCache = "${_balance.data.toString()} $currencyName"; + return Text( + balanceCache, + style: TextStyle( + fontSize: isTall ? size : 18, + ), + ); + }); + }), + ]); +} diff --git a/lib/providers/wallets_profiles.dart b/lib/providers/wallets_profiles.dart index 015124e..e26291e 100644 --- a/lib/providers/wallets_profiles.dart +++ b/lib/providers/wallets_profiles.dart @@ -239,25 +239,6 @@ class WalletsProfilesProvider with ChangeNotifier { return num.parse(result); } - snackCopyKey(context) { - const snackBar = SnackBar( - padding: EdgeInsets.all(20), - content: - Text("Cette clé publique a été copié dans votre presse-papier."), - duration: Duration(seconds: 2)); - ScaffoldMessenger.of(context).showSnackBar(snackBar); - } - - void switchProfileView() { - isHistoryScreen = !isHistoryScreen; - if (isHistoryScreen) { - historySwitchButtun = "Payer"; - } else { - historySwitchButtun = "Voir l'historique"; - } - notifyListeners(); - } - String generateIdenticon(String _pubkey) { return Jdenticon.toSvg(_pubkey); } @@ -285,3 +266,12 @@ class WalletsProfilesProvider with ChangeNotifier { return balance; } } + +snackCopyKey(context) { + const snackBar = SnackBar( + padding: EdgeInsets.all(20), + content: Text("Cette clé publique a été copié dans votre presse-papier.", + style: TextStyle(fontSize: 16)), + duration: Duration(seconds: 2)); + ScaffoldMessenger.of(context).showSnackBar(snackBar); +} diff --git a/lib/screens/history.dart b/lib/screens/history.dart index 2b0b878..a3b5c44 100644 --- a/lib/screens/history.dart +++ b/lib/screens/history.dart @@ -403,7 +403,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier { key: const Key('copyPubkey'), onTap: () { Clipboard.setData(ClipboardData(text: pubkey)); - _historyProvider.snackCopyKey(context); + snackCopyKey(context); }, child: Text( _historyProvider.getShortPubkey(pubkey!), diff --git a/lib/screens/myWallets/cesium_wallet_options.dart b/lib/screens/myWallets/cesium_wallet_options.dart deleted file mode 100644 index bce4b45..0000000 --- a/lib/screens/myWallets/cesium_wallet_options.dart +++ /dev/null @@ -1,410 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'dart:ui'; -import 'package:flutter/material.dart'; -import 'package:gecko/globals.dart'; -import 'package:gecko/models/chest_data.dart'; -import 'package:gecko/providers/chest_provider.dart'; -import 'package:gecko/providers/wallets_profiles.dart'; -import 'package:gecko/providers/my_wallets.dart'; -import 'package:gecko/models/queries.dart'; -import 'package:gecko/providers/wallet_options.dart'; -import 'package:gecko/screens/history.dart'; -import 'package:gecko/screens/myWallets/change_pin.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:provider/provider.dart'; -import 'package:flutter/services.dart'; -import 'package:qr_flutter/qr_flutter.dart'; - -bool _isNewNameValid = false; - -class CesiumWalletOptions extends StatelessWidget { - const CesiumWalletOptions( - {Key? key, Key? keyMyWallets, required this.cesiumWallet}) - : super(key: key); - - final ChestData cesiumWallet; - - @override - Widget build(BuildContext context) { - SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - WalletOptionsProvider _walletOptions = - Provider.of(context, listen: false); - ChestProvider _chestProvider = - Provider.of(context, listen: false); - WalletsProfilesProvider _historyProvider = - Provider.of(context, listen: false); - MyWalletsProvider _myWalletProvider = - Provider.of(context, listen: false); - - final String shortPubkey = - _walletOptions.getShortPubkey(_walletOptions.address.text); - - if (_isNewNameValid == false) { - _walletOptions.nameController.text = cesiumWallet.name!; - } else { - cesiumWallet.name = _walletOptions.nameController.text; - } - - return WillPopScope( - onWillPop: () { - _walletOptions.isEditing = false; - _walletOptions.isBalanceBlur = true; - Navigator.popUntil( - context, - ModalRoute.withName('/'), - ); - return Future.value(true); - }, - child: Scaffold( - resizeToAvoidBottomInset: false, - appBar: AppBar( - toolbarHeight: 60 * ratio, - elevation: 0, - leading: IconButton( - icon: const Icon(Icons.arrow_back, color: Colors.black), - onPressed: () { - _walletOptions.isEditing = false; - _walletOptions.isBalanceBlur = true; - Navigator.popUntil( - context, - ModalRoute.withName('/'), - ); - }), - title: SizedBox( - height: 22, - child: Consumer( - builder: (context, walletProvider, _) { - return Text(_walletOptions.nameController.text); - }), - ), - ), - body: Builder( - builder: (ctx) => SafeArea( - child: Column(children: [ - Consumer( - builder: (context, walletProvider, _) { - return Container( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - yellowC, - const Color(0xfffafafa), - ], - )), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - const Spacer(flex: 1), - InkWell( - onTap: () async { - File newAvatar = - await (_walletOptions.changeAvatar()); - cesiumWallet.imageFile = newAvatar; - _walletOptions.reloadBuild(); - }, - child: cesiumWallet.imageFile == null - ? Image.asset( - 'assets/chests/${cesiumWallet.imageName}', - width: 110, - ) - : Image.file(cesiumWallet.imageFile!, width: 110), - ), - InkWell( - onTap: () async { - File newAvatar = - await (_walletOptions.changeAvatar()); - cesiumWallet.imageFile = newAvatar; - _walletOptions.reloadBuild(); - }, - child: Column(children: [ - Image.asset( - 'assets/walletOptions/camera.png', - height: 40, - ), - const SizedBox(height: 80) - ])), - const Spacer(flex: 1), - Column(children: [ - SizedBox( - width: 260, - child: TextField( - key: const Key('walletName'), - autofocus: false, - focusNode: _walletOptions.walletNameFocus, - enabled: _walletOptions.isEditing, - controller: _walletOptions.nameController, - minLines: 1, - maxLines: 3, - textAlign: TextAlign.center, - decoration: const InputDecoration( - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - disabledBorder: InputBorder.none, - contentPadding: EdgeInsets.all(15.0), - ), - style: TextStyle( - fontSize: isTall ? 27 : 23, - color: Colors.black, - fontWeight: FontWeight.w400, - )), - ), - SizedBox(height: isTall ? 5 : 0), - Query( - options: QueryOptions( - document: gql(getBalance), - variables: { - 'pubkey': _walletOptions.address.text, - }, - // pollInterval: Duration(seconds: 1), - ), - builder: (QueryResult result, - {VoidCallback? refetch, FetchMore? fetchMore}) { - if (result.hasException) { - return Text(result.exception.toString()); - } - - if (result.isLoading) { - return const Text('Loading'); - } - - // List repositories = result.data['viewer']['repositories']['nodes']; - String wBalanceUD; - if (result.data!['balance'] == null) { - wBalanceUD = '0.0'; - } else { - int wBalanceG1 = - result.data!['balance']['amount']; - int currentUD = - result.data!['currentUd']['amount']; - double wBalanceUDBrut = - wBalanceG1 / currentUD; // .toString(); - wBalanceUD = double.parse( - (wBalanceUDBrut).toStringAsFixed(2)) - .toString(); - } - return Row(children: [ - ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: _walletOptions.isBalanceBlur - ? 6 - : 0.001, - sigmaY: _walletOptions.isBalanceBlur - ? 5 - : 0.001), - child: Text(wBalanceUD, - style: TextStyle( - fontSize: isTall ? 20 : 18, - color: Colors.black)), - ), - Text(' DU', - style: TextStyle( - fontSize: isTall ? 20 : 18, - color: Colors.black)) - ]); - - // Text( - // '$wBalanceUD DU', - // style: TextStyle( - // fontSize: 20, color: Colors.black), - // ); - }, - ), - const SizedBox(height: 5), - InkWell( - key: const Key('displayBalance'), - onTap: () { - _walletOptions.bluringBalance(); - }, - child: Image.asset( - _walletOptions.isBalanceBlur - ? 'assets/walletOptions/icon_oeuil.png' - : 'assets/walletOptions/icon_oeuil_close.png', - height: 35, - ), - ), - ]), - Column(children: [ - InkWell( - key: const Key('renameWallet'), - onTap: () async { - _isNewNameValid = _walletOptions.editWalletName( - [cesiumWallet.key, 0], - isCesium: cesiumWallet.isCesium); - await Future.delayed( - const Duration(milliseconds: 30)); - _walletOptions.walletNameFocus.requestFocus(); - }, - child: ClipRRect( - child: Image.asset( - _walletOptions.isEditing - ? 'assets/walletOptions/android-checkmark.png' - : 'assets/walletOptions/edit.png', - width: 20, - height: 20), - )), - const SizedBox( - height: 60, - ) - ]), - const Spacer(flex: 3), - ]), - ); - }), - SizedBox(height: 4 * ratio), - QrImageWidget( - data: _walletOptions.address.text, - version: QrVersions.auto, - size: isTall ? 300 : 270, - ), - SizedBox(height: 15 * ratio), - GestureDetector( - key: const Key('copyPubkey'), - onTap: () { - Clipboard.setData( - ClipboardData(text: _walletOptions.address.text)); - _walletOptions.snackCopyKey(ctx); - }, - child: SizedBox( - height: 50, - child: Row(children: [ - const SizedBox(width: 30), - Image.asset( - 'assets/walletOptions/key.png', - height: 45, - ), - const SizedBox(width: 20), - Text("${shortPubkey.split(':')[0]}:", - style: const TextStyle( - fontSize: 22, - fontWeight: FontWeight.w800, - fontFamily: 'Monospace', - color: Colors.black)), - Text(shortPubkey.split(':')[1], - style: const TextStyle( - fontSize: 22, - fontWeight: FontWeight.w800, - fontFamily: 'Monospace')), - const SizedBox(width: 15), - SizedBox( - height: 40, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - elevation: 1, - primary: orangeC, // background - onPrimary: Colors.black, // foreground - ), - onPressed: () { - Clipboard.setData(ClipboardData( - text: _walletOptions.address.text)); - _walletOptions.snackCopyKey(ctx); - }, - child: Row(children: [ - Image.asset( - 'assets/walletOptions/copy-white.png', - height: 25, - ), - const SizedBox(width: 7), - Text('Copier', - style: TextStyle( - fontSize: 15, color: Colors.grey[50])) - ]))), - ]))), - SizedBox(height: 10 * ratio), - InkWell( - key: const Key('displayHistory'), - onTap: () { - _historyProvider.nPage = 1; - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return HistoryScreen( - pubkey: _walletOptions.address.text); - }), - ); - }, - child: SizedBox( - height: 50, - child: Row(children: [ - const SizedBox(width: 30), - Image.asset( - 'assets/walletOptions/clock.png', - height: 45, - ), - const SizedBox(width: 22), - const Text('Historique des transactions', - style: - TextStyle(fontSize: 20, color: Colors.black)), - ]))), - SizedBox(height: 7 * ratio), - InkWell( - key: const Key('changePin'), - onTap: () async { - // await _chestProvider.changePin(context, cesiumWallet); - String? newPin = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return ChangePinScreen( - walletName: cesiumWallet.name, - walletProvider: _myWalletProvider, - ); - }, - ), - ); - - if (newPin != null) _myWalletProvider.pinCode = newPin; - }, - child: SizedBox( - height: 50, - child: Row(children: [ - const SizedBox(width: 31), - Image.asset( - 'assets/chests/secret_code.png', - height: 24, - ), - const SizedBox(width: 20), - const Text('Changer mon code secret', - style: TextStyle(fontSize: 20, color: Colors.black)), - ]), - ), - ), - SizedBox(height: 7 * ratio), - InkWell( - key: const Key('deleteWallet'), - onTap: () async { - await _chestProvider.deleteChest(context, cesiumWallet); - }, - child: SizedBox( - height: 50, - child: Row(children: [ - const SizedBox(width: 33), - Image.asset( - 'assets/walletOptions/trash.png', - height: 45, - ), - const SizedBox(width: 21), - const Text( - 'Supprimer ce coffre', - style: TextStyle( - fontSize: 20, - color: Color(0xffD80000), - ), - ), - ]), - ), - ), - ]), - ), - ), - ), - ); - } -} diff --git a/lib/screens/myWallets/generate_wallets.dart b/lib/screens/myWallets/generate_wallets.dart index c7abdad..91360b1 100644 --- a/lib/screens/myWallets/generate_wallets.dart +++ b/lib/screens/myWallets/generate_wallets.dart @@ -1,4 +1,3 @@ -import 'package:durt/durt.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; @@ -127,11 +126,6 @@ class GenerateFastChestScreen extends StatelessWidget { ? () async { _generateWalletProvider.nbrWord = _generateWalletProvider.getRandomInt(); - _generateWalletProvider.actualWallet = await Dewif() - .generateDewif( - _generateWalletProvider.generatedMnemonic!, - _generateWalletProvider.pin.text, - lang: appLang); await Navigator.push( context, MaterialPageRoute(builder: (context) { diff --git a/lib/screens/myWallets/restore_chest.dart b/lib/screens/myWallets/restore_chest.dart index 61a6e14..51106f7 100644 --- a/lib/screens/myWallets/restore_chest.dart +++ b/lib/screens/myWallets/restore_chest.dart @@ -3,6 +3,7 @@ import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:flutter/material.dart'; import 'package:gecko/providers/generate_wallets.dart'; +import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/screens/common_elements.dart'; import 'package:gecko/screens/onBoarding/11.dart'; import 'package:provider/provider.dart'; @@ -15,14 +16,19 @@ class RestoreChest extends StatelessWidget { @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - GenerateWalletsProvider generateWalletProvider = + GenerateWalletsProvider genW = Provider.of(context, listen: false); + SubstrateSdk _sub = Provider.of(context, listen: false); - generateWalletProvider.actualWallet = null; + genW.actualWallet = null; + if (genW.isSentenceComplete(context)) { + genW.generatedMnemonic = + '${genW.cellController0.text} ${genW.cellController1.text} ${genW.cellController2.text} ${genW.cellController3.text} ${genW.cellController4.text} ${genW.cellController5.text} ${genW.cellController6.text} ${genW.cellController7.text} ${genW.cellController8.text} ${genW.cellController9.text} ${genW.cellController10.text} ${genW.cellController11.text}'; + } return WillPopScope( onWillPop: () { - generateWalletProvider.resetImportView(); + genW.resetImportView(); return Future.value(true); }, child: Scaffold( @@ -31,7 +37,7 @@ class RestoreChest extends StatelessWidget { leading: IconButton( icon: const Icon(Icons.arrow_back, color: Colors.black), onPressed: () { - generateWalletProvider.resetImportView(); + genW.resetImportView(); Navigator.of(context).pop(); }), title: const SizedBox( @@ -48,32 +54,32 @@ class RestoreChest extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - arrayCell(context, generateWalletProvider.cellController0), - arrayCell(context, generateWalletProvider.cellController1), - arrayCell(context, generateWalletProvider.cellController2), - arrayCell(context, generateWalletProvider.cellController3), + arrayCell(context, genW.cellController0), + arrayCell(context, genW.cellController1), + arrayCell(context, genW.cellController2), + arrayCell(context, genW.cellController3), ]), const SizedBox(height: 15), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - arrayCell(context, generateWalletProvider.cellController4), - arrayCell(context, generateWalletProvider.cellController5), - arrayCell(context, generateWalletProvider.cellController6), - arrayCell(context, generateWalletProvider.cellController7), + arrayCell(context, genW.cellController4), + arrayCell(context, genW.cellController5), + arrayCell(context, genW.cellController6), + arrayCell(context, genW.cellController7), ]), const SizedBox(height: 15), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - arrayCell(context, generateWalletProvider.cellController8), - arrayCell(context, generateWalletProvider.cellController9), - arrayCell(context, generateWalletProvider.cellController10), - arrayCell(context, generateWalletProvider.cellController11), + arrayCell(context, genW.cellController8), + arrayCell(context, genW.cellController9), + arrayCell(context, genW.cellController10), + arrayCell(context, genW.cellController11), ]), ]), // const Spacer(), - if (generateWalletProvider.isSentenceComplete(context)) + if (genW.isSentenceComplete(context)) Expanded( child: Align( alignment: Alignment.center, @@ -87,8 +93,8 @@ class RestoreChest extends StatelessWidget { onPrimary: Colors.white, // foreground ), onPressed: () async { - if (await generateWalletProvider.isSentenceValid()) { - generateWalletProvider.resetImportView(); + if (await _sub.isMnemonicValid(genW.generatedMnemonic!)) { + genW.resetImportView(); await Navigator.push( context, FaderTransition( @@ -121,7 +127,7 @@ class RestoreChest extends StatelessWidget { onPrimary: Colors.black, // foreground ), onPressed: () { - generateWalletProvider.pasteMnemonic(context); + genW.pasteMnemonic(context); }, child: const Text( 'Coller depuis le\npresse-papier', @@ -193,7 +199,7 @@ class RestoreChest extends StatelessWidget { return AlertDialog( title: const Text('Phrase incorrecte'), content: const Text( - 'Votre phrase de restauration semble incorrecte, veuillez la corriger.'), + 'Votre phrase de restauration semble incorrecte, les mots ne sont pas dans le bon ordre.\nVeuillez la corriger.'), actions: [ TextButton( child: const Text("OK"), diff --git a/lib/screens/myWallets/unlocking_wallet.dart b/lib/screens/myWallets/unlocking_wallet.dart index 83346fa..a91563b 100644 --- a/lib/screens/myWallets/unlocking_wallet.dart +++ b/lib/screens/myWallets/unlocking_wallet.dart @@ -8,7 +8,6 @@ import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/providers/wallet_options.dart'; import 'package:flutter/material.dart'; -import 'package:gecko/screens/myWallets/cesium_wallet_options.dart'; import 'package:gecko/screens/myWallets/choose_chest.dart'; import 'package:gecko/screens/myWallets/choose_wallet.dart'; import 'package:gecko/screens/myWallets/wallets_home.dart'; @@ -214,20 +213,12 @@ class UnlockingWallet extends StatelessWidget { } else { pinColor = Colors.green[400]; if (action == "mywallets") { - currentChest.isCesium! - ? Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return CesiumWalletOptions( - cesiumWallet: currentChest); - }), - ).then((value) => _myWalletProvider.mnemonic = '') - : Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return const WalletsHome(); - }), - ); + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return const WalletsHome(); + }), + ); } else if (action == "pay") { Navigator.push( context, diff --git a/lib/screens/myWallets/wallet_options.dart b/lib/screens/myWallets/wallet_options.dart index a9b1d77..19a39fc 100644 --- a/lib/screens/myWallets/wallet_options.dart +++ b/lib/screens/myWallets/wallet_options.dart @@ -1,11 +1,8 @@ import 'dart:async'; -import 'dart:io'; -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/models/wallet_data.dart'; -import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/wallet_options.dart'; import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/screens/history.dart'; @@ -92,13 +89,13 @@ class WalletOptions extends StatelessWidget { Column(children: [ walletName(walletProvider, _walletOptions), SizedBox(height: isTall ? 5 : 0), - balance(context, walletProvider), + balance(context, walletProvider.address.text, 20), ]), const Spacer(flex: 3), ]), ); }), - SizedBox(height: 4 * ratio), + SizedBox(height: 10 * ratio), QrImageWidget( data: _walletOptions.address.text, version: QrVersions.auto, @@ -132,8 +129,10 @@ class WalletOptions extends StatelessWidget { children: [ InkWell( onTap: () async { - File newAvatar = await (walletProvider.changeAvatar()); - wallet.imageFile = newAvatar; + wallet.imageFile = await (walletProvider.changeAvatar()); + if (wallet.imageFile != null) { + walletBox.put(wallet.key, wallet); + } walletProvider.reloadBuild(); }, child: wallet.imageFile == null @@ -151,8 +150,7 @@ class WalletOptions extends StatelessWidget { top: 0, child: InkWell( onTap: () async { - File newAvatar = await (walletProvider.changeAvatar()); - wallet.imageFile = newAvatar; + wallet.imageFile = await (walletProvider.changeAvatar()); walletProvider.reloadBuild(); }, child: Image.asset( @@ -223,52 +221,6 @@ class WalletOptions extends StatelessWidget { ); } - Widget balance(BuildContext context, WalletOptionsProvider walletProvider) { - String balanceCache = ''; - - return Column(children: [ - Consumer(builder: (context, _sdk, _) { - return FutureBuilder( - future: _sdk.getBalance(walletProvider.address.text), - builder: (BuildContext context, AsyncSnapshot _balance) { - if (_balance.connectionState != ConnectionState.done || - _balance.hasError) { - return Text(balanceCache, - style: TextStyle( - fontSize: isTall ? 20 : 18, - )); - } - balanceCache = "${_balance.data.toString()} $currencyName"; - return ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: walletProvider.isBalanceBlur ? 6 : 0, - sigmaY: walletProvider.isBalanceBlur ? 5 : 0), - child: Text( - balanceCache, - style: TextStyle( - fontSize: isTall ? 20 : 18, - ), - ), - ); - }); - }), - - const SizedBox(height: 15), - // InkWell( - // key: const Key('displayBalance'), - // onTap: () { - // walletProvider.bluringBalance(); - // }, - // child: Image.asset( - // walletProvider.isBalanceBlur - // ? 'assets/walletOptions/icon_oeuil.png' - // : 'assets/walletOptions/icon_oeuil_close.png', - // height: 35, - // ), - // ), - ]); - } - Widget pubkeyWidget(WalletOptionsProvider walletProvider, BuildContext ctx) { final String shortPubkey = walletProvider.getShortPubkey(walletProvider.address.text); @@ -276,7 +228,7 @@ class WalletOptions extends StatelessWidget { key: const Key('copyPubkey'), onTap: () { Clipboard.setData(ClipboardData(text: walletProvider.address.text)); - walletProvider.snackCopyKey(ctx); + snackCopyKey(ctx); }, child: SizedBox( height: 50, @@ -313,7 +265,7 @@ class WalletOptions extends StatelessWidget { onPressed: () { Clipboard.setData( ClipboardData(text: walletProvider.address.text)); - walletProvider.snackCopyKey(ctx); + snackCopyKey(ctx); }, child: Row(children: [ Image.asset( diff --git a/lib/screens/onBoarding/1.dart b/lib/screens/onBoarding/1.dart index e0e7c72..126c3b2 100644 --- a/lib/screens/onBoarding/1.dart +++ b/lib/screens/onBoarding/1.dart @@ -18,20 +18,30 @@ class OnboardingStepOne extends StatelessWidget { @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - CommonElements common = CommonElements(); + ////TODO: Continue onbarding refactoring return Scaffold( + appBar: AppBar( + toolbarHeight: 60 * ratio, + title: const SizedBox( + height: 22, + child: Text( + 'Nouveau portefeuille', + style: TextStyle(fontWeight: FontWeight.w600), + ), + ), + ), extendBodyBehindAppBar: true, body: SafeArea( child: Column(children: [ - common.onboardingProgressBar( - context, 'Nouveau portefeuilles', progress), - common.bubbleSpeak( - "Il semblerait que vous n’ayez pas encore de coffre.\n\nUn coffre vous permet de gérer un ou plusieurs portefeuilles.", - textKey: const Key('step1')), + // common.onboardingProgressBar( + // context, 'Nouveau portefeuilles', progress), + // common.bubbleSpeak( + // "Il semblerait que vous n’ayez pas encore de coffre.\n\nUn coffre vous permet de gérer un ou plusieurs portefeuilles.", + // textKey: const Key('step1')), const SizedBox(height: 90), Image.asset( - 'assets/onBoarding/keys-and-wallets-horizontal.png', + 'assets/onBoarding/fabrication-de-portefeuille.png', height: 200, ), Expanded( diff --git a/lib/screens/search_result.dart b/lib/screens/search_result.dart index 5005a41..d619d70 100644 --- a/lib/screens/search_result.dart +++ b/lib/screens/search_result.dart @@ -3,6 +3,7 @@ import 'package:gecko/globals.dart'; import 'package:flutter/material.dart'; import 'package:gecko/providers/cesium_plus.dart'; import 'package:gecko/models/g1_wallets_list.dart'; +import 'package:gecko/providers/wallet_options.dart'; import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/providers/search.dart'; import 'package:gecko/screens/wallet_view.dart'; @@ -133,6 +134,11 @@ class SearchResultScreen extends StatelessWidget { fontWeight: FontWeight.w500), textAlign: TextAlign.center), ]), + trailing: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + balance(context, g1Wallet.pubkey!, 16) + ]), subtitle: Row(children: [ Text(g1Wallet.id?.username ?? '', style: const TextStyle( diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index 100dee2..12aa878 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -2,15 +2,12 @@ import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:flutter/material.dart'; import 'package:gecko/providers/cesium_plus.dart'; +import 'package:gecko/providers/wallet_options.dart'; import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/providers/wallets_profiles.dart'; -import 'package:gecko/models/queries.dart'; import 'package:gecko/screens/avatar_fullscreen.dart'; -import 'package:gecko/screens/common_elements.dart'; -import 'package:gecko/screens/history.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:provider/provider.dart'; class WalletViewScreen extends StatelessWidget { @@ -53,7 +50,8 @@ class WalletViewScreen extends StatelessWidget { height: buttonSize, child: ClipOval( child: Material( - color: const Color(0xffFFD58D), // button color + color: Colors + .grey[300], //const Color(0xffFFD58D), // button color child: InkWell( key: const Key('viewHistory'), splashColor: orangeC, // inkwell color @@ -64,19 +62,20 @@ class WalletViewScreen extends StatelessWidget { 'assets/walletOptions/clock.png'), height: 90)), onTap: () { - _historyProvider.nPage = 1; - Navigator.push( - context, - FaderTransition( - page: HistoryScreen( - pubkey: pubkey, - username: username ?? - g1WalletsBox.get(pubkey)?.username, - avatar: avatar ?? - g1WalletsBox.get(pubkey)?.avatar, - ), - isFast: false), - ); + ////TODO: wait for subsquid indexer + // _historyProvider.nPage = 1; + // Navigator.push( + // context, + // FaderTransition( + // page: HistoryScreen( + // pubkey: pubkey, + // username: username ?? + // g1WalletsBox.get(pubkey)?.username, + // avatar: avatar ?? + // g1WalletsBox.get(pubkey)?.avatar, + // ), + // isFast: false), + // ); }), ), ), @@ -105,7 +104,7 @@ class WalletViewScreen extends StatelessWidget { height: 90)), onTap: () { Clipboard.setData(ClipboardData(text: pubkey)); - _historyProvider.snackCopyKey(context); + snackCopyKey(context); }), ), ), @@ -286,21 +285,21 @@ class WalletViewScreen extends StatelessWidget { primary: orangeC, // background onPrimary: Colors.white, // foreground ), - onPressed: - _walletViewProvider.payAmount.text != '' - ? () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return UnlockingWallet( - wallet: defaultWallet, - action: "pay"); - }, - ), - ); - } - : null, + onPressed: _walletViewProvider.payAmount.text != + '' + ? () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return UnlockingWallet( + wallet: defaultWallet, + action: "pay"); + }, + ), + ); + } + : null, child: const Text( 'Effectuer le virement', style: TextStyle( @@ -352,7 +351,7 @@ class WalletViewScreen extends StatelessWidget { key: const Key('copyPubkey'), onTap: () { Clipboard.setData(ClipboardData(text: pubkey)); - _historyProvider.snackCopyKey(context); + snackCopyKey(context); }, child: Text( _historyProvider.getShortPubkey(pubkey!), @@ -363,40 +362,45 @@ class WalletViewScreen extends StatelessWidget { ), ), ]), - const SizedBox(height: 10), - if (username == null && - g1WalletsBox.get(pubkey)?.username == null) - Query( - options: QueryOptions( - document: gql(getId), - variables: { - 'pubkey': pubkey, - }, - ), - builder: (QueryResult result, - {VoidCallback? refetch, FetchMore? fetchMore}) { - if (result.isLoading || result.hasException) { - return const Text('...'); - } else if (result.data!['idty'] == null || - result.data!['idty']['username'] == null) { - g1WalletsBox.get(pubkey)?.username = ''; - return const Text(''); - } else { - g1WalletsBox.get(pubkey)?.username = - result.data!['idty']['username'] ?? ''; - return SizedBox( - width: 230, - child: Text( - result.data!['idty']['username'] ?? '', - style: const TextStyle( - fontSize: 27, - color: Color(0xff814C00), - ), - ), - ); - } - }, - ), + const SizedBox(height: 25), + Consumer( + builder: (context, walletProvider, _) { + return balance(context, pubkey!, 20); + }), + //// + // if (username == null && + // g1WalletsBox.get(pubkey)?.username == null) + // Query( + // options: QueryOptions( + // document: gql(getId), + // variables: { + // 'pubkey': pubkey, + // }, + // ), + // builder: (QueryResult result, + // {VoidCallback? refetch, FetchMore? fetchMore}) { + // if (result.isLoading || result.hasException) { + // return const Text('...'); + // } else if (result.data!['idty'] == null || + // result.data!['idty']['username'] == null) { + // g1WalletsBox.get(pubkey)?.username = ''; + // return const Text(''); + // } else { + // g1WalletsBox.get(pubkey)?.username = + // result.data!['idty']['username'] ?? ''; + // return SizedBox( + // width: 230, + // child: Text( + // result.data!['idty']['username'] ?? '', + // style: const TextStyle( + // fontSize: 27, + // color: Color(0xff814C00), + // ), + // ), + // ); + // } + // }, + // ), if (username == null && g1WalletsBox.get(pubkey)?.username != null) SizedBox( @@ -421,19 +425,20 @@ class WalletViewScreen extends StatelessWidget { ), ), const SizedBox(height: 25), - FutureBuilder( - future: _cesiumPlusProvider.getName(pubkey), - initialData: '...', - builder: (context, snapshot) { - return SizedBox( - width: 230, - child: Text( - snapshot.data.toString(), - style: const TextStyle( - fontSize: 18, color: Colors.black), - ), - ); - }), + //// To get Cs+ name + // FutureBuilder( + // future: _cesiumPlusProvider.getName(pubkey), + // initialData: '...', + // builder: (context, snapshot) { + // return SizedBox( + // width: 230, + // child: Text( + // snapshot.data.toString(), + // style: const TextStyle( + // fontSize: 18, color: Colors.black), + // ), + // ); + // }), const SizedBox(height: 30), ]), const Spacer(), diff --git a/pubspec.lock b/pubspec.lock index c069f08..12dc69d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,13 +8,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "40.0.0" - aes_ecb_pkcs5_flutter: - dependency: transitive - description: - name: aes_ecb_pkcs5_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.2" analyzer: dependency: transitive description: @@ -349,6 +342,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_aes_ecb_pkcs5: + dependency: transitive + description: + name: flutter_aes_ecb_pkcs5 + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" flutter_driver: dependency: "direct main" description: flutter @@ -368,13 +368,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.4.3+7" - flutter_launcher_icons_maker: - dependency: "direct dev" - description: - name: flutter_launcher_icons_maker - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.2" flutter_lints: dependency: "direct main" description: @@ -566,7 +559,7 @@ packages: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" http_server: dependency: transitive description: @@ -574,6 +567,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + icons_launcher: + dependency: "direct dev" + description: + name: icons_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" image: dependency: transitive description: @@ -615,7 +615,7 @@ packages: name: image_picker_ios url: "https://pub.dartlang.org" source: hosted - version: "0.8.5+4" + version: "0.8.5+5" image_picker_platform_interface: dependency: transitive description: @@ -914,7 +914,7 @@ packages: name: pdf url: "https://pub.dartlang.org" source: hosted - version: "3.8.0" + version: "3.8.1" permission_handler: dependency: "direct main" description: @@ -976,7 +976,7 @@ packages: description: path: "." ref: fixAndroidActivityVersion - resolved-ref: db17df1a7e421066dd88a16ed46c5cc945b77f82 + resolved-ref: e33351cde5ea9b55d191772fe3b36f9dbb8277e6 url: "https://github.com/poka-IT/sdk.git" source: git version: "0.4.5" @@ -992,7 +992,7 @@ packages: description: path: printing ref: HEAD - resolved-ref: "726aab13746a4f515601febfb0824ba71dbe4f80" + resolved-ref: "95bbc1f33b7cb45f7a4b98088b96bc541fefc495" url: "https://github.com/DavBfr/dart_pdf.git" source: git version: "5.9.1" @@ -1069,7 +1069,7 @@ packages: name: responsive_framework url: "https://pub.dartlang.org" source: hosted - version: "0.1.8" + version: "0.1.9" rxdart: dependency: transitive description: @@ -1306,6 +1306,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" + universal_io: + dependency: transitive + description: + name: universal_io + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" unorm_dart: dependency: "direct main" description: @@ -1361,7 +1368,7 @@ packages: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0" webview_flutter: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 586d403..e4409a5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -81,7 +81,9 @@ dependencies: ref: fixAndroidActivityVersion dev_dependencies: - flutter_launcher_icons_maker: ^0.10.2 + # flutter_launcher_icons: ^0.9.2 + # flutter_launcher_icons_maker: ^^0.10.2 + icons_launcher: ^1.1.8 build_runner: ^2.1.2 flutter_test: sdk: flutter @@ -95,6 +97,8 @@ flutter_icons: image_path: "assets/icon/gecko_flat.png" remove_alpha_ios: true +uses-material-design: true + # The following section is specific to Flutter. flutter: uses-material-design: true diff --git a/release/android/build-apk.sh b/release/android/build-apk.sh index 8589f33..6a022b9 100755 --- a/release/android/build-apk.sh +++ b/release/android/build-apk.sh @@ -19,7 +19,7 @@ cargo make # Build APK echo "Build APK..." -flutter clean +#flutter clean flutter build apk --release --build-name $VERSION --build-number $BUILD # Create artifacts folder diff --git a/scripts/generateIcon.sh b/scripts/generateIcon.sh index 518e86f..d81b5f5 100755 --- a/scripts/generateIcon.sh +++ b/scripts/generateIcon.sh @@ -1,5 +1,5 @@ #!/bin/bash -flutter pub run flutter_launcher_icons_maker:main +flutter pub run icons_launcher:main exit 0