fix: resolve TypeScript and lint errors

This commit is contained in:
Gigi
2025-10-05 02:38:51 +01:00
parent 1b8c276529
commit 7e5196d73d
3 changed files with 21 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react'
import { Hooks, useEventStore } from 'applesauce-react'
import { Hooks } from 'applesauce-react'
import { useEventStore } from 'applesauce-react/hooks'
import { RelayPool } from 'applesauce-relay'
import { EventFactory } from 'applesauce-factory'
import { Bookmark } from '../types/bookmarks'

View File

@@ -37,7 +37,7 @@ export async function collectBookmarksFromEvents(
publicItemsAll.push(...processApplesauceBookmarks(pub, activeAccount, false))
try {
if (Helpers.hasHiddenTags(evt) && Helpers.isHiddenTagsLocked(evt) && signerCandidate) {
if (Helpers.hasHiddenTags(evt) && !Helpers.isHiddenTagsUnlocked(evt) && signerCandidate) {
try {
await Helpers.unlockHiddenTags(evt, signerCandidate as HiddenContentSigner)
} catch {

View File

@@ -1,10 +1,10 @@
import { EventStore } from 'applesauce-core'
import { IEventStore, mapEventsToStore } from 'applesauce-core'
import { APP_DATA_KIND, getAppDataContent } from 'applesauce-core/helpers/app-data'
import { AppDataBlueprint } from 'applesauce-factory/blueprints'
import { EventFactory } from 'applesauce-factory'
import { RelayPool, onlyEvents, mapEventsToStore } from 'applesauce-relay'
import { RelayPool, onlyEvents } from 'applesauce-relay'
import { NostrEvent } from 'nostr-tools'
import { Account } from 'applesauce-accounts'
import { firstValueFrom } from 'rxjs'
const SETTINGS_IDENTIFIER = 'com.dergigi.boris.user-settings'
@@ -18,7 +18,7 @@ export interface UserSettings {
export async function loadSettings(
relayPool: RelayPool,
eventStore: EventStore,
eventStore: IEventStore,
pubkey: string,
relays: string[]
): Promise<UserSettings | null> {
@@ -39,15 +39,21 @@ export async function loadSettings(
})
.pipe(onlyEvents(), mapEventsToStore(eventStore))
.subscribe({
complete: () => {
complete: async () => {
clearTimeout(timeout)
if (!hasResolved) {
hasResolved = true
const event = eventStore.replaceable(APP_DATA_KIND, pubkey, SETTINGS_IDENTIFIER).value
if (event) {
const content = getAppDataContent<UserSettings>(event)
resolve(content || null)
} else {
try {
const event = await firstValueFrom(
eventStore.replaceable(APP_DATA_KIND, pubkey, SETTINGS_IDENTIFIER)
)
if (event) {
const content = getAppDataContent<UserSettings>(event)
resolve(content || null)
} else {
resolve(null)
}
} catch {
resolve(null)
}
}
@@ -69,7 +75,7 @@ export async function loadSettings(
export async function saveSettings(
relayPool: RelayPool,
eventStore: EventStore,
eventStore: IEventStore,
factory: EventFactory,
settings: UserSettings,
relays: string[]
@@ -82,7 +88,7 @@ export async function saveSettings(
}
export function watchSettings(
eventStore: EventStore,
eventStore: IEventStore,
pubkey: string,
callback: (settings: UserSettings | null) => void
) {