From d4cdee0698fefe87edfed60b3a892a6f69fd7e07 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Tue, 24 Mar 2026 21:19:39 +0800 Subject: [PATCH] Add verbose INFO logging to TimeSafariNativeFetcher for dual-notification debugging Log configure-time starred plan count, fetchContent entry (trigger, scheduledTime, thread), worker start, POST summary (plan count, truncated afterId), and HTTP status at INFO so logcat shows clearly when the native fetcher runs versus plugin-only DNP-FETCH paths. --- .../timesafari/TimeSafariNativeFetcher.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/app/timesafari/TimeSafariNativeFetcher.java b/android/app/src/main/java/app/timesafari/TimeSafariNativeFetcher.java index 9b105b20..89063a47 100644 --- a/android/app/src/main/java/app/timesafari/TimeSafariNativeFetcher.java +++ b/android/app/src/main/java/app/timesafari/TimeSafariNativeFetcher.java @@ -65,12 +65,22 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher this.apiBaseUrl = apiBaseUrl; this.activeDid = activeDid; this.jwtToken = jwtToken; - Log.i(TAG, "Configured with API: " + apiBaseUrl); + int starredCount = getStarredPlanIds().size(); + Log.i(TAG, "Configured with API: " + apiBaseUrl + ", starredPlanIds count=" + starredCount); } @NonNull @Override public CompletableFuture> fetchContent(@NonNull FetchContext fetchContext) { + Long scheduled = fetchContext.scheduledTime; + Log.i( + TAG, + "fetchContent START trigger=" + + fetchContext.trigger + + " scheduledTime=" + + (scheduled != null ? scheduled : "null") + + " callerThread=" + + Thread.currentThread().getName()); Log.d(TAG, "Fetching notification content, trigger: " + fetchContext.trigger); return fetchContentWithRetry(fetchContext, 0); } @@ -79,6 +89,7 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher @NonNull FetchContext context, int retryCount) { return CompletableFuture.supplyAsync(() -> { try { + Log.i(TAG, "fetchContent worker thread=" + Thread.currentThread().getName()); if (apiBaseUrl == null || activeDid == null || jwtToken == null) { Log.e(TAG, "Not configured. Call configureNativeFetcher() from TypeScript first."); return Collections.emptyList(); @@ -95,12 +106,21 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher connection.setDoOutput(true); Map requestBody = new HashMap<>(); - requestBody.put("planIds", getStarredPlanIds()); + List planIds = getStarredPlanIds(); + requestBody.put("planIds", planIds); String afterId = getLastAcknowledgedJwtId(); if (afterId == null || afterId.isEmpty()) { afterId = "0"; } requestBody.put("afterId", afterId); + Log.i( + TAG, + "POST " + + ENDORSER_ENDPOINT + + " planCount=" + + planIds.size() + + " afterId=" + + (afterId.length() > 12 ? afterId.substring(0, 12) + "…" : afterId)); String jsonBody = gson.toJson(requestBody); try (OutputStream os = connection.getOutputStream()) { @@ -109,7 +129,7 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher } int responseCode = connection.getResponseCode(); - Log.d(TAG, "HTTP response code: " + responseCode); + Log.i(TAG, "HTTP response code: " + responseCode); if (responseCode == 200) { StringBuilder response = new StringBuilder();