attendence login/logout has been implemented

This commit is contained in:
Daniah Ayad Al-sultani
2026-01-15 22:35:10 +03:00
parent 3b3ed5e640
commit 56e2c0ffaa
20 changed files with 538 additions and 200 deletions

View File

@@ -4,11 +4,14 @@ abstract class UserLocalDataSource {
Future<void> cacheUserToken(String token);
Future<String?> getCachedUserToken();
Future<void> clearCache();
Future<void> cacheEmployeeId(String id);
Future<String?> getCachedEmployeeId();
}
class UserLocalDataSourceImpl implements UserLocalDataSource {
final SharedPreferences sharedPreferences;
static const String _tokenKey = 'user_token';
static const String _employeeIdKey = 'employee_id';
UserLocalDataSourceImpl({required this.sharedPreferences});
@@ -25,5 +28,16 @@ class UserLocalDataSourceImpl implements UserLocalDataSource {
@override
Future<void> clearCache() async {
await sharedPreferences.remove(_tokenKey);
await sharedPreferences.remove(_employeeIdKey);
}
@override
Future<void> cacheEmployeeId(String id) async {
await sharedPreferences.setString(_employeeIdKey, id);
}
@override
Future<String?> getCachedEmployeeId() async {
return sharedPreferences.getString(_employeeIdKey);
}
}