diff --git a/app/lib/core/push/push_service.dart b/app/lib/core/push/push_service.dart index 9ef27a9..7ded2b8 100644 --- a/app/lib/core/push/push_service.dart +++ b/app/lib/core/push/push_service.dart @@ -138,10 +138,14 @@ class PushService { } /// Seznam nainstalovaných distributorů (pro výběr v nastavení). - Future> distributors() => UnifiedPush.getDistributors(); + /// UnifiedPush existuje jen na Androidu; jinde by volání pluginu vyhodilo + /// UnimplementedError (iOS: dlaždice Push v Nastavení). + Future> distributors() async => + Platform.isAndroid ? UnifiedPush.getDistributors() : const []; /// Aktuálně uložený distributor (null = push vypnutý / nevybraný). - Future currentDistributor() => UnifiedPush.getDistributor(); + Future currentDistributor() async => + Platform.isAndroid ? UnifiedPush.getDistributor() : null; /// Vybere konkrétního distributora a zaregistruje se u něj. Future useDistributor(String distributor) async { @@ -158,7 +162,7 @@ class PushService { } Future get isEnabled async => - (await UnifiedPush.getDistributor()) != null; + Platform.isAndroid && (await UnifiedPush.getDistributor()) != null; // ── Režimy (off / up / fcm) ───────────────────────────────────────── @@ -167,6 +171,7 @@ class PushService { Future currentMode() async { final mode = await PushBootstrap.readMode(); if (mode != 'off') return mode; + if (!Platform.isAndroid) return mode; return (await UnifiedPush.getDistributor()) != null ? 'up' : 'off'; }