add auth, format
This commit is contained in:
@@ -66,7 +66,7 @@ class NotificationLocalDataSource {
|
||||
'data': {
|
||||
'current_tier': 'gold',
|
||||
'next_tier': 'platinum',
|
||||
'points_needed': 2250
|
||||
'points_needed': 2250,
|
||||
},
|
||||
'is_read': true,
|
||||
'is_pushed': true,
|
||||
@@ -128,17 +128,20 @@ class NotificationLocalDataSource {
|
||||
|
||||
/// Get notifications by category
|
||||
Future<List<Map<String, dynamic>>> getNotificationsByCategory(
|
||||
String category) async {
|
||||
String category,
|
||||
) async {
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
|
||||
if (category == 'general') {
|
||||
return _mockNotifications
|
||||
.where((n) =>
|
||||
!(n['type'] as String).toLowerCase().contains('order') ||
|
||||
(n['type'] as String).toLowerCase().contains('loyalty') ||
|
||||
(n['type'] as String).toLowerCase().contains('promotion') ||
|
||||
(n['type'] as String).toLowerCase().contains('event') ||
|
||||
(n['type'] as String).toLowerCase().contains('birthday'))
|
||||
.where(
|
||||
(n) =>
|
||||
!(n['type'] as String).toLowerCase().contains('order') ||
|
||||
(n['type'] as String).toLowerCase().contains('loyalty') ||
|
||||
(n['type'] as String).toLowerCase().contains('promotion') ||
|
||||
(n['type'] as String).toLowerCase().contains('event') ||
|
||||
(n['type'] as String).toLowerCase().contains('birthday'),
|
||||
)
|
||||
.toList();
|
||||
} else if (category == 'order') {
|
||||
return _mockNotifications
|
||||
@@ -159,8 +162,9 @@ class NotificationLocalDataSource {
|
||||
Future<void> markAsRead(String notificationId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 150));
|
||||
|
||||
final index = _mockNotifications
|
||||
.indexWhere((n) => n['notification_id'] == notificationId);
|
||||
final index = _mockNotifications.indexWhere(
|
||||
(n) => n['notification_id'] == notificationId,
|
||||
);
|
||||
if (index != -1) {
|
||||
_mockNotifications[index]['is_read'] = true;
|
||||
_mockNotifications[index]['read_at'] = DateTime.now().toIso8601String();
|
||||
|
||||
Reference in New Issue
Block a user