v.1.0.10
This commit is contained in:
parent
895fe0d022
commit
3cd584436b
@ -1,5 +1,8 @@
|
||||
Workout Test and Diet 4 You Common Util Functions
|
||||
|
||||
Version 1.0.10
|
||||
Firebase FCM for web
|
||||
|
||||
Version 1.0.9
|
||||
Firebase web config
|
||||
|
||||
|
@ -34,7 +34,7 @@ class FirebaseApi with logger.Logging {
|
||||
// Define an async function to initialize FlutterFire
|
||||
Future<void> initializeFlutterFire() async {
|
||||
try {
|
||||
// Wait for Firebase to initialize and set `_initialized` state to true
|
||||
|
||||
if (kIsWeb) {
|
||||
await Firebase.initializeApp(
|
||||
options: const FirebaseOptions(
|
||||
@ -50,10 +50,30 @@ class FirebaseApi with logger.Logging {
|
||||
} else {
|
||||
await Firebase.initializeApp();
|
||||
}
|
||||
} on Exception catch(e) {
|
||||
Sentry.captureException(e);
|
||||
log("Error in Firebase init: $e");
|
||||
}
|
||||
|
||||
appleSignInAvailable = await SignInWithApple.isAvailable();
|
||||
|
||||
if (kIsWeb) {
|
||||
final fcmToken = await FirebaseMessaging.instance.getToken(vapidKey: "BKqkxyTqlGGI6m4gFLa-fFu9kYflyCbLkDKRKihWLqhDyR8oy1ymGzbk9lGcSDW1fd7XZiN2XYA2sDF8yjHdFPg");
|
||||
FirebaseMessaging.instance.onTokenRefresh
|
||||
.listen((fcmToken) {
|
||||
|
||||
|
||||
// Note: This callback is fired at each app startup and whenever a new
|
||||
// token is generated.
|
||||
log('FCM token generated');
|
||||
|
||||
})
|
||||
.onError((err) {
|
||||
Sentry.captureException(err);
|
||||
log("Error initializing Firebase Messaging for Web $err");
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
|
||||
alert: true, // Required to display a heads up notification
|
||||
badge: true,
|
||||
@ -64,6 +84,7 @@ class FirebaseApi with logger.Logging {
|
||||
log("FirebaseMessaging token $firebaseRegToken");
|
||||
|
||||
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
||||
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
log('Got a message whilst in the foreground!');
|
||||
log('Message data: ${message.data}');
|
||||
@ -73,9 +94,9 @@ class FirebaseApi with logger.Logging {
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// Set `_error` state to true if Firebase initialization fails
|
||||
Sentry.captureException(e);
|
||||
log("Error initializing Firebase");
|
||||
log("Error initializing Firebase Messaging $e");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: workouttest_util
|
||||
description: Workout Test app and web functions.
|
||||
version: 1.0.8
|
||||
version: 1.0.10
|
||||
homepage:
|
||||
|
||||
environment:
|
||||
|
Loading…
Reference in New Issue
Block a user