diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f951ce3..7bf1ee6 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -11,8 +11,8 @@ + android:label="gecko"> + Comparable.compare(a[0], b[0])); + transBC.sort((b, a) => Comparable.compare(a[0], b[0])); + transMP.sort((b, a) => Comparable.compare(a[0], b[0])); // // Keep only base if there is base change // var lastBase = 0; @@ -122,5 +186,5 @@ Future getHistory(String pubkey) async { // } // print(trans); - return trans; + return [transBC, transMP]; } diff --git a/lib/main.dart b/lib/main.dart index ce75049..fd17a7b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:typed_data'; +import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // import 'package:image_gallery_saver/image_gallery_saver.dart'; @@ -8,6 +9,7 @@ import 'package:qrscan/qrscan.dart' as scanner; import 'package:intl/intl.dart'; // import 'package:flutter_html_view'; import 'api.dart'; +import "package:dio/dio.dart"; void main() { runApp(MyApp()); @@ -30,21 +32,15 @@ class _MyAppState extends State { this._outputPubkey = new TextEditingController(); this._outputBalance = new TextEditingController(); this._outputHistory = new TextEditingController(); + // checkNode().then((result) { + // setState(() { + // _result = result; + // }); + // }); } @override Widget build(BuildContext context) { - // final List names = [ - // 'Aby', - // 'Aish', - // 'Ayan', - // 'Ben', - // 'Bob', - // 'Charlie', - // 'Cook', - // 'Carline' - // ]; - // final List msgCount = [2, 0, 10, 6, 52, 4, 0, 2]; return MaterialApp( home: Scaffold( backgroundColor: Colors.grey[300], @@ -163,13 +159,17 @@ class _MyAppState extends State { ); } + Future checkNode() async { + final response = await Dio().post(graphqlEndpoint); + return response; + } + Future _scan() async { await Permission.camera.request(); String barcode = await scanner.scan(); if (barcode == null) { print('nothing return.'); } else { - print("Debug: " + barcode); this._outputPubkey.text = ""; this._outputBalance.text = ""; this._outputHistory.text = ""; @@ -183,10 +183,9 @@ class _MyAppState extends State { return false; } - String historyBloc = ""; + String historyBC = ""; var j = 0; - for (var i in myHistory) { - // print(i); + for (var i in myHistory[0]) { var dateBrut = i[0]; dateBrut = DateTime.fromMillisecondsSinceEpoch(dateBrut * 1000); final DateFormat formatter = DateFormat('dd-MM-yy - H:M'); @@ -195,7 +194,7 @@ class _MyAppState extends State { final amount = i[2]; // final amountUD = i[3]; final comment = i[4]; - historyBloc += date.toString() + + historyBC += date.toString() + " \n " + issuer.toString() + " \n " + @@ -208,7 +207,37 @@ class _MyAppState extends State { break; } } - this._outputHistory.text = historyBloc; + + String historyMP = ""; + j = 0; + for (var i in myHistory[1]) { + if (i == null) { + break; + } + var dateBrut = "Now"; + final issuer = i[1]; + final amount = i[2]; + // final amountUD = i[3]; + final comment = i[4]; + historyMP += "EN COURS DE RECEPTION\n" + + dateBrut.toString() + + " \n " + + issuer.toString() + + " \n " + + amount.toString() + + " Ğ1\n " + + comment.toString() + + "\n---\n"; + } + + var history; + // print(historyMP.toString()); + if (historyMP == "") { + history = historyBC; + } else { + history = historyMP + '\n' + historyBC; + } + this._outputHistory.text = history; } } diff --git a/pubspec.lock b/pubspec.lock index 3b954c7..6fb8806 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,20 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.13" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" async: dependency: transitive description: @@ -43,13 +57,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0-nullsafety.3" - cupertino_icons: - dependency: "direct main" + convert: + dependency: transitive description: - name: cupertino_icons + name: convert url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" dio: dependency: "direct main" description: @@ -69,6 +90,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_launcher_icons: + dependency: "direct main" + description: + name: flutter_launcher_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.1" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -123,6 +151,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.19" image_gallery_saver: dependency: "direct main" description: @@ -193,6 +228,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" plugin_platform_interface: dependency: transitive description: @@ -268,6 +310,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0-nullsafety.3" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "4.5.1" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" sdks: dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 6a1b3ca..4258c7f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,6 +32,12 @@ dependencies: gql_exec: gql_link: intl: + flutter_launcher_icons: "^0.8.0" + +flutter_icons: + android: "launcher_icon" + ios: true + image_path: "assets/icon/gecko-bb-36.png" # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. diff --git a/scripts/build-apk.sh b/scripts/build-apk.sh index df291f0..86bb25f 100755 --- a/scripts/build-apk.sh +++ b/scripts/build-apk.sh @@ -2,3 +2,18 @@ flutter build apk --split-per-abi +APPNAME = "gecko" +VERSION="dev1" +ori_app="app.apk" + +if [[ -d $HOME/Téléchargements ]]; then + DL="$HOME/Téléchargements" +elif [[ -d $HOME/Downloads ]]; then + DL="$HOME/Downloads" +else + DL="/tmp" +fi + +mv build/app/outputs/flutter-apk/$ori_app "$DL/gecko-$VERSION" && echo "L'app se trouve ici: $DL/${APPNAME}-${VERSION}.apk" || exit 1 + +exit 0