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

View File

@@ -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)