mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +00:00
add signupEpoch to prefs
This commit is contained in:
parent
f87acdc721
commit
9746e6ab17
1 changed files with 22 additions and 0 deletions
|
@ -40,6 +40,7 @@ class Prefs extends ChangeNotifier {
|
|||
_externalCalls = await _getHasExternalCalls();
|
||||
_familiarity = await _getHasFamiliarity();
|
||||
_userId = await _getUserId();
|
||||
_signupEpoch = await _getSignupEpoch();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
@ -624,4 +625,25 @@ class Prefs extends ChangeNotifier {
|
|||
.put<dynamic>(boxName: DB.boxNamePrefs, key: "userID", value: _userId);
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
int? _signupEpoch;
|
||||
int? get signupEpoch => _signupEpoch;
|
||||
|
||||
Future<int?> _getSignupEpoch() async {
|
||||
int? signupEpoch = await DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNamePrefs, key: "signupEpoch") as int?;
|
||||
if (signupEpoch == null) {
|
||||
signupEpoch = DateTime.now().millisecondsSinceEpoch ~/
|
||||
Duration.millisecondsPerSecond;
|
||||
await saveSignupEpoch(signupEpoch);
|
||||
}
|
||||
return signupEpoch;
|
||||
}
|
||||
|
||||
Future<void> saveSignupEpoch(int signupEpoch) async {
|
||||
_signupEpoch = signupEpoch;
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "signupEpoch", value: _signupEpoch);
|
||||
// notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue