mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:28:41 +00:00
maybe #53
This commit is contained in:
parent
ee4a6fe8cf
commit
ad674dc77f
3 changed files with 17 additions and 9 deletions
|
|
@ -15,14 +15,14 @@ import 'package:twonly/src/utils/misc.dart';
|
|||
import 'src/app.dart';
|
||||
|
||||
void main() async {
|
||||
final settingsController = SettingsChangeProvider();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await initFCMService();
|
||||
|
||||
final settingsController = SettingsChangeProvider();
|
||||
// Load the user's preferred theme while the splash screen is displayed.
|
||||
// This prevents a sudden theme change when the app is first displayed.
|
||||
await settingsController.loadSettings();
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
Logger.root.level = kReleaseMode ? Level.INFO : Level.ALL;
|
||||
Logger.root.onRecord.listen((record) {
|
||||
writeLogToFile(record);
|
||||
|
|
@ -32,11 +32,10 @@ void main() async {
|
|||
}
|
||||
});
|
||||
|
||||
await deleteLogFile();
|
||||
// await deleteLogFile();
|
||||
|
||||
await setupPushNotification();
|
||||
await initMediaStorage();
|
||||
initFCMService();
|
||||
|
||||
gCameras = await availableCameras();
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,21 @@ Future initFCMService() async {
|
|||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
|
||||
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
||||
|
||||
// You may set the permission requests to "provisional" which allows the user to choose what type
|
||||
// of notifications they would like to receive once the user receives a notification.
|
||||
// final notificationSettings =
|
||||
await FirebaseMessaging.instance.requestPermission(provisional: true);
|
||||
// await FirebaseMessaging.instance.requestPermission(provisional: true);
|
||||
await FirebaseMessaging.instance.requestPermission(
|
||||
alert: true,
|
||||
announcement: false,
|
||||
badge: true,
|
||||
carPlay: false,
|
||||
criticalAlert: false,
|
||||
provisional: false,
|
||||
sound: true,
|
||||
);
|
||||
|
||||
// For apple platforms, ensure the APNS token is available before making any FCM plugin API calls
|
||||
if (Platform.isIOS) {
|
||||
|
|
@ -61,8 +72,6 @@ Future initFCMService() async {
|
|||
|
||||
// APNS token is available, make FCM plugin API requests...
|
||||
|
||||
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
||||
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
print('Got a message whilst in the foreground!');
|
||||
print('Message data: ${message.data}');
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ description: "Send pictures to friends in real time and be sure you are the only
|
|||
# Prevent accidental publishing to pub.dev.
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.0.7+7
|
||||
version: 0.0.8+8
|
||||
|
||||
environment:
|
||||
sdk: ^3.6.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue