commit 6b53a2ec7336bf3350d55d4ce634810abd26ac38 parent 3af3263ff263064953e8a19f335a4254a78c8dfa Author: mike a. <mavduevskiy@mozilla.com> Date: Mon, 24 Nov 2025 22:47:21 +0000 Bug 1996985 - Change API to implementation for appservices_fxrelay in build.gradle r=android-reviewers,gmalekpour Differential Revision: https://phabricator.services.mozilla.com/D273875 Diffstat:
3 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/mobile/android/android-components/components/service/firefox-relay/build.gradle b/mobile/android/android-components/components/service/firefox-relay/build.gradle @@ -28,7 +28,7 @@ android { } dependencies { - api ComponentsDependencies.mozilla_appservices_fxrelay + implementation ComponentsDependencies.mozilla_appservices_fxrelay implementation project(':components:support-base') implementation libs.kotlinx.coroutines.core } diff --git a/mobile/android/android-components/components/service/firefox-relay/src/main/java/mozilla/components/service/fxrelay/FxRelay.kt b/mobile/android/android-components/components/service/firefox-relay/src/main/java/mozilla/components/service/fxrelay/FxRelay.kt @@ -6,7 +6,6 @@ package mozilla.components.service.fxrelay import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import mozilla.appservices.relay.RelayAddress import mozilla.appservices.relay.RelayApiException import mozilla.appservices.relay.RelayClient import mozilla.components.support.base.log.logger.Logger @@ -100,7 +99,7 @@ class FxRelay( usedOn: String, ): RelayAddress? = withContext(Dispatchers.IO) { handleRelayExceptions(RelayOperation.CREATE_ADDRESS, { null }) { - client.createAddress(description, generatedFor, usedOn) + client.createAddress(description, generatedFor, usedOn).into() } } @@ -111,7 +110,7 @@ class FxRelay( handleRelayExceptions( RelayOperation.FETCH_ALL_ADDRESSES, { emptyList() }, ) { - client.fetchAddresses() + client.fetchAddresses().map { it.into() } } } } diff --git a/mobile/android/android-components/components/service/firefox-relay/src/main/java/mozilla/components/service/fxrelay/RelayAddress.kt b/mobile/android/android-components/components/service/firefox-relay/src/main/java/mozilla/components/service/fxrelay/RelayAddress.kt @@ -0,0 +1,58 @@ +/* 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 mozilla.components.service.fxrelay + +/** + * Represents a Relay email address object. + * + * Includes metadata and statistics for an alias, such as its status, usage stats, and identifying + * information. + */ +data class RelayAddress( + var maskType: String, + var enabled: Boolean, + var description: String, + var generatedFor: String, + var blockListEmails: Boolean, + var usedOn: String?, + var id: Long, + var address: String, + var domain: Long, + var fullAddress: String, + var createdAt: String, + var lastModifiedAt: String, + var lastUsedAt: String?, + var numForwarded: Long, + var numBlocked: Long, + var numLevelOneTrackersBlocked: Long, + var numReplied: Long, + var numSpam: Long, +) + +// We might want to remove the parameters we do not need before publishing the component. +// Waiting to have a better understanding of API's and what data we actually need. +// Clean up in: https://bugzilla.mozilla.org/show_bug.cgi?id=2002124 +internal fun mozilla.appservices.relay.RelayAddress.into(): RelayAddress { + return RelayAddress( + maskType = this.maskType, + enabled = this.enabled, + description = this.description, + generatedFor = this.generatedFor, + blockListEmails = this.blockListEmails, + usedOn = this.usedOn, + id = this.id, + address = this.address, + domain = this.domain, + fullAddress = this.fullAddress, + createdAt = this.createdAt, + lastModifiedAt = this.lastModifiedAt, + lastUsedAt = this.lastUsedAt, + numForwarded = this.numForwarded, + numBlocked = this.numBlocked, + numLevelOneTrackersBlocked = this.numLevelOneTrackersBlocked, + numReplied = this.numReplied, + numSpam = this.numSpam, + ) +}