Skip to content
Snippets Groups Projects
Commit 2a106085 authored by poka's avatar poka
Browse files

Implement getPinLenght Sync

parent 5ec1e720
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,6 @@ import 'package:provider/provider.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:flutter/foundation.dart';
import 'package:shared_preferences/shared_preferences.dart';
import "package:system_info/system_info.dart";
final bool enableSentry = true;
......@@ -30,8 +29,6 @@ Future<void> main() async {
await _homeProvider.createDefaultAvatar();
appVersion = await _homeProvider.getAppVersion();
prefs = await SharedPreferences.getInstance();
ramSys = SysInfo.getTotalPhysicalMemory() ~/ 800000;
print("Votre appareil fait $ramSys de RAM.");
final HiveStore _store =
await HiveStore.open(path: '${appPath.path}/gqlCache');
......
......@@ -75,6 +75,16 @@ class WalletOptionsProvider with ChangeNotifier {
}
}
int getPinLenght(_name) {
File _walletFile = File('${walletsDirectory.path}/$_name/wallet.dewif');
String _localDewif = _walletFile.readAsStringSync();
final int _pinLenght = DubpRust.getDewifSecretCodeLen(
dewif: _localDewif, secretCodeType: SecretCodeType.letters);
return _pinLenght;
}
Future _renameWallet(_walletName, _newName) async {
final _walletFile = Directory('${walletsDirectory.path}/$_walletName');
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dubp/dubp.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/walletOptions.dart';
import 'package:gecko/screens/myWallets/changePin.dart';
......@@ -22,7 +21,6 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
bool hasError = false;
var pinColor = Color(0xffF9F9F1);
var walletPin = '';
int _pinLenght;
Future<NewWallet> get badWallet => null;
......@@ -35,11 +33,8 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
Provider.of<MyWalletsProvider>(context);
errorController = StreamController<ErrorAnimationType>();
// _walletOptions.isWalletUnlock = false;
if (ramSys <= 3000) {
_pinLenght = 6;
} else {
_pinLenght = 5;
}
final int _pinLenght = _walletOptions.getPinLenght(this.walletName);
return WillPopScope(
onWillPop: () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment