mirror of
https://github.com/ente-io/ente.git
synced 2025-08-07 23:18:10 +00:00
[auth] Implemented function to set the app install time
This commit is contained in:
parent
bbf001e5cb
commit
6ed5203485
@ -23,9 +23,11 @@ class PreferenceService {
|
|||||||
static const kShouldAutoFocusOnSearchBar = "should_auto_focus_on_search_bar";
|
static const kShouldAutoFocusOnSearchBar = "should_auto_focus_on_search_bar";
|
||||||
static const kShouldMinimizeOnCopy = "should_minimize_on_copy";
|
static const kShouldMinimizeOnCopy = "should_minimize_on_copy";
|
||||||
static const kCompactMode = "vi.compactMode";
|
static const kCompactMode = "vi.compactMode";
|
||||||
|
static const kAppInstallTime = "appInstallTime";
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
_prefs = await SharedPreferences.getInstance();
|
_prefs = await SharedPreferences.getInstance();
|
||||||
|
await setAppInstallTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasShownCoachMark() {
|
bool hasShownCoachMark() {
|
||||||
@ -103,4 +105,19 @@ class PreferenceService {
|
|||||||
Future<void> setShouldMinimizeOnCopy(bool value) async {
|
Future<void> setShouldMinimizeOnCopy(bool value) async {
|
||||||
await _prefs.setBool(kShouldMinimizeOnCopy, value);
|
await _prefs.setBool(kShouldMinimizeOnCopy, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getAppInstalledTime() {
|
||||||
|
if (_prefs.containsKey(kAppInstallTime)) {
|
||||||
|
return _prefs.getInt(kAppInstallTime)!;
|
||||||
|
} else {
|
||||||
|
return DateTime.now().millisecondsSinceEpoch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> setAppInstallTime() async {
|
||||||
|
if (!_prefs.containsKey(kAppInstallTime)) {
|
||||||
|
final installedTimeinMillis = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
await _prefs.setInt(kAppInstallTime, installedTimeinMillis);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user