TF-439 Handle get stored device id

This commit is contained in:
dab246
2022-11-29 16:45:49 +07:00
committed by Dat H. Pham
parent ce1a52caac
commit 81278d13ba
12 changed files with 121 additions and 11 deletions
@@ -75,4 +75,14 @@ class FCMCacheManager {
Future<bool> storeDeviceId(String deviceId) {
return _sharedPreferences.setString(fcmDeviceIdKey, deviceId);
}
Future<String> getDeviceId() async {
await _sharedPreferences.reload();
final deviceId = _sharedPreferences.getString(fcmDeviceIdKey);
if (deviceId != null) {
return deviceId;
} else {
throw NotFoundDeviceIdException();
}
}
}