Unofficial Paperbnd/Popfeed plugin for KOReader

silence popups during automatic updates

add a timestamp item to the menu for last-synced timestamp

Changed files
+47 -7
+47 -7
main.lua
··· 154 154 }, 155 155 { 156 156 text_func = function() 157 + local doc_path = self:getCurrentDocumentPath() 158 + if 159 + doc_path 160 + and self.document_mappings[doc_path] 161 + and self.document_mappings[doc_path].last_sync_time 162 + then 163 + local mapping = self.document_mappings[doc_path] 164 + local time_diff = os.time() - mapping.last_sync_time 165 + local time_str 166 + if time_diff < 60 then 167 + time_str = _("Just now") 168 + elseif time_diff < 3600 then 169 + local mins = math.floor(time_diff / 60) 170 + time_str = T(_("%1 min ago"), mins) 171 + elseif time_diff < 86400 then 172 + local hours = math.floor(time_diff / 3600) 173 + time_str = T(_("%1 hr ago"), hours) 174 + else 175 + local days = math.floor(time_diff / 86400) 176 + time_str = T(_("%1 days ago"), days) 177 + end 178 + return T(_("Last synced: %1% (%2)"), mapping.last_sync_percent, time_str) 179 + else 180 + return _("Last synced: Never") 181 + end 182 + end, 183 + enabled = false, 184 + }, 185 + { 186 + text_func = function() 157 187 if self.auto_sync_enabled then 158 188 return _("Auto-sync: Enabled") 159 189 else ··· 427 457 end 428 458 end 429 459 430 - function Paperbnd:syncProgress() 460 + function Paperbnd:syncProgress(use_notification) 431 461 if not self:isAuthenticated() then 432 462 return 433 463 end ··· 490 520 return 491 521 end 492 522 493 - UIManager:show(InfoMessage:new({ 494 - text = T(_("Synced: %1% (%2/%3)"), percent, current_page, pages), 495 - timeout = 2, 496 - })) 523 + -- Record last sync info for status display (per-document) 524 + self.document_mappings[doc_path].last_sync_time = os.time() 525 + self.document_mappings[doc_path].last_sync_percent = percent 526 + self:saveSettings() 527 + 528 + -- Show success notification (silent for auto-sync) 529 + if not use_notification then 530 + -- Use InfoMessage for manual sync and document close 531 + UIManager:show(InfoMessage:new({ 532 + text = T(_("Synced: %1% (%2/%3)"), percent, current_page, pages), 533 + timeout = 2, 534 + })) 535 + end 536 + -- Auto-sync is completely silent (use_notification = true) 497 537 end 498 538 499 539 function Paperbnd:scheduleDebouncedSync(pageno) ··· 535 575 return 536 576 end 537 577 538 - -- Perform sync (reuses existing logic) 539 - self:syncProgress() 578 + -- Perform sync with notification (less intrusive for auto-sync) 579 + self:syncProgress(true) 540 580 541 581 -- Track synced page 542 582 self.last_synced_page = pageno