update
Some checks are pending
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run

This commit is contained in:
efrilm 2026-05-29 21:56:46 +07:00
parent 77651e2e95
commit ded5516bb1
2 changed files with 11 additions and 8 deletions

View File

@ -43,13 +43,8 @@ class LoginFormBloc extends Bloc<LoginFormEvent, LoginFormState> {
if (emailValid && passwordValid) { if (emailValid && passwordValid) {
// Ambil device info dan FCM token secara paralel // Ambil device info dan FCM token secara paralel
final results = await Future.wait([ final deviceInfo = await _deviceInfoService.getDeviceInfo();
_deviceInfoService.getDeviceInfo(), final fcmToken = await _fcmService.getToken();
_fcmService.getToken(),
]);
final deviceInfo = results[0] as DeviceInfo;
final fcmToken = results[1] as String?;
failureOrAuth = await _repository.login( failureOrAuth = await _repository.login(
email: state.email, email: state.email,

View File

@ -194,7 +194,15 @@ class FcmService {
} }
/// Returns the FCM registration token for this device. /// Returns the FCM registration token for this device.
Future<String?> getToken() => _messaging.getToken(); /// Returns null if token is unavailable (e.g. simulator, APNs not ready).
Future<String?> getToken() async {
try {
return await _messaging.getToken();
} catch (e) {
debugPrint('[FCM] getToken failed: $e');
return null;
}
}
/// Subscribe to a topic (e.g. 'all', 'promo'). /// Subscribe to a topic (e.g. 'all', 'promo').
Future<void> subscribeToTopic(String topic) => Future<void> subscribeToTopic(String topic) =>