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:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Tenant;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Tenant\AdminPushSubscriptionDeleteRequest;
|
||||
use App\Http\Requests\Tenant\AdminPushSubscriptionStoreRequest;
|
||||
use App\Services\TenantAdminPushSubscriptionService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class AdminPushSubscriptionController extends Controller
|
||||
{
|
||||
public function store(
|
||||
AdminPushSubscriptionStoreRequest $request,
|
||||
TenantAdminPushSubscriptionService $subscriptions
|
||||
): JsonResponse {
|
||||
$tenant = $request->attributes->get('tenant') ?? $request->user()?->tenant;
|
||||
|
||||
if (! $tenant) {
|
||||
return response()->json([
|
||||
'error' => [
|
||||
'code' => 'tenant_context_missing',
|
||||
'title' => 'Tenant context missing',
|
||||
'message' => 'Unable to resolve tenant for push subscriptions.',
|
||||
],
|
||||
], 403);
|
||||
}
|
||||
|
||||
$payload = array_merge($request->validated(), [
|
||||
'language' => $request->getPreferredLanguage() ?? $request->headers->get('Accept-Language'),
|
||||
'user_agent' => (string) $request->userAgent(),
|
||||
]);
|
||||
|
||||
$subscription = $subscriptions->register($tenant, $request->user(), $payload);
|
||||
|
||||
return response()->json([
|
||||
'id' => $subscription->id,
|
||||
'status' => $subscription->status,
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function destroy(
|
||||
AdminPushSubscriptionDeleteRequest $request,
|
||||
TenantAdminPushSubscriptionService $subscriptions
|
||||
): JsonResponse {
|
||||
$tenant = $request->attributes->get('tenant') ?? $request->user()?->tenant;
|
||||
|
||||
if (! $tenant) {
|
||||
return response()->json([
|
||||
'error' => [
|
||||
'code' => 'tenant_context_missing',
|
||||
'title' => 'Tenant context missing',
|
||||
'message' => 'Unable to resolve tenant for push subscriptions.',
|
||||
],
|
||||
], 403);
|
||||
}
|
||||
|
||||
$validated = $request->validated();
|
||||
$revoked = $subscriptions->revoke($tenant, $validated['endpoint'], $request->user());
|
||||
|
||||
return response()->json([
|
||||
'status' => $revoked ? 'revoked' : 'not_found',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user