Skip to content

Commit

Permalink
Update customtabs service
Browse files Browse the repository at this point in the history
  • Loading branch information
NotWoods authored and ekager committed Jun 25, 2020
1 parent a684cfe commit c958cc0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ dependencies {
implementation Deps.mozilla_feature_webnotifications
implementation Deps.mozilla_feature_webcompat_reporter

implementation Deps.mozilla_service_digitalassetlinks
implementation Deps.mozilla_service_experiments
implementation Deps.mozilla_service_sync_logins
implementation Deps.mozilla_service_firefox_accounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Components(private val context: Context) {
core.sessionManager,
useCases.sessionUseCases,
useCases.searchUseCases,
core.client,
core.relationChecker,
core.customTabsStore,
migrationStore,
core.webAppManifestStorage
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/org/mozilla/fenix/components/Core.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ import mozilla.components.feature.webcompat.reporter.WebCompatReporterFeature
import mozilla.components.feature.webnotifications.WebNotificationFeature
import mozilla.components.lib.dataprotect.SecureAbove22Preferences
import mozilla.components.lib.dataprotect.generateEncryptionKey
import mozilla.components.service.digitalassetlinks.RelationChecker
import mozilla.components.service.digitalassetlinks.api.DigitalAssetLinksApi
import mozilla.components.service.sync.logins.SyncableLoginsStorage
import org.mozilla.fenix.AppRequestInterceptor
import org.mozilla.fenix.BuildConfig.DIGITAL_ASSET_LINKS_TOKEN
import org.mozilla.fenix.Config
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
Expand Down Expand Up @@ -136,6 +139,13 @@ class Core(private val context: Context) {
*/
val customTabsStore by lazy { CustomTabsServiceStore() }

/**
* The [RelationChecker] checks Digital Asset Links relationships for Trusted Web Activities.
*/
val relationChecker: RelationChecker by lazy {
DigitalAssetLinksApi(client, DIGITAL_ASSET_LINKS_TOKEN)
}

/**
* The session manager component provides access to a centralized registry of
* all browser sessions (i.e. tabs). It is initialized here to persist and restore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package org.mozilla.fenix.components

import android.content.Context
import mozilla.components.browser.session.SessionManager
import mozilla.components.concept.fetch.Client
import mozilla.components.feature.customtabs.CustomTabIntentProcessor
import mozilla.components.feature.customtabs.store.CustomTabsServiceStore
import mozilla.components.feature.intent.processing.TabIntentProcessor
Expand All @@ -15,9 +14,9 @@ import mozilla.components.feature.pwa.intent.TrustedWebActivityIntentProcessor
import mozilla.components.feature.pwa.intent.WebAppIntentProcessor
import mozilla.components.feature.search.SearchUseCases
import mozilla.components.feature.session.SessionUseCases
import mozilla.components.service.digitalassetlinks.RelationChecker
import mozilla.components.support.migration.MigrationIntentProcessor
import mozilla.components.support.migration.state.MigrationStore
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.customtabs.FennecWebAppIntentProcessor
import org.mozilla.fenix.home.intent.FennecBookmarkShortcutsIntentProcessor
import org.mozilla.fenix.utils.Mockable
Expand All @@ -31,7 +30,7 @@ class IntentProcessors(
private val sessionManager: SessionManager,
private val sessionUseCases: SessionUseCases,
private val searchUseCases: SearchUseCases,
private val httpClient: Client,
private val relationChecker: RelationChecker,
private val customTabsStore: CustomTabsServiceStore,
private val migrationStore: MigrationStore,
private val manifestStorage: ManifestStorage
Expand Down Expand Up @@ -63,9 +62,8 @@ class IntentProcessors(
TrustedWebActivityIntentProcessor(
sessionManager = sessionManager,
loadUrlUseCase = sessionUseCases.loadUrl,
httpClient = httpClient,
packageManager = context.packageManager,
apiKey = BuildConfig.DIGITAL_ASSET_LINKS_TOKEN,
relationChecker = relationChecker,
store = customTabsStore
),
WebAppIntentProcessor(sessionManager, sessionUseCases.loadUrl, manifestStorage),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ package org.mozilla.fenix.customtabs

import mozilla.components.concept.engine.Engine
import mozilla.components.feature.customtabs.AbstractCustomTabsService
import org.mozilla.fenix.BuildConfig.DIGITAL_ASSET_LINKS_TOKEN
import org.mozilla.fenix.ext.components

class CustomTabsService : AbstractCustomTabsService() {
override val engine: Engine by lazy { applicationContext.components.core.engine }
override val customTabsServiceStore by lazy { applicationContext.components.core.customTabsStore }
override val httpClient by lazy { applicationContext.components.core.client }
override val apiKey: String? = DIGITAL_ASSET_LINKS_TOKEN
override val engine: Engine by lazy { components.core.engine }
override val customTabsServiceStore by lazy { components.core.customTabsStore }
override val relationChecker by lazy { components.core.relationChecker }
}
2 changes: 2 additions & 0 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ object Deps {
const val mozilla_feature_webnotifications = "org.mozilla.components:feature-webnotifications:${Versions.mozilla_android_components}"
const val mozilla_feature_webcompat_reporter = "org.mozilla.components:feature-webcompat-reporter:${Versions.mozilla_android_components}"

const val mozilla_service_digitalassetlinks =
"org.mozilla.components:service-digitalassetlinks:${Versions.mozilla_android_components}"
const val mozilla_service_experiments =
"org.mozilla.components:service-experiments:${Versions.mozilla_android_components}"
const val mozilla_service_sync_logins =
Expand Down

0 comments on commit c958cc0

Please sign in to comment.