Commit b3cdb8ee authored by Matthew Finkel's avatar Matthew Finkel Committed by Pier Angelo Vendrame
Browse files

TB 40185: [android] Use NimbusDisabled

Originally, fenix#40185.
parent 30dc3653
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -96,32 +96,32 @@ open class NimbusMessagingController(
     * creates a URI string for the message action.
     */
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    fun processMessageActionToUri(message: Message): Uri {
    open fun processMessageActionToUri(message: Message): Uri {
        val (uuid, action) = messagingStorage.generateUuidAndFormatMessage(message)
        sendClickedMessageTelemetry(message.id, uuid)

        return convertActionIntoDeepLinkSchemeUri(action)
    }

    private fun sendDismissedMessageTelemetry(messageId: String) {
    open fun sendDismissedMessageTelemetry(messageId: String) {
        GleanMessaging.messageDismissed.record(GleanMessaging.MessageDismissedExtra(messageId))
    }

    private fun sendShownMessageTelemetry(messageId: String) {
    open fun sendShownMessageTelemetry(messageId: String) {
        GleanMessaging.messageShown.record(GleanMessaging.MessageShownExtra(messageId))
    }

    private fun sendExpiredMessageTelemetry(messageId: String) {
    open fun sendExpiredMessageTelemetry(messageId: String) {
        GleanMessaging.messageExpired.record(GleanMessaging.MessageExpiredExtra(messageId))
    }

    private fun sendClickedMessageTelemetry(messageId: String, uuid: String?) {
    open fun sendClickedMessageTelemetry(messageId: String, uuid: String?) {
        GleanMessaging.messageClicked.record(
            GleanMessaging.MessageClickedExtra(messageKey = messageId, actionUuid = uuid),
        )
    }

    private fun sendMicrosurveyCompletedTelemetry(messageId: String, answer: String) {
    open fun sendMicrosurveyCompletedTelemetry(messageId: String, answer: String) {
        Microsurvey.submitButtonTapped.record(
            Microsurvey.SubmitButtonTappedExtra(
                surveyId = messageId,
@@ -130,7 +130,7 @@ open class NimbusMessagingController(
        )
    }

    private fun convertActionIntoDeepLinkSchemeUri(action: String): Uri =
    open fun convertActionIntoDeepLinkSchemeUri(action: String): Uri =
        if (action.startsWith("://")) {
            "$deepLinkScheme$action".toUri()
        } else {
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ const val MESSAGING_FEATURE_ID = "messaging"
/**
 * Provides messages from [messagingFeature] and combine with the metadata store on [metadataStorage].
 */
class NimbusMessagingStorage(
open class NimbusMessagingStorage(
    private val context: Context,
    private val metadataStorage: MessageMetadataStorage,
    private val onMalformedMessage: (String) -> Unit = {
+1 −1
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
        //
        // We can initialize Nimbus before Glean because Glean will queue messages
        // before it's initialized.
        initializeNimbus()
        // initializeNimbus()

        ProfilerMarkerFactProcessor.create { components.core.engine.profiler }.register()

+8 −7
Original line number Diff line number Diff line
@@ -119,7 +119,6 @@ import org.mozilla.fenix.ext.getIntentSource
import org.mozilla.fenix.ext.getNavDirections
import org.mozilla.fenix.ext.hasTopDestination
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.recordEventInNimbus
import org.mozilla.fenix.ext.setNavigationIcon
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.systemGesturesInsets
@@ -398,7 +397,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {

        if (!shouldShowOnboarding) {
            lifecycleScope.launch(IO) {
                showFullscreenMessageIfNeeded(applicationContext)
                // showFullscreenMessageIfNeeded(applicationContext)
            }

            // Unless the activity is recreated, navigate to home first (without rendering it)
@@ -439,7 +438,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
                        ),
                    )
                    // This will record an event in Nimbus' internal event store. Used for behavioral targeting
                    recordEventInNimbus("app_opened")
                    // recordEventInNimbus("app_opened")

                    if (safeIntent.action.equals(ACTION_OPEN_PRIVATE_TAB) && source == APP_ICON) {
                        AppIcon.newPrivateTabTapped.record(NoExtras())
@@ -1387,10 +1386,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
            keyDismissButtonText = null,
        )

        /*
        researchSurfaceDialogFragment.onAccept = {
            processIntent(messaging.getIntentForMessage(nextMessage))
            components.appStore.dispatch(AppAction.MessagingAction.MessageClicked(nextMessage))
        }
        */

        researchSurfaceDialogFragment.onDismiss = {
            components.appStore.dispatch(AppAction.MessagingAction.MessageDismissed(nextMessage))
@@ -1403,10 +1404,10 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
            )
        }

        // Update message as displayed.
        val currentBootUniqueIdentifier = BootUtils.getBootIdentifier(context)

        messaging.onMessageDisplayed(nextMessage, currentBootUniqueIdentifier)
//        // Update message as displayed.
//        val currentBootUniqueIdentifier = BootUtils.getBootIdentifier(context)
//
//        messaging.onMessageDisplayed(nextMessage, currentBootUniqueIdentifier)
    }

    @VisibleForTesting
+1 −1
Original line number Diff line number Diff line
@@ -727,7 +727,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {

    override fun navToQuickSettingsSheet(tab: SessionState, sitePermissions: SitePermissions?) {
        val useCase = requireComponents.useCases.trackingProtectionUseCases
        FxNimbus.features.cookieBanners.recordExposure()
        // FxNimbus.features.cookieBanners.recordExposure()
        useCase.containsException(tab.id) { hasTrackingProtectionException ->
            lifecycleScope.launch {
                val cookieBannersStorage = requireComponents.core.cookieBannersStorage
Loading