Fix notification badge: archive marks as read; change notifications to full page
This commit is contained in:
parent
9fafda2e13
commit
b14e1fbfa3
|
|
@ -254,7 +254,7 @@ func (r *NotificationRepository) MarkNotificationsAsRead(ctx context.Context, id
|
|||
|
||||
func (r *NotificationRepository) ArchiveNotifications(ctx context.Context, ids []string, userID string) error {
|
||||
_, err := r.pool.Exec(ctx, `
|
||||
UPDATE public.notifications SET archived_at = NOW()
|
||||
UPDATE public.notifications SET archived_at = NOW(), is_read = TRUE
|
||||
WHERE id = ANY($1::uuid[]) AND user_id = $2::uuid
|
||||
`, ids, userID)
|
||||
return err
|
||||
|
|
@ -262,7 +262,7 @@ func (r *NotificationRepository) ArchiveNotifications(ctx context.Context, ids [
|
|||
|
||||
func (r *NotificationRepository) ArchiveAllNotifications(ctx context.Context, userID string) error {
|
||||
_, err := r.pool.Exec(ctx, `
|
||||
UPDATE public.notifications SET archived_at = NOW()
|
||||
UPDATE public.notifications SET archived_at = NOW(), is_read = TRUE
|
||||
WHERE user_id = $1::uuid AND archived_at IS NULL
|
||||
`, userID)
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -300,43 +300,10 @@ class _HomeShellState extends ConsumerState<HomeShell> with WidgetsBindingObserv
|
|||
),
|
||||
tooltip: 'Notifications',
|
||||
onPressed: () {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierLabel: 'Notifications',
|
||||
barrierColor: Colors.black54,
|
||||
transitionDuration: const Duration(milliseconds: 250),
|
||||
pageBuilder: (context, _, __) {
|
||||
final height = MediaQuery.of(context).size.height;
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
bottom: Radius.circular(20),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: height * 0.9,
|
||||
child: const NotificationsScreen(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
transitionBuilder: (context, animation, _, child) {
|
||||
final curve = CurvedAnimation(
|
||||
parent: animation,
|
||||
curve: Curves.easeOutCubic,
|
||||
);
|
||||
return SlideTransition(
|
||||
position: Tween<Offset>(
|
||||
begin: const Offset(0, -1),
|
||||
end: Offset.zero,
|
||||
).animate(curve),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const NotificationsScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue