chore: changes for 1.1.2

This commit is contained in:
Andrei O 2023-10-01 06:46:14 +03:00
parent 999573a9e5
commit b1122d2cdf
No known key found for this signature in database
GPG Key ID: B961E5B68389457E
5 changed files with 22 additions and 22 deletions

View File

@ -1,5 +1,10 @@
# Change Log # 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] ## [Version 1.1.1]
- changed auth condition - changed auth condition

View File

@ -1,7 +1,7 @@
{ {
"name": "yup live", "name": "yup live",
"description": "Light alternative extension for yup protocol", "description": "Light extension helper for yup social platform.",
"version": "1.1.1", "version": "1.1.2",
"manifest_version": 3, "manifest_version": 3,
"icons": { "icons": {
"16": "src/assets/icons/yup_ext_16.png", "16": "src/assets/icons/yup_ext_16.png",

View File

@ -161,7 +161,7 @@ const alarmHandler = async () => {
const lastFollowNotif = await getSetting('lastfollowNotif') as number const lastFollowNotif = await getSetting('lastfollowNotif') as number
const isNew = !lastFollowNotif || ( !closeTo(new Date(lastFollowNotif), new Date(followNotif.createdAt), 2e4)) const isNew = !lastFollowNotif || ( !closeTo(new Date(lastFollowNotif), new Date(followNotif.createdAt), 2e4))
if (followNotif && isNew) { 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({ await chrome.notifications.create({
type: 'basic', type: 'basic',
iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'), 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 lastCommentNotif = await getSetting('lastCommentNotif') as number
const isNew = !lastCommentNotif || ( !closeTo(new Date(lastCommentNotif), new Date(commentNotif.createdAt), 2e4)) const isNew = !lastCommentNotif || ( !closeTo(new Date(lastCommentNotif), new Date(commentNotif.createdAt), 2e4))
if (commentNotif && isNew) { 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({ await chrome.notifications.create({
type: 'basic', type: 'basic',
iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'), 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 lastMentionNotif = await getSetting('lastMentionNotif') as number
const isNew = !lastMentionNotif || ( !closeTo(new Date(lastMentionNotif), new Date(mentionNotif.createdAt), 2e4)) const isNew = !lastMentionNotif || ( !closeTo(new Date(lastMentionNotif), new Date(mentionNotif.createdAt), 2e4))
if (mentionNotif && isNew) { 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({ await chrome.notifications.create({
type: 'basic', type: 'basic',
iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'), iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'),

View File

@ -3,9 +3,8 @@
export let source export let source
export let loading = true let loading = true
export let loaded = false let loaded = false
export let error = false
export const onLoad = () => { export const onLoad = () => {
loading = false loading = false
@ -14,18 +13,14 @@
export const onError = () => { export const onError = () => {
loading = false loading = false
error = true source = undefined
} }
$: { $: {
if(isUrlInvalid(source)) { if(isUrlInvalid(source)) {
loading = false source = undefined
error = true
} else { } else {
loading = true
error = false
} }
} }
</script> </script>
@ -34,7 +29,7 @@
{#if loading || loaded} {#if loading || loaded}
<slot name="img"> <slot name="img">
</slot> </slot>
{:else if error} {:else if source === undefined}
<slot name="error"> <slot name="error">
</slot> </slot>
{/if} {/if}

View File

@ -9,9 +9,10 @@
import { YUP_APP_BASE } from "@/constants/config"; import { YUP_APP_BASE } from "@/constants/config";
let loader;
export let notif: Notification; export let notif: Notification;
const numImages = notif?.senders?.length ?? 0;
let loaders: ImgLoader[] = Array(numImages).fill(null);
</script> </script>
{#if notif.eventType === "vote"} {#if notif.eventType === "vote"}
@ -71,14 +72,13 @@
</div> </div>
{:else if ["follow"].includes(notif.eventType)} {:else if ["follow"].includes(notif.eventType)}
<div class="flex flex-col notifBody"> <div class="flex flex-col notifBody">
{#each notif.senders as sender} {#each notif.senders as sender, i}
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
<ImgLoader bind:this={loaders[i]} source="{sender?.avatar}" >
<ImgLoader bind:this={loader} source="{sender?.avatar}" loaded={loader?.loaded ?? false} error={loader?.error ?? false} loading={loader?.loading ?? true}>
<img <img
class="notificationImage" class="notificationImage"
on:load={() => { loader.loaded = true; loader.loading = false; }} on:load={() => loaders[i]?.onLoad()}
on:error={() => { loader.error = true; loader.loading = false; }} on:error={() => loaders[i]?.onError()}
style={$mainStore.settings.theme === "light" ? "filter: invert(0.9);" : ""} style={$mainStore.settings.theme === "light" ? "filter: invert(0.9);" : ""}
slot="img" slot="img"
src={sender.avatar} src={sender.avatar}