Peer-programming with Hugo: Copy pubkeys on tap and display notif for it. Improve pubkeys fonts
This commit is contained in:
parent
3bf3f85b9c
commit
d80b1190ae
|
@ -28,6 +28,8 @@ Future<void> main() async {
|
|||
await _homeProvider.createDefaultAvatar();
|
||||
appVersion = await _homeProvider.getAppVersion();
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
final HiveStore _store =
|
||||
await HiveStore.open(path: '${appPath.path}/gqlCache');
|
||||
|
||||
String _randomEndpoint;
|
||||
int i = 0;
|
||||
|
@ -52,21 +54,20 @@ Future<void> main() async {
|
|||
options.dsn =
|
||||
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||
},
|
||||
appRunner: () => runApp(Gecko(_randomEndpoint)),
|
||||
appRunner: () => runApp(Gecko(_randomEndpoint, _store)),
|
||||
);
|
||||
} else {
|
||||
print('Debug mode enabled: No sentry alerte');
|
||||
|
||||
runApp(Gecko(
|
||||
_randomEndpoint,
|
||||
));
|
||||
runApp(Gecko(_randomEndpoint, _store));
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class Gecko extends StatelessWidget {
|
||||
Gecko(this.randomEndpoint);
|
||||
Gecko(this.randomEndpoint, this._store);
|
||||
final String randomEndpoint;
|
||||
final HiveStore _store;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -76,7 +77,7 @@ class Gecko extends StatelessWidget {
|
|||
|
||||
final _client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(store: null),
|
||||
cache: GraphQLCache(store: _store),
|
||||
link: _httpLink,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -9,7 +9,6 @@ import 'dart:math';
|
|||
import 'package:intl/intl.dart';
|
||||
|
||||
class HistoryProvider with ChangeNotifier {
|
||||
// String pubkey = 'D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU'; // For debug
|
||||
String pubkey = '';
|
||||
HistoryProvider(this.pubkey);
|
||||
final TextEditingController outputPubkey = new TextEditingController();
|
||||
|
@ -63,8 +62,10 @@ class HistoryProvider with ChangeNotifier {
|
|||
return '';
|
||||
}
|
||||
|
||||
// Pi: D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU // For debug
|
||||
// Boris: JE6mkuzSpT3ePciCPRTpuMT9fqPUVVLJz2618d33p7tn
|
||||
// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25
|
||||
// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25.
|
||||
// Lion simone: 78jhpprYkMNF6i5kQPXfkAVBpd2aqcpieNsXTSW4c21f
|
||||
|
||||
List parseHistory(txs, _pubkey) {
|
||||
// print(txs);
|
||||
|
@ -162,7 +163,7 @@ class HistoryProvider with ChangeNotifier {
|
|||
return opts;
|
||||
}
|
||||
|
||||
snackNode(context) {
|
||||
void snackNode(context) {
|
||||
if (isFirstBuild) {
|
||||
String _message;
|
||||
if (endPointGVA == 'HS') {
|
||||
|
|
|
@ -26,11 +26,9 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
Future importWallet() async {}
|
||||
|
||||
Map getAllWalletsNames() {
|
||||
print(listWallets);
|
||||
if (listWallets.isNotEmpty) {
|
||||
listWallets.clear();
|
||||
}
|
||||
print(walletsDirectory.path);
|
||||
|
||||
// int i = 0;
|
||||
walletsDirectory
|
||||
|
@ -39,7 +37,6 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
String _name = wallet.path.split('/').last;
|
||||
List _pubkeyList = File(wallet.path + '/pubkey').readAsLinesSync();
|
||||
String _pubkey = _pubkeyList[0];
|
||||
print("$_name: $_pubkey");
|
||||
listWallets[_name] = _pubkey;
|
||||
// i++;
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
|
||||
Future readLocalWallet(String _name, String _pin) async {
|
||||
isWalletUnlock = false;
|
||||
print('NOM: ' + _name);
|
||||
try {
|
||||
File _walletFile = File('${walletsDirectory.path}/$_name/wallet.dewif');
|
||||
String _localDewif = await _walletFile.readAsString();
|
||||
|
@ -204,9 +203,15 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
final walletFile = File('${walletNameDirectory.path}/wallet.dewif');
|
||||
|
||||
walletFile.writeAsString('${_newWalletFile.dewif}');
|
||||
|
||||
Navigator.pop(context);
|
||||
|
||||
return _name;
|
||||
}
|
||||
|
||||
snackCopyKey(context) {
|
||||
final snackBar = SnackBar(
|
||||
content:
|
||||
Text("Cette clé publique a été copié dans votre presse-papier."),
|
||||
duration: Duration(seconds: 2));
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_historyProvider.snackNode(context);
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
floatingActionButton: Container(
|
||||
height: 80.0,
|
||||
|
@ -78,16 +79,17 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
disabledBorder: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
|
||||
if (_historyProvider.pubkey != '') historyQuery(context),
|
||||
if (_historyProvider.pubkey != '')
|
||||
historyQuery(context, _historyProvider),
|
||||
]));
|
||||
}
|
||||
|
||||
historyQuery(context) {
|
||||
print("I'M HERE 1");
|
||||
Widget historyQuery(context, _historyProvider) {
|
||||
_pubkeyFocus.unfocus();
|
||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||
// HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||
CesiumPlusProvider _cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context);
|
||||
print("I'M HERE 1");
|
||||
return Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
|
@ -104,8 +106,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
),
|
||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||
print("I'M HERE 2 !");
|
||||
print(result.source.isEager);
|
||||
|
||||
if (result.isLoading && result.data == null) {
|
||||
print("I'M HERE 3 !");
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
|
|
|
@ -59,7 +59,8 @@ class GenerateWalletsScreen extends StatelessWidget {
|
|||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold)),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Monospace')),
|
||||
SizedBox(height: 8),
|
||||
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
||||
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:gecko/screens/myWallets/changePin.dart';
|
|||
import 'dart:async';
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||
|
@ -15,7 +16,7 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
String walletName;
|
||||
|
||||
StreamController<ErrorAnimationType> errorController;
|
||||
TextEditingController _enterPin = new TextEditingController();
|
||||
TextEditingController _enterPin = TextEditingController();
|
||||
final formKey = GlobalKey<FormState>();
|
||||
bool hasError = false;
|
||||
var pinColor = Color(0xffF9F9F1);
|
||||
|
@ -32,6 +33,7 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
Provider.of<MyWalletsProvider>(context);
|
||||
errorController = StreamController<ErrorAnimationType>();
|
||||
// _walletOptions.isWalletUnlock = false;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
|
@ -50,8 +52,8 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
height: 22,
|
||||
child: Text(walletName),
|
||||
)),
|
||||
body: Center(
|
||||
child: SafeArea(
|
||||
body: Builder(
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
Visibility(
|
||||
visible: _walletOptions.isWalletUnlock,
|
||||
|
@ -66,13 +68,20 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Text(
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: _walletOptions.pubkey.text));
|
||||
_walletOptions.snackCopyKey(ctx);
|
||||
},
|
||||
child: Text(
|
||||
_walletOptions.pubkey.text,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Monospace'),
|
||||
)),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
|
@ -84,7 +93,8 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
elevation: 5,
|
||||
primary: Color(
|
||||
0xffFFD68E), //Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
onPrimary:
|
||||
Colors.black, // foreground
|
||||
),
|
||||
onPressed: () => _walletOptions
|
||||
.renameWalletAlerte(
|
||||
|
@ -92,16 +102,21 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
.then((_result) {
|
||||
if (_result == true) {
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
.addPostFrameCallback(
|
||||
(_) {
|
||||
_myWalletProvider
|
||||
.listWallets =
|
||||
_myWalletProvider
|
||||
.getAllWalletsNames();
|
||||
_myWalletProvider.rebuildWidget();
|
||||
_myWalletProvider
|
||||
.rebuildWidget();
|
||||
});
|
||||
}
|
||||
}),
|
||||
child: Text('Renommer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20)))))),
|
||||
child: Text(
|
||||
'Renommer ce portefeuille',
|
||||
style: TextStyle(
|
||||
fontSize: 20)))))),
|
||||
SizedBox(height: 30),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
|
@ -140,9 +155,11 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
onPressed: () async {
|
||||
await _walletOptions.deleteWallet(
|
||||
context, walletName);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
_myWalletProvider.getAllWalletsNames();
|
||||
_myWalletProvider
|
||||
.getAllWalletsNames();
|
||||
_myWalletProvider.rebuildWidget();
|
||||
});
|
||||
},
|
||||
|
@ -200,12 +217,15 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
borderRadius: BorderRadius.circular(5),
|
||||
fieldHeight: 60,
|
||||
fieldWidth: 50,
|
||||
activeFillColor:
|
||||
hasError ? Colors.orange : Colors.white,
|
||||
activeFillColor: hasError
|
||||
? Colors.orange
|
||||
: Colors.white,
|
||||
),
|
||||
cursorColor: Colors.black,
|
||||
animationDuration: Duration(milliseconds: 300),
|
||||
textStyle: TextStyle(fontSize: 20, height: 1.6),
|
||||
animationDuration:
|
||||
Duration(milliseconds: 300),
|
||||
textStyle:
|
||||
TextStyle(fontSize: 20, height: 1.6),
|
||||
backgroundColor: pinColor,
|
||||
enableActiveFill: false,
|
||||
errorAnimationController: errorController,
|
||||
|
@ -222,7 +242,8 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
print("Completed");
|
||||
final resultWallet =
|
||||
await _walletOptions.readLocalWallet(
|
||||
this.walletName, _pin.toUpperCase());
|
||||
this.walletName,
|
||||
_pin.toUpperCase());
|
||||
if (resultWallet == 'bad') {
|
||||
errorController.add(ErrorAnimationType
|
||||
.shake); // Triggering error shake animation
|
||||
|
|
|
@ -13,7 +13,6 @@ class WalletsHome extends StatelessWidget {
|
|||
Provider.of<MyWalletsProvider>(context);
|
||||
WalletOptionsProvider _walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
print('BUILD: WalletsHome');
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
myWalletProvider.listWallets = myWalletProvider.getAllWalletsNames();
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
|
@ -97,8 +96,6 @@ class WalletsHome extends StatelessWidget {
|
|||
List _listWallets = [];
|
||||
myWalletProvider.listWallets.forEach((_name, _pubkey) {
|
||||
_listWallets.add(_name);
|
||||
// _balance[_name] = _historyProvider.getBalance(_pubkey).toString();
|
||||
print(_name + _pubkey);
|
||||
});
|
||||
|
||||
return Column(children: <Widget>[
|
||||
|
|
11
pubspec.lock
11
pubspec.lock
|
@ -232,14 +232,14 @@ packages:
|
|||
name: graphql
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0-beta.6"
|
||||
version: "4.0.0"
|
||||
graphql_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: graphql_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0-beta.6"
|
||||
version: "4.0.0"
|
||||
hive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -595,6 +595,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
system_info:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: system_info
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -5,7 +5,7 @@ description: A new Flutter project.
|
|||
# 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.1+2
|
||||
version: 0.0.1+3
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
|
Loading…
Reference in New Issue