()
| 699 | |
| 700 | # Run pending reminders |
| 701 | def run_pending_reminders(): |
| 702 | notes = load_notes() |
| 703 | reminders = notes.get('_reminders', []) |
| 704 | now = datetime.now() |
| 705 | changed = False |
| 706 | for r in list(reminders): |
| 707 | try: |
| 708 | dt = datetime.fromisoformat(r['datetime']) |
| 709 | except Exception: |
| 710 | continue |
| 711 | if dt <= now: |
| 712 | if ensure_termux_api(): |
| 713 | try: |
| 714 | subprocess.check_call(['termux-notification', '--title', r['title'], '--content', r.get('text','')]) |
| 715 | except Exception: |
| 716 | pass |
| 717 | reminders.remove(r) |
| 718 | changed = True |
| 719 | if changed: |
| 720 | notes['_reminders'] = reminders |
| 721 | save_notes(notes) |
| 722 | |
| 723 | # Main menu |
| 724 | def main_menu(stdscr): |
no test coverage detected