From e42640b33e75d155b566dec7fd40a4154eb55ff5 Mon Sep 17 00:00:00 2001 From: Franco Bugnano Date: Mon, 6 Jun 2022 16:01:46 +0200 Subject: [PATCH] Revert to non-prerelease version of flutter_local_notifications --- example/push_notifications/lib/main.dart | 1 + example/push_notifications/pubspec.lock | 8 ++++---- lib/src/notification.dart | 13 +++++++++---- pubspec.lock | 6 +++--- pubspec.yaml | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/example/push_notifications/lib/main.dart b/example/push_notifications/lib/main.dart index 28292eb..77e9d0e 100644 --- a/example/push_notifications/lib/main.dart +++ b/example/push_notifications/lib/main.dart @@ -1,3 +1,4 @@ +import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:talkjs_flutter/talkjs_flutter.dart'; import 'package:firebase_core/firebase_core.dart'; diff --git a/example/push_notifications/pubspec.lock b/example/push_notifications/pubspec.lock index fd54e9c..68c8a2b 100644 --- a/example/push_notifications/pubspec.lock +++ b/example/push_notifications/pubspec.lock @@ -159,21 +159,21 @@ packages: name: flutter_local_notifications url: "https://pub.dartlang.org" source: hosted - version: "10.0.0-dev.14" + version: "9.6.0" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux url: "https://pub.dartlang.org" source: hosted - version: "0.5.0-dev.4" + version: "0.5.0+1" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "6.0.0-dev.4" + version: "5.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -307,7 +307,7 @@ packages: path: "../.." relative: true source: path - version: "0.2.1" + version: "0.3.0" talkjs_webview_flutter: dependency: transitive description: diff --git a/lib/src/notification.dart b/lib/src/notification.dart index 9cc3eff..a764442 100644 --- a/lib/src/notification.dart +++ b/lib/src/notification.dart @@ -3,7 +3,6 @@ import 'dart:typed_data'; import 'dart:ui'; import 'dart:convert'; import 'dart:isolate'; -import 'package:flutter/services.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:http/http.dart' as http; @@ -288,8 +287,10 @@ Future _onReceiveMessageFromPort(RemoteMessage firebaseMessage) async { ); } -void _onSelectNotification(NotificationResponse details) { - final payload = details.payload; +// The commented code is for when we will upgrade to flutter_local_notifications version 10 +void _onSelectNotification(String? payload) { +//void _onSelectNotification(NotificationResponse details) { +// final payload = details.payload; print('📘 _onSelectNotification: $payload'); @@ -320,11 +321,14 @@ Future registerAndroidPushNotificationHandlers(AndroidChannel androidChann InitializationSettings( android: AndroidInitializationSettings('@mipmap/ic_launcher'), ), - onDidReceiveNotificationResponse: _onSelectNotification, + // The commented code is for when we will upgrade to flutter_local_notifications version 10 + //onDidReceiveNotificationResponse: _onSelectNotification, + onSelectNotification: _onSelectNotification, ); _androidChannel = androidChannel; + /* The commented code is for when we will upgrade to flutter_local_notifications version 10 try { final activeNotifications = await _flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation() @@ -357,6 +361,7 @@ Future registerAndroidPushNotificationHandlers(AndroidChannel androidChann // PlatformException is raised on Android < 6.0 // Simply ignoring this part } + */ IsolateNameServer.registerPortWithName(_receivePort.sendPort, 'talkjsFCMPort'); _receivePort.listen((message) async => await _onReceiveMessageFromPort(message)); diff --git a/pubspec.lock b/pubspec.lock index 27287b2..fa624d1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -145,21 +145,21 @@ packages: name: flutter_local_notifications url: "https://pub.dartlang.org" source: hosted - version: "10.0.0-dev.14" + version: "9.6.0" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux url: "https://pub.dartlang.org" source: hosted - version: "0.5.0-dev.4" + version: "0.5.0+1" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "6.0.0-dev.4" + version: "5.0.0" flutter_test: dependency: "direct dev" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 6ff7d4f..9cb4e20 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: crypto: ^3.0.1 firebase_core: ^1.16.0 firebase_messaging: ^11.3.0 - flutter_local_notifications: ^10.0.0-dev.14 + flutter_local_notifications: ^9.6.0 http: ^0.13.4 flutter_apns_only: ^1.5.2