Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(blockchain_card): AND-6762 Blockchain Card Waitlist Announcement…
… (#4098) * Blockchain card waitlist announcement * ktlint * retrieve list of eligible countries from remoteconfig
- Loading branch information
Showing
8 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
.../blockchain/android/ui/dashboard/announcements/rule/BlockchainCardWaitlistAnnouncement.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package piuk.blockchain.android.ui.dashboard.announcements.rule | ||
|
||
import androidx.annotation.VisibleForTesting | ||
import com.blockchain.walletmode.WalletMode | ||
import io.reactivex.rxjava3.core.Single | ||
import piuk.blockchain.android.R | ||
import piuk.blockchain.android.ui.dashboard.announcements.AnnouncementHost | ||
import piuk.blockchain.android.ui.dashboard.announcements.AnnouncementQueries | ||
import piuk.blockchain.android.ui.dashboard.announcements.AnnouncementRule | ||
import piuk.blockchain.android.ui.dashboard.announcements.DismissRecorder | ||
import piuk.blockchain.android.ui.dashboard.announcements.DismissRule | ||
import piuk.blockchain.android.ui.dashboard.announcements.StandardAnnouncementCard | ||
import piuk.blockchain.android.urllinks.URL_JOIN_BLOCKCHAIN_CARD_WAITLIST | ||
|
||
class BlockchainCardWaitlistAnnouncement( | ||
private val announcementQueries: AnnouncementQueries, | ||
dismissRecorder: DismissRecorder | ||
) : AnnouncementRule(dismissRecorder) { | ||
|
||
override val dismissKey = DISMISS_KEY | ||
|
||
override val name = "card_issuing_waitlist" | ||
override val associatedWalletModes: List<WalletMode> | ||
get() = listOf(WalletMode.CUSTODIAL_ONLY) | ||
|
||
override fun shouldShow(): Single<Boolean> = | ||
if (dismissEntry.isDismissed) { | ||
Single.just(false) | ||
} else { | ||
announcementQueries.isBlockchainCardAvailable() | ||
} | ||
|
||
companion object { | ||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) | ||
const val DISMISS_KEY = "BlockchainCardWaitlistAnnouncement_DISMISSED" | ||
} | ||
|
||
override fun show(host: AnnouncementHost) { | ||
host.showAnnouncementCard( | ||
card = StandardAnnouncementCard( | ||
name = name, | ||
dismissRule = DismissRule.CardOneTime, | ||
dismissEntry = dismissEntry, | ||
titleText = R.string.blockchain_card_waitlist_announcement_title, | ||
bodyText = R.string.blockchain_card_waitlist_announcement_description, | ||
ctaText = R.string.blockchain_card_waitlist_announcement_action, | ||
iconImage = R.drawable.card_filled_with_background, | ||
dismissFunction = { | ||
host.dismissAnnouncementCard() | ||
}, | ||
ctaFunction = { | ||
host.dismissAnnouncementCard() | ||
host.openBrowserLink(URL_JOIN_BLOCKCHAIN_CARD_WAITLIST) | ||
} | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M5,4C3.343,4 2,5.343 2,7V17C2,18.657 3.343,20 5,20H19C20.657,20 22,18.657 22,17V7C22,5.343 20.657,4 19,4H5ZM4,7C4,6.448 4.448,6 5,6H19C19.552,6 20,6.448 20,7V8H4V7ZM4,10H20V17C20,17.552 19.552,18 19,18H5C4.448,18 4,17.552 4,17V10ZM7,13C6.448,13 6,13.448 6,14V15C6,15.552 6.448,16 7,16H9C9.552,16 10,15.552 10,15V14C10,13.448 9.552,13 9,13H7Z" | ||
android:fillColor="#121D33" | ||
android:fillType="evenOdd"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M5,4C3.343,4 2,5.343 2,7V8H22V7C22,5.343 20.657,4 19,4H5ZM22,10H2V17C2,18.657 3.343,20 5,20H19C20.657,20 22,18.657 22,17V10ZM6,14C6,13.448 6.448,13 7,13H9C9.552,13 10,13.448 10,14V15C10,15.552 9.552,16 9,16H7C6.448,16 6,15.552 6,15V14Z" | ||
android:fillColor="#121D33" | ||
android:fillType="evenOdd"/> | ||
</vector> |
13 changes: 13 additions & 0 deletions
13
componentlib/src/main/res/drawable/card_filled_with_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="32dp" | ||
android:height="32dp" | ||
android:viewportWidth="32" | ||
android:viewportHeight="32"> | ||
<path | ||
android:pathData="M16,16m-16,0a16,16 0,1 1,32 0a16,16 0,1 1,-32 0" | ||
android:fillColor="#F0F2F7"/> | ||
<path | ||
android:pathData="M7.668,11.834C7.668,10.453 8.787,9.334 10.168,9.334H21.835C23.215,9.334 24.335,10.453 24.335,11.834V12.667H7.668V11.834ZM7.668,14.334V20.167C7.668,21.548 8.787,22.667 10.168,22.667H21.835C23.215,22.667 24.335,21.548 24.335,20.167V14.334H7.668ZM11.001,17.834C11.001,17.282 11.449,16.834 12.001,16.834H13.335C13.887,16.834 14.335,17.282 14.335,17.834V18.334C14.335,18.886 13.887,19.334 13.335,19.334H12.001C11.449,19.334 11.001,18.886 11.001,18.334V17.834Z" | ||
android:fillColor="#000000" | ||
android:fillType="evenOdd"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters