fix: no exception if token is just null

This commit is contained in:
Christian Pauly 2021-01-18 19:23:52 +01:00
parent a04c3ab303
commit db349a56ef

View File

@ -34,11 +34,11 @@ abstract class FirebaseController {
String token; String token;
try { try {
token = await _firebaseMessaging.getToken(); token = await _firebaseMessaging.getToken();
} catch (e, s) {
token = null;
Logs().w('Unable to get firebase token', e, s);
}
if (token?.isEmpty ?? true) { if (token?.isEmpty ?? true) {
throw '_firebaseMessaging.getToken() has not thrown an exception but returned no token';
}
} catch (e, s) {
Logs().w('Unable to get firebase token', e, s);
final storeItem = await matrix.store.getItem(SettingKeys.showNoGoogle); final storeItem = await matrix.store.getItem(SettingKeys.showNoGoogle);
final configOptionMissing = storeItem == null || storeItem.isEmpty; final configOptionMissing = storeItem == null || storeItem.isEmpty;
if (configOptionMissing || (!configOptionMissing && storeItem == '1')) { if (configOptionMissing || (!configOptionMissing && storeItem == '1')) {