Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode VERSIONCODE as Integer
versionName "4.68.1"
versionName "4.68.2"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
resValue "string", "rn_config_reader_custom_package", "chat.rocket.reactnative"
Expand Down
56 changes: 7 additions & 49 deletions android/app/src/main/java/chat/rocket/reactnative/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import android.os.Bundle
import com.zoontek.rnbootsplash.RNBootSplash
import android.content.Intent
import android.content.res.Configuration
import chat.rocket.reactnative.notification.VideoConfModule
import chat.rocket.reactnative.notification.VideoConfNotification
import com.google.gson.GsonBuilder
import chat.rocket.reactnative.notification.NotificationIntentHandler

class MainActivity : ReactActivity() {

Expand All @@ -32,56 +30,16 @@ class MainActivity : ReactActivity() {
RNBootSplash.init(this, R.style.BootTheme)
super.onCreate(null)

// Handle video conf action from notification
intent?.let { handleVideoConfIntent(it) }
// Handle notification intents
intent?.let { NotificationIntentHandler.handleIntent(this, it) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "NotificationIntentHandler.kt" -type f

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 171


🏁 Script executed:

wc -l ./android/app/src/main/java/chat/rocket/reactnative/notification/NotificationIntentHandler.kt

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 175


🏁 Script executed:

cat -n ./android/app/src/main/java/chat/rocket/reactnative/notification/NotificationIntentHandler.kt

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 7595


🏁 Script executed:

sed -n '1,60p' android/app/src/main/java/chat/rocket/reactnative/MainActivity.kt

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 1713


🏁 Script executed:

rg -n "ACTION_VIEW|deep.*link|scheme|data.*intent|android:scheme" --type=kotlin android/app/src/main/

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 358


🏁 Script executed:

find . -name "AndroidManifest.xml" -path "*/android/app/src/main/*"

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 120


🏁 Script executed:

grep -A 20 "MainActivity" ./android/app/src/main/AndroidManifest.xml

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 1407


🏁 Script executed:

rg -n "ACTION_VIEW|handleIntent" --type=kotlin android/app/src/main/java/chat/rocket/reactnative/

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 856


🏁 Script executed:

rg -n "intent.data|ACTION_VIEW|getAction|scheme" --type=kotlin android/app/src/main/java/chat/rocket/reactnative/ -A 3 -B 1

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 1987


Deep link intents are not being processed by NotificationIntentHandler.

The centralized notification handling correctly processes video conference notifications (via videoConfAction extra) and regular push notifications (via ejson extra). However, deep link intents registered in AndroidManifest.xml (ACTION_VIEW with https://go.rocket.chat paths) are silently dropped because they lack the ejson extra and are not checked for ACTION_VIEW or intent data. The handleNotificationIntent method returns early at line 87-92 when ejson is null/empty, which excludes all deep links from processing.

Either:

  • Extend NotificationIntentHandler to handle ACTION_VIEW intents and extract/process the intent data URI
  • Or remove the deep link intent-filters from the manifest if deep linking is not supported
🤖 Prompt for AI Agents
In @android/app/src/main/java/chat/rocket/reactnative/MainActivity.kt at line
34, Notification intents are currently ignored for deep links because
NotificationIntentHandler.handleIntent calls handleNotificationIntent which
returns early when the "ejson" extra is empty, so ACTION_VIEW intents or intents
with a data URI (deep links) are never processed; update
NotificationIntentHandler (specifically handleIntent and
handleNotificationIntent) to detect Intent.ACTION_VIEW or a non-null intent.data
URI (in addition to videoConfAction and ejson) and extract/route the deep link
URI for processing, or if deep linking is not intended remove the ACTION_VIEW
deep link intent-filters from AndroidManifest.xml so deep link intents are not
delivered to this handler.

}

public override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
// Handle video conf action when activity is already running
handleVideoConfIntent(intent)
}

private fun handleVideoConfIntent(intent: Intent) {
if (intent.getBooleanExtra("videoConfAction", false)) {
val notificationId = intent.getIntExtra("notificationId", 0)
val event = intent.getStringExtra("event") ?: return
val rid = intent.getStringExtra("rid") ?: ""
val callerId = intent.getStringExtra("callerId") ?: ""
val callerName = intent.getStringExtra("callerName") ?: ""
val host = intent.getStringExtra("host") ?: ""
val callId = intent.getStringExtra("callId") ?: ""

android.util.Log.d("RocketChat.MainActivity", "Handling video conf intent - event: $event, rid: $rid, host: $host, callId: $callId")

// Cancel the notification
if (notificationId != 0) {
VideoConfNotification.cancelById(this, notificationId)
}

// Store action for JS to pick up - include all required fields
val data = mapOf(
"notificationType" to "videoconf",
"rid" to rid,
"event" to event,
"host" to host,
"callId" to callId,
"caller" to mapOf(
"_id" to callerId,
"name" to callerName
)
)

val gson = GsonBuilder().create()
val jsonData = gson.toJson(data)

android.util.Log.d("RocketChat.MainActivity", "Storing video conf action: $jsonData")

VideoConfModule.storePendingAction(this, jsonData)

// Clear the video conf flag to prevent re-processing
intent.removeExtra("videoConfAction")
}
setIntent(intent)

// Handle notification intents when activity is already running
NotificationIntentHandler.handleIntent(this, intent)
}

override fun invokeDefaultOnBackPressed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import android.content.res.Configuration
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactInstanceEventListener
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.ReactContext
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
Expand All @@ -21,8 +18,8 @@ import expo.modules.ApplicationLifecycleDispatcher
import chat.rocket.reactnative.networking.SSLPinningTurboPackage;
import chat.rocket.reactnative.storage.MMKVKeyManager;
import chat.rocket.reactnative.storage.SecureStoragePackage;
import chat.rocket.reactnative.notification.CustomPushNotification;
import chat.rocket.reactnative.notification.VideoConfTurboPackage
import chat.rocket.reactnative.notification.PushNotificationTurboPackage

/**
* Main Application class.
Expand All @@ -45,6 +42,7 @@ open class MainApplication : Application(), ReactApplication {
add(SSLPinningTurboPackage())
add(WatermelonDBJSIPackage())
add(VideoConfTurboPackage())
add(PushNotificationTurboPackage())
add(SecureStoragePackage())
}

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

// Register listener to set React context when initialized
reactHost.addReactInstanceEventListener(object : ReactInstanceEventListener {
override fun onReactContextInitialized(context: ReactContext) {
CustomPushNotification.setReactContext(context as ReactApplicationContext)
}
})

ApplicationLifecycleDispatcher.onApplicationCreate(this)
}

Expand Down
Loading
Loading