2020-02-27 22:32:24 +01:00
|
|
|
/* 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
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import mozilla.components.concept.engine.EngineSession
|
|
|
|
import mozilla.components.concept.engine.request.RequestInterceptor
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
import org.mozilla.fenix.ui.robots.appContext
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class overrides the application's request interceptor to
|
|
|
|
* deactivate the FxA web channel
|
|
|
|
* which is not supported on the staging servers.
|
2020-06-27 15:43:34 +02:00
|
|
|
*/
|
2020-02-27 22:32:24 +01:00
|
|
|
|
|
|
|
class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|
|
|
override fun onLoadRequest(
|
|
|
|
engineSession: EngineSession,
|
|
|
|
uri: String,
|
2020-07-28 01:03:45 +02:00
|
|
|
lastUri: String?,
|
2020-02-27 22:32:24 +01:00
|
|
|
hasUserGesture: Boolean,
|
2020-06-27 15:43:34 +02:00
|
|
|
isSameDomain: Boolean,
|
2020-07-05 16:20:28 +02:00
|
|
|
isRedirect: Boolean,
|
2020-07-14 21:25:05 +02:00
|
|
|
isDirectNavigation: Boolean,
|
|
|
|
isSubframeRequest: Boolean
|
2020-02-27 22:32:24 +01:00
|
|
|
): RequestInterceptor.InterceptionResponse? {
|
|
|
|
return appContext.components.services.accountsAuthFeature.interceptor.onLoadRequest(
|
2020-07-28 01:03:45 +02:00
|
|
|
engineSession, uri, lastUri, hasUserGesture, isSameDomain, isRedirect, isDirectNavigation, isSubframeRequest
|
2020-06-27 15:43:34 +02:00
|
|
|
)
|
2020-02-27 22:32:24 +01:00
|
|
|
}
|
|
|
|
}
|