Closed richanshah closed 10 months ago
can you reproduce the same in our Chat sample?
yeah its working in sample , not able to find out reason why its not working in the app.
There are two places for processing this event https://github.com/ConnectyCube/connectycube-flutter-samples/blob/master/chat_sample/lib/src/login_screen.dart#L492
try to add logs in these places and debug where your app gets stuck
@TatankaConCube , can u tell me which method from ur sample is called while getting message click from termination mode?
I provided the related to this feature links in the previous message, for more details please follow the documentation of the plugins you use for working with the push notifications
@TatankaConCube, Thanks a lot for the help. I have implemented it.
@TatankaConCube, When I redirect from termination mode , I am getting "Forbidden need user" , Which code i Have to implement before getDialog ? In termination mode?
you need to create the session with a user first before calling any user-related requests
@TatankaConCube , static void processMessageNotification(Map<String, dynamic> notificationData) async { showSnackBar(message: "Message notification callback"); print("Notification Data: $notificationData"); String dialogId = notificationData['dialog_id'] ?? ""; var isWithUser = CubeSessionManager.instance.activeSession?.user != null; if (dialogId.isNotEmpty) { DebugLog.d("dialogId richa shah $dialogId"); if (CubeSessionManager.instance.isActiveSessionValid() && isWithUser) { getDialogs({'id': dialogId}).then((dialogs) { if (dialogs?.items != null && dialogs!.items.isNotEmpty) { CubeDialog dialog = dialogs.items.first; DebugLog.d("dialog is NOT empty ${dialog.dialogId}");
Get.toNamed(AppPages.chat, arguments: {AppConstant.userArgName: SharedPref.getUser(), AppConstant.dialogArgName: dialog});
} else {
// Get.toNamed(AppPages.chat, arguments: {AppConstant.userArgName: SharedPref.getUser(), AppConstant.dialogArgName: null});
DebugLog.d("dialog is empty $dialogId");
}
}).catchError((onError) {
DebugLog.d("dialog is onError $onError");
});
} else {
await MainController.createConnectyCubeSession().then((value) {
getDialogs({'id': dialogId}).then((dialogs) {
if (dialogs?.items != null && dialogs!.items.isNotEmpty) {
CubeDialog dialog = dialogs.items.first;
DebugLog.d("dialog is NOT empty ${dialog.dialogId}");
Get.toNamed(AppPages.chat, arguments: {AppConstant.userArgName: SharedPref.getUser(), AppConstant.dialogArgName: dialog});
} else {
// Get.toNamed(AppPages.chat, arguments: {AppConstant.userArgName: SharedPref.getUser(), AppConstant.dialogArgName: null});
DebugLog.d("dialog is empty $dialogId");
}
}).catchError((onError) {
DebugLog.d("dialog is onError $onError");
Get.toNamed(AppPages.chat, arguments: {AppConstant.userArgName: SharedPref.getUser(), AppConstant.dialogArgName: null});
});
});
}
} else {
DebugLog.d("dialog is empty exit condition $dialogId");
}
// PushNotificationsManager.instance.onNotificationClicked?.call(jsonEncode(notificationData));
}
in above code i am getting CubeSessionManager.instance.isActiveSessionValid() && isWithUser true , which i put as per ur suggestion in one ticket to handle "403: {"errors":{"base":["Forbidden. Need user."]}" , but still i am getting this error with this check, is there a better way to check this ?
could you please collect the full log without any filters and cuttings? the log should start from a normal app running, then terminate the app, then receive a notification, then start the app and call getDialogs
if your log contains some personal data you can send it to our support team's email support@connectycube.com
no activity for a long time. closing...
i am trying with flutter notification only for now for chat module but termination mode redirection code is not working. can u guide me for the same?