Proje: OkulUp · Hub: OkulUp — Architecture

Bildirim Sistemi

Katmanlar

1. Push Notifications (expo-notifications)

Arka planda ve kapalıyken gelen bildirimler. Token: login’de register, logout’ta unregister. resolveNotificationRoute() → tıklamada deep link.

2. In-App Banner (NotificationBanner)

Uygulama açıkken gelen bildirimler için in-app banner. notificationBannerEmitter event emitter ile tetikleniyor.

3. WebSocket Notifications

subscribeToUserNotifications(userId, callback) — gerçek zamanlı badge count artırma.

4. Polling (useNotificationPolling)

Uygulama açıkken periyodik GET /api/notifications/unread-count — badge sayıları sync. Sadece authenticated kullanıcılar için.

NotificationStore (notificationSlice)

state: { unreadTotal, unreadConversations, unreadAnnouncements, byType }
 
actions:
  syncCounts(data)     // backend response ile tümünü sync
  incrementByType(type) // WS/push gelince +1
  decrementByType(type) // tek bildirim okunca -1
  clearType(type)       // type için tümünü sıfırla
  markAllAsRead()       // hepsini sıfırla
  fetchNotificationCounts() // backend'den sync et
  resetNotificationState()  // logout'ta

Not: notificationSlice persist edilmiyor — her oturumda backend’den fetch.

Notification Tipleri

NotificationType:
  'announcement_published' | 'announcement'
  'message_received' | 'message'
  'assignment_published' | 'assignment_submitted' | 'assignment_reviewed'
  'payment_due' | 'payment_overdue' | 'payment_reminder'
  'event_reminder' | 'event'
  'appointment_created' | 'appointment_updated'
  'attendance_alert'

Badge Keys (TabBar)

  • notificationsunreadTotal
  • conversationsunreadConversations
  • announcementsunreadAnnouncements

byType map’inden extraction:

  • conversations: message + message_received toplamı
  • announcements: announcement + announcement_published toplamı