From 25ba0ef0f07488a7a4096ea565076d7573538f60 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 24 Dec 2025 08:37:40 +0000 Subject: [PATCH] fix(android): fix Java calls to Kotlin companion object methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix Java compilation errors when calling Kotlin companion object methods. Fixes: - isAlarmScheduled(): Use NotifyReceiver.Companion with correct parameter types - getNextAlarmTime(): Use NotifyReceiver.Companion with correct return type - Kotlin Long? maps to java.lang.Long in Java (no conversion needed) Errors Fixed: - cannot find symbol: isAlarmScheduled(Context, String, Long) - cannot find symbol: getNextAlarmTime(Context) Verification: - Java compilation: PASS - Full assembleDebug build: BUILD SUCCESSFUL ✅ --- .../DailyNotificationScheduler.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/timesafari/dailynotification/DailyNotificationScheduler.java b/android/src/main/java/com/timesafari/dailynotification/DailyNotificationScheduler.java index 3bc9c46..af7f2a4 100644 --- a/android/src/main/java/com/timesafari/dailynotification/DailyNotificationScheduler.java +++ b/android/src/main/java/com/timesafari/dailynotification/DailyNotificationScheduler.java @@ -587,10 +587,13 @@ public class DailyNotificationScheduler { public boolean isScheduled(String scheduleId, Long triggerAtMillis) { try { // Delegate to NotifyReceiver which checks actual AlarmManager state - return com.timesafari.dailynotification.NotifyReceiver.isAlarmScheduled( + // Note: NotifyReceiver.isAlarmScheduled is a Kotlin companion object function with default parameters + // From Java, we need to use Companion and provide explicit values (null is acceptable for optional params) + // Kotlin Long? maps to java.lang.Long in Java + return com.timesafari.dailynotification.NotifyReceiver.Companion.isAlarmScheduled( context, - scheduleId != null ? scheduleId : null, - triggerAtMillis != null ? triggerAtMillis : null + scheduleId, + triggerAtMillis ); } catch (Exception e) { Log.e(TAG, "Error checking alarm schedule status", e); @@ -618,7 +621,9 @@ public class DailyNotificationScheduler { public Long getNextAlarmTime() { try { // Delegate to NotifyReceiver which checks actual AlarmManager state - return com.timesafari.dailynotification.NotifyReceiver.getNextAlarmTime(context); + // Note: NotifyReceiver.getNextAlarmTime is a Kotlin companion object function + // Kotlin Long? maps to java.lang.Long in Java + return com.timesafari.dailynotification.NotifyReceiver.Companion.getNextAlarmTime(context); } catch (Exception e) { Log.e(TAG, "Error getting next alarm time", e); return null;