Add api for showing toast notifications

This commit is contained in:
AAGaming
2022-08-09 21:52:03 -04:00
parent 0dbdb4a143
commit 67426af3ef
9 changed files with 190 additions and 24 deletions
+4 -2
View File
@@ -62,7 +62,7 @@ class Updater:
"updatable": self.localVer != None
}
else:
return {"current": "unknown", "updatable": False}
return {"current": "unknown", "remote": self.remoteVer, "updatable": False}
async def check_for_updates(self):
async with ClientSession() as web:
@@ -70,6 +70,8 @@ class Updater:
remoteVersions = await res.json()
self.remoteVer = next(filter(lambda ver: ver["prerelease"] and ver["tag_name"].startswith("v") and ver["tag_name"].endswith("-pre"), remoteVersions), None)
logger.info("Updated remote version information")
tab = await get_tab("SP")
await tab.evaluate_js(f"window.DeckyPluginLoader.notifyUpdates()", False, True, False)
return await self.get_version()
async def version_reloader(self):
@@ -79,7 +81,7 @@ class Updater:
await self.check_for_updates()
except:
pass
await sleep(60 * 60) # 1 hour
await sleep(60 * 60 * 6) # 6 hours
async def do_update(self):
version = self.remoteVer["tag_name"]