Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/push_notifications/lib/main.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
8 changes: 4 additions & 4 deletions example/push_notifications/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -307,7 +307,7 @@ packages:
path: "../.."
relative: true
source: path
version: "0.2.1"
version: "0.3.0"
talkjs_webview_flutter:
dependency: transitive
description:
Expand Down
13 changes: 9 additions & 4 deletions lib/src/notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -288,8 +287,10 @@ Future<void> _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');

Expand Down Expand Up @@ -320,11 +321,14 @@ Future<void> 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<AndroidFlutterLocalNotificationsPlugin>()
Expand Down Expand Up @@ -357,6 +361,7 @@ Future<void> 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));
Expand Down
6 changes: 3 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down