feat: Add session count to app badge (#575)

This commit is contained in:
lostb1t
2025-03-05 08:21:59 +01:00
committed by GitHub
parent 89eb0d7796
commit 5df021a836
5 changed files with 91 additions and 56 deletions

View File

@@ -24,3 +24,26 @@ export async function unregisterBackgroundFetchAsync() {
console.log("Error unregistering background fetch task", error);
}
}
export const BACKGROUND_FETCH_TASK_SESSIONS =
"background-fetch-sessions";
export async function registerBackgroundFetchAsyncSessions() {
try {
BackgroundFetch.registerTaskAsync(BACKGROUND_FETCH_TASK_SESSIONS, {
minimumInterval: 1 * 60, // 1 minutes
stopOnTerminate: false, // android only,
startOnBoot: true, // android only
});
} catch (error) {
console.log("Error registering background fetch task", error);
}
}
export async function unregisterBackgroundFetchAsyncSessions() {
try {
BackgroundFetch.unregisterTaskAsync(BACKGROUND_FETCH_TASK_SESSIONS);
} catch (error) {
console.log("Error unregistering background fetch task", error);
}
}

3
utils/store.ts Normal file
View File

@@ -0,0 +1,3 @@
import { createStore } from 'jotai';
export const store = createStore();