mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/5733 - Private mode notification - wrong home screen (https://github.com/mozilla-mobile/fenix/pull/6188)
- added PRIVATE MODE intent extra to the notification action (could use also the OPEN_FROM_NOTIFICATION, but I considered this one to be more explicit. Kept the old one in case other checks will be done filtering for it) - added intent? param to the getPrivateModeFromIntent method, because onNewIntent() method does not set the activities intent, and it was needed to be used both in onCreate() and onNewIntent()
This commit is contained in:
parent
799f009731
commit
aa66b3e66e
@ -86,7 +86,7 @@ open class HomeActivity : AppCompatActivity() {
|
||||
final override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val mode = getPrivateModeFromIntent()
|
||||
val mode = getPrivateModeFromIntent(intent)
|
||||
|
||||
components.publicSuffixList.prefetch()
|
||||
setupThemeAndBrowsingMode(mode)
|
||||
@ -150,6 +150,7 @@ open class HomeActivity : AppCompatActivity() {
|
||||
|
||||
val intentProcessors = listOf(CrashReporterIntentProcessor()) + externalSourceIntentProcessors
|
||||
intentProcessors.any { it.process(intent, navHost.navController, this.intent) }
|
||||
browsingModeManager.mode = getPrivateModeFromIntent(intent)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,7 +193,7 @@ open class HomeActivity : AppCompatActivity() {
|
||||
* External sources such as 3rd party links and shortcuts use this function to enter
|
||||
* private mode directly before the content view is created.
|
||||
*/
|
||||
private fun getPrivateModeFromIntent(): BrowsingMode {
|
||||
private fun getPrivateModeFromIntent(intent: Intent?): BrowsingMode {
|
||||
intent?.toSafeIntent()?.let {
|
||||
if (it.hasExtra(PRIVATE_BROWSING_MODE)) {
|
||||
val startPrivateMode = it.getBooleanExtra(PRIVATE_BROWSING_MODE, false)
|
||||
|
@ -18,9 +18,8 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.getSystemService
|
||||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.support.utils.ThreadUtils
|
||||
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.metrics
|
||||
@ -104,6 +103,7 @@ class SessionNotificationService : Service() {
|
||||
private fun createOpenActionIntent(): PendingIntent {
|
||||
val intent = Intent(this, HomeActivity::class.java)
|
||||
intent.putExtra(HomeActivity.EXTRA_OPENED_FROM_NOTIFICATION, true)
|
||||
intent.putExtra(HomeActivity.PRIVATE_BROWSING_MODE, true)
|
||||
|
||||
return PendingIntent.getActivity(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user