mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-29 09:11:17 +01:00
34 lines
973 B
Dart
34 lines
973 B
Dart
//INFO: This is a stub - contact me if you need the full implementation.
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
final propPrefs = PropPrefs();
|
|
|
|
class PropPrefs {
|
|
late SharedPreferences _prefs;
|
|
|
|
void initialize(SharedPreferences prefs) {
|
|
_prefs = prefs;
|
|
}
|
|
|
|
DateTime? getZwiftClickV2LastUnlock(String deviceId) {
|
|
final key = 'clickV2_$deviceId';
|
|
final timestamp = _prefs.getInt('${key}_unlock_date');
|
|
if (timestamp == null) return null;
|
|
return DateTime.fromMillisecondsSinceEpoch(timestamp);
|
|
}
|
|
|
|
void setZwiftClickV2LastUnlock(String deviceId, DateTime dateTime) {
|
|
final key = 'clickV2_$deviceId';
|
|
_prefs.setInt("${key}_unlock_date", dateTime.millisecondsSinceEpoch);
|
|
}
|
|
|
|
bool notSureIfUnlocked(String deviceId) {
|
|
return _prefs.getBool('clickV2_${deviceId}_notSure') ?? false;
|
|
}
|
|
|
|
void setNotSureIfUnlocked(String deviceId, bool value) {
|
|
_prefs.setBool('clickV2_${deviceId}_notSure', value);
|
|
}
|
|
}
|