mirror of
https://github.com/cstaelen/shazarr.git
synced 2026-10-19 01:31:11 -05:00
feat(front): download directly the apk on update (#319)
This commit is contained in:
1 parent
25b52225b8
commit
1d5021c0be
2 files changed
+17
-3
No files matched your search
@@ -6,6 +6,8 @@ Shazarr notable changes.
|
||||
## 📦 0.3.2
|
||||
### 🚀 Added
|
||||
* Use back button to close panel
|
||||
### 🖍 Changed
|
||||
* Download the APK directly on update
|
||||
### 🐛 Fixed
|
||||
* Rewrite Lidarr album monitoring #308
|
||||
|
||||
|
||||
@@ -60,7 +60,11 @@ export function ConfigProvider({ children }: { children: ReactNode }) {
|
||||
);
|
||||
|
||||
|
||||
async function sendNotification(name: string, prerelease: boolean) {
|
||||
async function sendNotification(
|
||||
name: string,
|
||||
prerelease: boolean,
|
||||
apkUrl?: string,
|
||||
) {
|
||||
let allowed = false;
|
||||
|
||||
const { display: currentPerm } =
|
||||
@@ -81,7 +85,8 @@ export function ConfigProvider({ children }: { children: ReactNode }) {
|
||||
|
||||
LocalNotifications.addListener("localNotificationActionPerformed", () => {
|
||||
window.open(
|
||||
`https://github.com${import.meta.env.VITE_REPO_API_URL}/releases`,
|
||||
apkUrl ??
|
||||
`https://github.com${import.meta.env.VITE_REPO_API_URL}/releases`,
|
||||
);
|
||||
});
|
||||
LocalNotifications.schedule({
|
||||
@@ -117,7 +122,14 @@ export function ConfigProvider({ children }: { children: ReactNode }) {
|
||||
latestVersion !== currentVersion &&
|
||||
latestVersion > currentVersion
|
||||
) {
|
||||
sendNotification(data[0].tag_name, data[0].prerelease);
|
||||
const apkAsset = data[0].assets?.find((asset: { name: string }) =>
|
||||
asset.name.endsWith(".apk"),
|
||||
);
|
||||
sendNotification(
|
||||
data[0].tag_name,
|
||||
data[0].prerelease,
|
||||
apkAsset?.browser_download_url,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("fetch github issue", e);
|
||||
|
||||
Reference in new issue
Block a user