2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00
This commit is contained in:
Jeff Boek 2019-11-26 14:53:03 -08:00 committed by GitHub
parent 58a007659f
commit 11b8410367
3 changed files with 7 additions and 88 deletions

View File

@ -131,62 +131,6 @@
android:resource="@mipmap/ic_launcher" />
</activity>
<!-- Launch in private mode alias -->
<activity-alias
android:name="org.mozilla.fenix.alias.IntentReceiverActivity"
android:label="@string/app_name_private_2"
android:icon="@mipmap/ic_launcher_private"
android:roundIcon="@mipmap/ic_launcher_private_round"
android:targetActivity=".IntentReceiverActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="text/html" />
<data android:mimeType="text/plain" />
<data android:mimeType="application/xhtml+xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<meta-data
android:name="com.android.systemui.action_assist_icon"
android:resource="@mipmap/ic_launcher_private" />
<meta-data
android:name="org.mozilla.fenix.LAUNCH_PRIVATE_LINK"
android:value="true" />
</activity-alias>
<activity android:name=".widget.VoiceSearchActivity" />
<activity

View File

@ -6,7 +6,6 @@ package org.mozilla.fenix
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import androidx.annotation.VisibleForTesting
import kotlinx.coroutines.MainScope
@ -38,22 +37,7 @@ class IntentReceiverActivity : Activity() {
}
suspend fun processIntent(intent: Intent) {
val didLaunchPrivateLink = packageManager
?.getActivityInfo(componentName, PackageManager.GET_META_DATA)
?.metaData
?.getBoolean(LAUNCH_PRIVATE_LINK) ?: false
/* If LAUNCH_PRIVATE_LINK is set AND we're the default browser they must have pressed "always."
This is because LAUNCH_PRIVATE_LINK is only accessible through the "launch browser intent" menu
Which only appears if the user doesn't have a default set. */
if (didLaunchPrivateLink && Browsers.all(this).isDefaultBrowser) {
this.settings().openLinksInAPrivateTab = true
components.analytics.metrics.track(Event.PreferenceToggled(
preferenceKey = getString(R.string.pref_key_open_links_in_a_private_tab),
enabled = true,
context = applicationContext
))
} else if (!Browsers.all(this).isDefaultBrowser) {
if (!Browsers.all(this).isDefaultBrowser) {
/* If the user has unset us as the default browser, unset openLinksInAPrivateTab */
this.settings().openLinksInAPrivateTab = false
components.analytics.metrics.track(Event.PreferenceToggled(
@ -63,7 +47,7 @@ class IntentReceiverActivity : Activity() {
))
}
val tabIntentProcessor = if (settings().openLinksInAPrivateTab || didLaunchPrivateLink) {
val tabIntentProcessor = if (settings().openLinksInAPrivateTab) {
components.analytics.metrics.track(Event.OpenedLink(Event.OpenedLink.Mode.PRIVATE))
components.intentProcessors.privateIntentProcessor
} else {
@ -108,9 +92,4 @@ class IntentReceiverActivity : Activity() {
intent.putExtra(HomeActivity.OPEN_TO_BROWSER, openToBrowser)
}
companion object {
// This constant must match the metadata from the private activity-alias
const val LAUNCH_PRIVATE_LINK = "org.mozilla.fenix.LAUNCH_PRIVATE_LINK"
}
}

View File

@ -307,8 +307,9 @@ class HomeFragment : Fragment() {
super.onDestroyView()
}
override fun onResume() {
super.onResume()
override fun onStart() {
super.onStart()
subscribeToTabCollections()
getAutoDisposeObservable<SessionControlAction>()
.subscribe {
@ -351,11 +352,6 @@ class HomeFragment : Fragment() {
!PrivateShortcutCreateManager.doesPrivateBrowsingPinnedShortcutExist(context)) {
recommendPrivateBrowsingShortcut()
}
}
override fun onStart() {
super.onStart()
subscribeToTabCollections()
// We only want this observer live just before we navigate away to the collection creation screen
requireComponents.core.tabCollectionStorage.unregister(collectionStorageObserver)
@ -598,9 +594,9 @@ class HomeFragment : Fragment() {
}
}
override fun onPause() {
override fun onStop() {
invokePendingDeleteJobs()
super.onPause()
super.onStop()
val homeViewModel: HomeScreenViewModel by activityViewModels {
ViewModelProvider.NewInstanceFactory() // this is a workaround for #4652
}