From 38c43ee93f537d463f36a9e486904c05fe1ace7f Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:51:07 +0200 Subject: [PATCH 1/2] feat: update icon --- capacitor/android/variables.gradle | 4 +-- common/components/Sidebar.svelte | 39 +++++++++++++++++++++++++-- common/views/Settings/Settings.svelte | 15 ----------- electron/src/main/updater.js | 6 +++++ 4 files changed, 45 insertions(+), 19 deletions(-) diff --git a/capacitor/android/variables.gradle b/capacitor/android/variables.gradle index 5946ada..58af7a5 100644 --- a/capacitor/android/variables.gradle +++ b/capacitor/android/variables.gradle @@ -1,7 +1,7 @@ ext { minSdkVersion = 22 - compileSdkVersion = 33 - targetSdkVersion = 33 + compileSdkVersion = 34 + targetSdkVersion = 34 androidxActivityVersion = '1.7.0' androidxAppCompatVersion = '1.6.1' androidxCoordinatorLayoutVersion = '1.2.0' diff --git a/common/components/Sidebar.svelte b/common/components/Sidebar.svelte index 07d13f3..45da2d1 100644 --- a/common/components/Sidebar.svelte +++ b/common/components/Sidebar.svelte @@ -8,9 +8,40 @@ import { click } from '@/modules/click.js' import { logout } from './Logout.svelte' import IPC from '@/modules/ipc.js' + + let wasUpdated = false + + globalThis.dd = IPC + + IPC.on('update-available', () => { + console.log('uwu') + if (!wasUpdated) { + // insert icon in 2nd to last position + links.splice(links.length - 1, 0, { + click: () => { + toast('Update is downloading...') + }, + icon: 'download', + text: 'Update Downloading...' + }) + links = links + } + wasUpdated = true + }) + IPC.on('update-downloaded', () => { + links[links.length - 2].css = 'update' + links[links.length - 2].text = 'Update Ready!' + links[links.length - 2].click = () => { + IPC.emit('quit-and-install') + } + links = links + }) + const view = getContext('view') + export let page - const links = [ + + let links = [ { click: () => { if (anilistClient.userID?.viewer?.data?.Viewer) { @@ -94,7 +125,7 @@