Merge branch 'HiveStorage'

This commit is contained in:
poka 2021-11-08 22:29:22 +01:00
commit de4e0b5457
34 changed files with 949 additions and 807 deletions

3
.gitignore vendored
View File

@ -56,3 +56,6 @@ packages/dubp_rs/lib/ffi.dart
/target
pubkeys.txt
# Linux builds
linux/

View File

@ -5,7 +5,7 @@ stages:
- package
.env:
image: axiomteam/gecko-ci:v0.0.7
image: axiomteam/gecko-ci:v0.0.8
tags:
- redshift
before_script:

View File

@ -29,15 +29,6 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

View File

@ -0,0 +1,447 @@
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:gecko/main.dart' as app;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
int globalTimeout = 2;
group(
'Gecko end-to-end tests',
() {
// First, define the Finders and use them to locate widgets from the
// test suite. Note: the Strings provided to the `byValueKey` method must
// be the same as the Strings we used for the Keys in step 1.
// final manageWalletsFinder = find.byKey(Key('manageWallets'));
// final buttonFinder = find.byValueKey('increment');
// FlutterDriver driver;
WidgetTester tester;
String pinCode;
// *** Global functions *** //
// Easy get text
Future<String> getText(String text) async {
Text resultText = tester.firstWidget(find.byKey(Key(text)));
// Text pinCodeText = generatedPinFinder.evaluate().single.widget as Text;
return resultText.data;
}
// Function to tap the widget by key
Future tapOn(String key) async {
await tester.tap(find.byKey(Key(key)));
}
// Function to go back to previous screen
Future goBack() async {
await Process.run(
'adb',
<String>['shell', 'input', 'keyevent', 'KEYCODE_BACK'],
runInShell: true,
);
}
// Easy sleep
Future sleep(int _time) async {
await Future.delayed(Duration(milliseconds: _time));
}
// Test if widget exist on screen, return a boolean
Future<bool> isPresent(String text,
{Duration timeout = const Duration(seconds: 1)}) async {
try {
expect(text, findsOneWidget);
return true;
} catch (exception) {
return false;
}
}
// Create a derivation
Future createDerivation(String _name) async {
await tapOn('addDerivation');
await sleep(100);
await tester.enterText(find.byKey(Key('DerivationNameKey')), _name);
await tapOn('validDerivation');
await sleep(300);
}
// Delete a derivation
Future deleteWallet(bool _confirm) async {
await tapOn('deleteWallet');
await sleep(100);
_confirm
? await tapOn('confirmDeleting')
: await tapOn('cancelDeleting');
await sleep(300);
}
// Delete all wallets
Future deleteAllWallets() async {
await tester.tap(find.byKey(Key('drawerMenu')));
await sleep(300);
await tester.tap(find.byKey(Key('parameters')));
await sleep(300);
await tester.tap(find.byKey(Key('deleteAllWallets')));
await sleep(300);
await tester.tap(find.byKey(Key('confirmDeletingAllWallets')));
await sleep(300);
}
// Fast creation of new Keychain
Future<String> createNewKeychain(String name) async {
await tapOn('drawerMenu');
await sleep(300);
await tapOn('parameters');
await sleep(300);
await tapOn('generateKeychain');
expect(find.text(''), findsOneWidget);
pinCode = await getText('generatedPin');
await tapOn('storeKeychain');
await sleep(100);
await tester.enterText(find.byKey(Key('askedWord')), 'triche');
await tapOn('walletName');
await tester.enterText(find.byKey(Key('walletName')), 'name');
await tapOn('confirmStorage');
await sleep(300);
return pinCode;
}
// *** Begin of tests *** //
testWidgets('OnBoarding - Open wallets management', (
WidgetTester tester, {
timeout: Timeout.none,
}) async {
app.main();
await tester.pumpAndSettle();
// expect("y'a pas de lézard !", findsOneWidget);
await tester.tap(find.byKey(Key('manageWallets')));
print(
'####################################################################');
// If a wallet exist, go to delete theme all
await tester.pumpAndSettle();
if (!await isPresent(
"Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.")) {
await tester.pumpAndSettle();
// await tester.pageBack();
await goBack();
await sleep(500);
await deleteAllWallets();
await sleep(300);
await tester.tap(find.byKey(Key('manageWallets')));
}
await tester.pumpAndSettle();
// Verify onboarding is starting, with text
expect(
"Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.",
findsOneWidget);
});
// test('OnBoarding - Go to create restore sentance', (
// {timeout: Timeout.none}) async {
// await tapOn('goStep1');
// await tapOn('goStep2');
// await tapOn('goStep3');
// await tapOn('goStep4');
// await tapOn('goStep5');
// await tapOn('goStep6');
// expect(
// "Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.",
// findsOneWidget);
// });
// test('OnBoarding - Generate sentance and confirme it', (
// {timeout: Timeout.none}) async {
// await tapOn('goStep7');
// await tester.pumpAndSettle();
// Future selectWord() async {
// List words = [for (var i = 1; i <= 13; i += 1) i];
// for (var j = 1; j < 13; j++) {
// words[j] = await getText('word$j');
// }
// expect(await getText('step7'),
// "C'est le moment de noter votre phrase !");
// await tapOn('goStep8');
// await sleep(200);
// String goodWord = words[int.parse(
// await getText('askedWord'),
// )];
// // Enter the expected word
// await tester.enterText(find.byKey(Key('inputWord')), goodWord);
// // Check if word is valid
// expect(find.text("C'est le bon mot !"), findsOneWidget);
// // Continue onboarding workflow
// await tapOn('goStep9');
// }
// await selectWord();
// //Go back 2 times to mnemonic generation screen
// await goBack();
// await goBack();
// await sleep(100);
// // Generate 3 times mnemonic
// await tapOn('generateMnemonic');
// await tapOn('generateMnemonic');
// await tapOn('generateMnemonic');
// await sleep(500);
// await selectWord();
// });
// test('OnBoarding - Generate secret code and confirm it', (
// {timeout: Timeout.none}) async {
// expect(await getText('step9'),
// "Super !\n\nJe vais maintenant créer votre code secret. \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole.");
// await tapOn('goStep10');
// await tapOn('goStep11');
// while (await getText('generatedPin') == '') {
// print('Waiting for pin code generation...');
// await sleep(100);
// }
// // Change secret code 4 times
// for (int i = 0; i < 4; i++) await tapOn('changeSecretCode');
// await sleep(500);
// pinCode = await getText('generatedPin');
// await tapOn('goStep12');
// await sleep(300);
// // //Enter bad secret code
// // await tester.enterText('abcde');
// // await tapOn('formKey');
// // await sleep(1500);
// // await tapOn('formKey2');
// //Enter good secret code
// await tester.enterText(find.byKey(Key('formKey2')), pinCode);
// expect(await getText('step13'),
// "Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !");
// });
// test('My wallets - Rename first derivation', (
// {timeout: const Duration(seconds: 2)}) async {
// await tapOn('goWalletHome');
// expect(await getText('myWallets'), "Mes portefeuilles");
// await sleep(300);
// // Go to first derivation and rename it
// await tester.tap(find.text('Mon portefeuille courant'));
// await sleep(300);
// await tapOn('renameWallet');
// await sleep(100);
// await tapOn('walletName');
// await sleep(100);
// await tester.enterText(
// find.byKey(Key('walletName')), 'Renommage wallet 1');
// await sleep(300);
// await tapOn('renameWallet');
// await sleep(400);
// expect('Renommage wallet 1', findsOneWidget);
// await goBack();
// });
// test('My wallets - Create a derivations, open thems, tap all buttons', (
// {timeout: const Duration(seconds: 2)}) async {
// expect('Renommage wallet 1', findsOneWidget);
// // Add a second derivation
// await createDerivation('Derivation 2');
// // Go to second derivation options
// await tester.tap(find.text('Derivation 2'));
// await sleep(100);
// // Test options
// await tapOn('displayBalance');
// await tapOn('displayHistory');
// await sleep(300);
// await goBack();
// await tapOn('displayBalance');
// await sleep(100);
// await tapOn('displayBalance');
// await sleep(100);
// await tapOn('displayBalance');
// await tapOn('setDefaultWallet');
// await sleep(50);
// await tapOn('copyPubkey');
// expect('Cette clé publique a été copié dans votre presse-papier.',
// findsOneWidget);
// await goBack();
// // Add a third derivation
// await createDerivation('Derivation 3');
// // Add a fourth derivation
// await createDerivation('Derivation 4');
// await sleep(50);
// // Go to third derivation options
// await tester.tap(find.text('Derivation 3'));
// await sleep(100);
// await tapOn('displayBalance');
// // Delete third derivation
// await deleteWallet(true);
// });
// test('My wallets - Extra tests', (
// {timeout: const Duration(seconds: 2)}) async {
// // Add derivation 5,6 and 7
// expect('Derivation 4', findsOneWidget);
// await createDerivation('Derivation 5');
// await createDerivation('Derivation 6');
// await createDerivation('Derivation 7');
// // Go home and come back to my wallets view
// await goBack();
// await sleep(100);
// await tapOn('manageWallets');
// await sleep(200);
// //Enter secret code
// await tester.enterText(find.byKey(Key('formKey')), pinCode);
// await sleep(200);
// // Go to derivation 6 and delete it
// await tester.tap(find.text('Derivation 6'));
// await sleep(100);
// await deleteWallet(true);
// // Go to 2nd derivation and check if it's de default
// await tester.tap(find.text('Derivation 2'));
// expect('Ce portefeuille est celui par defaut', findsOneWidget);
// await tapOn('setDefaultWallet');
// await sleep(100);
// expect('Ce portefeuille est celui par defaut', findsOneWidget);
// await sleep(300);
// // Display history, copy pubkey, go back and rename wallet name
// await tapOn('displayHistory');
// await sleep(400);
// await tapOn('copyPubkey');
// expect('Cette clé publique a été copié dans votre presse-papier.',
// findsOneWidget);
// await sleep(800);
// await goBack();
// await sleep(300);
// await tapOn('renameWallet');
// await sleep(100);
// await tapOn('walletName');
// await sleep(100);
// await tester.enterText(
// find.byKey(Key('walletName')), 'Renommage wallet 2');
// await sleep(300);
// await tapOn('renameWallet');
// await sleep(400);
// await goBack();
// expect('Renommage wallet 2', findsOneWidget);
// await createDerivation('Derivation 8');
// await createDerivation('Derivation 9');
// await createDerivation('Derivation 10');
// await createDerivation('Derivation 11');
// await createDerivation('Derivation 12');
// await createDerivation('Derivation 13');
// await createDerivation('Derivation 14');
// await createDerivation('Derivation 15');
// await createDerivation('Derivation 16');
// await createDerivation('Derivation 17');
// await createDerivation('Derivation 18');
// await createDerivation('Derivation 19');
// await createDerivation('Derivation 20');
// await sleep(400);
// // Scroll the wallet screen until Derivation 20 and open it
// await tester.scrollUntilVisible(find.byKey(Key('listWallets')), -300.0);
// expect('Derivation 20', findsOneWidget);
// await sleep(400);
// await tester.tap(find.text('Derivation 20'));
// await tapOn('copyPubkey');
// });
// test('Search - Search Pi profile, navigate in history transactions', (
// {timeout: const Duration(seconds: 2)}) async {
// expect('Derivation 20', findsOneWidget);
// await goBack();
// await goBack();
// await sleep(200);
// await tapOn('searchIcon');
// await sleep(400);
// await tester.enterText(find.byKey(Key('searchInput')),
// 'D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU');
// await sleep(100);
// await tapOn('copyPubkey');
// await sleep(500);
// await tapOn('switchPayHistory');
// await sleep(1200);
// // await tester.scrollIntoView(find.byValueKey('listTransactions'));
// await tester.scrollUntilVisible(
// find.byKey(Key('listTransactions')),
// -600.0,
// );
// await sleep(100);
// await tapOn('transaction33');
// expect('Commentaire:', findsOneWidget);
// // Want to paste pubkey copied, but doesn't work actualy with flutter driver: https://github.com/flutter/flutter/issues/47448
// // final ClipboardData pubkeyCopied =
// // await Clipboard.getData(Clipboard.kTextPlain);
// // await tester.enterText(pubkeyCopied.text);
// await sleep(300);
// }, timeout: Timeout(Duration(minutes: globalTimeout)));
// test('Wallet generation - Fast wallets generations', (
// {timeout: const Duration(seconds: 2)}) async {
// expect('Commentaire:', findsOneWidget);
// await goBack();
// await goBack();
// await deleteAllWallets();
// await sleep(100);
// final String pincode = await createNewKeychain('Fast wallet');
// await sleep(100);
// await tapOn('manageWallets');
// await sleep(200);
// await tester.enterText(find.byKey(Key('formKey')), pinCode);
// await sleep(100);
// await createDerivation('Derivation 2');
// await sleep(100);
// await tester.tap(find.text('Fast wallet'));
// expect('Fast wallet', findsOneWidget);
// // Wait 3 seconds at the end
// await sleep(3000);
// });
},
);
}

View File

@ -1,19 +1,20 @@
import 'dart:io';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/walletData.dart';
import 'package:hive/hive.dart';
import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart';
// Files paths
Directory appPath;
Directory walletsDirectory;
File defaultWalletFile;
File currentChestFile;
WalletData defaultWallet;
String appVersion;
SharedPreferences prefs;
String endPointGVA;
int ramSys;
Box<WalletData> walletBox;
Box chestBox;
Box configBox;
// String cesiumPod = "https://g1.data.le-sou.org";
String cesiumPod = "https://g1.data.e-is.pro";

View File

@ -22,12 +22,15 @@ import 'package:gecko/models/generateWallets.dart';
import 'package:gecko/models/history.dart';
import 'package:gecko/models/home.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/walletData.dart';
import 'package:gecko/models/walletOptions.dart';
import 'package:gecko/screens/home.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/walletsHome.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
import 'package:flutter/foundation.dart';
import 'package:responsive_framework/responsive_framework.dart';
@ -41,17 +44,26 @@ Future<void> main() async {
HomeProvider _homeProvider = HomeProvider();
MyWalletsProvider _walletsProvider = MyWalletsProvider();
await _homeProvider.getAppPath();
appPath = await getApplicationDocumentsDirectory();
await _homeProvider.createDefaultAvatar();
await _walletsProvider.initWalletFolder();
// _walletsProvider.getDefaultWallet();
appVersion = await _homeProvider.getAppVersion();
prefs = await SharedPreferences.getInstance();
// Configure Hive and open boxes
await Hive.initFlutter(appPath.path);
Hive.registerAdapter(WalletDataAdapter());
walletBox = await Hive.openBox<WalletData>("walletBox");
chestBox = await Hive.openBox("chestBox");
configBox = await Hive.openBox("configBox");
_walletsProvider.getDefaultWallet();
// final HiveStore _store =
// await HiveStore.open(path: '${appPath.path}/gqlCache');
// Get a valid GVA endpoint
endPointGVA = await _homeProvider.getValidEndpoint();
endPointGVA = 'https://g1.librelois.fr/gva';
// await _homeProvider.getValidEndpoint();
// if (endPointGVA == 'HS') {
// _homeProvider.playSound('faché', 0.8);
@ -141,6 +153,10 @@ class Gecko extends StatelessWidget {
background: Container(color: Color(0xFFF5F5F5))),
title: 'Ğecko',
theme: ThemeData(
appBarTheme: AppBarTheme(
color: const Color(0xffFFD58D),
foregroundColor: const Color(0xFF000000),
),
primaryColor: Color(0xffFFD58D),
textTheme: TextTheme(
bodyText1: TextStyle(),

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:dubp/dubp.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -13,9 +12,7 @@ class ChangePinProvider with ChangeNotifier {
Future<NewWallet> changePin(_name, _oldPin) async {
try {
final _walletFile = Directory('${walletsDirectory.path}/$_name');
final _dewif =
File(_walletFile.path + '/wallet.dewif').readAsLinesSync()[0];
final _dewif = chestBox.get(0);
NewWallet newWalletFile = await DubpRust.changeDewifPin(
dewif: _dewif,
@ -32,12 +29,9 @@ class ChangePinProvider with ChangeNotifier {
}
}
Future storeWallet(context, _name, _newWalletFile) async {
final Directory walletNameDirectory =
Directory('${walletsDirectory.path}/$_name');
final walletFile = File('${walletNameDirectory.path}/wallet.dewif');
Future storeWallet(context, _name, NewWallet _newWalletFile) async {
chestBox.put(0, _newWalletFile.dewif);
walletFile.writeAsString('${_newWalletFile.dewif}');
Navigator.pop(context);
return _name;
}

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'package:dubp/dubp.dart';
@ -6,6 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/walletData.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
@ -38,40 +38,14 @@ class GenerateWalletsProvider with ChangeNotifier {
bool canImport = false;
bool isPinChanged = false;
Future storeHDWChest(
void storeHDWChest(
NewWallet _wallet, String _name, BuildContext context) async {
// Directory walletDirectory;
final Directory hdDirectory = Directory('${walletsDirectory.path}/0');
await hdDirectory.create();
final configFile = File('${hdDirectory.path}/list.conf');
File _currentChestFile = File('${walletsDirectory.path}/currentChest.conf');
final dewifFile = File('${hdDirectory.path}/wallet.dewif');
// List<String> _lastConfig = [];
// _lastConfig = await masterConfigFile.readAsLines();
// final int _lastDerivation = int.parse(_lastConfig.last.split(':')[2]);
// final int _derivationNbr = _lastDerivation + 3;
final int _derivationNbr = 3;
List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys(
dewif: _wallet.dewif,
secretCode: _wallet.pin,
accountsIndex: [_derivationNbr]);
String _pubkey = _pubkeysTmp[0];
await configFile.writeAsString('0:0:$_name:$_derivationNbr:$_pubkey');
await dewifFile.writeAsString(_wallet.dewif);
bool isCurrentChestExist = _currentChestFile.existsSync();
if (isCurrentChestExist) {
await _currentChestFile.delete();
}
await _currentChestFile.create();
await _currentChestFile.writeAsString('0');
return _name;
WalletData myWallet =
WalletData(chest: 0, number: 0, name: _name, derivation: 3);
walletBox.add(myWallet);
chestBox.put(0, _wallet.dewif);
configBox.put('currentChest', 0);
// walletBox.get(1)
}
void checkAskedWord(String inputWord, String _mnemo) {

View File

@ -1,5 +1,3 @@
import 'dart:io';
import 'package:dubp/dubp.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -52,10 +50,7 @@ class HistoryProvider with ChangeNotifier {
Future<String> pay(BuildContext context, String pinCode) async {
// MyWalletsProvider _myWalletProvider = MyWalletsProvider();
List dewifList = await File(
walletsDirectory.path + '/${defaultWallet.chest}/wallet.dewif')
.readAsLines();
String dewif = dewifList[0];
String dewif = chestBox.get(0);
try {
await DubpRust.simplePaymentFromTransparentAccount(
accountIndex: defaultWallet.derivation,

View File

@ -11,7 +11,6 @@ import 'package:gecko/globals.dart';
import 'package:gecko/screens/history.dart';
import 'package:gecko/screens/myWallets/walletsHome.dart';
import 'package:package_info/package_info.dart';
import 'package:path_provider/path_provider.dart';
class HomeProvider with ChangeNotifier {
int _currentIndex = 0;
@ -100,17 +99,6 @@ class HomeProvider with ChangeNotifier {
return _endpoint;
}
Future getAppPath() async {
appPath = await getApplicationDocumentsDirectory();
walletsDirectory = Directory('${appPath.path}/wallets');
bool isWalletFolderExist = await walletsDirectory.exists();
if (!isWalletFolderExist) {
await Directory(walletsDirectory.path).create();
}
}
Future createDefaultAvatar() async {
File defaultAvatar = File(appPath.path + '/default_avatar.png');
final bool isAvatarExist = await defaultAvatar.exists();

View File

@ -1,51 +1,20 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:gecko/globals.dart';
import 'package:provider/provider.dart';
import 'package:gecko/models/walletData.dart';
class MyWalletsProvider with ChangeNotifier {
List<WalletData> listWallets = [];
String pinCode;
int pinLenght;
Future initWalletFolder() async {
// getDefaultWallet();
final bool isWalletFolderExist = await walletsDirectory.exists();
if (!isWalletFolderExist) {
await Directory(walletsDirectory.path).create();
}
File _currentChestFile = File('${walletsDirectory.path}/currentChest.conf');
await _currentChestFile.create();
await _currentChestFile.writeAsString('0');
final bool isChestsExist =
await Directory('${walletsDirectory.path}/0').exists();
if (!isChestsExist) {
await Directory('${walletsDirectory.path}/0').create();
await Directory('${walletsDirectory.path}/1').create();
await File('${walletsDirectory.path}/0/list.conf').create();
await File('${walletsDirectory.path}/0/order.conf').create();
await File('${walletsDirectory.path}/1/list.conf').create();
await File('${walletsDirectory.path}/1/order.conf').create();
// getDefaultWallet();
}
await getDefaultWalletAsync();
}
int getCurrentChest() {
File _currentChestFile = File('${walletsDirectory.path}/currentChest.conf');
bool isCurrentChestExist = _currentChestFile.existsSync();
if (!isCurrentChestExist) {
_currentChestFile.createSync();
_currentChestFile.writeAsString('0');
if (configBox.get('currentChest') == null) {
configBox.put('currentChest', 0);
}
return int.parse(_currentChestFile.readAsStringSync());
return configBox.get('currentChest');
}
bool checkIfWalletExist() {
@ -63,89 +32,53 @@ class MyWalletsProvider with ChangeNotifier {
}
}
List readAllWallets(int _chest) {
// log.d(walletsDirectory.path);
listWallets = [];
File _walletConfig = File('${walletsDirectory.path}/$_chest/list.conf');
_walletConfig.readAsLinesSync().forEach((element) {
listWallets.add(WalletData(element));
List<WalletData> readAllWallets(int _chest) {
listWallets.clear();
walletBox.toMap().forEach((key, value) {
if (value.chest == _chest) {
listWallets.add(value);
}
});
log.i(listWallets.toString());
return listWallets;
}
WalletData getWalletData(String _id) {
// log.d(_id);
if (_id == '') return WalletData('');
int chest = int.parse(_id.split(':')[0]);
final _walletConfig = File('${walletsDirectory.path}/$chest/list.conf');
WalletData getWalletData(List<int> _id) {
if (_id.isEmpty) return WalletData();
int _chest = _id[0];
int _nbr = _id[1];
var _targetedWallet;
return WalletData(_walletConfig
.readAsLinesSync()
.firstWhere((element) => element.startsWith(_id)));
}
walletBox.toMap().forEach((key, value) {
if (value.chest == _chest && value.number == _nbr) {
_targetedWallet = value;
return false;
}
});
Future<WalletData> getWalletDataAsync(String _id) async {
// log.d(_id);
if (_id == '') return WalletData('');
int chest = int.parse(_id.split(':')[0]);
final _walletConfig = File('${walletsDirectory.path}/$chest/list.conf');
List configLines = await _walletConfig.readAsLines();
//log.d(configLines);
if (configLines.isEmpty) {
return WalletData('');
}
return WalletData(
configLines.firstWhere((element) => element.startsWith(_id)));
return _targetedWallet;
}
void getDefaultWallet() {
defaultWalletFile = File('${appPath.path}/defaultWallet');
MyWalletsProvider myWalletsProvider = MyWalletsProvider();
if (!defaultWalletFile.existsSync()) {
File(defaultWalletFile.path).createSync();
defaultWalletFile.writeAsStringSync("0:0");
if (configBox.get('defaultWallet') == null) {
configBox.put('defaultWallet', [0, 0]);
}
defaultWallet = getWalletData(defaultWalletFile.readAsStringSync());
}
Future getDefaultWalletAsync() async {
defaultWalletFile = File('${appPath.path}/defaultWallet');
if (!await defaultWalletFile.exists()) {
await File(defaultWalletFile.path).create();
await defaultWalletFile.writeAsString("0:0");
} else {
defaultWallet =
await getWalletDataAsync(await defaultWalletFile.readAsString());
}
defaultWallet = myWalletsProvider
.getWalletData(configBox.get('defaultWallet').cast<int>());
}
Future<int> deleteAllWallet(context) async {
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false);
try {
log.w('DELETE THAT ?: $walletsDirectory');
log.w('DELETE ALL WALLETS ?');
final bool _answer = await _confirmDeletingAllWallets(context);
if (_answer) {
await walletsDirectory.delete(recursive: true);
await defaultWalletFile.delete();
await walletsDirectory.create();
await initWalletFolder();
// await Future.delayed(Duration(milliseconds: 500));
// scheduleMicrotask(() {
notifyListeners();
rebuildWidget();
_myWalletProvider.rebuildWidget();
// });
await walletBox.clear();
await chestBox.clear();
await configBox.delete('defaultWallet');
Navigator.pop(context);
}
@ -187,27 +120,26 @@ class MyWalletsProvider with ChangeNotifier {
Future<void> generateNewDerivation(context, String _name) async {
int _newDerivationNbr;
int _newWalletNbr;
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
int _chest = 0;
List<WalletData> _walletConfig = readAllWallets(_chest);
if (await _walletConfig.readAsString() == '') {
if (_walletConfig.isEmpty) {
_newDerivationNbr = 3;
_newWalletNbr = 0;
} else {
String _lastWallet =
await _walletConfig.readAsLines().then((value) => value.last);
int _lastDerivation = int.parse(_lastWallet.split(':')[3]);
_newDerivationNbr = _lastDerivation + 3;
int _lastWalletNbr = int.parse(_lastWallet.split(':')[1]);
_newWalletNbr = _lastWalletNbr + 1;
_newDerivationNbr = _walletConfig.last.derivation + 3;
_newWalletNbr = _walletConfig.last.number + 1;
}
await _walletConfig.writeAsString(
'\n0:$_newWalletNbr:$_name:$_newDerivationNbr',
mode: FileMode.append);
WalletData newWallet = WalletData(
chest: _chest,
number: _newWalletNbr,
name: _name,
derivation: _newDerivationNbr);
await walletBox.add(newWallet);
notifyListeners();
Navigator.pop(context);
}
@ -215,44 +147,3 @@ class MyWalletsProvider with ChangeNotifier {
notifyListeners();
}
}
// wallet data contains elements identifying wallet
class WalletData {
int chest;
int number;
String name;
int derivation;
// constructor from ':'-separated string
WalletData(String element) {
if (element != '') {
List parts = element.split(':');
this.chest = int.parse(parts[0]);
this.number = int.parse(parts[1]);
this.name = parts[2];
this.derivation = int.parse(parts[3]);
}
}
// default wallet
static WalletData defaultWallet() {
return WalletData("0:0:default:3");
}
// representation of WalletData when debugging
@override
String toString() {
return this.name;
}
// creates the ':'-separated string from the WalletData
String inLine() {
return "${this.chest}:${this.number}:${this.name}:${this.derivation}";
}
// returns only the id part of the ':'-separated string
String id() {
return "${this.chest}:${this.number}";
}
}

View File

@ -0,0 +1,36 @@
import 'package:hive_flutter/hive_flutter.dart';
part 'walletData.g.dart';
@HiveType(typeId: 0)
class WalletData extends HiveObject {
@HiveField(0)
int chest;
@HiveField(1)
int number;
@HiveField(2)
String name;
@HiveField(3)
int derivation;
WalletData({this.chest, this.number, this.name, this.derivation});
// representation of WalletData when debugging
@override
String toString() {
return this.name;
}
// creates the ':'-separated string from the WalletData
String inLine() {
return "${this.chest}:${this.number}:${this.name}:${this.derivation}";
}
// returns only the id part of the ':'-separated string
List id() {
return [this.chest, this.number];
}
}

View File

@ -0,0 +1,50 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'walletData.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class WalletDataAdapter extends TypeAdapter<WalletData> {
@override
final int typeId = 0;
@override
WalletData read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return WalletData(
chest: fields[0] as int,
number: fields[1] as int,
name: fields[2] as String,
derivation: fields[3] as int,
);
}
@override
void write(BinaryWriter writer, WalletData obj) {
writer
..writeByte(4)
..writeByte(0)
..write(obj.chest)
..writeByte(1)
..write(obj.number)
..writeByte(2)
..write(obj.name)
..writeByte(3)
..write(obj.derivation);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is WalletDataAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}

View File

@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
import 'dart:async';
import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/walletData.dart';
import 'package:image_picker/image_picker.dart';
import 'package:truncate/truncate.dart';
import 'package:qrscan/qrscan.dart' as scanner;
@ -23,7 +24,7 @@ class WalletOptionsProvider with ChangeNotifier {
bool isBalanceBlur = true;
FocusNode walletNameFocus = FocusNode();
TextEditingController nameController = TextEditingController();
String walletID;
List<int> walletID;
bool isDefaultWallet;
Future<NewWallet> get badWallet => null;
@ -75,14 +76,8 @@ class WalletOptionsProvider with ChangeNotifier {
context, WalletData _wallet, String _pin, int _pinLenght) async {
isWalletUnlock = false;
try {
File _walletFile = File('${walletsDirectory.path}/0/wallet.dewif');
String _localDewif = await _walletFile.readAsString();
String _localDewif = chestBox.get(0);
String _localPubkey;
// log.d("$_localDewif $_pin $_pinLenght ${_wallet.derivation}");
// String mnemo = await DubpRust.getBip32DewifMnemonic(
// dewif: _localDewif, secretCode: _pin);
// log.d(mnemo.toString());
if ((_localPubkey = await _getPubkeyFromDewif(
_localDewif, _pin, _pinLenght, _wallet.derivation)) !=
@ -119,8 +114,7 @@ class WalletOptionsProvider with ChangeNotifier {
int getPinLenght(_walletNbr) {
String _localDewif;
if (_walletNbr is int) {
File _walletFile = File('${walletsDirectory.path}/0/wallet.dewif');
_localDewif = _walletFile.readAsStringSync();
_localDewif = chestBox.get(0);
} else {
_localDewif = _walletNbr;
}
@ -131,29 +125,13 @@ class WalletOptionsProvider with ChangeNotifier {
return _pinLenght;
}
Future _renameWallet(_walletID, _newName) async {
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
Future _renameWallet(List<int> _walletID, _newName) async {
MyWalletsProvider myWalletClass = MyWalletsProvider();
String newConfig =
await _walletConfig.readAsLines().then((List<String> lines) {
int nbrLines = lines.length;
if (nbrLines != 1) {
for (String wLine in lines) {
String wID = "${wLine.split(':')[0]}:${wLine.split(':')[1]}";
String deri = wLine.split(':')[3];
if (wID == _walletID) {
lines.remove(wLine);
lines.add('$_walletID:$_newName:$deri');
}
}
return lines.join('\n');
} else {
return 'true';
}
});
WalletData _walletTarget = myWalletClass.getWalletData(_walletID);
_walletTarget.name = _newName;
await walletBox.putAt(_walletTarget.key, _walletTarget);
await _walletConfig.delete();
await _walletConfig.writeAsString(newConfig);
_newWalletName.text = '';
}
@ -198,7 +176,7 @@ class WalletOptionsProvider with ChangeNotifier {
);
}
Future<bool> editWalletName(_wID) async {
Future<bool> editWalletName(List<int> _wID) async {
bool nameState;
if (isEditing) {
if (!nameController.text.contains(':') &&
@ -218,27 +196,12 @@ class WalletOptionsProvider with ChangeNotifier {
return nameState;
}
Future<int> deleteWallet(context, wallet) async {
Future<int> deleteWallet(context, WalletData wallet) async {
final bool _answer = await _confirmDeletingWallet(context, wallet.name);
if (_answer) {
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
walletBox.delete(wallet.key);
if (wallet.derivation != -1) {
String newConfig =
await _walletConfig.readAsLines().then((List<String> lines) {
lines.removeWhere((element) => element.contains(wallet.inLine()));
return lines.join('\n');
});
await _walletConfig.delete();
await _walletConfig.writeAsString(newConfig);
} else {
final _walletFile =
Directory('${walletsDirectory.path}/${wallet.number}');
await _walletFile.delete(recursive: true);
}
Navigator.popUntil(
context,
ModalRoute.withName('/mywallets'),
@ -281,37 +244,6 @@ class WalletOptionsProvider with ChangeNotifier {
);
}
Future<NewWallet> changePin(_name, _oldPin) async {
try {
final _walletFile = Directory('${walletsDirectory.path}/$_name');
final _dewif =
File(_walletFile.path + '/wallet.dewif').readAsLinesSync()[0];
NewWallet newWalletFile = await DubpRust.changeDewifPin(
dewif: _dewif,
oldPin: _oldPin,
);
newPin.text = newWalletFile.pin;
ischangedPin = true;
// notifyListeners();
return newWalletFile;
} catch (e) {
log.e('Impossible de changer le code PIN.');
return badWallet;
}
}
Future storeWallet(context, _name, _newWalletFile) async {
final Directory walletNameDirectory =
Directory('${walletsDirectory.path}/$_name');
final walletFile = File('${walletNameDirectory.path}/wallet.dewif');
walletFile.writeAsString('${_newWalletFile.dewif}');
Navigator.pop(context);
return _name;
}
snackCopyKey(context) {
final snackBar = SnackBar(
content:
@ -346,13 +278,6 @@ class WalletOptionsProvider with ChangeNotifier {
return await scanner.generateBarCode(_pubkey);
}
void defAsDefaultWallet(String _id) {
defaultWalletFile.deleteSync();
defaultWalletFile.createSync();
defaultWalletFile.writeAsStringSync(_id);
notifyListeners();
}
Future changeAvatar() async {
File _image;
final picker = ImagePicker();

View File

@ -22,6 +22,12 @@ class HomeScreen extends StatelessWidget {
Provider.of<MyWalletsProvider>(context);
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
// walletBox.toMap().forEach((key, value) {
// if (value.chest == 0) {
// print('$key: ${value.derivation}');
// }
// });
isTall = false;
ratio = 1;
if (MediaQuery.of(context).size.height >= 930) {

View File

@ -134,8 +134,8 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
onPressed: (_generateWalletProvider
.isAskedWordValid &&
this.walletName.text != '')
? () async {
await _generateWalletProvider.storeHDWChest(
? () {
_generateWalletProvider.storeHDWChest(
generatedWallet,
walletName.text,
context);

View File

@ -1,9 +1,9 @@
import 'dart:async';
import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart';
import 'package:gecko/models/history.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/walletData.dart';
import 'package:gecko/models/walletOptions.dart';
import 'package:flutter/material.dart';
import 'package:pin_code_fields/pin_code_fields.dart';
@ -34,7 +34,7 @@ class UnlockingWallet extends StatelessWidget {
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context);
log.d("defaultWallet: " + defaultWallet.toString());
// log.d("defaultWallet: " + defaultWallet.toString());
final int _pinLenght = _walletOptions.getPinLenght(wallet.number);
errorController = StreamController<ErrorAnimationType>();

View File

@ -5,6 +5,7 @@ import 'package:gecko/globals.dart';
import 'package:gecko/models/history.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/models/walletData.dart';
import 'package:gecko/models/walletOptions.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
@ -44,12 +45,12 @@ class WalletOptions extends StatelessWidget {
if (_walletOptions.nameController.text.length >= 26 && isTall)
_nbrLinesName = 3;
_walletOptions.walletID = '0:${wallet.number}';
_walletOptions.walletID = [0, wallet.number];
_myWalletProvider.getDefaultWallet();
_walletOptions.isDefaultWallet =
(defaultWallet.id() == _walletOptions.walletID);
(defaultWallet.id()[1] == _walletOptions.walletID[1]);
int currentChest = _myWalletProvider.getCurrentChest();
@ -361,8 +362,9 @@ class WalletOptions extends StatelessWidget {
onTap: !_walletOptions.isDefaultWallet
? () {
defaultWallet = wallet;
_walletOptions.defAsDefaultWallet(wallet.id());
configBox.put('defaultWallet', wallet.id());
_myWalletProvider.readAllWallets(_currentChest);
_myWalletProvider.rebuildWidget();
}
: null,
child: SizedBox(

View File

@ -1,6 +1,7 @@
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/walletData.dart';
import 'package:gecko/models/walletOptions.dart';
import 'package:flutter/material.dart';
import 'package:gecko/screens/commonElements.dart';
@ -165,9 +166,10 @@ class WalletsHome extends StatelessWidget {
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(12))),
// contentPadding: const EdgeInsets.only(left: 7.0),
tileColor: _repository.id() == defaultWallet.id()
? Color(0xffD28928)
: Color(0xffFFD58D),
tileColor:
_repository.id()[1] == defaultWallet.id()[1]
? Color(0xffD28928)
: Color(0xffFFD58D),
// leading: Text('IMAGE'),
// subtitle: Text(_repository.split(':')[3],
@ -180,8 +182,8 @@ class WalletsHome extends StatelessWidget {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
color: _repository.id() ==
defaultWallet.id()
color: _repository.id()[1] ==
defaultWallet.id()[1]
? Color(0xffF9F9F1)
: Colors.black)))),
// dense: true,
@ -216,6 +218,7 @@ class WalletsHome extends StatelessWidget {
Padding(
padding: EdgeInsets.all(8.0),
child: TextFormField(
key: Key('DerivationNameKey'),
controller: _newDerivationName,
textAlign: TextAlign.center,
autofocus: true,

View File

@ -119,10 +119,10 @@ class OnboardingStepFourteen extends StatelessWidget {
generatedWallet.dewif, _pin.toUpperCase(), _pinLenght);
if (resultWallet) {
pinColor = Colors.green[500];
await _generateWalletProvider.storeHDWChest(
_generateWalletProvider.storeHDWChest(
generatedWallet, 'Mon portefeuille courant', context);
_myWalletProvider.readAllWallets(_currentChest);
await _myWalletProvider.getDefaultWalletAsync();
_myWalletProvider.getDefaultWallet();
scheduleMicrotask(() {
_walletOptions.reloadBuild();
_myWalletProvider.rebuildWidget();

View File

@ -1,11 +1,13 @@
import 'package:flutter/material.dart';
import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart';
import 'package:gecko/models/home.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/screens/myWallets/generateWallets.dart';
import 'dart:io';
import 'package:gecko/screens/myWallets/importWallet.dart';
import 'package:gecko/globals.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class SettingsScreen extends StatelessWidget {
@ -25,6 +27,8 @@ class SettingsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
// getAppDirectory();
return Scaffold(
appBar: AppBar(
@ -91,7 +95,9 @@ class SettingsScreen extends StatelessWidget {
),
onPressed: () async => {
log.i('Suppression de tous les wallets'),
await _myWallets.deleteAllWallet(context)
await _myWallets
.deleteAllWallet(context)
.then((v) => _homeProvider.rebuildWidget())
},
child: Text("EFFACER TOUS MES PORTEFEUILLES",
style: TextStyle(fontSize: 20)))))),

1
linux/.gitignore vendored
View File

@ -1 +0,0 @@
flutter/ephemeral

View File

@ -1,106 +0,0 @@
cmake_minimum_required(VERSION 3.10)
project(runner LANGUAGES CXX)
set(BINARY_NAME "gecko")
set(APPLICATION_ID "com.example.gecko")
cmake_policy(SET CMP0063 NEW)
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
# Configure build options.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
# Compilation settings that should be applied to most targets.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
endfunction()
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
# Flutter library and tool build rules.
add_subdirectory(${FLUTTER_MANAGED_DIR})
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Application build
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
apply_standard_settings(${BINARY_NAME})
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
add_dependencies(${BINARY_NAME} flutter_assemble)
# Only the install-generated bundle's copy of the executable will launch
# correctly, since the resources must in the right relative locations. To avoid
# people trying to run the unbundled copy, put it in a subdirectory instead of
# the default top-level location.
set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
# === Installation ===
# By default, "installing" just makes a relocatable bundle in the build
# directory.
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
# Start with a clean build bundle directory every time.
install(CODE "
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
" COMPONENT Runtime)
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
if(PLUGIN_BUNDLED_LIBRARIES)
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
# Install the AOT library on non-Debug builds only.
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()

View File

@ -1,91 +0,0 @@
cmake_minimum_required(VERSION 3.10)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
# which isn't available in 3.10.
function(list_prepend LIST_NAME PREFIX)
set(NEW_LIST "")
foreach(element ${${LIST_NAME}})
list(APPEND NEW_LIST "${PREFIX}${element}")
endforeach(element)
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
endfunction()
# === Flutter Library ===
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)
pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma)
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"fl_basic_message_channel.h"
"fl_binary_codec.h"
"fl_binary_messenger.h"
"fl_dart_project.h"
"fl_engine.h"
"fl_json_message_codec.h"
"fl_json_method_codec.h"
"fl_message_codec.h"
"fl_method_call.h"
"fl_method_channel.h"
"fl_method_codec.h"
"fl_method_response.h"
"fl_plugin_registrar.h"
"fl_plugin_registry.h"
"fl_standard_message_codec.h"
"fl_standard_method_codec.h"
"fl_string_codec.h"
"fl_value.h"
"fl_view.h"
"flutter_linux.h"
)
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
target_link_libraries(flutter INTERFACE
PkgConfig::GTK
PkgConfig::GLIB
PkgConfig::GIO
PkgConfig::BLKID
PkgConfig::LZMA
)
add_dependencies(flutter flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/_phony_
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
)

View File

@ -1,13 +0,0 @@
//
// Generated file. Do not edit.
//
#include "generated_plugin_registrant.h"
#include <printing/printing_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) printing_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin");
printing_plugin_register_with_registrar(printing_registrar);
}

View File

@ -1,13 +0,0 @@
//
// Generated file. Do not edit.
//
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter_linux/flutter_linux.h>
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_

View File

@ -1,16 +0,0 @@
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
printing
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

View File

@ -1,6 +0,0 @@
#include "my_application.h"
int main(int argc, char** argv) {
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}

View File

@ -1,104 +0,0 @@
#include "my_application.h"
#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
GdkScreen *screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
}
#endif
if (use_header_bar) {
GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "gecko");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
}
else {
gtk_window_set_title(window, "gecko");
}
gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}
// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) {
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
g_autoptr(GError) error = nullptr;
if (!g_application_register(application, nullptr, &error)) {
g_warning("Failed to register: %s", error->message);
*exit_status = 1;
return TRUE;
}
g_application_activate(application);
*exit_status = 0;
return TRUE;
}
// Implements GObject::dispose.
static void my_application_dispose(GObject *object) {
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
nullptr));
}

View File

@ -1,18 +0,0 @@
#ifndef FLUTTER_MY_APPLICATION_H_
#define FLUTTER_MY_APPLICATION_H_
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)
/**
* my_application_new:
*
* Creates a new Flutter-based application.
*
* Returns: a new #MyApplication.
*/
MyApplication* my_application_new();
#endif // FLUTTER_MY_APPLICATION_H_

View File

@ -67,6 +67,7 @@ enum WalletType {
bip32Ed25519,
}
// ignore: avoid_classes_with_only_static_members
/// DUBP Rust utilities
///
/// All the functions of this package are static methods of this

View File

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "20.0.0"
version: "30.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
version: "2.7.0"
archive:
dependency: transitive
description:
@ -28,7 +28,7 @@ packages:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.3.0"
async:
dependency: transitive
description:
@ -57,6 +57,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.2"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.1"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.3"
characters:
dependency: transitive
description:
@ -71,13 +127,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.3.5"
clock:
dependency: transitive
description:
@ -85,6 +148,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
collection:
dependency: transitive
description:
@ -98,7 +168,7 @@ packages:
name: connectivity_plus
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.4.0"
connectivity_plus_linux:
dependency: transitive
description:
@ -112,7 +182,7 @@ packages:
name: connectivity_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.1"
connectivity_plus_platform_interface:
dependency: transitive
description:
@ -133,14 +203,14 @@ packages:
name: connectivity_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
coverage:
dependency: transitive
description:
@ -154,7 +224,7 @@ packages:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+5"
version: "0.3.2"
crypto:
dependency: "direct main"
description:
@ -162,13 +232,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
dbus:
dependency: transitive
description:
name: dbus
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.4"
version: "0.5.6"
dubp:
dependency: "direct main"
description:
@ -189,14 +266,14 @@ packages:
name: fast_base58
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "0.2.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.2"
file:
dependency: transitive
description:
@ -210,6 +287,13 @@ packages:
name: file_utils
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
flutter:
dependency: "direct main"
@ -227,7 +311,7 @@ packages:
name: flutter_launcher_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
version: "0.9.2"
flutter_logs:
dependency: "direct main"
description:
@ -241,7 +325,7 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.4"
flutter_svg:
dependency: "direct main"
description:
@ -277,7 +361,7 @@ packages:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
globbing:
dependency: transitive
description:
@ -348,20 +432,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
hive:
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
hive:
dependency: "direct main"
description:
name: hive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.4"
hive_flutter:
dependency: "direct main"
description:
name: hive_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
hive_generator:
dependency: "direct dev"
description:
name: hive_generator
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
http:
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.0"
version: "0.13.4"
http_multi_server:
dependency: transitive
description:
@ -382,28 +487,28 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.8"
image_gallery_saver:
dependency: "direct main"
description:
name: image_gallery_saver
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.9"
version: "1.7.1"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.4"
version: "0.8.4+4"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4"
image_picker_platform_interface:
dependency: transitive
description:
@ -411,6 +516,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
integration_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
intl:
dependency: "direct main"
description:
@ -424,14 +534,14 @@ packages:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.3"
isolate:
dependency: transitive
description:
name: isolate
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.1.1"
jdenticon_dart:
dependency: "direct main"
description:
@ -446,6 +556,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.0"
logger:
dependency: "direct main"
description:
@ -459,7 +576,7 @@ packages:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
matcher:
dependency: transitive
description:
@ -480,7 +597,7 @@ packages:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
nested:
dependency: transitive
description:
@ -501,7 +618,7 @@ packages:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.1"
normalize:
dependency: transitive
description:
@ -515,7 +632,7 @@ packages:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
package_info:
dependency: "direct main"
description:
@ -529,42 +646,42 @@ packages:
name: package_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.3.0"
package_info_plus_linux:
dependency: transitive
description:
name: package_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.3"
package_info_plus_macos:
dependency: transitive
description:
name: package_info_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.3.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.2"
package_info_plus_web:
dependency: transitive
description:
name: package_info_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.4"
package_info_plus_windows:
dependency: transitive
description:
name: package_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.4"
path:
dependency: transitive
description:
@ -578,7 +695,7 @@ packages:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.1"
version: "0.5.1+1"
path_parsing:
dependency: transitive
description:
@ -592,21 +709,21 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.6"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
path_provider_platform_interface:
dependency: transitive
description:
@ -620,21 +737,21 @@ packages:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.3"
pdf:
dependency: "direct main"
description:
name: pdf
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
version: "3.6.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
version: "1.11.1"
permission_handler:
dependency: "direct main"
description:
@ -648,21 +765,21 @@ packages:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
version: "3.7.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.0"
version: "4.4.0"
pin_code_fields:
dependency: "direct main"
description:
name: pin_code_fields
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.2"
version: "6.1.0"
platform:
dependency: transitive
description:
@ -676,7 +793,7 @@ packages:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
pool:
dependency: transitive
description:
@ -690,7 +807,7 @@ packages:
name: printing
url: "https://pub.dartlang.org"
source: hosted
version: "5.5.0"
version: "5.6.0"
process:
dependency: transitive
description:
@ -704,21 +821,28 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
version: "6.0.1"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
qr:
dependency: transitive
description:
name: qr
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
qrscan:
dependency: "direct main"
description:
@ -739,7 +863,7 @@ packages:
name: responsive_framework
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
rxdart:
dependency: transitive
description:
@ -753,35 +877,35 @@ packages:
name: sentry
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
version: "6.1.0"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
version: "6.1.0"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
version: "2.0.8"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
shared_preferences_platform_interface:
dependency: transitive
description:
@ -795,21 +919,21 @@ packages:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
shelf_packages_handler:
dependency: transitive
description:
@ -823,7 +947,7 @@ packages:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0"
shelf_web_socket:
dependency: transitive
description:
@ -836,6 +960,20 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
source_helper:
dependency: transitive
description:
name: source_helper
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
source_map_stack_trace:
dependency: transitive
description:
@ -871,6 +1009,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
@ -898,7 +1043,7 @@ packages:
name: system_info
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
term_glyph:
dependency: transitive
description:
@ -927,6 +1072,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
truncate:
dependency: "direct main"
description:
@ -954,7 +1106,7 @@ packages:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.5"
vector_math:
dependency: transitive
description:
@ -975,14 +1127,14 @@ packages:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
webdriver:
dependency: transitive
description:
@ -1003,7 +1155,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.2.10"
xdg_directories:
dependency: transitive
description:
@ -1017,7 +1169,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.0"
version: "5.3.1"
yaml:
dependency: transitive
description:
@ -1027,4 +1179,4 @@ packages:
version: "3.1.0"
sdks:
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.0.0"
flutter: ">=2.5.0"

View File

@ -5,52 +5,54 @@ 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.2+6
version: 0.0.2+7
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
bubble: ^1.2.1
crypto: ^3.0.1
dubp:
path: packages/dubp_rs
flutter_launcher_icons: "^0.9.0"
qrscan: ^0.3.2
permission_handler: ^8.1.6
image_gallery_saver: ^1.6.9
image_picker: ^0.8.4
# graphql_flutter: ^4.0.1 #^3.1.0
graphql_flutter: ^5.0.0
provider: ^6.0.0
truncate: ^3.0.1
path_provider: ^2.0.3
intl: ^0.17.0
pin_code_fields: ^6.0.2
http: ^0.13.0
super_tooltip: ^1.0.1
package_info: ^2.0.2
xml: ^5.3.0
pdf: ^3.5.0
printing: ^5.5.0
shared_preferences: ^2.0.7
sync_http: ^0.3.0
crypto: ^3.0.1
fast_base58: ^0.2.0
logger: ^1.1.0
flutter_logs: ^2.1.4
sentry: ^6.0.0
sentry_flutter: ^6.0.0
bubble: ^1.2.1
flutter_svg: ^0.22.0
responsive_framework: ^0.1.4
responsive_builder: ^0.4.1
jdenticon_dart: ^2.0.0
# audioplayers: ^0.18.1
flutter:
sdk: flutter
flutter_driver:
sdk: flutter
flutter_launcher_icons: ^0.9.0
flutter_logs: ^2.1.4
flutter_svg: ^0.22.0
graphql_flutter: ^5.0.0
hive: ^2.0.4
hive_flutter: ^1.1.0
http: ^0.13.0
image_gallery_saver: ^1.6.9
image_picker: ^0.8.4
intl: ^0.17.0
jdenticon_dart: ^2.0.0
logger: ^1.1.0
package_info: ^2.0.2
path_provider: ^2.0.3
pdf: ^3.5.0
permission_handler: 8.1.6
pin_code_fields: ^6.0.2
printing: ^5.6.0
provider: ^6.0.0
qrscan: ^0.3.2
responsive_builder: ^0.4.1
responsive_framework: ^0.1.4
sentry: ^6.0.0
sentry_flutter: ^6.0.0
shared_preferences: ^2.0.7
super_tooltip: ^1.0.1
sync_http: ^0.3.0
test: ^1.17.10
# test_api: ^0.4.7
# test: ^1.19.3
truncate: ^3.0.1
unorm_dart: ^0.2.0
xml: ^5.3.0
flutter_icons:
android: "ic_launcher"
@ -61,6 +63,10 @@ flutter_icons:
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
hive_generator: ^1.1.1
build_runner: ^2.1.2
# The following section is specific to Flutter.
flutter:

View File

@ -254,13 +254,32 @@ void main() {
"Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !");
});
test('My wallets - Create a derivations, open thems, tap all buttons', (
{timeout: Timeout.none}) async {
test('My wallets - Rename first derivation', (
{timeout: const Duration(seconds: 2)}) async {
await tapOn('goWalletHome');
expect(await getText('myWallets'), "Mes portefeuilles");
await sleep(300);
// Go to first derivation and rename it
await driver.tap(find.text('Mon portefeuille courant'));
await sleep(300);
await tapOn('renameWallet');
await sleep(100);
await tapOn('walletName');
await sleep(100);
await driver.enterText('Renommage wallet 1');
await sleep(300);
await tapOn('renameWallet');
await sleep(400);
await driver.waitFor(find.text('Renommage wallet 1'), timeout: timeout);
// expect(await getText('walletName'), "Renommage wallet 1");
await goBack();
});
test('My wallets - Create a derivations, open thems, tap all buttons', (
{timeout: const Duration(seconds: 2)}) async {
await driver.waitFor(find.text('Renommage wallet 1'), timeout: timeout);
// Add a second derivation
await createDerivation('Derivation 2');
@ -301,8 +320,10 @@ void main() {
await deleteWallet(true);
});
test('My wallets - Extra tests', ({timeout: Timeout.none}) async {
test('My wallets - Extra tests', (
{timeout: const Duration(seconds: 2)}) async {
// Add derivation 5,6 and 7
await driver.waitFor(find.text('Derivation 4'), timeout: timeout);
await createDerivation('Derivation 5');
await createDerivation('Derivation 6');
await createDerivation('Derivation 7');
@ -377,7 +398,8 @@ void main() {
});
test('Search - Search Pi profile, navigate in history transactions', (
{timeout: Timeout.none}) async {
{timeout: const Duration(seconds: 2)}) async {
await driver.waitFor(find.text('Derivation 20'), timeout: timeout);
await goBack();
await goBack();
await sleep(200);
@ -408,7 +430,8 @@ void main() {
}, timeout: Timeout(Duration(minutes: globalTimeout)));
test('Wallet generation - Fast wallets generations', (
{timeout: Timeout.none}) async {
{timeout: const Duration(seconds: 2)}) async {
await driver.waitFor(find.text('Commentaire:'), timeout: timeout);
await goBack();
await goBack();
await deleteAllWallets();