From f6fc1a45d1973cb576c630181874361fde00d9c5 Mon Sep 17 00:00:00 2001 From: indu Date: Thu, 11 Aug 2022 10:31:59 +0530 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/26037: Open shared FireFox tab from another device in Firefox browser This fix will allow the tab that's being shared from a device to open in FireFox browser in the device that receives the tab, even if another browser is set as default in the destination device. Co-Authored-By: Mugurell --- .../org/mozilla/fenix/components/NotificationManager.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/NotificationManager.kt b/app/src/main/java/org/mozilla/fenix/components/NotificationManager.kt index 8122162c62..0abf97b282 100644 --- a/app/src/main/java/org/mozilla/fenix/components/NotificationManager.kt +++ b/app/src/main/java/org/mozilla/fenix/components/NotificationManager.kt @@ -20,6 +20,7 @@ import androidx.core.content.getSystemService import mozilla.components.concept.sync.Device import mozilla.components.concept.sync.TabData import mozilla.components.support.base.log.logger.Logger +import org.mozilla.fenix.IntentReceiverActivity import org.mozilla.fenix.R import org.mozilla.fenix.utils.IntentUtils @@ -60,8 +61,11 @@ class NotificationManager(private val context: Context) { logger.debug("${filteredTabs.size} tab(s) after filtering for unsupported schemes") filteredTabs.forEach { tab -> val showReceivedTabsIntentFlags = IntentUtils.defaultIntentPendingFlags or PendingIntent.FLAG_ONE_SHOT - val intent = Intent(Intent.ACTION_VIEW, Uri.parse(tab.url)) - intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK + val intent = Intent(context, IntentReceiverActivity::class.java).apply { + action = Intent.ACTION_VIEW + data = Uri.parse(tab.url) + flags = Intent.FLAG_ACTIVITY_NEW_TASK + } intent.putExtra(RECEIVE_TABS_TAG, true) val pendingIntent: PendingIntent = PendingIntent.getActivity(context, 0, intent, showReceivedTabsIntentFlags)