WIP: new-activity notification #231

Draft
trentlarson wants to merge 80 commits from notify-api into master
Showing only changes of commit 55ef36be06 - Show all commits

View File

@@ -14,6 +14,7 @@
import { Capacitor } from "@capacitor/core";
import type { PushNotificationSchema } from "@capacitor/push-notifications";
import { DailyNotification } from "@/plugins/DailyNotificationPlugin";
import { getOrCreateDeviceId } from "./deviceId";
import { REMINDER_ID_DAILY_REMINDER } from "./reminderIds";
import { configureNativeFetcherIfReady } from "./nativeFetcherConfig";
import {
@@ -601,11 +602,22 @@ export async function refreshNotificationsWithDiagnostics(options?: {
};
}
let deviceId: string | undefined;
try {
deviceId = await getOrCreateDeviceId();
} catch (err) {
logger.warn(
"[NativeNotificationService] Could not obtain deviceId; refresh proceeding without deviceId",
err,
);
}
const baseUrl = getNotificationApiBaseUrl();
const res = await fetch(`${baseUrl}/notifications/refresh`, {
method: "POST",
headers: auth.headers,
body: JSON.stringify({
deviceId,
platform: Capacitor.getPlatform(),
testMode: getTestMode(),
}),