🐛 Fix bugs
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -11,6 +12,10 @@ import 'notify.universal.dart' as universal_notify;
|
||||
|
||||
// Platform-specific delegation
|
||||
Future<void> initializeLocalNotifications() async {
|
||||
if (kIsWeb) {
|
||||
// No local notifications on web
|
||||
return;
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return windows_notify.initializeLocalNotifications();
|
||||
} else {
|
||||
@@ -18,10 +23,14 @@ Future<void> initializeLocalNotifications() async {
|
||||
}
|
||||
}
|
||||
|
||||
StreamSubscription setupNotificationListener(
|
||||
StreamSubscription? setupNotificationListener(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
) {
|
||||
if (kIsWeb) {
|
||||
// No notification listener on web
|
||||
return null;
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return windows_notify.setupNotificationListener(context, ref);
|
||||
} else {
|
||||
@@ -33,6 +42,10 @@ Future<void> subscribePushNotification(
|
||||
Dio apiClient, {
|
||||
bool detailedErrors = false,
|
||||
}) async {
|
||||
if (kIsWeb) {
|
||||
// No push notification subscription on web
|
||||
return;
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return windows_notify.subscribePushNotification(
|
||||
apiClient,
|
||||
|
Reference in New Issue
Block a user