144 lines
3.2 KiB
Dart
144 lines
3.2 KiB
Dart
abstract class BaseStorage {
|
|
|
|
Future<void> init();
|
|
|
|
Future<void> set(String key, String value);
|
|
|
|
Future<String?> get(String key);
|
|
|
|
Future<void> delete(String key);
|
|
|
|
Future<void> clearAll();
|
|
}
|
|
|
|
enum Storage {
|
|
SecureStorage,
|
|
SharedPreferences,
|
|
SQLiteStorage,
|
|
}
|
|
|
|
enum SharedPreferencesKey {
|
|
isFirstRun,
|
|
}
|
|
|
|
extension SharedPreferencesKeyExtension on SharedPreferencesKey {
|
|
String get value {
|
|
switch (this) {
|
|
case SharedPreferencesKey.isFirstRun:
|
|
return 'fre_isFirstRun';
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
}
|
|
|
|
enum SecureStorageKey {
|
|
isLogged,
|
|
email,
|
|
password,
|
|
deviceType,
|
|
token,
|
|
accessPass,
|
|
panicPass,
|
|
fingerprintPass,
|
|
haveLocal,
|
|
deviceDescription,
|
|
}
|
|
|
|
extension SecureStorageKeyExtension on SecureStorageKey {
|
|
String get value {
|
|
switch (this) {
|
|
case SecureStorageKey.isLogged:
|
|
return 'fre_isLogged';
|
|
case SecureStorageKey.email:
|
|
return 'fre_email';
|
|
case SecureStorageKey.password:
|
|
return 'fre_passwd';
|
|
case SecureStorageKey.deviceType:
|
|
return 'fre_deviceType';
|
|
case SecureStorageKey.token:
|
|
return 'fre_token';
|
|
case SecureStorageKey.accessPass:
|
|
return 'fre_accessPass';
|
|
case SecureStorageKey.panicPass:
|
|
return 'fre_panicPass';
|
|
case SecureStorageKey.fingerprintPass:
|
|
return 'fre_fingerprintPass';
|
|
case SecureStorageKey.haveLocal:
|
|
return 'fre_have_local';
|
|
case SecureStorageKey.deviceDescription:
|
|
return 'fre_deviceDescription';
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
}
|
|
|
|
enum SQLiteStorageKey {
|
|
devUUID,
|
|
userUUID,
|
|
userDevUUID,
|
|
status,
|
|
userName,
|
|
clientUUID,
|
|
ownerUUID,
|
|
clientName,
|
|
petAmount,
|
|
whatsapp,
|
|
provisional,
|
|
pets,
|
|
local,
|
|
notify,
|
|
fingerprint,
|
|
access,
|
|
panic,
|
|
person,
|
|
requestOSNotification,
|
|
}
|
|
|
|
extension SQLIteStorageKeyExtension on SQLiteStorageKey {
|
|
String get value {
|
|
switch (this) {
|
|
case SQLiteStorageKey.devUUID:
|
|
return 'fre_devUUID';
|
|
case SQLiteStorageKey.userUUID:
|
|
return 'fre_userUUID';
|
|
case SQLiteStorageKey.userDevUUID:
|
|
return 'fre_userDevUUID';
|
|
case SQLiteStorageKey.status:
|
|
return 'fre_status';
|
|
case SQLiteStorageKey.userName:
|
|
return 'fre_userName';
|
|
case SQLiteStorageKey.clientUUID:
|
|
return 'fre_cliUUID';
|
|
case SQLiteStorageKey.ownerUUID:
|
|
return 'fre_ownerUUID';
|
|
case SQLiteStorageKey.clientName:
|
|
return 'fre_cliName';
|
|
case SQLiteStorageKey.petAmount:
|
|
return 'fre_petAmountRegister';
|
|
case SQLiteStorageKey.whatsapp:
|
|
return 'fre_whatsapp';
|
|
case SQLiteStorageKey.provisional:
|
|
return 'fre_provisional';
|
|
case SQLiteStorageKey.pets:
|
|
return 'fre_pets';
|
|
case SQLiteStorageKey.local:
|
|
return 'fre_local';
|
|
case SQLiteStorageKey.notify:
|
|
return 'fre_notify';
|
|
case SQLiteStorageKey.fingerprint:
|
|
return 'fre_fingerprint';
|
|
case SQLiteStorageKey.access:
|
|
return 'fre_access';
|
|
case SQLiteStorageKey.panic:
|
|
return 'fre_panic';
|
|
case SQLiteStorageKey.person:
|
|
return 'fre_person';
|
|
case SQLiteStorageKey.requestOSNotification:
|
|
return 'fre_requestOSnotification';
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
} |