feat: rizful

This commit is contained in:
codytseng 2025-09-29 23:36:49 +08:00
parent 520649e862
commit 6357fd5b44
32 changed files with 812 additions and 123 deletions

View file

@ -1,12 +1,7 @@
import { BIG_RELAY_URLS, CODY_PUBKEY, JUMBLE_PUBKEY } from '@/constants'
import { getZapInfoFromEvent } from '@/lib/event-metadata'
import { TProfile } from '@/types'
import {
init,
launchPaymentModal,
onConnected,
onDisconnected
} from '@getalby/bitcoin-connect-react'
import { init, launchPaymentModal } from '@getalby/bitcoin-connect-react'
import { Invoice } from '@getalby/lightning-tools'
import { bech32 } from '@scure/base'
import { WebLNProvider } from '@webbtc/webln-types'
@ -23,7 +18,7 @@ const OFFICIAL_PUBKEYS = [JUMBLE_PUBKEY, CODY_PUBKEY]
class LightningService {
static instance: LightningService
private provider: WebLNProvider | null = null
provider: WebLNProvider | null = null
private recentSupportersCache: TRecentSupporter[] | null = null
constructor() {
@ -33,12 +28,6 @@ class LightningService {
appName: 'Jumble',
showBalance: false
})
onConnected((provider) => {
this.provider = provider
})
onDisconnected(() => {
this.provider = null
})
}
return LightningService.instance
}

View file

@ -47,6 +47,7 @@ class LocalStorageService {
private hideContentMentioningMutedUsers: boolean = false
private notificationListStyle: TNotificationStyle = NOTIFICATION_LIST_STYLE.DETAILED
private mediaAutoLoadPolicy: TMediaAutoLoadPolicy = MEDIA_AUTO_LOAD_POLICY.ALWAYS
private shownCreateWalletGuideToastPubkeys: Set<string> = new Set()
constructor() {
if (!LocalStorageService.instance) {
@ -185,6 +186,13 @@ class LocalStorageService {
this.mediaAutoLoadPolicy = mediaAutoLoadPolicy as TMediaAutoLoadPolicy
}
const shownCreateWalletGuideToastPubkeysStr = window.localStorage.getItem(
StorageKey.SHOWN_CREATE_WALLET_GUIDE_TOAST_PUBKEYS
)
this.shownCreateWalletGuideToastPubkeys = shownCreateWalletGuideToastPubkeysStr
? new Set(JSON.parse(shownCreateWalletGuideToastPubkeysStr))
: new Set()
// Clean up deprecated data
window.localStorage.removeItem(StorageKey.ACCOUNT_PROFILE_EVENT_MAP)
window.localStorage.removeItem(StorageKey.ACCOUNT_FOLLOW_LIST_EVENT_MAP)
@ -453,6 +461,21 @@ class LocalStorageService {
this.mediaAutoLoadPolicy = policy
window.localStorage.setItem(StorageKey.MEDIA_AUTO_LOAD_POLICY, policy)
}
hasShownCreateWalletGuideToast(pubkey: string) {
return this.shownCreateWalletGuideToastPubkeys.has(pubkey)
}
markCreateWalletGuideToastAsShown(pubkey: string) {
if (this.shownCreateWalletGuideToastPubkeys.has(pubkey)) {
return
}
this.shownCreateWalletGuideToastPubkeys.add(pubkey)
window.localStorage.setItem(
StorageKey.SHOWN_CREATE_WALLET_GUIDE_TOAST_PUBKEYS,
JSON.stringify(Array.from(this.shownCreateWalletGuideToastPubkeys))
)
}
}
const instance = new LocalStorageService()