purple: add subscriber number on the Purple supporter badge
This change adds an subscriber number to the supporter badge. Testing -------- PASS Device: iPhone 15 simulator iOS: 17.2 Damus: This commit damus-api: `53fd7fef1c8c0bbf82bb28d1d776e45379433d23` Setup: - `damus-api` running on `npm run dev` mode - Damus configured to enable experimental Purple support + localhost mode Test steps: 1. Wipe local database and rerun server 2. Purchase purple using In-app purchase (Xcode environment) flow 3. Make sure that badge to the side of the user's name on the event shows a golden star without any ordinal numbers 4. Make sure that the badge to the side of the user's name on the profile page shows a golden star with the text "1st" 5. Repeat steps 2–4 and make sure the text says "2nd" 6. Look at the SupporterBadge view previews. Ordinals should show up correctly for all previews (They should always show up, no matter the number) Closes: https://github.com/damus-io/damus/issues/1873 Signed-off-by: Daniel D’Aquino <daniel@daquino.me> Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
838ce26c64
commit
854036b413
@@ -41,12 +41,14 @@ struct ProfileName: View {
|
||||
@State var display_name: DisplayName?
|
||||
@State var nip05: NIP05?
|
||||
@State var donation: Int?
|
||||
@State var purple_badge: DamusPurple.UserBadgeInfo?
|
||||
|
||||
init(pubkey: Pubkey, prefix: String = "", damus: DamusState, show_nip5_domain: Bool = true) {
|
||||
self.pubkey = pubkey
|
||||
self.prefix = prefix
|
||||
self.damus_state = damus
|
||||
self.show_nip5_domain = show_nip5_domain
|
||||
self.purple_badge = nil
|
||||
}
|
||||
|
||||
var friend_type: FriendType? {
|
||||
@@ -107,10 +109,15 @@ struct ProfileName: View {
|
||||
.frame(width: 14, height: 14)
|
||||
}
|
||||
|
||||
if let supporter = supporter(profile: profile) {
|
||||
SupporterBadge(percent: supporter)
|
||||
}
|
||||
SupporterBadge(percent: supporter(profile: profile), purple_badge_info: self.purple_badge, style: .full)
|
||||
}
|
||||
.onAppear(perform: {
|
||||
Task {
|
||||
if damus_state.settings.enable_experimental_purple_api {
|
||||
self.purple_badge = await damus_state.purple.profile_purple_badge_info(pubkey: pubkey)
|
||||
}
|
||||
}
|
||||
})
|
||||
.onReceive(handle_notify(.profile_updated)) { update in
|
||||
if update.pubkey != pubkey {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user