@@ -85,6 +85,8 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ONE_TO_ONE
8585import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
8686import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SHARE_RECORDING_TO_CHAT_URL
8787import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SYSTEM_NOTIFICATION_ID
88+ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_THREAD_ID
89+ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_OPENED_VIA_NOTIFICATION
8890import com.nextcloud.talk.utils.preferences.AppPreferences
8991import io.reactivex.Observable
9092import io.reactivex.Observer
@@ -397,6 +399,10 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
397399 val ncNotification = notificationOverall.ocs!! .notification
398400 if (ncNotification != null ) {
399401 enrichPushMessageByNcNotificationData(ncNotification)
402+
403+ val threadId = parseThreadId(ncNotification.objectId)
404+ threadId?.let { intent.putExtra(KEY_THREAD_ID , it) }
405+
400406 showNotification(intent, ncNotification)
401407 }
402408 }
@@ -827,6 +833,8 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
827833 }
828834 }
829835
836+ private fun parseThreadId (objectId : String? ): Long? = objectId?.split(" /" )?.getOrNull(2 )?.toLongOrNull()
837+
830838 private fun sendNotification (notificationId : Int , notification : Notification ) {
831839 Log .d(TAG , " show notification with id $notificationId " )
832840 if (ActivityCompat .checkSelfPermission(
@@ -982,6 +990,7 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
982990 val bundle = Bundle ()
983991 bundle.putString(KEY_ROOM_TOKEN , pushMessage.id)
984992 bundle.putLong(KEY_INTERNAL_USER_ID , signatureVerification.user!! .id!! )
993+ bundle.putBoolean(KEY_OPENED_VIA_NOTIFICATION , true )
985994 intent.putExtras(bundle)
986995 return intent
987996 }
0 commit comments