Fix mutes again

This commit is contained in:
Jon Staab 2024-09-19 14:12:40 -07:00
parent 9de8ace29b
commit b5ce6797ed
9 changed files with 30 additions and 15 deletions

View File

@ -9,7 +9,7 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-app')
}

View File

@ -1,3 +1,6 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')

BIN
package-lock.json generated

Binary file not shown.

View File

@ -43,6 +43,7 @@
"dependencies": {
"@bugsnag/js": "^8.0.0",
"@capacitor/android": "^6.1.2",
"@capacitor/app": "^6.0.1",
"@capacitor/core": "^6.1.2",
"@capacitor/ios": "^6.1.2",
"@event-calendar/core": "^3.4.0",
@ -59,7 +60,7 @@
"@welshman/net": "^0.0.22",
"@welshman/signer": "^0.0.5",
"@welshman/store": "^0.0.7",
"@welshman/util": "^0.0.32",
"@welshman/util": "^0.0.33",
"bowser": "^2.11.0",
"classnames": "^2.5.1",
"compressorjs": "^1.2.1",

View File

@ -37,6 +37,7 @@
loadEvent,
ensureUnwrapped,
isEventMuted,
userMutes,
getSetting,
sortEventsDesc,
} from "src/engine"
@ -50,7 +51,7 @@
export let isLastReply = false
export let showParent = true
export let showLoading = false
export let showMuted = false
export let showHidden = false
export let showGroup = false
export let showMedia = getSetting("show_media")
export let contextAddress = null
@ -113,7 +114,8 @@
$: root = tags.root()
$: lnurl = getLnUrl(event.tags?.find(nthEq(0, "zap"))?.[1] || "")
$: zapper = lnurl ? deriveZapper(lnurl) : deriveZapperForPubkey(event.pubkey)
$: muted = $isEventMuted(event, true)
$: muted = $userMutes.has(event.id)
$: hidden = $isEventMuted(event, true)
// Find children in our context
$: children = context.filter(e => isChildOf(e, event))
@ -271,13 +273,13 @@
</small>
{/if}
</div>
{#if muted && !showMuted}
{#if hidden && !showHidden}
<p class="border-l-2 border-solid border-neutral-600 pl-4 text-neutral-100">
You have hidden this note.
<Anchor
underline
on:click={() => {
showMuted = true
showHidden = true
}}>Show</Anchor>
</p>
{:else}
@ -292,7 +294,7 @@
{contextAddress}
{addToContext}
{replyCtrl}
{showMuted}
{showHidden}
{replies}
{likes}
{zaps}
@ -370,7 +372,7 @@
<svelte:self
isLastReply={i === visibleReplies.length - 1}
showParent={false}
showMuted
showHidden
note={r}
depth={depth - 1}
{filters}

View File

@ -63,7 +63,7 @@
export let note: TrustedEvent
export let muted
export let replyCtrl
export let showMuted
export let showHidden
export let addToContext
export let contextAddress
export let removeFromContext
@ -212,7 +212,7 @@
let handlersShown = false
$: disableActions =
!$signer || (muted && !showMuted) || (note.wrap && address && !$userIsGroupMember(address))
!$signer || (muted && !showHidden) || (note.wrap && address && !$userIsGroupMember(address))
$: like = likes.find(e => e.pubkey === $sessionWithMeta?.pubkey)
$: $likesCount = likes.length
$: zap = zaps.find(e => e.request.pubkey === $sessionWithMeta?.pubkey)

View File

@ -13,7 +13,7 @@
export let value
export let depth = 0
let showMuted = false
let showHidden = false
const {id, identifier, kind, pubkey, relays: relayHints = []} = value
const idOrAddress = id || new Address(kind, pubkey, identifier).toString()
@ -43,7 +43,7 @@
}
const unmute = e => {
showMuted = true
showHidden = true
}
$: address = $quote ? getAddress($quote) : ""
@ -54,7 +54,7 @@
<div class="py-2" on:click|stopPropagation>
<Card interactive stopPropagation class="my-2" on:click={openQuote}>
{#if muted && !showMuted}
{#if muted && !showHidden}
<p class="mb-1 py-24 text-center text-neutral-600">
You have hidden this note.
<Anchor underline stopPropagation on:click={unmute}>Show</Anchor>

View File

@ -3,7 +3,6 @@ import crypto from "crypto"
import {get, derived, writable} from "svelte/store"
import {doPipe, batch, seconds, sleep} from "hurdak"
import {
find,
defaultTo,
equals,
assoc,
@ -745,7 +744,7 @@ export const isEventMuted = withGetter(
if (strict || $userFollows.has(e.pubkey)) return false
const addresses = getAddressTagValues(e.tags || []).filter(isContextAddress)
const wotAdjustment = addresses.some($userIsGroupMember) ? 1 : 0
const wotAdjustment = addresses.some(a => $userIsGroupMember(a)) ? 1 : 0
const wotScore = getWotScore($pubkey, e.pubkey)
return wotScore < minWot - wotAdjustment

View File

@ -1,5 +1,6 @@
import "src/app.css"
import Bugsnag from "@bugsnag/js"
import {App as CapacitorApp} from "@capacitor/app"
import App from "src/app/App.svelte"
import {installPrompt} from "src/partials/state"
@ -25,6 +26,15 @@ window.addEventListener("beforeinstallprompt", e => {
installPrompt.set(e)
})
// Handle back button on android
CapacitorApp.addListener("backButton", ({canGoBack}) => {
if (!canGoBack) {
CapacitorApp.exitApp()
} else {
window.history.back()
}
})
export default new App({
target: document.getElementById("app"),
})