fix(android): correct NotificationContentEntity DAO method calls

Fix ReactivationManager to use correct DAO method names and entity
constructor for NotificationContentEntity:

- Change getById() to getNotificationById()
- Change insert() to insertNotification()
- Update NotificationContentEntity construction to use Java class
  constructor with positional parameters
- Set entity fields using Java property syntax after construction

This fixes compilation errors introduced when switching to Java-based
NotificationContentEntity class.
This commit is contained in:
Matthew Raymer
2025-11-28 08:56:02 +00:00
parent 07ace32982
commit 0f87dad135
@@ -208,7 +208,7 @@ class ReactivationManager(private val context: Context) {
// Find or create NotificationContentEntity for this schedule // Find or create NotificationContentEntity for this schedule
val notificationId = "daily_${schedule.id}" val notificationId = "daily_${schedule.id}"
val existing = try { val existing = try {
db.notificationContentDao().getById(notificationId) db.notificationContentDao().getNotificationById(notificationId)
} catch (e: Exception) { } catch (e: Exception) {
null null
} }
@@ -221,20 +221,22 @@ class ReactivationManager(private val context: Context) {
db.notificationContentDao().updateNotification(existing) db.notificationContentDao().updateNotification(existing)
} else { } else {
// Create new notification content entry for missed alarm // Create new notification content entry for missed alarm
val notification = NotificationContentEntity( val notification = com.timesafari.dailynotification.entities.NotificationContentEntity(
id = notificationId, notificationId,
scheduleId = schedule.id, "1.0.2", // Plugin version
title = "Daily Notification", null, // timesafariDid
body = "Your daily update is ready", "daily", // notificationType
scheduledTime = scheduledTime, "Daily Notification",
deliveryStatus = "missed", "Your daily update is ready",
fetchTime = System.currentTimeMillis(), scheduledTime,
lastDeliveryAttempt = System.currentTimeMillis(), java.time.ZoneId.systemDefault().id
deliveryAttempts = 1,
createdAt = System.currentTimeMillis(),
updatedAt = System.currentTimeMillis()
) )
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) { } catch (e: Exception) {
Log.e(TAG, "Failed to mark missed notification for schedule ${schedule.id}", e) 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 // Find or create NotificationContentEntity for this schedule
val notificationId = "daily_${schedule.id}" val notificationId = "daily_${schedule.id}"
val existing = try { val existing = try {
db.notificationContentDao().getById(notificationId) db.notificationContentDao().getNotificationById(notificationId)
} catch (e: Exception) { } catch (e: Exception) {
null null
} }
@@ -673,20 +675,22 @@ class ReactivationManager(private val context: Context) {
db.notificationContentDao().updateNotification(existing) db.notificationContentDao().updateNotification(existing)
} else { } else {
// Create new notification content entry for missed alarm // Create new notification content entry for missed alarm
val notification = NotificationContentEntity( val notification = com.timesafari.dailynotification.entities.NotificationContentEntity(
id = notificationId, notificationId,
scheduleId = schedule.id, "1.0.2", // Plugin version
title = "Daily Notification", null, // timesafariDid
body = "Your daily update is ready", "daily", // notificationType
scheduledTime = scheduledTime, "Daily Notification",
deliveryStatus = "missed", "Your daily update is ready",
fetchTime = System.currentTimeMillis(), scheduledTime,
lastDeliveryAttempt = System.currentTimeMillis(), java.time.ZoneId.systemDefault().id
deliveryAttempts = 1,
createdAt = System.currentTimeMillis(),
updatedAt = System.currentTimeMillis()
) )
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) { } catch (e: Exception) {
Log.e(TAG, "Failed to mark missed notification for schedule ${schedule.id}", e) Log.e(TAG, "Failed to mark missed notification for schedule ${schedule.id}", e)