feat: Implement push notification system for admin announcements
- Add a notification manager to handle push notifications and integrate with Nostr events. - Create a push notification service to manage subscription and permission requests. - Introduce components for notification settings and permission prompts in the UI. - Update Nostr store to manage push notification state and enable/disable functionality. - Enhance NostrFeed to send notifications for new admin announcements. - Implement test notification functionality for development purposes.
This commit is contained in:
parent
6c1caac84b
commit
c05f40f1ec
17 changed files with 1316 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { SimplePool, type Filter, type Event, type UnsignedEvent } from 'nostr-tools'
|
||||
import { extractReactions, extractReplyCounts, getReplyInfo, EventKinds } from './events'
|
||||
import { SimplePool, type Filter, type Event } from 'nostr-tools'
|
||||
import { getReplyInfo, EventKinds } from './events'
|
||||
|
||||
export interface NostrClientConfig {
|
||||
relays: string[]
|
||||
|
|
@ -61,7 +61,6 @@ export class NostrClient {
|
|||
} = {}): Promise<NostrNote[]> {
|
||||
const {
|
||||
limit = 20,
|
||||
since = Math.floor((Date.now() - 7 * 24 * 60 * 60 * 1000) / 1000), // Last 7 days
|
||||
authors,
|
||||
includeReplies = false
|
||||
} = options
|
||||
|
|
@ -135,7 +134,7 @@ export class NostrClient {
|
|||
/**
|
||||
* Publish an event to all connected relays
|
||||
*/
|
||||
async publishEvent(event: UnsignedEvent): Promise<void> {
|
||||
async publishEvent(event: Event): Promise<void> {
|
||||
if (!this._isConnected) {
|
||||
throw new Error('Not connected to any relays')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { generateSecretKey, getPublicKey, nip19 } from 'nostr-tools'
|
||||
import { SecureStorage, type EncryptedData } from '@/lib/crypto/encryption'
|
||||
import { SecureStorage } from '@/lib/crypto/encryption'
|
||||
import { bytesToHex, hexToBytes } from '@/lib/utils/crypto'
|
||||
|
||||
export interface NostrIdentity {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue