@@ -9,9 +9,7 @@ import android.os.Bundle
99import com.zoontek.rnbootsplash.RNBootSplash
1010import android.content.Intent
1111import android.content.res.Configuration
12- import chat.rocket.reactnative.notification.VideoConfModule
13- import chat.rocket.reactnative.notification.VideoConfNotification
14- import com.google.gson.GsonBuilder
12+ import chat.rocket.reactnative.notification.NotificationIntentHandler
1513
1614class MainActivity : ReactActivity () {
1715
@@ -32,56 +30,16 @@ class MainActivity : ReactActivity() {
3230 RNBootSplash .init (this , R .style.BootTheme )
3331 super .onCreate(null )
3432
35- // Handle video conf action from notification
36- intent?.let { handleVideoConfIntent( it) }
33+ // Handle notification intents
34+ intent?.let { NotificationIntentHandler .handleIntent( this , it) }
3735 }
3836
3937 public override fun onNewIntent (intent : Intent ) {
4038 super .onNewIntent(intent)
41- // Handle video conf action when activity is already running
42- handleVideoConfIntent(intent)
43- }
44-
45- private fun handleVideoConfIntent (intent : Intent ) {
46- if (intent.getBooleanExtra(" videoConfAction" , false )) {
47- val notificationId = intent.getIntExtra(" notificationId" , 0 )
48- val event = intent.getStringExtra(" event" ) ? : return
49- val rid = intent.getStringExtra(" rid" ) ? : " "
50- val callerId = intent.getStringExtra(" callerId" ) ? : " "
51- val callerName = intent.getStringExtra(" callerName" ) ? : " "
52- val host = intent.getStringExtra(" host" ) ? : " "
53- val callId = intent.getStringExtra(" callId" ) ? : " "
54-
55- android.util.Log .d(" RocketChat.MainActivity" , " Handling video conf intent - event: $event , rid: $rid , host: $host , callId: $callId " )
56-
57- // Cancel the notification
58- if (notificationId != 0 ) {
59- VideoConfNotification .cancelById(this , notificationId)
60- }
61-
62- // Store action for JS to pick up - include all required fields
63- val data = mapOf (
64- " notificationType" to " videoconf" ,
65- " rid" to rid,
66- " event" to event,
67- " host" to host,
68- " callId" to callId,
69- " caller" to mapOf (
70- " _id" to callerId,
71- " name" to callerName
72- )
73- )
74-
75- val gson = GsonBuilder ().create()
76- val jsonData = gson.toJson(data)
77-
78- android.util.Log .d(" RocketChat.MainActivity" , " Storing video conf action: $jsonData " )
79-
80- VideoConfModule .storePendingAction(this , jsonData)
81-
82- // Clear the video conf flag to prevent re-processing
83- intent.removeExtra(" videoConfAction" )
84- }
39+ setIntent(intent)
40+
41+ // Handle notification intents when activity is already running
42+ NotificationIntentHandler .handleIntent(this , intent)
8543 }
8644
8745 override fun invokeDefaultOnBackPressed () {
0 commit comments