From 957e4c5bbe6d5d4d77acf1d12f9f15a20cf4fabb Mon Sep 17 00:00:00 2001 From: Sawyer Blatz Date: Fri, 24 May 2019 14:18:27 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/2327: Adds error state syncing --- .../java/org/mozilla/fenix/HomeActivity.kt | 6 +- .../components/toolbar/DefaultToolbarMenu.kt | 22 +++-- .../fenix/components/toolbar/ToolbarUIView.kt | 3 +- .../org/mozilla/fenix/home/HomeFragment.kt | 5 ++ .../library/bookmarks/BookmarkFragment.kt | 5 ++ .../SelectBookmarkFolderFragment.kt | 5 ++ .../fenix/settings/AccountPreference.kt | 42 +++++++++ .../fenix/settings/SettingsFragment.kt | 88 +++++++++++++++++-- .../fenix/settings/SyncProblemFragment.kt | 63 +++++++++++++ .../org/mozilla/fenix/share/AppShareView.kt | 2 - .../java/org/mozilla/fenix/utils/Settings.kt | 9 ++ .../main/res/drawable/ic_account_warning.xml | 9 ++ app/src/main/res/drawable/ic_alert.xml | 9 ++ .../main/res/layout/account_preference.xml | 78 ++++++++++++++++ app/src/main/res/navigation/nav_graph.xml | 6 ++ app/src/main/res/values/colors.xml | 2 + app/src/main/res/values/preference_keys.xml | 1 + app/src/main/res/xml/preferences.xml | 5 +- app/src/main/res/xml/sync_problem.xml | 14 +++ buildSrc/src/main/java/Dependencies.kt | 2 +- 20 files changed, 356 insertions(+), 20 deletions(-) create mode 100644 app/src/main/java/org/mozilla/fenix/settings/AccountPreference.kt create mode 100644 app/src/main/java/org/mozilla/fenix/settings/SyncProblemFragment.kt create mode 100644 app/src/main/res/drawable/ic_account_warning.xml create mode 100644 app/src/main/res/drawable/ic_alert.xml create mode 100644 app/src/main/res/layout/account_preference.xml create mode 100644 app/src/main/res/xml/sync_problem.xml diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index 6ba4e3fc5a..60ed7c2ce5 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -36,6 +36,7 @@ import org.mozilla.fenix.library.history.HistoryFragmentDirections import org.mozilla.fenix.search.SearchFragmentDirections import org.mozilla.fenix.settings.PairFragmentDirections import org.mozilla.fenix.settings.SettingsFragmentDirections +import org.mozilla.fenix.settings.SyncProblemFragmentDirections import org.mozilla.fenix.settings.TurnOnSyncFragmentDirections import org.mozilla.fenix.utils.Settings @@ -200,6 +201,8 @@ open class HomeActivity : AppCompatActivity() { BrowserDirection.FromTurnOnSync -> TurnOnSyncFragmentDirections.actionTurnOnSyncFragmentToBrowserFragment( customTabSessionId ) + BrowserDirection.FromSyncProblem -> + SyncProblemFragmentDirections.actionSyncProblemFragmentToBrowserFragment(customTabSessionId) } if (sessionObserver == null) sessionObserver = subscribeToSessions() @@ -288,5 +291,6 @@ open class HomeActivity : AppCompatActivity() { enum class BrowserDirection { FromGlobal, FromHome, FromSearch, FromSettings, FromBookmarks, - FromBookmarksFolderSelect, FromHistory, FromPair, FromTurnOnSync + FromBookmarksFolderSelect, FromHistory, FromPair, FromTurnOnSync, + FromSyncProblem } diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt index 18b2d0b07a..780cbe8c58 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt @@ -7,6 +7,7 @@ package org.mozilla.fenix.components.toolbar import android.content.Context import mozilla.components.browser.menu.BrowserMenuBuilder import mozilla.components.browser.menu.item.BrowserMenuDivider +import mozilla.components.browser.menu.item.BrowserMenuHighlightableItem import mozilla.components.browser.menu.item.BrowserMenuImageText import mozilla.components.browser.menu.item.BrowserMenuItemToolbar import mozilla.components.browser.menu.item.BrowserMenuSwitch @@ -18,7 +19,7 @@ import org.mozilla.fenix.ext.components class DefaultToolbarMenu( private val context: Context, - private val sessionId: String?, + private val hasSyncError: Boolean = false, private val requestDesktopStateProvider: () -> Boolean = { false }, private val onItemTapped: (ToolbarMenu.Item) -> Unit = {} ) : ToolbarMenu { @@ -103,10 +104,21 @@ class DefaultToolbarMenu( onItemTapped.invoke(ToolbarMenu.Item.Help) }, - BrowserMenuImageText( - context.getString(R.string.browser_menu_settings), - R.drawable.ic_settings, - DefaultThemeManager.resolveAttribute(R.attr.primaryText, context) + BrowserMenuHighlightableItem( + label = context.getString(R.string.browser_menu_settings), + imageResource = R.drawable.ic_settings, + iconTintColorResource = if (hasSyncError) + R.color.sync_error_text_color else + DefaultThemeManager.resolveAttribute(R.attr.primaryText, context), + textColorResource = if (hasSyncError) + R.color.sync_error_text_color else + DefaultThemeManager.resolveAttribute(R.attr.primaryText, context), + highlight = if (hasSyncError) { + BrowserMenuHighlightableItem.Highlight( + imageResource = R.drawable.ic_alert, + backgroundResource = R.color.sync_error_color + ) + } else null ) { onItemTapped.invoke(ToolbarMenu.Item.Settings) }, diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt index 90df43d59a..935abf9982 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt @@ -20,6 +20,7 @@ import org.mozilla.fenix.R import org.mozilla.fenix.customtabs.CustomTabToolbarMenu import org.mozilla.fenix.ext.components import org.mozilla.fenix.mvi.UIView +import org.mozilla.fenix.utils.Settings class ToolbarUIView( sessionId: String?, @@ -104,7 +105,7 @@ class ToolbarUIView( ) } else { DefaultToolbarMenu(this, - sessionId = sessionId, + hasSyncError = Settings.getInstance(this).hasSyncProblem, requestDesktopStateProvider = { session?.desktopMode ?: false }, onItemTapped = { actionEmitter.onNext(SearchAction.ToolbarMenuItemTapped(it)) } ) diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index aa66cd3dd1..593785d400 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -77,6 +77,7 @@ import org.mozilla.fenix.onboarding.FenixOnboarding import org.mozilla.fenix.settings.SupportUtils import org.mozilla.fenix.share.ShareTab import org.mozilla.fenix.utils.allowUndo +import org.mozilla.fenix.utils.Settings import kotlin.coroutines.CoroutineContext import kotlin.math.roundToInt @@ -682,6 +683,10 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver { Mode.Normal } + override fun onAuthenticationProblems() { + Settings.getInstance(context!!).setHasAuthenticationProblem(true) + emitAccountChanges() + } override fun onAuthenticated(account: OAuthAccount) { emitAccountChanges() } override fun onError(error: Exception) { emitAccountChanges() } override fun onLoggedOut() { emitAccountChanges() } diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt index 04435a92a4..dcea50b667 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt @@ -50,6 +50,7 @@ import org.mozilla.fenix.mvi.ActionBusFactory import org.mozilla.fenix.mvi.getAutoDisposeObservable import org.mozilla.fenix.mvi.getManagedEmitter import org.mozilla.fenix.utils.allowUndo +import org.mozilla.fenix.utils.Settings import kotlin.coroutines.CoroutineContext @SuppressWarnings("TooManyFunctions", "LargeClass") @@ -363,6 +364,10 @@ class BookmarkFragment : Fragment(), CoroutineScope, BackHandler, AccountObserve getManagedEmitter().onNext(SignInChange.SignedOut) } + override fun onAuthenticationProblems() { + Settings.getInstance(context!!).setHasAuthenticationProblem(true) + } + override fun onProfileUpdated(profile: Profile) { } diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt index 682aa2c4ac..921c5c2bec 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt @@ -46,6 +46,7 @@ import org.mozilla.fenix.library.bookmarks.SignInViewModel import org.mozilla.fenix.mvi.ActionBusFactory import org.mozilla.fenix.mvi.getAutoDisposeObservable import org.mozilla.fenix.mvi.getManagedEmitter +import org.mozilla.fenix.utils.Settings import kotlin.coroutines.CoroutineContext @SuppressWarnings("TooManyFunctions") @@ -156,6 +157,10 @@ class SelectBookmarkFolderFragment : Fragment(), CoroutineScope, AccountObserver } } + override fun onAuthenticationProblems() { + Settings.getInstance(context!!).setHasAuthenticationProblem(true) + } + override fun onAuthenticated(account: OAuthAccount) { getManagedEmitter().onNext(SignInChange.SignedIn) } diff --git a/app/src/main/java/org/mozilla/fenix/settings/AccountPreference.kt b/app/src/main/java/org/mozilla/fenix/settings/AccountPreference.kt new file mode 100644 index 0000000000..88bacf8c51 --- /dev/null +++ b/app/src/main/java/org/mozilla/fenix/settings/AccountPreference.kt @@ -0,0 +1,42 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.settings + +import android.content.Context +import android.util.AttributeSet +import android.view.View +import android.widget.ImageView +import android.widget.TextView +import androidx.preference.Preference +import androidx.preference.PreferenceViewHolder +import org.mozilla.fenix.R + +class AccountPreference : Preference { + + var title: TextView? = null + var summary: TextView? = null + var errorIcon: ImageView? = null + var background: View? = null + + constructor(context: Context) : super(context) + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + constructor(context: Context, attrs: AttributeSet?, attributeSetId: Int) : super( + context, + attrs, + attributeSetId + ) + + init { + layoutResource = R.layout.account_preference + } + + override fun onBindViewHolder(holder: PreferenceViewHolder) { + super.onBindViewHolder(holder) + title = holder.findViewById(R.id.title) as TextView + summary = holder.findViewById(R.id.summary) as TextView + errorIcon = holder.findViewById(R.id.error_icon) as ImageView + background = holder.itemView + } +} diff --git a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt index 60364d67f9..02d5a3660b 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt @@ -9,8 +9,10 @@ import android.content.Intent import android.net.Uri import android.os.Bundle import android.provider.Settings +import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import androidx.navigation.Navigation import androidx.preference.Preference import androidx.preference.Preference.OnPreferenceClickListener @@ -50,6 +52,7 @@ import org.mozilla.fenix.R.string.pref_key_tracking_protection_settings import org.mozilla.fenix.R.string.pref_key_your_rights import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.ext.components +import org.mozilla.fenix.ext.getColorFromAttr import org.mozilla.fenix.ext.getPreferenceKey import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.utils.ItsNotBrokenSnack @@ -66,12 +69,15 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse job = Job() setupAccountUI() updateSignInVisibility() + displayAccountErrorIfNecessary() preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener { sharedPreferences, key -> try { context?.let { - it.components.analytics.metrics.track(Event.PreferenceToggled - (key, sharedPreferences.getBoolean(key, false), it)) + it.components.analytics.metrics.track( + Event.PreferenceToggled + (key, sharedPreferences.getBoolean(key, false), it) + ) } } catch (e: IllegalArgumentException) { // The event is not tracked @@ -123,6 +129,7 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse setupPreferences() setupAccountUI() updateSignInVisibility() + displayAccountErrorIfNecessary() } @Suppress("ComplexMethod") @@ -171,7 +178,12 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse navigateToAbout() } resources.getString(pref_key_account) -> { - navigateToAccountSettings() + if (org.mozilla.fenix.utils.Settings.getInstance(preference.context).preferences + .getBoolean(context!!.getPreferenceKey(R.string.pref_key_sync_problem), false)) { + navigateToSyncProblem() + } else { + navigateToAccountSettings() + } } resources.getString(pref_key_delete_browsing_data) -> { navigateToDeleteBrowsingData() @@ -302,6 +314,11 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse Navigation.findNavController(view!!).navigate(directions) } + private fun navigateToSyncProblem() { + val directions = SettingsFragmentDirections.actionSettingsFragmentToSyncProblemFragment() + Navigation.findNavController(view!!).navigate(directions) + } + private fun navigateToAccountSettings() { val directions = SettingsFragmentDirections.actionSettingsFragmentToAccountSettingsFragment() @@ -316,6 +333,7 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse override fun onAuthenticated(account: OAuthAccount) { updateAuthState(account) updateSignInVisibility() + displayAccountErrorIfNecessary() } override fun onError(error: Exception) { @@ -329,16 +347,25 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse override fun onLoggedOut() { updateAuthState() updateSignInVisibility() + displayAccountErrorIfNecessary() } override fun onProfileUpdated(profile: Profile) { updateAccountProfile(profile) } + override fun onAuthenticationProblems() { + org.mozilla.fenix.utils.Settings.getInstance(context!!).setHasAuthenticationProblem(true) + displayAccountErrorIfNecessary() + } + // --- Account UI helpers --- private fun updateAuthState(account: OAuthAccount? = null) { // Cache the user's auth state to improve performance of sign in visibility org.mozilla.fenix.utils.Settings.getInstance(context!!).setHasCachedAccount(account != null) + + // Unset sync problems + org.mozilla.fenix.utils.Settings.getInstance(context!!).setHasAuthenticationProblem(false) } private fun updateSignInVisibility() { @@ -363,12 +390,59 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse } } - private fun updateAccountProfile(profile: Profile) { + private fun updateAccountProfile(profile: Profile, error: Boolean = false) { launch { val preferenceFirefoxAccount = - findPreference(context!!.getPreferenceKey(pref_key_account)) - preferenceFirefoxAccount?.title = profile.displayName.orEmpty() - preferenceFirefoxAccount?.summary = profile.email.orEmpty() + findPreference(context!!.getPreferenceKey(pref_key_account)) + + preferenceFirefoxAccount?.title?.setTextColor( + R.attr.primaryText.getColorFromAttr(context!!) + ) + preferenceFirefoxAccount?.title?.text = profile.displayName.orEmpty() + preferenceFirefoxAccount?.title?.visibility = + if (preferenceFirefoxAccount?.title?.text.isNullOrEmpty()) View.GONE else View.VISIBLE + + preferenceFirefoxAccount?.summary?.setTextColor( + R.attr.primaryText.getColorFromAttr(context!!) + ) + preferenceFirefoxAccount?.summary?.text = profile.email.orEmpty() + + preferenceFirefoxAccount?.icon = ContextCompat.getDrawable(context!!, R.drawable.ic_shortcuts) + preferenceFirefoxAccount?.errorIcon?.visibility = View.GONE + preferenceFirefoxAccount?.background?.background = null + } + } + + private fun displayAccountErrorIfNecessary() { + if (!org.mozilla.fenix.utils.Settings.getInstance(context!!).hasSyncProblem) { return } + + launch { + val preferenceFirefoxAccount = + findPreference(context!!.getPreferenceKey(pref_key_account)) + + preferenceFirefoxAccount?.title?.setTextColor( + ContextCompat.getColor( + context!!, + R.color.sync_error_text_color + ) + ) + preferenceFirefoxAccount?.title?.text = context!!.getString(R.string.preferences_account_sync_error) + preferenceFirefoxAccount?.title?.visibility = + if (preferenceFirefoxAccount?.title?.text.isNullOrEmpty()) View.GONE else View.VISIBLE + + preferenceFirefoxAccount?.summary?.setTextColor( + ContextCompat.getColor( + context!!, + R.color.sync_error_text_color + ) + ) + preferenceFirefoxAccount?.summary?.text = + requireComponents.backgroundServices.accountManager.accountProfile()?.email.orEmpty() + + preferenceFirefoxAccount?.icon = ContextCompat.getDrawable(context!!, R.drawable.ic_account_warning) + preferenceFirefoxAccount?.errorIcon?.visibility = View.VISIBLE + preferenceFirefoxAccount?.background?.background = + ContextCompat.getDrawable(context!!, R.color.sync_error_color) } } } diff --git a/app/src/main/java/org/mozilla/fenix/settings/SyncProblemFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SyncProblemFragment.kt new file mode 100644 index 0000000000..d17db419bd --- /dev/null +++ b/app/src/main/java/org/mozilla/fenix/settings/SyncProblemFragment.kt @@ -0,0 +1,63 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.settings + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import androidx.navigation.Navigation +import androidx.preference.Preference +import androidx.preference.PreferenceFragmentCompat +import org.mozilla.fenix.BrowserDirection +import org.mozilla.fenix.HomeActivity +import org.mozilla.fenix.R +import org.mozilla.fenix.ext.getPreferenceKey +import org.mozilla.fenix.ext.requireComponents + +class SyncProblemFragment : PreferenceFragmentCompat() { + + override fun onResume() { + super.onResume() + (activity as AppCompatActivity).title = getString(R.string.sync_reconnect) + (activity as AppCompatActivity).supportActionBar?.show() + } + + override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { + setPreferencesFromResource(R.xml.sync_problem, rootKey) + + val preferenceSignIn = + findPreference(context!!.getPreferenceKey(R.string.pref_key_sync_sign_in)) + val preferenceNewAccount = + findPreference(context!!.getPreferenceKey(R.string.pref_key_sync_create_account)) + val preferencePairSignIn = + findPreference(context!!.getPreferenceKey(R.string.pref_key_sync_pair)) + preferenceSignIn?.onPreferenceClickListener = getClickListenerForSignIn() + preferenceNewAccount?.onPreferenceClickListener = getClickListenerForSignIn() + preferencePairSignIn?.onPreferenceClickListener = getClickListenerForPairing() + } + + private fun getClickListenerForSignIn(): Preference.OnPreferenceClickListener { + return Preference.OnPreferenceClickListener { + requireComponents.services.accountsAuthFeature.beginAuthentication() + // TODO The sign-in web content populates session history, + // so pressing "back" after signing in won't take us back into the settings screen, but rather up the + // session history stack. + // We could auto-close this tab once we get to the end of the authentication process? + // Via an interceptor, perhaps. + view?.let { + (activity as HomeActivity).openToBrowser(BrowserDirection.FromSyncProblem) + } + true + } + } + + private fun getClickListenerForPairing(): Preference.OnPreferenceClickListener { + return Preference.OnPreferenceClickListener { + val directions = TurnOnSyncFragmentDirections.actionTurnOnSyncFragmentToPairInstructionsFragment() + Navigation.findNavController(view!!).navigate(directions) + + true + } + } +} diff --git a/app/src/main/java/org/mozilla/fenix/share/AppShareView.kt b/app/src/main/java/org/mozilla/fenix/share/AppShareView.kt index d0f93685bd..3a260540c7 100644 --- a/app/src/main/java/org/mozilla/fenix/share/AppShareView.kt +++ b/app/src/main/java/org/mozilla/fenix/share/AppShareView.kt @@ -10,7 +10,6 @@ import android.content.Intent.ACTION_SEND import android.content.Intent.FLAG_ACTIVITY_NEW_TASK import android.graphics.drawable.Drawable import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -109,7 +108,6 @@ class AppShareItemViewHolder( init { itemView.setOnClickListener { - Log.d("Jonathan", "${shareItem?.name} clicked.") shareItem?.let { actionEmitter.onNext(ShareAction.ShareAppClicked(it)) } diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index 1d134e8211..4662144778 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -155,6 +155,9 @@ class Settings private constructor(context: Context) { val hasCachedAccount: Boolean get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_cached_account), false) + val hasSyncProblem: Boolean + get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_sync_problem), false) + private val autoBounceQuickActionSheetCount: Int get() = (preferences.getInt(appContext.getPreferenceKey(R.string.pref_key_bounce_quick_action), 0)) @@ -235,6 +238,12 @@ class Settings private constructor(context: Context) { .apply() } + fun setHasAuthenticationProblem(hasProblem: Boolean) { + preferences.edit() + .putBoolean(appContext.getPreferenceKey(R.string.pref_key_sync_problem), hasProblem) + .apply() + } + private val SitePermissionsRules.Action.id: Int get() { return when (this) { diff --git a/app/src/main/res/drawable/ic_account_warning.xml b/app/src/main/res/drawable/ic_account_warning.xml new file mode 100644 index 0000000000..5ecec3d7e6 --- /dev/null +++ b/app/src/main/res/drawable/ic_account_warning.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_alert.xml b/app/src/main/res/drawable/ic_alert.xml new file mode 100644 index 0000000000..03b067c4c9 --- /dev/null +++ b/app/src/main/res/drawable/ic_alert.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/account_preference.xml b/app/src/main/res/layout/account_preference.xml new file mode 100644 index 0000000000..45d72aef85 --- /dev/null +++ b/app/src/main/res/layout/account_preference.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 1978a6c5a8..a3c78cced7 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -290,6 +290,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e3c413dacd..63d4e73d73 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -139,6 +139,8 @@ #cccccc #E7DFFF #232749 + #FFF36E + #960E18 @color/primary_text_light_theme diff --git a/app/src/main/res/values/preference_keys.xml b/app/src/main/res/values/preference_keys.xml index dda5e7f4dd..64280ab847 100644 --- a/app/src/main/res/values/preference_keys.xml +++ b/app/src/main/res/values/preference_keys.xml @@ -45,6 +45,7 @@ pref_key_sync_sign_in pref_key_sync_create_account pref_key_sync_syncing_items + pref_key_sync_problem pref_key_show_search_suggestions diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 520b6a06c4..021a4d585e 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -19,10 +19,9 @@ app:iconSpaceReserved="false" app:isPreferenceVisible="false"> - + android:key="@string/pref_key_account"/> + + + + + + diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 7f33332504..33574ebb7a 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -29,7 +29,7 @@ private object Versions { const val androidx_transition = "1.1.0-rc01" const val google_material = "1.1.0-alpha06" - const val mozilla_android_components = "0.54.0-SNAPSHOT" + const val mozilla_android_components = "0.55.0-SNAPSHOT" // Note that android-components also depends on application-services, // and in fact is our main source of appservices-related functionality. // The version number below tracks the application-services version