Implement getPinLenght Sync
This commit is contained in:
parent
5ec1e72030
commit
2a1060850b
|
@ -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');
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
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: () {
|
||||
|
|
Loading…
Reference in New Issue