Skip to content

Commit aaec5ac

Browse files
authored
chore: Merge 4.68.2 into single-server (#6907)
1 parent c2b1f71 commit aaec5ac

File tree

24 files changed

+1190
-376
lines changed

24 files changed

+1190
-376
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ android {
9090
minSdkVersion rootProject.ext.minSdkVersion
9191
targetSdkVersion rootProject.ext.targetSdkVersion
9292
versionCode VERSIONCODE as Integer
93-
versionName "4.68.1"
93+
versionName "4.68.2"
9494
vectorDrawables.useSupportLibrary = true
9595
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
9696
resValue "string", "rn_config_reader_custom_package", "chat.rocket.reactnative"

android/app/src/main/java/chat/rocket/reactnative/MainActivity.kt

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import android.os.Bundle
99
import com.zoontek.rnbootsplash.RNBootSplash
1010
import android.content.Intent
1111
import 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

1614
class 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() {

android/app/src/main/java/chat/rocket/reactnative/MainApplication.kt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ import android.content.res.Configuration
55
import com.facebook.react.PackageList
66
import com.facebook.react.ReactApplication
77
import com.facebook.react.ReactHost
8-
import com.facebook.react.ReactInstanceEventListener
98
import com.facebook.react.ReactNativeHost
109
import com.facebook.react.ReactPackage
11-
import com.facebook.react.bridge.ReactContext
12-
import com.facebook.react.bridge.ReactApplicationContext
1310
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
1411
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
1512
import com.facebook.react.defaults.DefaultReactNativeHost
@@ -21,8 +18,8 @@ import expo.modules.ApplicationLifecycleDispatcher
2118
import chat.rocket.reactnative.networking.SSLPinningTurboPackage;
2219
import chat.rocket.reactnative.storage.MMKVKeyManager;
2320
import chat.rocket.reactnative.storage.SecureStoragePackage;
24-
import chat.rocket.reactnative.notification.CustomPushNotification;
2521
import chat.rocket.reactnative.notification.VideoConfTurboPackage
22+
import chat.rocket.reactnative.notification.PushNotificationTurboPackage
2623

2724
/**
2825
* Main Application class.
@@ -45,6 +42,7 @@ open class MainApplication : Application(), ReactApplication {
4542
add(SSLPinningTurboPackage())
4643
add(WatermelonDBJSIPackage())
4744
add(VideoConfTurboPackage())
45+
add(PushNotificationTurboPackage())
4846
add(SecureStoragePackage())
4947
}
5048

@@ -71,13 +69,6 @@ open class MainApplication : Application(), ReactApplication {
7169
// Load the native entry point for the New Architecture
7270
load()
7371

74-
// Register listener to set React context when initialized
75-
reactHost.addReactInstanceEventListener(object : ReactInstanceEventListener {
76-
override fun onReactContextInitialized(context: ReactContext) {
77-
CustomPushNotification.setReactContext(context as ReactApplicationContext)
78-
}
79-
})
80-
8172
ApplicationLifecycleDispatcher.onApplicationCreate(this)
8273
}
8374

0 commit comments

Comments
 (0)