mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-06-25 09:04:07 +00:00
fix notification click did not directly open the chats
This commit is contained in:
parent
0007ba62a0
commit
26c9dc0066
4 changed files with 36 additions and 51 deletions
|
|
@ -74,6 +74,7 @@ void main() async {
|
||||||
|
|
||||||
var storageError = await twonlyMinimumInitialization();
|
var storageError = await twonlyMinimumInitialization();
|
||||||
await FcmNotificationService.initStartup();
|
await FcmNotificationService.initStartup();
|
||||||
|
await setupPushNotification();
|
||||||
|
|
||||||
var userExists = false;
|
var userExists = false;
|
||||||
|
|
||||||
|
|
@ -163,7 +164,6 @@ Future<void> postStartupTasks() async {
|
||||||
unawaited(MediaFileService.purgeTempFolder());
|
unawaited(MediaFileService.purgeTempFolder());
|
||||||
|
|
||||||
// 2. Service initializations
|
// 2. Service initializations
|
||||||
unawaited(setupPushNotification());
|
|
||||||
unawaited(finishStartedPreprocessing());
|
unawaited(finishStartedPreprocessing());
|
||||||
unawaited(createPushAvatars());
|
unawaited(createPushAvatars());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ Future<void> showLocalPushNotification(
|
||||||
ticker: 'You got a new message.',
|
ticker: 'You got a new message.',
|
||||||
largeIcon: styleInformation,
|
largeIcon: styleInformation,
|
||||||
icon: 'ic_launcher_foreground',
|
icon: 'ic_launcher_foreground',
|
||||||
|
groupKey: 'com.twonly.messages',
|
||||||
);
|
);
|
||||||
|
|
||||||
const darwinNotificationDetails = DarwinNotificationDetails();
|
const darwinNotificationDetails = DarwinNotificationDetails();
|
||||||
|
|
@ -190,43 +191,29 @@ Future<void> showLocalPushNotification(
|
||||||
notificationDetails,
|
notificationDetails,
|
||||||
payload: payload,
|
payload: payload,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> showLocalPushNotificationWithoutUserId(
|
if (Platform.isAndroid) {
|
||||||
PushNotification pushNotification,
|
final summaryAndroidDetails = AndroidNotificationDetails(
|
||||||
) async {
|
'0',
|
||||||
final lang = getLocalizations();
|
lang.notificationCategoryMessageTitle,
|
||||||
|
channelDescription: lang.notificationCategoryMessageDesc,
|
||||||
var title = lang.notificationTitleUnknown;
|
importance: Importance.max,
|
||||||
var body = lang.notificationBodyUnknown;
|
priority: Priority.max,
|
||||||
|
groupKey: 'com.twonly.messages',
|
||||||
if (pushNotification.kind == PushKind.CONTACT_REQUEST) {
|
setAsGroupSummary: true,
|
||||||
title = lang.you;
|
icon: 'ic_launcher_foreground',
|
||||||
body = lang.notificationContactRequestUnknownUser;
|
);
|
||||||
|
final summaryNotificationDetails = NotificationDetails(
|
||||||
|
android: summaryAndroidDetails,
|
||||||
|
);
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
0,
|
||||||
|
lang.notificationCategoryMessageTitle,
|
||||||
|
'',
|
||||||
|
summaryNotificationDetails,
|
||||||
|
payload: Routes.chats,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final androidNotificationDetails = AndroidNotificationDetails(
|
|
||||||
'0',
|
|
||||||
lang.notificationCategoryMessageTitle,
|
|
||||||
channelDescription: lang.notificationCategoryMessageDesc,
|
|
||||||
importance: Importance.max,
|
|
||||||
priority: Priority.max,
|
|
||||||
ticker: 'You got a new message.',
|
|
||||||
);
|
|
||||||
|
|
||||||
const darwinNotificationDetails = DarwinNotificationDetails();
|
|
||||||
final notificationDetails = NotificationDetails(
|
|
||||||
android: androidNotificationDetails,
|
|
||||||
iOS: darwinNotificationDetails,
|
|
||||||
);
|
|
||||||
|
|
||||||
await flutterLocalNotificationsPlugin.show(
|
|
||||||
2,
|
|
||||||
title,
|
|
||||||
body,
|
|
||||||
notificationDetails,
|
|
||||||
payload: pushNotification.kind.name,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> getAvatarIcon(int contactId) async {
|
Future<String?> getAvatarIcon(int contactId) async {
|
||||||
|
|
|
||||||
|
|
@ -197,17 +197,15 @@ class MainCameraController {
|
||||||
if (!isVideoRecording) {
|
if (!isVideoRecording) {
|
||||||
await cameraController?.stopImageStream();
|
await cameraController?.stopImageStream();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
if (cameraController == null) return;
|
||||||
Log.info(e);
|
selectedCameraDetails.scaleFactor = 1;
|
||||||
}
|
|
||||||
if (cameraController == null) return;
|
|
||||||
selectedCameraDetails.scaleFactor = 1;
|
|
||||||
|
|
||||||
await cameraController?.setZoomLevel(1);
|
await cameraController?.setZoomLevel(1);
|
||||||
if (cameraController == null) return;
|
if (cameraController == null) return;
|
||||||
await cameraController?.setDescription(AppEnvironment.cameras[cameraId]);
|
await cameraController?.setDescription(
|
||||||
if (cameraController == null) return;
|
AppEnvironment.cameras[cameraId],
|
||||||
try {
|
);
|
||||||
|
if (cameraController == null) return;
|
||||||
if (!isVideoRecording) {
|
if (!isVideoRecording) {
|
||||||
await cameraController?.startImageStream(_processCameraImage);
|
await cameraController?.startImageStream(_processCameraImage);
|
||||||
}
|
}
|
||||||
|
|
@ -462,7 +460,10 @@ class MainCameraController {
|
||||||
scannedUrl = link;
|
scannedUrl = link;
|
||||||
if (sharedLinkForPreview == null) {
|
if (sharedLinkForPreview == null) {
|
||||||
timeSharedLinkWasSetWithQr = clock.now();
|
timeSharedLinkWasSetWithQr = clock.now();
|
||||||
setSharedLinkForPreview(Uri.parse(scannedUrl!), generatePreview: false);
|
setSharedLinkForPreview(
|
||||||
|
Uri.parse(scannedUrl!),
|
||||||
|
generatePreview: false,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,11 +156,8 @@ class HomeViewState extends State<HomeView> with WidgetsBindingObserver {
|
||||||
payload.startsWith(Routes.chats) &&
|
payload.startsWith(Routes.chats) &&
|
||||||
payload != Routes.chats) {
|
payload != Routes.chats) {
|
||||||
routerProvider.go(payload);
|
routerProvider.go(payload);
|
||||||
streamHomeViewPageIndex.add(0);
|
|
||||||
}
|
|
||||||
if (payload == Routes.chats) {
|
|
||||||
streamHomeViewPageIndex.add(0);
|
|
||||||
}
|
}
|
||||||
|
streamHomeViewPageIndex.add(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue