diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingFirefoxAccountViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingFirefoxAccountViewHolder.kt index ac8136b451..442a2666d5 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingFirefoxAccountViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingFirefoxAccountViewHolder.kt @@ -5,15 +5,22 @@ package org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding import android.view.View +import androidx.navigation.Navigation import androidx.recyclerview.widget.RecyclerView import kotlinx.android.synthetic.main.onboarding_firefox_account.view.* import org.mozilla.fenix.R +import org.mozilla.fenix.home.HomeFragmentDirections class OnboardingFirefoxAccountViewHolder(view: View) : RecyclerView.ViewHolder(view) { init { val appName = view.context.getString(R.string.app_name) view.header_text.text = view.context.getString(R.string.onboarding_firefox_account_header, appName) + + view.turn_on_sync_button.setOnClickListener { + val directions = HomeFragmentDirections.actionHomeFragmentToTurnOnSyncFragment() + Navigation.findNavController(view).navigate(directions) + } } companion object { diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivateBrowsingViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivateBrowsingViewHolder.kt index c5498333c3..3220ff5a3e 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivateBrowsingViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingPrivateBrowsingViewHolder.kt @@ -14,8 +14,6 @@ import androidx.recyclerview.widget.RecyclerView import kotlinx.android.synthetic.main.onboarding_private_browsing.view.* import org.mozilla.fenix.R - - class OnboardingPrivateBrowsingViewHolder(view: View) : RecyclerView.ViewHolder(view) { init { diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingThemePickerViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingThemePickerViewHolder.kt index b364065c7f..1ba3365c59 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingThemePickerViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingThemePickerViewHolder.kt @@ -11,7 +11,6 @@ import androidx.recyclerview.widget.RecyclerView import kotlinx.android.synthetic.main.onboarding_section_header.view.* import kotlinx.android.synthetic.main.onboarding_theme_picker.view.* import org.mozilla.fenix.R -import org.mozilla.fenix.ext.asActivity import org.mozilla.fenix.ext.components import org.mozilla.fenix.utils.Settings diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingTrackingProtectionViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingTrackingProtectionViewHolder.kt index 559119b709..4534f024ab 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingTrackingProtectionViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/onboarding/OnboardingTrackingProtectionViewHolder.kt @@ -29,12 +29,11 @@ class OnboardingTrackingProtectionViewHolder(val view: View) : RecyclerView.View val switch = view.tracking_protection_toggle - switch.isChecked = Settings.getInstance(view.context).shouldUseTrackingProtection + switch.isChecked = Settings.getInstance(view.context).shouldUseTrackingProtection switch.setOnCheckedChangeListener { _, isChecked -> updateTrackingProtectionSetting(isChecked) } - } private fun updateTrackingProtectionSetting(enabled: Boolean) { @@ -42,12 +41,9 @@ class OnboardingTrackingProtectionViewHolder(val view: View) : RecyclerView.View with(view.context.components.core) { val policy = createTrackingProtectionPolicy(enabled) engine.settings.trackingProtectionPolicy = policy - with(sessionManager) { - sessions.forEach { - if (enabled) - getEngineSession(it)?.enableTrackingProtection(policy) else - getEngineSession(it)?.disableTrackingProtection() - } + sessionManager.sessions.forEach { + if (enabled) sessionManager.getEngineSession(it)?.enableTrackingProtection(policy) + else sessionManager.getEngineSession(it)?.disableTrackingProtection() } } diff --git a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt index d48023d57a..a792f5e038 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt @@ -50,7 +50,6 @@ object SupportUtils { setPackage(context.packageName) } - private fun getEncodedTopicUTF8(topic: String): String { try { return URLEncoder.encode(topic, "UTF-8") diff --git a/app/src/main/res/layout/onboarding_firefox_account.xml b/app/src/main/res/layout/onboarding_firefox_account.xml index 98a484c58f..d13a71d1af 100644 --- a/app/src/main/res/layout/onboarding_firefox_account.xml +++ b/app/src/main/res/layout/onboarding_firefox_account.xml @@ -20,7 +20,7 @@ android:textAppearance="@style/Header16TextStyle" android:textColor="@color/onboarding_card_primary_text_dark"/> +