diff --git a/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt b/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt index ef6e7c1..fd626d1 100644 --- a/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt +++ b/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt @@ -208,7 +208,7 @@ class ReactivationManager(private val context: Context) { // Find or create NotificationContentEntity for this schedule val notificationId = "daily_${schedule.id}" val existing = try { - db.notificationContentDao().getById(notificationId) + db.notificationContentDao().getNotificationById(notificationId) } catch (e: Exception) { null } @@ -221,20 +221,22 @@ class ReactivationManager(private val context: Context) { db.notificationContentDao().updateNotification(existing) } else { // Create new notification content entry for missed alarm - val notification = NotificationContentEntity( - id = notificationId, - scheduleId = schedule.id, - title = "Daily Notification", - body = "Your daily update is ready", - scheduledTime = scheduledTime, - deliveryStatus = "missed", - fetchTime = System.currentTimeMillis(), - lastDeliveryAttempt = System.currentTimeMillis(), - deliveryAttempts = 1, - createdAt = System.currentTimeMillis(), - updatedAt = System.currentTimeMillis() + val notification = com.timesafari.dailynotification.entities.NotificationContentEntity( + notificationId, + "1.0.2", // Plugin version + null, // timesafariDid + "daily", // notificationType + "Daily Notification", + "Your daily update is ready", + scheduledTime, + java.time.ZoneId.systemDefault().id ) - db.notificationContentDao().insert(notification) + notification.deliveryStatus = "missed" + notification.lastDeliveryAttempt = System.currentTimeMillis() + notification.deliveryAttempts = 1 + notification.createdAt = System.currentTimeMillis() + notification.updatedAt = System.currentTimeMillis() + db.notificationContentDao().insertNotification(notification) } } catch (e: Exception) { Log.e(TAG, "Failed to mark missed notification for schedule ${schedule.id}", e) @@ -660,7 +662,7 @@ class ReactivationManager(private val context: Context) { // Find or create NotificationContentEntity for this schedule val notificationId = "daily_${schedule.id}" val existing = try { - db.notificationContentDao().getById(notificationId) + db.notificationContentDao().getNotificationById(notificationId) } catch (e: Exception) { null } @@ -673,20 +675,22 @@ class ReactivationManager(private val context: Context) { db.notificationContentDao().updateNotification(existing) } else { // Create new notification content entry for missed alarm - val notification = NotificationContentEntity( - id = notificationId, - scheduleId = schedule.id, - title = "Daily Notification", - body = "Your daily update is ready", - scheduledTime = scheduledTime, - deliveryStatus = "missed", - fetchTime = System.currentTimeMillis(), - lastDeliveryAttempt = System.currentTimeMillis(), - deliveryAttempts = 1, - createdAt = System.currentTimeMillis(), - updatedAt = System.currentTimeMillis() + val notification = com.timesafari.dailynotification.entities.NotificationContentEntity( + notificationId, + "1.0.2", // Plugin version + null, // timesafariDid + "daily", // notificationType + "Daily Notification", + "Your daily update is ready", + scheduledTime, + java.time.ZoneId.systemDefault().id ) - db.notificationContentDao().insert(notification) + notification.deliveryStatus = "missed" + notification.lastDeliveryAttempt = System.currentTimeMillis() + notification.deliveryAttempts = 1 + notification.createdAt = System.currentTimeMillis() + notification.updatedAt = System.currentTimeMillis() + db.notificationContentDao().insertNotification(notification) } } catch (e: Exception) { Log.e(TAG, "Failed to mark missed notification for schedule ${schedule.id}", e)