feat: Enhance APNS token retrieval with retries and add cancel functionality to revert changes in notification and privacy settings.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
||||
import 'package:real_estate_mobile/features/notifications/data/models/notification_model.dart';
|
||||
import 'package:real_estate_mobile/features/notifications/presentation/providers/notification_provider.dart';
|
||||
@@ -248,6 +249,7 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
|
||||
.read(notificationListProvider.notifier)
|
||||
.markAsRead(notification.id);
|
||||
}
|
||||
_navigateToNotification(notification);
|
||||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Column(
|
||||
@@ -359,6 +361,36 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _navigateToNotification(AppNotification notification) {
|
||||
final data = notification.data;
|
||||
final type = data?['type'] ?? notification.type;
|
||||
|
||||
switch (type) {
|
||||
case 'message':
|
||||
final conversationId = data?['conversationId'];
|
||||
if (conversationId != null) {
|
||||
context.push('/messages/chat/$conversationId');
|
||||
} else {
|
||||
context.go('/messages');
|
||||
}
|
||||
break;
|
||||
case 'connection_request':
|
||||
case 'connection':
|
||||
context.go('/agent/network');
|
||||
break;
|
||||
case 'connection_response':
|
||||
final status = data?['status'];
|
||||
if (status == 'ACCEPTED') {
|
||||
context.go('/messages');
|
||||
} else {
|
||||
context.go('/home');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
IconData _iconForType(String type) {
|
||||
switch (type) {
|
||||
case 'connection':
|
||||
|
||||
Reference in New Issue
Block a user