Close #27949: Add Nimbus exposure event for re-engagement notification
This commit is contained in:
parent
d4303a29c6
commit
40e4c57ec4
|
@ -23,6 +23,7 @@ import org.mozilla.fenix.GleanMetrics.Events
|
|||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.nimbus.FxNimbus
|
||||
import org.mozilla.fenix.utils.IntentUtils
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -42,6 +43,14 @@ class ReEngagementNotificationWorker(
|
|||
return Result.success()
|
||||
}
|
||||
|
||||
// Recording the exposure event here to capture all users who met all criteria to receive
|
||||
// the re-engagement notification
|
||||
FxNimbus.features.reEngagementNotification.recordExposure()
|
||||
|
||||
if (!settings.reEngagementNotificationEnabled) {
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
val channelId = ensureMarketingChannelExists(applicationContext)
|
||||
NotificationManagerCompat.from(applicationContext)
|
||||
.notify(
|
||||
|
|
|
@ -599,7 +599,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|||
* Check if we should show the re-engagement notification.
|
||||
*/
|
||||
fun shouldShowReEngagementNotification(): Boolean {
|
||||
return !reEngagementNotificationShown && reEngagementNotificationEnabled && !isDefaultBrowserBlocking()
|
||||
return !reEngagementNotificationShown && !isDefaultBrowserBlocking()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -793,37 +793,17 @@ class SettingsTest {
|
|||
|
||||
every { localSetting.isDefaultBrowserBlocking() } returns false
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns false
|
||||
localSetting.reEngagementNotificationShown = false
|
||||
assertFalse(localSetting.shouldShowReEngagementNotification())
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns true
|
||||
localSetting.reEngagementNotificationShown = false
|
||||
assert(localSetting.shouldShowReEngagementNotification())
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns false
|
||||
localSetting.reEngagementNotificationShown = true
|
||||
assertFalse(localSetting.shouldShowReEngagementNotification())
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns true
|
||||
localSetting.reEngagementNotificationShown = true
|
||||
assertFalse(localSetting.shouldShowReEngagementNotification())
|
||||
|
||||
every { localSetting.isDefaultBrowserBlocking() } returns true
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns false
|
||||
localSetting.reEngagementNotificationShown = false
|
||||
assertFalse(localSetting.shouldShowReEngagementNotification())
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns true
|
||||
localSetting.reEngagementNotificationShown = false
|
||||
assertFalse(localSetting.shouldShowReEngagementNotification())
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns false
|
||||
localSetting.reEngagementNotificationShown = true
|
||||
assertFalse(localSetting.shouldShowReEngagementNotification())
|
||||
|
||||
every { localSetting.reEngagementNotificationEnabled } returns true
|
||||
localSetting.reEngagementNotificationShown = true
|
||||
assertFalse(localSetting.shouldShowReEngagementNotification())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user