From b1122d2cdf7fb97372d21470c1cf1e372557cec1 Mon Sep 17 00:00:00 2001 From: Andrei O Date: Sun, 1 Oct 2023 06:46:14 +0300 Subject: [PATCH] chore: changes for `1.1.2` --- CHANGELOG.MD | 5 +++++ manifest.json | 4 ++-- src/background/index.ts | 6 +++--- src/components/ImgLoader.svelte | 15 +++++---------- src/components/Notification.svelte | 14 +++++++------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 3920010..68069e3 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,5 +1,10 @@ # Change Log +## [Version 1.1.2] + +- changed service worker open notification to use app.yup.io +- fixed follow notification with multiple senders + ## [Version 1.1.1] - changed auth condition diff --git a/manifest.json b/manifest.json index 431c0e1..cbd3633 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "yup live", - "description": "Light alternative extension for yup protocol", - "version": "1.1.1", + "description": "Light extension helper for yup social platform.", + "version": "1.1.2", "manifest_version": 3, "icons": { "16": "src/assets/icons/yup_ext_16.png", diff --git a/src/background/index.ts b/src/background/index.ts index c5c4868..71cf9d1 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -161,7 +161,7 @@ const alarmHandler = async () => { const lastFollowNotif = await getSetting('lastfollowNotif') as number const isNew = !lastFollowNotif || ( !closeTo(new Date(lastFollowNotif), new Date(followNotif.createdAt), 2e4)) if (followNotif && isNew) { - notificationUrl = followNotif?.senders?.[0]._id ? `${API_BASE}/account/${followNotif?.senders?.[0]._id}`: undefined + notificationUrl = followNotif?.senders?.[0]._id ? `${YUP_APP_BASE}/account/${followNotif?.senders?.[0]._id}`: undefined await chrome.notifications.create({ type: 'basic', iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'), @@ -176,7 +176,7 @@ const alarmHandler = async () => { const lastCommentNotif = await getSetting('lastCommentNotif') as number const isNew = !lastCommentNotif || ( !closeTo(new Date(lastCommentNotif), new Date(commentNotif.createdAt), 2e4)) if (commentNotif && isNew) { - notificationUrl = commentNotif?.meta?.postid ? `${API_BASE}/post/${commentNotif?.meta?.postid}`: undefined + notificationUrl = commentNotif?.meta?.postid ? `${YUP_APP_BASE}/post/${commentNotif?.meta?.postid}`: undefined await chrome.notifications.create({ type: 'basic', iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'), @@ -191,7 +191,7 @@ const alarmHandler = async () => { const lastMentionNotif = await getSetting('lastMentionNotif') as number const isNew = !lastMentionNotif || ( !closeTo(new Date(lastMentionNotif), new Date(mentionNotif.createdAt), 2e4)) if (mentionNotif && isNew) { - notificationUrl = mentionNotif?.meta?.postid ? `${API_BASE}/post/${mentionNotif?.meta?.postid}`: undefined + notificationUrl = mentionNotif?.meta?.postid ? `${YUP_APP_BASE}/post/${mentionNotif?.meta?.postid}`: undefined await chrome.notifications.create({ type: 'basic', iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'), diff --git a/src/components/ImgLoader.svelte b/src/components/ImgLoader.svelte index 06c62a5..a01bb55 100644 --- a/src/components/ImgLoader.svelte +++ b/src/components/ImgLoader.svelte @@ -3,9 +3,8 @@ export let source - export let loading = true - export let loaded = false - export let error = false + let loading = true + let loaded = false export const onLoad = () => { loading = false @@ -14,18 +13,14 @@ export const onError = () => { loading = false - error = true + source = undefined } $: { if(isUrlInvalid(source)) { - loading = false - error = true + source = undefined } else { - loading = true - error = false } - } @@ -34,7 +29,7 @@ {#if loading || loaded} - {:else if error} + {:else if source === undefined} {/if} diff --git a/src/components/Notification.svelte b/src/components/Notification.svelte index 7b9c942..09112fa 100644 --- a/src/components/Notification.svelte +++ b/src/components/Notification.svelte @@ -9,9 +9,10 @@ import { YUP_APP_BASE } from "@/constants/config"; - let loader; - export let notif: Notification; + const numImages = notif?.senders?.length ?? 0; + let loaders: ImgLoader[] = Array(numImages).fill(null); + {#if notif.eventType === "vote"} @@ -71,14 +72,13 @@ {:else if ["follow"].includes(notif.eventType)}
- {#each notif.senders as sender} + {#each notif.senders as sender, i}
- - + { loader.loaded = true; loader.loading = false; }} - on:error={() => { loader.error = true; loader.loading = false; }} + on:load={() => loaders[i]?.onLoad()} + on:error={() => loaders[i]?.onError()} style={$mainStore.settings.theme === "light" ? "filter: invert(0.9);" : ""} slot="img" src={sender.avatar}