From 328a747d79c15209f3e6eae70fd8e5fa1294d2f6 Mon Sep 17 00:00:00 2001
From: Marcel Hibbe <dev@mhibbe.de>
Date: Fri, 24 Feb 2023 10:45:13 +0100
Subject: [PATCH] move createMainActivityIntent near
 getIntentToOpenConversation

TODO: unify?

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
---
 .../nextcloud/talk/jobs/NotificationWorker.kt | 28 ++++++++-----------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt
index 80da76747..3c595aac2 100644
--- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt
+++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt
@@ -186,17 +186,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
         }
     }
 
-    private fun createMainActivityIntent(): Intent {
-        val intent = Intent(context, MainActivity::class.java)
-        intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK
-        val bundle = Bundle()
-        bundle.putString(KEY_ROOM_TOKEN, pushMessage.id)
-        bundle.putParcelable(KEY_USER_ENTITY, signatureVerification.user)
-        bundle.putBoolean(KEY_FROM_NOTIFICATION_START_CALL, false)
-        intent.putExtras(bundle)
-        return intent
-    }
-
     private fun handleCallPushMessage() {
         val fullScreenIntent = Intent(context, CallNotificationActivity::class.java)
         val bundle = Bundle()
@@ -871,16 +860,23 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
                 })
         }
     }
-
-    private fun getIntentToOpenConversation(): PendingIntent? {
-        val bundle = Bundle()
+    private fun createMainActivityIntent(): Intent {
         val intent = Intent(context, MainActivity::class.java)
         intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK
-
+        val bundle = Bundle()
+        bundle.putString(KEY_ROOM_TOKEN, pushMessage.id)
+        bundle.putParcelable(KEY_USER_ENTITY, signatureVerification.user)
+        bundle.putBoolean(KEY_FROM_NOTIFICATION_START_CALL, false)
+        intent.putExtras(bundle)
+        return intent
+    }
+    private fun getIntentToOpenConversation(): PendingIntent? {
+        val intent = Intent(context, MainActivity::class.java)
+        intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK
+        val bundle = Bundle()
         bundle.putString(KEY_ROOM_TOKEN, pushMessage.id)
         bundle.putParcelable(KEY_USER_ENTITY, signatureVerification.user)
         bundle.putBoolean(KEY_FROM_NOTIFICATION_START_CALL, false)
-
         intent.putExtras(bundle)
 
         val requestCode = System.currentTimeMillis().toInt()