diff --git a/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt b/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt index 0824938409c6..b35fe16f4e53 100644 --- a/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt +++ b/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt @@ -25,8 +25,11 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { } adjustTrackingProtection(host, context, session) + + return null + // Accounts uses interception to check for a "success URL" in the sign-in flow to finalize authentication. - return context.components.services.accountsAuthFeature.interceptor.onLoadRequest(session, uri) +// return context.components.services.accountsAuthFeature.interceptor.onLoadRequest(session, uri) } private fun adjustTrackingProtection(host: String, context: Context, session: EngineSession) { diff --git a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt index 90b1db780808..c34566b1ba20 100644 --- a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt @@ -62,6 +62,7 @@ class IntentReceiverActivity : Activity() { private fun setIntentActivity(intent: Intent) { val openToBrowser = when { components.utils.customTabIntentProcessor.matches(intent) -> { + // TODO This is potentially unsafe. Any app on the system can set the auth extra. val activityClass = if (intent.hasExtra(getString(R.string.intent_extra_auth))) { AuthCustomTabActivity::class } else { diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt index 79eb039ec10c..d5fd3b34b43a 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt @@ -27,6 +27,7 @@ import kotlinx.coroutines.withContext import mozilla.appservices.places.BookmarkRoot import mozilla.components.browser.session.Session import mozilla.components.feature.readerview.ReaderViewFeature +import mozilla.components.feature.accounts.WebChannelFeature import mozilla.components.feature.session.ThumbnailsFeature import mozilla.components.feature.sitepermissions.SitePermissions import mozilla.components.lib.state.ext.consumeFrom @@ -63,6 +64,7 @@ class BrowserFragment : BaseBrowserFragment(), BackHandler { private val readerViewFeature = ViewBoundFeatureWrapper() private val thumbnailsFeature = ViewBoundFeatureWrapper() + private val webchannelIntegration = ViewBoundFeatureWrapper() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -102,6 +104,18 @@ class BrowserFragment : BaseBrowserFragment(), BackHandler { view = view ) + webchannelIntegration.set( + feature = WebChannelFeature( + requireContext(), + customTabSessionId, + requireComponents.core.engine, + requireComponents.core.sessionManager, + requireComponents.backgroundServices.accountManager + ), + owner = this, + view = view + ) + readerViewFeature.set( feature = ReaderViewFeature( requireContext(), diff --git a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt index f9cbe3ced0af..ef557835ac31 100644 --- a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt +++ b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt @@ -54,7 +54,7 @@ class BackgroundServices( ) { companion object { const val CLIENT_ID = "a2270f727f45f648" - const val REDIRECT_URL = "https://accounts.firefox.com/oauth/success/$CLIENT_ID" + const val REDIRECT_URL = "urn:ietf:wg:oauth:2.0:oob:oauth-redirect-webchannel" } fun defaultDeviceName(context: Context): String = context.getString( @@ -64,7 +64,7 @@ class BackgroundServices( Build.MODEL ) - private val serverConfig = ServerConfig.release(CLIENT_ID, REDIRECT_URL) + private val serverConfig = ServerConfig("https://oauthchannel.dev.lcip.org", CLIENT_ID, REDIRECT_URL) private val deviceConfig = DeviceConfig( name = defaultDeviceName(context), type = DeviceType.MOBILE, diff --git a/app/src/main/java/org/mozilla/fenix/components/Core.kt b/app/src/main/java/org/mozilla/fenix/components/Core.kt index 0905b64db9f7..89ce9daa4a87 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Core.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Core.kt @@ -21,9 +21,6 @@ import mozilla.components.browser.storage.sync.PlacesHistoryStorage import mozilla.components.concept.engine.DefaultSettings import mozilla.components.concept.engine.Engine import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy -import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.SafeBrowsingCategory -import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.Companion.select -import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.TrackingCategory import mozilla.components.concept.engine.mediaquery.PreferredColorScheme import mozilla.components.concept.fetch.Client import mozilla.components.feature.media.MediaFeature @@ -179,10 +176,11 @@ class Core(private val context: Context) { normalMode && privateMode -> trackingProtectionPolicy normalMode && !privateMode -> trackingProtectionPolicy.forRegularSessionsOnly() !normalMode && privateMode -> trackingProtectionPolicy.forPrivateSessionsOnly() - else -> select( - trackingCategories = arrayOf(TrackingCategory.NONE), - safeBrowsingCategories = arrayOf(SafeBrowsingCategory.RECOMMENDED) - ) + else -> trackingProtectionPolicy.forRegularSessionsOnly() +// else -> select( +// trackingCategories = arrayOf(TrackingCategory.NONE), +// safeBrowsingCategories = arrayOf(SafeBrowsingCategory.RECOMMENDED) +// ) } } diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt b/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt index af762dcc7815..1a0432d05fe6 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt @@ -11,7 +11,6 @@ import org.mozilla.fenix.ext.components class AuthCustomTabActivity : CustomTabActivity() { private lateinit var accountManager: FxaAccountManager - // Navigate away from this activity when we have successful authentication private val accountStateObserver = object : AccountObserver { override fun onAuthenticated(account: OAuthAccount, newAccount: Boolean) { diff --git a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsUIView.kt b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsUIView.kt index 0719773af03f..8efea68e305f 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsUIView.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsUIView.kt @@ -111,7 +111,7 @@ class QuickSettingsUIView( drawableTint = R.color.photonGreen50 } else { stringId = R.string.quick_settings_sheet_insecure_connection - drawableId = R.drawable.mozac_ic_broken_lock + drawableId = R.drawable.mozac_ic_lock drawableTint = R.color.photonRed50 }