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 {
|
func (r *NotificationRepository) ArchiveNotifications(ctx context.Context, ids []string, userID string) error {
|
||||||
_, err := r.pool.Exec(ctx, `
|
_, 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
|
WHERE id = ANY($1::uuid[]) AND user_id = $2::uuid
|
||||||
`, ids, userID)
|
`, ids, userID)
|
||||||
return err
|
return err
|
||||||
|
|
@ -262,7 +262,7 @@ func (r *NotificationRepository) ArchiveNotifications(ctx context.Context, ids [
|
||||||
|
|
||||||
func (r *NotificationRepository) ArchiveAllNotifications(ctx context.Context, userID string) error {
|
func (r *NotificationRepository) ArchiveAllNotifications(ctx context.Context, userID string) error {
|
||||||
_, err := r.pool.Exec(ctx, `
|
_, 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
|
WHERE user_id = $1::uuid AND archived_at IS NULL
|
||||||
`, userID)
|
`, userID)
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -300,43 +300,10 @@ class _HomeShellState extends ConsumerState<HomeShell> with WidgetsBindingObserv
|
||||||
),
|
),
|
||||||
tooltip: 'Notifications',
|
tooltip: 'Notifications',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showGeneralDialog(
|
Navigator.of(context).push(
|
||||||
context: context,
|
MaterialPageRoute(
|
||||||
barrierDismissible: true,
|
builder: (_) => const NotificationsScreen(),
|
||||||
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,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue