Added Phase‑1 continuation work across deep links, offline moderation queue, and admin push.
resources/js/admin/mobile/lib.
- Admin push is end‑to‑end: new backend model/migration/service/job + API endpoints, admin runtime config, push‑aware
service worker, and a settings toggle via useAdminPushSubscription. Notifications now auto‑refresh on push.
- New PHP/JS tests: admin push API feature test and queue/haptics unit tests
Added admin-specific PWA icon assets and wired them into the admin manifest, service worker, and admin shell, plus a
new “Device & permissions” card in mobile Settings with a persistent storage action and translations.
Details: public/manifest.json, public/admin-sw.js, resources/views/admin.blade.php, new icons in public/; new hook
resources/js/admin/mobile/hooks/useDevicePermissions.ts, helpers/tests in resources/js/admin/mobile/lib/
devicePermissions.ts + resources/js/admin/mobile/lib/devicePermissions.test.ts, and Settings UI updates in resources/
js/admin/mobile/SettingsPage.tsx with copy in resources/js/admin/i18n/locales/en/management.json and resources/js/
admin/i18n/locales/de/management.json.
This commit is contained in:
@@ -673,6 +673,15 @@ export type EventToolkitNotification = {
|
||||
};
|
||||
type CreatedEventResponse = { message: string; data: JsonValue; balance: number };
|
||||
type PhotoResponse = { message: string; data: TenantPhoto };
|
||||
type AdminPushSubscriptionPayload = {
|
||||
endpoint: string;
|
||||
keys: {
|
||||
p256dh: string;
|
||||
auth: string;
|
||||
};
|
||||
expirationTime?: number | null;
|
||||
contentEncoding?: string | null;
|
||||
};
|
||||
|
||||
type EventSavePayload = {
|
||||
name: string;
|
||||
@@ -1498,6 +1507,43 @@ export async function getEventPhotos(
|
||||
};
|
||||
}
|
||||
|
||||
export async function getEventPhoto(slug: string, id: number): Promise<TenantPhoto> {
|
||||
const response = await authorizedFetch(`${eventEndpoint(slug)}/photos/${id}`);
|
||||
const data = await jsonOrThrow<PhotoResponse>(response, 'Failed to load photo');
|
||||
return normalizePhoto(data.data);
|
||||
}
|
||||
|
||||
export async function registerAdminPushSubscription(subscription: PushSubscription, deviceId?: string): Promise<void> {
|
||||
const json = subscription.toJSON() as AdminPushSubscriptionPayload;
|
||||
const response = await authorizedFetch('/api/v1/tenant/notifications/push-subscriptions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
endpoint: json.endpoint,
|
||||
keys: json.keys,
|
||||
expiration_time: json.expirationTime ?? null,
|
||||
content_encoding: json.contentEncoding ?? null,
|
||||
device_id: deviceId ?? null,
|
||||
}),
|
||||
});
|
||||
|
||||
await jsonOrThrow<{ id: number; status: string }>(response, 'Failed to register push subscription', { suppressToast: true });
|
||||
}
|
||||
|
||||
export async function unregisterAdminPushSubscription(endpoint: string): Promise<void> {
|
||||
const response = await authorizedFetch('/api/v1/tenant/notifications/push-subscriptions', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ endpoint }),
|
||||
});
|
||||
|
||||
await jsonOrThrow<{ status: string }>(response, 'Failed to unregister push subscription', { suppressToast: true });
|
||||
}
|
||||
|
||||
export async function featurePhoto(slug: string, id: number): Promise<TenantPhoto> {
|
||||
const response = await authorizedFetch(`${eventEndpoint(slug)}/photos/${id}/feature`, { method: 'POST' });
|
||||
const data = await jsonOrThrow<PhotoResponse>(response, 'Failed to feature photo');
|
||||
|
||||
Reference in New Issue
Block a user