Merge remote-tracking branch 'origin/master'
commit
880f924fc5
|
@ -14,26 +14,12 @@ import org.mozilla.fenix.HomeActivity
|
|||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.home.intent.StartSearchIntentProcessor
|
||||
import java.util.UUID
|
||||
import android.content.pm.ShortcutManager
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
|
||||
/**
|
||||
* Handles the creation and existence of pinned shortcuts.
|
||||
* Handles the creation of pinned shortcuts.
|
||||
*/
|
||||
object PrivateShortcutCreateManager {
|
||||
|
||||
fun doesPrivateBrowsingPinnedShortcutExist(context: Context): Boolean {
|
||||
return if (SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
val pinnedShortcuts = context.getSystemService(ShortcutManager::class.java).pinnedShortcuts
|
||||
pinnedShortcuts.any {
|
||||
it.intent?.extras?.getString(HomeActivity.OPEN_TO_SEARCH) ==
|
||||
StartSearchIntentProcessor.PRIVATE_BROWSING_PINNED_SHORTCUT
|
||||
}
|
||||
} else
|
||||
false
|
||||
}
|
||||
|
||||
fun createPrivateShortcut(context: Context) {
|
||||
if (!ShortcutManagerCompat.isRequestPinShortcutSupported(context)) return
|
||||
|
||||
|
|
|
@ -340,8 +340,7 @@ class HomeFragment : Fragment() {
|
|||
}, owner = this)
|
||||
|
||||
if (context.settings().showPrivateModeContextualFeatureRecommender &&
|
||||
browsingModeManager.mode.isPrivate &&
|
||||
!PrivateShortcutCreateManager.doesPrivateBrowsingPinnedShortcutExist(context)) {
|
||||
browsingModeManager.mode.isPrivate) {
|
||||
recommendPrivateBrowsingShortcut()
|
||||
}
|
||||
|
||||
|
|
|
@ -173,11 +173,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
}
|
||||
|
||||
findPreference<Preference>(getPreferenceKey(pref_key_add_private_browsing_shortcut))?.apply {
|
||||
isVisible =
|
||||
!PrivateShortcutCreateManager.doesPrivateBrowsingPinnedShortcutExist(context)
|
||||
}
|
||||
|
||||
setupPreferences()
|
||||
|
||||
updateAccountUIState(
|
||||
|
|
|
@ -155,6 +155,8 @@
|
|||
<string name="settings">Settings</string>
|
||||
<!-- Preference category for basic settings -->
|
||||
<string name="preferences_category_basics">Basics</string>
|
||||
<!-- Preference category for general settings -->
|
||||
<string name="preferences_category_general">General</string>
|
||||
<!-- Preference category for all links about Fenix -->
|
||||
<string name="preferences_category_about">About</string>
|
||||
<!-- Preference for settings related to changing the default search engine -->
|
||||
|
@ -184,8 +186,12 @@
|
|||
<string name="preferences_category_advanced">Advanced</string>
|
||||
<!-- Preference category for privacy settings -->
|
||||
<string name="preferences_category_privacy">Privacy</string>
|
||||
<!-- Preference category for privacy and security settings -->
|
||||
<string name="preferences_category_privacy_security">Privacy and security</string>
|
||||
<!-- Preference for advanced site permissions -->
|
||||
<string name="preferences_site_permissions">Site permissions</string>
|
||||
<!-- Preference for private browsing options -->
|
||||
<string name="preferences_private_browsing_options">Private browsing</string>
|
||||
<!-- Preference for opening links in a private tab-->
|
||||
<string name="preferences_open_links_in_a_private_tab">Open links in a private tab</string>
|
||||
<!-- Preference for adding private browsing shortcut -->
|
||||
|
@ -200,6 +206,8 @@
|
|||
<string name="preferences_toolbar">Toolbar</string>
|
||||
<!-- Preference for changing default theme to dark or light mode -->
|
||||
<string name="preferences_theme">Theme</string>
|
||||
<!-- Preference for settings related to visual options -->
|
||||
<string name="preferences_customize">Customize</string>
|
||||
<!-- Preference description for banner about signing in -->
|
||||
<string name="preferences_sign_in_description">Sync bookmarks, history, and more with your Firefox Account</string>
|
||||
<!-- Preference shown instead of account display name while account profile information isn't available yet. -->
|
||||
|
|
Loading…
Reference in New Issue