Disable zaps on ios

This commit is contained in:
Jon Staab
2025-07-17 14:39:59 -07:00
parent 79de2e1176
commit 037c8cb41b
10 changed files with 36 additions and 44 deletions

View File

@@ -15,7 +15,7 @@
import ChannelMessageEmojiButton from "@app/components/ChannelMessageEmojiButton.svelte" import ChannelMessageEmojiButton from "@app/components/ChannelMessageEmojiButton.svelte"
import ChannelMessageMenuButton from "@app/components/ChannelMessageMenuButton.svelte" import ChannelMessageMenuButton from "@app/components/ChannelMessageMenuButton.svelte"
import ChannelMessageMenuMobile from "@app/components/ChannelMessageMenuMobile.svelte" import ChannelMessageMenuMobile from "@app/components/ChannelMessageMenuMobile.svelte"
import {colors} from "@app/state" import {colors, ENABLE_ZAPS} from "@app/state"
import {publishDelete, publishReaction} from "@app/commands" import {publishDelete, publishReaction} from "@app/commands"
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
@@ -95,7 +95,9 @@
<button <button
class="join absolute right-1 top-1 border border-solid border-neutral text-xs opacity-0 transition-all" class="join absolute right-1 top-1 border border-solid border-neutral text-xs opacity-0 transition-all"
class:group-hover:opacity-100={!isMobile}> class:group-hover:opacity-100={!isMobile}>
<ChannelMessageZapButton {url} {event} /> {#if ENABLE_ZAPS}
<ChannelMessageZapButton {url} {event} />
{/if}
<ChannelMessageEmojiButton {url} {event} /> <ChannelMessageEmojiButton {url} {event} />
{#if replyTo} {#if replyTo}
<Button class="btn join-item btn-xs" onclick={reply}> <Button class="btn join-item btn-xs" onclick={reply}>

View File

@@ -9,6 +9,7 @@
import ZapButton from "@app/components/ZapButton.svelte" import ZapButton from "@app/components/ZapButton.svelte"
import EmojiButton from "@lib/components/EmojiButton.svelte" import EmojiButton from "@lib/components/EmojiButton.svelte"
import EventMenu from "@app/components/EventMenu.svelte" import EventMenu from "@app/components/EventMenu.svelte"
import {ENABLE_ZAPS} from "@app/state"
import {publishReaction} from "@app/commands" import {publishReaction} from "@app/commands"
type Props = { type Props = {
@@ -32,7 +33,7 @@
</script> </script>
<Button class="join rounded-full"> <Button class="join rounded-full">
{#if !hideZap} {#if ENABLE_ZAPS && !hideZap}
<ZapButton {url} {event} class="btn join-item btn-neutral btn-xs"> <ZapButton {url} {event} class="btn join-item btn-neutral btn-xs">
<Icon icon="bolt" size={4} /> <Icon icon="bolt" size={4} />
</ZapButton> </ZapButton>

View File

@@ -18,6 +18,7 @@
import RoomCreate from "@app/components/RoomCreate.svelte" import RoomCreate from "@app/components/RoomCreate.svelte"
import MenuSpaceRoomItem from "@app/components/MenuSpaceRoomItem.svelte" import MenuSpaceRoomItem from "@app/components/MenuSpaceRoomItem.svelte"
import { import {
ENABLE_ZAPS,
userRoomsByUrl, userRoomsByUrl,
hasMembershipUrl, hasMembershipUrl,
memberships, memberships,
@@ -131,12 +132,14 @@
<SecondaryNavItem {replaceState} href={makeSpacePath(url)}> <SecondaryNavItem {replaceState} href={makeSpacePath(url)}>
<Icon icon="home-smile" /> Home <Icon icon="home-smile" /> Home
</SecondaryNavItem> </SecondaryNavItem>
<SecondaryNavItem {#if ENABLE_ZAPS}
{replaceState} <SecondaryNavItem
href={goalsPath} {replaceState}
notification={$notifications.has(goalsPath)}> href={goalsPath}
<Icon icon="star-fall-minimalistic-2" /> Goals notification={$notifications.has(goalsPath)}>
</SecondaryNavItem> <Icon icon="star-fall-minimalistic-2" /> Goals
</SecondaryNavItem>
{/if}
<SecondaryNavItem <SecondaryNavItem
{replaceState} {replaceState}
href={threadsPath} href={threadsPath}

View File

@@ -21,6 +21,7 @@
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import Reaction from "@app/components/Reaction.svelte" import Reaction from "@app/components/Reaction.svelte"
import EventReportDetails from "@app/components/EventReportDetails.svelte" import EventReportDetails from "@app/components/EventReportDetails.svelte"
import {REACTION_KINDS} from "@app/state"
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
interface Props { interface Props {
@@ -94,7 +95,7 @@
load({ load({
relays: [url], relays: [url],
signal: controller.signal, signal: controller.signal,
filters: getReplyFilters([event], {kinds: [REACTION, REPORT, DELETE, ZAP_RESPONSE]}), filters: getReplyFilters([event], {kinds: [REPORT, DELETE, ...REACTION_KINDS]}),
onEvent: batch(300, (events: TrustedEvent[]) => { onEvent: batch(300, (events: TrustedEvent[]) => {
load({ load({
relays: [url], relays: [url],

View File

@@ -1,4 +1,5 @@
import twColors from "tailwindcss/colors" import twColors from "tailwindcss/colors"
import {Capacitor} from "@capacitor/core"
import {get, derived} from "svelte/store" import {get, derived} from "svelte/store"
import * as nip19 from "nostr-tools/nip19" import * as nip19 from "nostr-tools/nip19"
import { import {
@@ -98,6 +99,10 @@ export const ROOM = "h"
export const PROTECTED = ["-"] export const PROTECTED = ["-"]
export const ENABLE_ZAPS = Capacitor.getPlatform() != "ios"
export const REACTION_KINDS = ENABLE_ZAPS ? [REACTION, ZAP_RESPONSE] : [REACTION]
export const NOTIFIER_PUBKEY = import.meta.env.VITE_NOTIFIER_PUBKEY export const NOTIFIER_PUBKEY = import.meta.env.VITE_NOTIFIER_PUBKEY
export const NOTIFIER_RELAY = import.meta.env.VITE_NOTIFIER_RELAY export const NOTIFIER_RELAY = import.meta.env.VITE_NOTIFIER_RELAY
@@ -132,8 +137,6 @@ export const DUFFLEPUD_URL = "https://dufflepud.onrender.com"
export const IMGPROXY_URL = "https://imgproxy.coracle.social" export const IMGPROXY_URL = "https://imgproxy.coracle.social"
export const REACTION_KINDS = [REACTION, ZAP_RESPONSE]
export const NIP46_PERMS = export const NIP46_PERMS =
"nip44_encrypt,nip44_decrypt," + "nip44_encrypt,nip44_decrypt," +
[CLIENT_AUTH, AUTH_JOIN, MESSAGE, THREAD, COMMENT, ROOMS, WRAP, REACTION, ZAP_REQUEST] [CLIENT_AUTH, AUTH_JOIN, MESSAGE, THREAD, COMMENT, ROOMS, WRAP, REACTION, ZAP_REQUEST]

View File

@@ -12,8 +12,6 @@
makeRoomMeta, makeRoomMeta,
MESSAGE, MESSAGE,
DELETE, DELETE,
REACTION,
ZAP_RESPONSE,
ROOM_ADD_USER, ROOM_ADD_USER,
ROOM_REMOVE_USER, ROOM_REMOVE_USER,
} from "@welshman/util" } from "@welshman/util"
@@ -38,6 +36,7 @@
deriveUserMembershipStatus, deriveUserMembershipStatus,
deriveChannel, deriveChannel,
MembershipStatus, MembershipStatus,
REACTION_KINDS,
} from "@app/state" } from "@app/state"
import {setChecked, checked} from "@app/notifications" import {setChecked, checked} from "@app/notifications"
import {addRoomMembership, removeRoomMembership, prependParent} from "@app/commands" import {addRoomMembership, removeRoomMembership, prependParent} from "@app/commands"
@@ -228,7 +227,7 @@
relays: [url], relays: [url],
feedFilters: [filter], feedFilters: [filter],
subscriptionFilters: [ subscriptionFilters: [
{kinds: [DELETE, REACTION, ZAP_RESPONSE, MESSAGE], "#h": [room], since: now()}, {kinds: [DELETE, MESSAGE, ...REACTION_KINDS], "#h": [room], since: now()},
], ],
initialEvents: getEventsForUrl(url, [{...filter, limit: 20}]), initialEvents: getEventsForUrl(url, [{...filter, limit: 20}]),
onExhausted: () => { onExhausted: () => {

View File

@@ -5,7 +5,7 @@
import {page} from "$app/stores" import {page} from "$app/stores"
import {now, last, formatTimestampAsDate} from "@welshman/lib" import {now, last, formatTimestampAsDate} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import {REACTION, ZAP_RESPONSE, DELETE, EVENT_TIME, getTagValue} from "@welshman/util" import {DELETE, EVENT_TIME, getTagValue} from "@welshman/util"
import {fly} from "@lib/transition" import {fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
@@ -17,7 +17,7 @@
import CalendarEventItem from "@app/components/CalendarEventItem.svelte" import CalendarEventItem from "@app/components/CalendarEventItem.svelte"
import CalendarEventCreate from "@app/components/CalendarEventCreate.svelte" import CalendarEventCreate from "@app/components/CalendarEventCreate.svelte"
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
import {getEventsForUrl, decodeRelay} from "@app/state" import {getEventsForUrl, decodeRelay, REACTION_KINDS} from "@app/state"
import {makeCalendarFeed} from "@app/requests" import {makeCalendarFeed} from "@app/requests"
import {setChecked} from "@app/notifications" import {setChecked} from "@app/notifications"
@@ -93,9 +93,7 @@
onMount(() => { onMount(() => {
const feedFilters = [{kinds: [EVENT_TIME]}] const feedFilters = [{kinds: [EVENT_TIME]}]
const subscriptionFilters = [ const subscriptionFilters = [{kinds: [DELETE, EVENT_TIME, ...REACTION_KINDS], since: now()}]
{kinds: [DELETE, REACTION, ZAP_RESPONSE, EVENT_TIME], since: now()},
]
;({events, cleanup} = makeCalendarFeed({ ;({events, cleanup} = makeCalendarFeed({
element: element!, element: element!,

View File

@@ -5,7 +5,7 @@
import type {Readable} from "svelte/store" import type {Readable} from "svelte/store"
import {now, formatTimestampAsDate} from "@welshman/lib" import {now, formatTimestampAsDate} from "@welshman/lib"
import type {TrustedEvent, EventContent} from "@welshman/util" import type {TrustedEvent, EventContent} from "@welshman/util"
import {makeEvent, MESSAGE, DELETE, REACTION, ZAP_RESPONSE} from "@welshman/util" import {makeEvent, MESSAGE, DELETE} from "@welshman/util"
import {pubkey, publishThunk} from "@welshman/app" import {pubkey, publishThunk} from "@welshman/app"
import {slide, fade, fly} from "@lib/transition" import {slide, fade, fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
@@ -21,7 +21,7 @@
import {userSettingValues, decodeRelay, getEventsForUrl} from "@app/state" import {userSettingValues, decodeRelay, getEventsForUrl} from "@app/state"
import {setChecked, checked} from "@app/notifications" import {setChecked, checked} from "@app/notifications"
import {prependParent} from "@app/commands" import {prependParent} from "@app/commands"
import {PROTECTED} from "@app/state" import {PROTECTED, REACTION_KINDS} from "@app/state"
import {makeFeed} from "@app/requests" import {makeFeed} from "@app/requests"
import {popKey} from "@app/implicit" import {popKey} from "@app/implicit"
@@ -174,7 +174,7 @@
element: element!, element: element!,
relays: [url], relays: [url],
feedFilters: [filter], feedFilters: [filter],
subscriptionFilters: [{kinds: [DELETE, REACTION, ZAP_RESPONSE, MESSAGE], since: now()}], subscriptionFilters: [{kinds: [DELETE, MESSAGE, ...REACTION_KINDS], since: now()}],
initialEvents: getEventsForUrl(url, [{...filter, limit: 20}]), initialEvents: getEventsForUrl(url, [{...filter, limit: 20}]),
onExhausted: () => { onExhausted: () => {
loadingEvents = false loadingEvents = false

View File

@@ -3,15 +3,7 @@
import {page} from "$app/stores" import {page} from "$app/stores"
import {sortBy, max, nthEq} from "@welshman/lib" import {sortBy, max, nthEq} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import { import {ZAP_GOAL, DELETE, COMMENT, getListTags, getPubkeyTagValues} from "@welshman/util"
ZAP_GOAL,
REACTION,
ZAP_RESPONSE,
DELETE,
COMMENT,
getListTags,
getPubkeyTagValues,
} from "@welshman/util"
import {userMutes} from "@welshman/app" import {userMutes} from "@welshman/app"
import {fly} from "@lib/transition" import {fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
@@ -22,7 +14,7 @@
import MenuSpaceButton from "@app/components/MenuSpaceButton.svelte" import MenuSpaceButton from "@app/components/MenuSpaceButton.svelte"
import GoalItem from "@app/components/GoalItem.svelte" import GoalItem from "@app/components/GoalItem.svelte"
import GoalCreate from "@app/components/GoalCreate.svelte" import GoalCreate from "@app/components/GoalCreate.svelte"
import {decodeRelay, getEventsForUrl} from "@app/state" import {decodeRelay, getEventsForUrl, REACTION_KINDS} from "@app/state"
import {setChecked} from "@app/notifications" import {setChecked} from "@app/notifications"
import {makeFeed} from "@app/requests" import {makeFeed} from "@app/requests"
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
@@ -57,7 +49,7 @@
relays: [url], relays: [url],
feedFilters: [{kinds: [ZAP_GOAL, COMMENT]}], feedFilters: [{kinds: [ZAP_GOAL, COMMENT]}],
subscriptionFilters: [ subscriptionFilters: [
{kinds: [ZAP_GOAL, REACTION, ZAP_RESPONSE, DELETE]}, {kinds: [ZAP_GOAL, DELETE, ...REACTION_KINDS]},
{kinds: [COMMENT], "#K": [String(ZAP_GOAL)]}, {kinds: [COMMENT], "#K": [String(ZAP_GOAL)]},
], ],
initialEvents: getEventsForUrl(url, [{kinds: [ZAP_GOAL, COMMENT], limit: 10}]), initialEvents: getEventsForUrl(url, [{kinds: [ZAP_GOAL, COMMENT], limit: 10}]),

View File

@@ -3,15 +3,7 @@
import {page} from "$app/stores" import {page} from "$app/stores"
import {sortBy, max, nthEq} from "@welshman/lib" import {sortBy, max, nthEq} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import { import {THREAD, DELETE, COMMENT, getListTags, getPubkeyTagValues} from "@welshman/util"
THREAD,
REACTION,
ZAP_RESPONSE,
DELETE,
COMMENT,
getListTags,
getPubkeyTagValues,
} from "@welshman/util"
import {userMutes} from "@welshman/app" import {userMutes} from "@welshman/app"
import {fly} from "@lib/transition" import {fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
@@ -24,6 +16,7 @@
import ThreadCreate from "@app/components/ThreadCreate.svelte" import ThreadCreate from "@app/components/ThreadCreate.svelte"
import {decodeRelay, getEventsForUrl} from "@app/state" import {decodeRelay, getEventsForUrl} from "@app/state"
import {setChecked} from "@app/notifications" import {setChecked} from "@app/notifications"
import {REACTION_KINDS} from "@app/state"
import {makeFeed} from "@app/requests" import {makeFeed} from "@app/requests"
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
@@ -57,7 +50,7 @@
relays: [url], relays: [url],
feedFilters: [{kinds: [THREAD, COMMENT]}], feedFilters: [{kinds: [THREAD, COMMENT]}],
subscriptionFilters: [ subscriptionFilters: [
{kinds: [THREAD, REACTION, ZAP_RESPONSE, DELETE]}, {kinds: [THREAD, DELETE, ...REACTION_KINDS]},
{kinds: [COMMENT], "#K": [String(THREAD)]}, {kinds: [COMMENT], "#K": [String(THREAD)]},
], ],
initialEvents: getEventsForUrl(url, [{kinds: [THREAD, COMMENT], limit: 10}]), initialEvents: getEventsForUrl(url, [{kinds: [THREAD, COMMENT], limit: 10}]),