Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/2.25.x' into feature/13387-extend_notes
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuraiKek committed Jul 11, 2022
2 parents c72a380 + 8dbb893 commit 82ab92d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ class PersonCertificatesProvider @Inject constructor(
.filterNot { certs ->
certs.isEmpty() // Any person should have at least one certificate to show up in the list
}.map { certs ->
var personIdentifier: CertificatePersonIdentifier = certs.identifier
var dccWalletInfo: DccWalletInfo? = null
certs.forEach {
dccWalletInfo = personWalletsGroup[it.personIdentifier.groupingKey]?.dccWalletInfo
if (dccWalletInfo != null) {
personIdentifier = it.personIdentifier
return@forEach
}
}
val (personIdentifier: CertificatePersonIdentifier, dccWalletInfo: DccWalletInfo?) =
certs.firstNotNullOfOrNull {
personWalletsGroup[it.personIdentifier.groupingKey]?.let { walletGroup ->
it.personIdentifier to walletGroup.dccWalletInfo
}
} ?: (certs.identifier to null)

val settings = personsSettings[personIdentifier]

Expand Down Expand Up @@ -108,10 +105,10 @@ class PersonCertificatesProvider @Inject constructor(

private fun PersonSettings?.hasBoosterBadge(boosterNotification: BoosterNotification?): Boolean {
if (boosterNotification == null || !boosterNotification.visible) return false
return hasBoosterRuleNotYetSeen(this, boosterNotification)
return hasNotSeenBoosterRuleYet(this, boosterNotification)
}

private fun hasBoosterRuleNotYetSeen(
fun hasNotSeenBoosterRuleYet(
personSettings: PersonSettings?,
boosterNotification: BoosterNotification
) = personSettings?.lastSeenBoosterRuleIdentifier != boosterNotification.identifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BoosterNotificationServiceTest : BaseTest() {
private fun service() = BoosterNotificationService(
personNotificationSender = personNotificationSender,
personCertificatesSettings = personCertificatesSettings,
timeStamper = timeStamper
timeStamper = timeStamper,
)

@Test
Expand Down Expand Up @@ -135,7 +135,13 @@ class BoosterNotificationServiceTest : BaseTest() {
}

private fun verifyThatBoosterNotificationIsShown() {
verify(exactly = 1) { personNotificationSender.showNotification(personIdentifier, any(), R.string.notification_body) }
verify(exactly = 1) {
personNotificationSender.showNotification(
personIdentifier,
any(),
R.string.notification_body
)
}
}

private fun verifyThatLegacyBoosterRuleIsCleared() {
Expand Down

0 comments on commit 82ab92d

Please sign in to comment.