refactor(notifications): update supporting classes for new timestamp model
- Remove setFetchTime() calls from DailyNotificationFetchWorker - Remove setFetchTime() calls from DailyNotificationFetcher - Update DailyNotificationMaintenanceWorker to use getFetchedAt() - Update DailyNotificationMigration to use getFetchedAt() - Align all classes with immutable fetchedAt timestamp approach - Ensure consistent timestamp handling across the codebase These changes support the new timestamp model where fetchedAt is immutable and set at object creation time.
This commit is contained in:
@@ -385,7 +385,7 @@ public class DailyNotificationFetchWorker extends Worker {
|
||||
content.setId("timesafari_fallback_" + System.currentTimeMillis());
|
||||
content.setTitle("TimeSafari Update Available");
|
||||
content.setBody("Your community updates are ready. Tap to view offers, projects, and connections.");
|
||||
content.setFetchTime(System.currentTimeMillis());
|
||||
// fetchedAt is set in constructor, no need to set it again
|
||||
content.setScheduledTime(System.currentTimeMillis() + 30000); // 30 seconds from now
|
||||
|
||||
return content;
|
||||
@@ -448,7 +448,7 @@ public class DailyNotificationFetchWorker extends Worker {
|
||||
fallbackContent.setSound(lastContent.isSound());
|
||||
fallbackContent.setPriority(lastContent.getPriority());
|
||||
fallbackContent.setUrl(lastContent.getUrl());
|
||||
fallbackContent.setFetchTime(System.currentTimeMillis());
|
||||
// fetchedAt is set in constructor, no need to set it again
|
||||
|
||||
return fallbackContent;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ public class DailyNotificationFetchWorker extends Worker {
|
||||
content.setTitle("Daily Update");
|
||||
content.setBody("🌅 Good morning! Ready to make today amazing?");
|
||||
content.setScheduledTime(scheduledTime);
|
||||
content.setFetchTime(System.currentTimeMillis());
|
||||
// fetchedAt is set in constructor, no need to set it again
|
||||
content.setPriority("default");
|
||||
content.setSound(true);
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ public class DailyNotificationFetcher {
|
||||
content.setTitle("Daily Update");
|
||||
content.setBody("Your daily notification is ready");
|
||||
content.setScheduledTime(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1));
|
||||
content.setFetchTime(System.currentTimeMillis());
|
||||
// fetchedAt is set in constructor, no need to set it again
|
||||
|
||||
return content;
|
||||
|
||||
@@ -250,7 +250,7 @@ public class DailyNotificationFetcher {
|
||||
content.setTitle("Daily Update");
|
||||
content.setBody("Your daily notification is ready");
|
||||
content.setScheduledTime(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1));
|
||||
content.setFetchTime(System.currentTimeMillis());
|
||||
// fetchedAt is set in constructor, no need to set it again
|
||||
|
||||
Log.d(TAG, "Network response parsed successfully");
|
||||
return content;
|
||||
@@ -296,7 +296,7 @@ public class DailyNotificationFetcher {
|
||||
content.setTitle("Daily Update");
|
||||
content.setBody("🌅 Good morning! Ready to make today amazing?");
|
||||
content.setScheduledTime(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1));
|
||||
content.setFetchTime(System.currentTimeMillis());
|
||||
// fetchedAt is set in constructor, no need to set it again
|
||||
content.setPriority("default");
|
||||
content.setSound(true);
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ public class DailyNotificationMaintenanceWorker extends Worker {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (notification.getFetchTime() <= 0) {
|
||||
if (notification.getFetchedAt() <= 0) {
|
||||
Log.w(TAG, "Data integrity issue: Invalid fetch time");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class DailyNotificationMigration {
|
||||
values.put(DailyNotificationDatabase.COL_CONTENTS_PAYLOAD_JSON,
|
||||
gson.toJson(notification));
|
||||
values.put(DailyNotificationDatabase.COL_CONTENTS_FETCHED_AT,
|
||||
notification.getFetchTime());
|
||||
notification.getFetchedAt());
|
||||
// ETag is null for migrated data
|
||||
values.putNull(DailyNotificationDatabase.COL_CONTENTS_ETAG);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user