Reminders in the agenda !293
18 files changed, +354 −35
Layout: unified · split
Sources/OrgApp/AgendaModel.swift +10
| @@ -47,6 +47,10 @@ public final class AgendaModel { | ||
| 47 | 47 | public private(set) var events: [AgendaEvent] = [] |
| 48 | 48 | public var calendarEvents: CalendarEvents? |
| 49 | 49 | public var calendarNames: [String] = [] |
| 50 | /// Reminders due by the last day shown, from `reminderLists` (nil reads none) and the lists | |
| 51 | /// in `reminderListNames` (all when empty), among the events. | |
| 52 | public var reminderLists: ReminderLists? | |
| 53 | public var reminderListNames: [String] = [] | |
| 50 | 54 | /// Today and the calendar of the last refresh. |
| 51 | 55 | public private(set) var today = Days.absolute(Date(), calendar: .current) |
| 52 | 56 | @ObservationIgnored private var calendar = Calendar.current |
| @@ -89,6 +93,11 @@ public final class AgendaModel { | ||
| 89 | 93 | let provider = calendarEvents |
| 90 | 94 | let names = calendarNames |
| 91 | 95 | let all = await sources(open: open) |
| 96 | let agendaEnd = jobs.filter { if case .agenda = $0.mode { true } else { false } }.map { $0.first + $0.span }.max() | |
| 97 | var reminders: [AgendaEvent] = [] | |
| 98 | if let agendaEnd, let reminderLists { | |
| 99 | reminders = await reminderLists.reminders(before: Self.date(agendaEnd, calendar: calendar), chosen: reminderListNames, calendar: calendar) | |
| 100 | } | |
| 92 | 101 | let results = await Task.detached { |
| 93 | 102 | jobs.map { job in |
| 94 | 103 | var result = AgendaBlockResult(header: job.header, mode: job.mode) |
| @@ -99,6 +108,7 @@ public final class AgendaModel { | ||
| 99 | 108 | let from = Self.date(job.first, calendar: calendar) |
| 100 | 109 | result.events = provider.events(from: from, to: Self.date(job.first + job.span, calendar: calendar), chosen: names) |
| 101 | 110 | } |
| 111 | result.events += reminders | |
| 102 | 112 | case .todo(let keywords): |
| 103 | 113 | result.list = Agenda.todoList(all, keywords: keywords, options: job.options, today: today) |
| 104 | 114 | case .match(let match, let todoOnly): |
Sources/OrgApp/OrgPreferences.swift +6
| @@ -195,6 +195,12 @@ public enum OrgPreferences { | ||
| 195 | 195 | public static func calendarEventCalendars(_ defaults: UserDefaults = .standard) -> [String] { |
| 196 | 196 | string("calendarEventCalendars", defaults).split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty } |
| 197 | 197 | } |
| 198 | /// `agenda-reminders`: Reminders' incomplete reminders show in the agenda. | |
| 199 | public static func agendaReminders(_ defaults: UserDefaults = .standard) -> Bool { bool("agendaReminders", defaults) } | |
| 200 | /// `agenda-reminder-lists`: the lists chosen, by title or identifier; empty for all. | |
| 201 | public static func agendaReminderLists(_ defaults: UserDefaults = .standard) -> [String] { | |
| 202 | string("agendaReminderLists", defaults).split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty } | |
| 203 | } | |
| 198 | 204 | public static func reminders(_ defaults: UserDefaults = .standard) -> Bool { bool("reminders", defaults) } |
| 199 | 205 | /// `appt-message-warning-time`, in minutes. |
| 200 | 206 | public static func reminderLead(_ defaults: UserDefaults = .standard) -> Int { integer("reminderLead", defaults) } |
Sources/OrgApp/ReminderLists.swift added +75
| @@ -0,0 +1,75 @@ | ||
| 1 | import CoreGraphics | |
| 2 | import EventKit | |
| 3 | import Foundation | |
| 4 | import OrgPresentation | |
| 5 | ||
| 6 | /// What the agenda reads from a reminder: `EKReminder`, or a value made in tests. | |
| 7 | public protocol ReminderRecord { | |
| 8 | var recordID: String { get } | |
| 9 | var recordTitle: String { get } | |
| 10 | var recordDue: DateComponents? { get } | |
| 11 | var recordListID: String { get } | |
| 12 | var recordListTitle: String { get } | |
| 13 | var recordListColor: CGColor? { get } | |
| 14 | } | |
| 15 | ||
| 16 | extension EKReminder: ReminderRecord { | |
| 17 | public var recordID: String { calendarItemIdentifier } | |
| 18 | public var recordTitle: String { title ?? "" } | |
| 19 | public var recordDue: DateComponents? { dueDateComponents } | |
| 20 | public var recordListID: String { calendar?.calendarIdentifier ?? "" } | |
| 21 | public var recordListTitle: String { calendar?.title ?? "" } | |
| 22 | public var recordListColor: CGColor? { calendar?.cgColor } | |
| 23 | } | |
| 24 | ||
| 25 | /// Read-only incomplete reminders with a due date from Reminders for the agenda | |
| 26 | /// (`agenda-reminders` in config.toml), from the lists `agenda-reminder-lists` names. | |
| 27 | public final class ReminderLists: @unchecked Sendable { | |
| 28 | private let store = EKEventStore() | |
| 29 | ||
| 30 | public init() {} | |
| 31 | ||
| 32 | public static var isAuthorized: Bool { EKEventStore.authorizationStatus(for: .reminder) == .fullAccess } | |
| 33 | ||
| 34 | /// Asks for access once; later calls answer with what the person chose. | |
| 35 | public func requestAccess() async -> Bool { | |
| 36 | if Self.isAuthorized { return true } | |
| 37 | return (try? await store.requestFullAccessToReminders()) ?? false | |
| 38 | } | |
| 39 | ||
| 40 | /// The reminder lists, for choosing among them. | |
| 41 | public func lists() -> [(id: String, title: String, color: RGBA?)] { | |
| 42 | guard Self.isAuthorized else { return [] } | |
| 43 | return store.calendars(for: .reminder).map { ($0.calendarIdentifier, $0.title, $0.cgColor.flatMap(CalendarEvents.rgba)) } | |
| 44 | } | |
| 45 | ||
| 46 | /// Incomplete reminders due before `end` in the chosen lists (all when `chosen` is empty), | |
| 47 | /// by due date. Earlier ones are overdue and show today. None without access. | |
| 48 | public func reminders(before end: Date, chosen: [String], calendar: Calendar = .current) async -> [AgendaEvent] { | |
| 49 | guard Self.isAuthorized else { return [] } | |
| 50 | let lists = store.calendars(for: .reminder).filter { CalendarEvents.chooses(id: $0.calendarIdentifier, title: $0.title, chosen: chosen) } | |
| 51 | guard !lists.isEmpty else { return [] } | |
| 52 | let predicate = store.predicateForIncompleteReminders(withDueDateStarting: nil, ending: end, calendars: lists) | |
| 53 | let store = store | |
| 54 | let found: [AgendaEvent] = await withCheckedContinuation { continuation in | |
| 55 | store.fetchReminders(matching: predicate) { reminders in | |
| 56 | continuation.resume(returning: (reminders ?? []).compactMap { Self.event($0, calendar: calendar) }) | |
| 57 | } | |
| 58 | } | |
| 59 | return found.sorted { $0.start < $1.start } | |
| 60 | } | |
| 61 | ||
| 62 | /// Nil without a due date. | |
| 63 | public static func event(_ record: some ReminderRecord, calendar: Calendar = .current) -> AgendaEvent? { | |
| 64 | guard let due = record.recordDue, due.year != nil, due.month != nil, due.day != nil else { return nil } | |
| 65 | let timed = due.hour != nil | |
| 66 | var parts = DateComponents(year: due.year, month: due.month, day: due.day, hour: due.hour ?? 0, minute: due.minute ?? 0) | |
| 67 | parts.timeZone = due.timeZone | |
| 68 | guard let date = (due.timeZone.map { zone -> Calendar in var c = calendar; c.timeZone = zone; return c } ?? calendar).date(from: parts) | |
| 69 | else { return nil } | |
| 70 | return AgendaEvent( | |
| 71 | id: record.recordID, title: record.recordTitle, calendarID: record.recordListID, calendarTitle: record.recordListTitle, | |
| 72 | color: record.recordListColor.flatMap(CalendarEvents.rgba), start: date, end: date, isAllDay: !timed, isReminder: true | |
| 73 | ) | |
| 74 | } | |
| 75 | } | |
Sources/OrgApp/UserConfig.swift +4
| @@ -318,6 +318,10 @@ public enum UserConfig { | ||
| 318 | 318 | comment: "show events from Calendar in the agenda, read-only", legacy: ""), |
| 319 | 319 | Setting(section: "orgstar", key: "calendar-event-calendars", defaultsKey: "calendarEventCalendars", kind: .string, fallback: .string(""), |
| 320 | 320 | comment: "the calendars whose events show, by title or identifier, separated by commas; \"\" for all", legacy: ""), |
| 321 | Setting(section: "orgstar", key: "agenda-reminders", defaultsKey: "agendaReminders", kind: .bool, fallback: .bool(false), | |
| 322 | comment: "show incomplete reminders with a due date from Reminders in the agenda, read-only", legacy: ""), | |
| 323 | Setting(section: "orgstar", key: "agenda-reminder-lists", defaultsKey: "agendaReminderLists", kind: .string, fallback: .string(""), | |
| 324 | comment: "the Reminders lists shown, by title or identifier, separated by commas; \"\" for all", legacy: ""), | |
| 321 | 325 | Setting(section: "orgstar", key: "global-capture-hotkey", defaultsKey: "globalCapture", kind: .bool, fallback: .bool(true), |
| 322 | 326 | comment: "⌃⌥Space opens Capture from any app; templates go in capture.toml", legacy: "capture.global-hotkey"), |
| 323 | 327 | ] |
Sources/OrgPresentation/AgendaRows.swift +29 −11
| @@ -1,7 +1,9 @@ | ||
| 1 | 1 | import Foundation |
| 2 | 2 | import OrgCore |
| 3 | 3 | |
| 4 | /// An event from the system Calendar, read-only (OrgApp's `CalendarEvents` reads them). | |
| 4 | /// An event from the system Calendar or a reminder from Reminders, read-only (OrgApp's | |
| 5 | /// `CalendarEvents` and `ReminderLists` read them). A reminder starts and ends at its due date; | |
| 6 | /// one without a time is all day. | |
| 5 | 7 | public struct AgendaEvent: Sendable, Equatable, Identifiable { |
| 6 | 8 | public let id: String |
| 7 | 9 | public let title: String |
| @@ -13,10 +15,11 @@ public struct AgendaEvent: Sendable, Equatable, Identifiable { | ||
| 13 | 15 | public let end: Date |
| 14 | 16 | public let isAllDay: Bool |
| 15 | 17 | public let location: String? |
| 18 | public let isReminder: Bool | |
| 16 | 19 | |
| 17 | 20 | public init( |
| 18 | 21 | id: String, title: String, calendarID: String, calendarTitle: String, color: RGBA?, start: Date, end: Date, |
| 19 | isAllDay: Bool, location: String? = nil | |
| 22 | isAllDay: Bool, location: String? = nil, isReminder: Bool = false | |
| 20 | 23 | ) { |
| 21 | 24 | self.id = id |
| 22 | 25 | self.title = title |
| @@ -27,6 +30,7 @@ public struct AgendaEvent: Sendable, Equatable, Identifiable { | ||
| 27 | 30 | self.end = end |
| 28 | 31 | self.isAllDay = isAllDay |
| 29 | 32 | self.location = location |
| 33 | self.isReminder = isReminder | |
| 30 | 34 | } |
| 31 | 35 | |
| 32 | 36 | /// The days (as `Days` numbers them) the event covers; an end at midnight ends the day before. |
| @@ -58,7 +62,7 @@ public struct AgendaRow: Sendable, Equatable, Identifiable { | ||
| 58 | 62 | } |
| 59 | 63 | |
| 60 | 64 | public enum Icon: String, Sendable { |
| 61 | case scheduled, deadline, habit, event, timestamp | |
| 65 | case scheduled, deadline, habit, event, timestamp, reminder | |
| 62 | 66 | } |
| 63 | 67 | |
| 64 | 68 | /// Unique within a day group. |
| @@ -164,6 +168,7 @@ public struct AgendaRow: Sendable, Equatable, Identifiable { | ||
| 164 | 168 | |
| 165 | 169 | /// The event's row on `day`: its times on the day it starts (the end only when it ends that |
| 166 | 170 | /// day too), `Until 10:00` on the day a longer event ends, `All day` otherwise. |
| 171 | /// A reminder due before `day` shows as late, untimed. | |
| 167 | 172 | public init(event: AgendaEvent, day: Int, calendar: Calendar) { |
| 168 | 173 | let days = event.days(calendar: calendar) |
| 169 | 174 | func hhmm(_ date: Date) -> Int { |
| @@ -173,7 +178,16 @@ public struct AgendaRow: Sendable, Equatable, Identifiable { | ||
| 173 | 178 | var start: Int? |
| 174 | 179 | var end: Int? |
| 175 | 180 | let gutter: String |
| 176 | if event.isAllDay || (day != days.lowerBound && day != days.upperBound) { | |
| 181 | if event.isReminder { | |
| 182 | if days.lowerBound < day { | |
| 183 | gutter = "\(AgendaAge.compact(day - days.lowerBound)) late" | |
| 184 | } else if event.isAllDay { | |
| 185 | gutter = "Reminder" | |
| 186 | } else { | |
| 187 | start = hhmm(event.start) | |
| 188 | gutter = Self.timeText(start!, nil) | |
| 189 | } | |
| 190 | } else if event.isAllDay || (day != days.lowerBound && day != days.upperBound) { | |
| 177 | 191 | gutter = "All day" |
| 178 | 192 | } else if day == days.lowerBound { |
| 179 | 193 | start = hhmm(event.start) |
| @@ -182,10 +196,10 @@ public struct AgendaRow: Sendable, Equatable, Identifiable { | ||
| 182 | 196 | } else { |
| 183 | 197 | gutter = "Until " + Self.timeText(hhmm(event.end), nil) |
| 184 | 198 | } |
| 185 | self.id = "event\u{1f}" + event.id | |
| 199 | self.id = (event.isReminder ? "reminder\u{1f}" : "event\u{1f}") + event.id | |
| 186 | 200 | self.gutter = gutter |
| 187 | self.status = .normal | |
| 188 | self.icon = .event | |
| 201 | self.status = event.isReminder && days.lowerBound < day ? .overdue : .normal | |
| 202 | self.icon = event.isReminder ? .reminder : .event | |
| 189 | 203 | self.category = event.calendarTitle |
| 190 | 204 | self.title = event.title |
| 191 | 205 | self.tags = [] |
| @@ -198,7 +212,7 @@ public struct AgendaRow: Sendable, Equatable, Identifiable { | ||
| 198 | 212 | self.prefixDetail = nil |
| 199 | 213 | self.start = start |
| 200 | 214 | self.end = end |
| 201 | self.planningDay = nil | |
| 215 | self.planningDay = event.isReminder ? days.lowerBound : nil | |
| 202 | 216 | self.item = nil |
| 203 | 217 | self.event = event |
| 204 | 218 | } |
| @@ -313,7 +327,8 @@ public enum AgendaRows { | ||
| 313 | 327 | /// oldest date first, Org's order among the same date. |
| 314 | 328 | /// - Other rows keep Org's order (timed by time, then untimed by urgency, habits last). |
| 315 | 329 | /// All-day events come first, timed events go among the timed entries by start time, |
| 316 | /// after entries at the same time. | |
| 330 | /// after entries at the same time. Reminders due before today show in today's | |
| 331 | /// `overdue`. | |
| 317 | 332 | /// - `keep` filters the Org entries (an `AgendaFilter`); events are not filtered. |
| 318 | 333 | public static func groups( |
| 319 | 334 | _ days: [AgendaDay], events: [AgendaEvent] = [], today: Int, showAllDates: Bool = false, calendar: Calendar = .current, |
| @@ -337,11 +352,14 @@ public enum AgendaRows { | ||
| 337 | 352 | rows.append(row) |
| 338 | 353 | } |
| 339 | 354 | } |
| 355 | let dayEvents = eventDays.filter { event, days in | |
| 356 | days.contains(day.day) || (event.isReminder && day.day == today && days.upperBound < today) | |
| 357 | }.map { AgendaRow(event: $0.0, day: day.day, calendar: calendar) } | |
| 358 | overdue += dayEvents.filter { $0.status == .overdue } | |
| 340 | 359 | overdue = overdue.enumerated().sorted { a, b in |
| 341 | 360 | a.element.planningDay! != b.element.planningDay! ? a.element.planningDay! < b.element.planningDay! : a.offset < b.offset |
| 342 | 361 | }.map(\.element) |
| 343 | let dayEvents = eventDays.filter { $0.1.contains(day.day) }.map { AgendaRow(event: $0.0, day: day.day, calendar: calendar) } | |
| 344 | rows = merge(rows, events: dayEvents) | |
| 362 | rows = merge(rows, events: dayEvents.filter { $0.status != .overdue }) | |
| 345 | 363 | let orgIndices = rows.indices.filter { !rows[$0].isEvent } |
| 346 | 364 | var group = AgendaDayGroup(day: day.day, isToday: day.day == today, header: day.header, overdue: unique(overdue), rows: unique(rows)) |
| 347 | 365 | group.grid = grid.map { .init(before: $0.ordinal < orgIndices.count ? orgIndices[$0.ordinal] : rows.count, time: $0.time) } |
Sources/Orgstar/AgendaRowView.swift +1
| @@ -94,6 +94,7 @@ struct AgendaRowView: View { | ||
| 94 | 94 | case .deadline: return "flag.fill" |
| 95 | 95 | case .habit: return "repeat" |
| 96 | 96 | case .event: return "circle.fill" |
| 97 | case .reminder: return "circle" | |
| 97 | 98 | case .timestamp: return row.start == nil ? "calendar" : "clock" |
| 98 | 99 | } |
| 99 | 100 | } |
Sources/Orgstar/AgendaView.swift +19 −5
| @@ -10,10 +10,11 @@ enum AgendaSpan: String, CaseIterable { | ||
| 10 | 10 | case day, week, month |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | /// The app's one reader of Calendar events, for the agenda and Settings. | |
| 13 | /// The app's one reader of Calendar events and of Reminders, for the agenda and Settings. | |
| 14 | 14 | @MainActor |
| 15 | 15 | enum CalendarAccess { |
| 16 | 16 | static let events = CalendarEvents() |
| 17 | static let reminders = ReminderLists() | |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | /// The agenda window: the day/week agenda, the TODO list, tag matches, text search and saved views. |
| @@ -75,6 +76,8 @@ struct AgendaView: View { | ||
| 75 | 76 | @AppStorage("agendaShowAllDates") private var showAllDates = false |
| 76 | 77 | @AppStorage("calendarEvents") private var calendarEventsOn = false |
| 77 | 78 | @AppStorage("calendarEventCalendars") private var calendarNames = "" |
| 79 | @AppStorage("agendaReminders") private var remindersOn = false | |
| 80 | @AppStorage("agendaReminderLists") private var reminderListNames = "" | |
| 78 | 81 | @AppStorage("agendaPrefixAgenda") private var prefixAgenda = PrefixFormat.defaults["agenda"]! |
| 79 | 82 | @AppStorage("agendaPrefixTodo") private var prefixTodo = PrefixFormat.defaults["todo"]! |
| 80 | 83 | @AppStorage("agendaPrefixTags") private var prefixTags = PrefixFormat.defaults["tags"]! |
| @@ -154,7 +157,7 @@ struct AgendaView: View { | ||
| 154 | 157 | mode: agenda.mode, start: agenda.start, span: span, startOffset: startOffset, startOnWeekday: startOnWeekday, includeSubfolders: includeSubfolders, prefix: [prefixAgenda, prefixTodo, prefixTags], |
| 155 | 158 | settings: [sortAgenda, sortTodo, sortTags, sortSearch, gridWhen, gridTimes, "\(useTimeGrid) \(showCurrentTime)", stuckMatch, stuckTodo, stuckTags, stuckRegexp, agendaFileList], |
| 156 | 159 | logMode: logMode, |
| 157 | calendars: calendarEventsOn ? [calendarNames] : [], files: 0, changed: nil, edits: 0, path: nil, tick: tick | |
| 160 | calendars: (calendarEventsOn ? [calendarNames] : []) + (remindersOn ? ["reminders", reminderListNames] : []), files: 0, changed: nil, edits: 0, path: nil, tick: tick | |
| 158 | 161 | ) |
| 159 | 162 | } |
| 160 | 163 | |
| @@ -173,6 +176,12 @@ struct AgendaView: View { | ||
| 173 | 176 | } else { |
| 174 | 177 | agenda.calendarEvents = nil |
| 175 | 178 | } |
| 179 | agenda.reminderListNames = OrgPreferences.agendaReminderLists() | |
| 180 | if remindersOn, isAgenda || isBlocks { | |
| 181 | agenda.reminderLists = await CalendarAccess.reminders.requestAccess() ? CalendarAccess.reminders : nil | |
| 182 | } else { | |
| 183 | agenda.reminderLists = nil | |
| 184 | } | |
| 176 | 185 | await agenda.refresh(open: session.openTexts) |
| 177 | 186 | } |
| 178 | 187 | |
| @@ -536,7 +545,7 @@ struct AgendaView: View { | ||
| 536 | 545 | @ViewBuilder |
| 537 | 546 | private func menu(_ line: Line) -> some View { |
| 538 | 547 | if let event = line.row.event { |
| 539 | Button("Show in Calendar") { openEvent(event) } | |
| 548 | Button(event.isReminder ? "Show in Reminders" : "Show in Calendar") { openEvent(event) } | |
| 540 | 549 | } else if line.row.item != nil { |
| 541 | 550 | Button("Open") { selection = line.id; jump(line.id) } |
| 542 | 551 | Divider() |
| @@ -561,14 +570,19 @@ struct AgendaView: View { | ||
| 561 | 570 | |
| 562 | 571 | func item(_ id: String) -> AgendaItem? { line(id)?.row.item } |
| 563 | 572 | |
| 564 | /// Return and double click: the entry in the main window, or the event in Calendar. | |
| 573 | /// Return and double click: the entry in the main window, or the event in Calendar or Reminders. | |
| 565 | 574 | func open(_ line: Line) { |
| 566 | 575 | selection = line.id |
| 567 | 576 | if let event = line.row.event { openEvent(event) } else { jump(line.id) } |
| 568 | 577 | } |
| 569 | 578 | |
| 570 | /// Calendar shows an event from its identifier (`AgendaEvent.id` adds `@` and the start). | |
| 579 | /// Calendar shows an event from its identifier (`AgendaEvent.id` adds `@` and the start); | |
| 580 | /// Reminders a reminder from its own. | |
| 571 | 581 | private func openEvent(_ event: AgendaEvent) { |
| 582 | if event.isReminder { | |
| 583 | if let url = URL(string: "x-apple-reminderkit://REMCDReminder/\(event.id)") { NSWorkspace.shared.open(url) } | |
| 584 | return | |
| 585 | } | |
| 572 | 586 | let identifier = event.id.split(separator: "@").dropLast().joined(separator: "@") |
| 573 | 587 | guard !identifier.isEmpty, let encoded = identifier.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed), |
| 574 | 588 | let url = URL(string: "ical://ekevent/\(encoded)?method=show&options=more") else { return } |
Sources/Orgstar/OrgstarApp.swift +37 −5
| @@ -579,6 +579,9 @@ struct SettingsView: View { | ||
| 579 | 579 | @AppStorage("calendarEvents") private var calendarEvents = false |
| 580 | 580 | @AppStorage("calendarEventCalendars") private var calendarEventCalendars = "" |
| 581 | 581 | @State private var calendars: [(id: String, title: String, color: RGBA?)] = [] |
| 582 | @AppStorage("agendaReminders") private var agendaReminders = false | |
| 583 | @AppStorage("agendaReminderLists") private var agendaReminderLists = "" | |
| 584 | @State private var reminderLists: [(id: String, title: String, color: RGBA?)] = [] | |
| 582 | 585 | @AppStorage("reminders") private var reminders = true |
| 583 | 586 | @AppStorage("reminderLead") private var reminderLead = 12 |
| 584 | 587 | @AppStorage("clockIdleTime") private var clockIdleTime = 0 |
| @@ -765,7 +768,7 @@ struct SettingsView: View { | ||
| 765 | 768 | .foregroundStyle(.secondary) |
| 766 | 769 | } |
| 767 | 770 | ForEach(calendars, id: \.id) { calendar in |
| 768 | Toggle(isOn: calendarChosen(calendar)) { | |
| 771 | Toggle(isOn: chosen(calendar, among: calendars, setting: $calendarEventCalendars)) { | |
| 769 | 772 | HStack(spacing: 6) { |
| 770 | 773 | Circle() |
| 771 | 774 | .fill(calendar.color.map { Color(.sRGB, red: $0.red, green: $0.green, blue: $0.blue, opacity: $0.alpha) } ?? .secondary) |
| @@ -783,6 +786,32 @@ struct SettingsView: View { | ||
| 783 | 786 | let allowed = calendarEvents ? await CalendarAccess.events.requestAccess() : false |
| 784 | 787 | calendars = allowed ? CalendarAccess.events.calendars() : [] |
| 785 | 788 | } |
| 789 | Section { | |
| 790 | Toggle("Show reminders from Reminders", isOn: $agendaReminders) | |
| 791 | if agendaReminders { | |
| 792 | if reminderLists.isEmpty { | |
| 793 | Text(ReminderLists.isAuthorized ? "No lists." : "Allow orgstar to read your reminders in System Settings ▸ Privacy & Security ▸ Reminders.") | |
| 794 | .foregroundStyle(.secondary) | |
| 795 | } | |
| 796 | ForEach(reminderLists, id: \.id) { list in | |
| 797 | Toggle(isOn: chosen(list, among: reminderLists, setting: $agendaReminderLists)) { | |
| 798 | HStack(spacing: 6) { | |
| 799 | Circle() | |
| 800 | .fill(list.color.map { Color(.sRGB, red: $0.red, green: $0.green, blue: $0.blue, opacity: $0.alpha) } ?? .secondary) | |
| 801 | .frame(width: 8, height: 8) | |
| 802 | Text(list.title) | |
| 803 | } | |
| 804 | } | |
| 805 | } | |
| 806 | } | |
| 807 | } footer: { | |
| 808 | Text("Incomplete reminders with a due date show in the agenda read-only, overdue ones under today; double-click one to open it in Reminders.") | |
| 809 | .settingsFooter() | |
| 810 | } | |
| 811 | .task(id: agendaReminders) { | |
| 812 | let allowed = agendaReminders ? await CalendarAccess.reminders.requestAccess() : false | |
| 813 | reminderLists = allowed ? CalendarAccess.reminders.lists() : [] | |
| 814 | } | |
| 786 | 815 | Section { |
| 787 | 816 | Toggle("Notify before timed agenda entries", isOn: $reminders) |
| 788 | 817 | Stepper("\(reminderLead) minutes before", value: $reminderLead, in: 0...120) |
| @@ -809,9 +838,12 @@ struct SettingsView: View { | ||
| 809 | 838 | .frame(height: 560) |
| 810 | 839 | } |
| 811 | 840 | |
| 812 | /// `calendar-event-calendars`: empty for every calendar, else the titles checked. | |
| 813 | private func calendarChosen(_ calendar: (id: String, title: String, color: RGBA?)) -> Binding<Bool> { | |
| 814 | let chosen = calendarEventCalendars.split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty } | |
| 841 | /// `calendar-event-calendars` and `agenda-reminder-lists`: empty for every calendar or | |
| 842 | /// list, else the titles checked. | |
| 843 | private func chosen( | |
| 844 | _ calendar: (id: String, title: String, color: RGBA?), among calendars: [(id: String, title: String, color: RGBA?)], setting: Binding<String> | |
| 845 | ) -> Binding<Bool> { | |
| 846 | let chosen = setting.wrappedValue.split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty } | |
| 815 | 847 | return Binding { |
| 816 | 848 | CalendarEvents.chooses(id: calendar.id, title: calendar.title, chosen: chosen) |
| 817 | 849 | } set: { on in |
| @@ -822,7 +854,7 @@ struct SettingsView: View { | ||
| 822 | 854 | if on { titles.append(calendar.title) } |
| 823 | 855 | // An empty list means every calendar; turning events off hides them all. |
| 824 | 856 | guard !titles.isEmpty else { return } |
| 825 | calendarEventCalendars = Set(titles) == Set(calendars.map(\.title)) ? "" : titles.joined(separator: ", ") | |
| 857 | setting.wrappedValue = Set(titles) == Set(calendars.map(\.title)) ? "" : titles.joined(separator: ", ") | |
| 826 | 858 | } |
| 827 | 859 | } |
| 828 | 860 | |
Sources/OrgstarMobile/AgendaScreen.swift +7 −4
| @@ -294,10 +294,11 @@ struct AgendaScreen: View, Equatable { | ||
| 294 | 294 | if Days.absolute(now, calendar: .current) != agenda.today { tick += 1 } |
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | // Calendar access is asked for when calendar-events is turned on. | |
| 297 | // Calendar and Reminders access are asked for when calendar-events and | |
| 298 | // agenda-reminders are turned on. | |
| 298 | 299 | .task(id: model.settingsVersion) { |
| 299 | guard OrgPreferences.calendarEvents(), !CalendarEvents.isAuthorized else { return } | |
| 300 | if await model.calendarEvents.requestAccess() { tick += 1 } | |
| 300 | if OrgPreferences.calendarEvents(), !CalendarEvents.isAuthorized, await model.calendarEvents.requestAccess() { tick += 1 } | |
| 301 | if OrgPreferences.agendaReminders(), !ReminderLists.isAuthorized, await model.reminderLists.requestAccess() { tick += 1 } | |
| 301 | 302 | } |
| 302 | 303 | .background { Refresher(workspace: workspace, session: session, agenda: agenda, model: model, tick: tick, logMode: logMode) } |
| 303 | 304 | } |
| @@ -611,7 +612,8 @@ struct AgendaScreen: View, Equatable { | ||
| 611 | 612 | } else if let event = row.event { |
| 612 | 613 | // Calendar can't be asked for one event by URL; it opens on the event's day. |
| 613 | 614 | Button { |
| 614 | if let url = URL(string: "calshow:\(event.start.timeIntervalSinceReferenceDate)") { openURL(url) } | |
| 615 | let link = event.isReminder ? "x-apple-reminderkit://REMCDReminder/\(event.id)" : "calshow:\(event.start.timeIntervalSinceReferenceDate)" | |
| 616 | if let url = URL(string: link) { openURL(url) } | |
| 615 | 617 | } label: { |
| 616 | 618 | AgendaRowView(row: row, day: day, theme: theme, dark: isDark) |
| 617 | 619 | } |
| @@ -935,6 +937,7 @@ struct AgendaRowView: View { | ||
| 935 | 937 | case .deadline: row.status == .overdue ? "exclamationmark.triangle.fill" : "flag.fill" |
| 936 | 938 | case .habit: "repeat" |
| 937 | 939 | case .event: "calendar" |
| 940 | case .reminder: "circle" | |
| 938 | 941 | case .timestamp: "clock" |
| 939 | 942 | case nil: nil |
| 940 | 943 | } |
Sources/OrgstarMobile/MobileModel.swift +6
| @@ -38,6 +38,8 @@ final class MobileModel { | ||
| 38 | 38 | var captureRequest: CaptureRequest? |
| 39 | 39 | /// Calendar's events for the agenda, with `calendar-events`. |
| 40 | 40 | let calendarEvents = CalendarEvents() |
| 41 | /// Reminders for the agenda, with `agenda-reminders`. | |
| 42 | let reminderLists = ReminderLists() | |
| 41 | 43 | |
| 42 | 44 | struct AgendaDays: Equatable { |
| 43 | 45 | let start: Int |
| @@ -150,6 +152,8 @@ final class MobileModel { | ||
| 150 | 152 | agenda.options = OrgPreferences.agendaOptions(agenda.options) |
| 151 | 153 | agenda.calendarEvents = OrgPreferences.calendarEvents() ? calendarEvents : nil |
| 152 | 154 | agenda.calendarNames = OrgPreferences.calendarEventCalendars() |
| 155 | agenda.reminderLists = OrgPreferences.agendaReminders() ? reminderLists : nil | |
| 156 | agenda.reminderListNames = OrgPreferences.agendaReminderLists() | |
| 153 | 157 | } |
| 154 | 158 | settingsVersion += 1 |
| 155 | 159 | } |
| @@ -284,6 +288,8 @@ final class MobileModel { | ||
| 284 | 288 | days.options.logMode = false |
| 285 | 289 | days.calendarEvents = agenda.calendarEvents |
| 286 | 290 | days.calendarNames = agenda.calendarNames |
| 291 | days.reminderLists = agenda.reminderLists | |
| 292 | days.reminderListNames = agenda.reminderListNames | |
| 287 | 293 | } |
| 288 | 294 | await days.refresh(open: session.openTexts) |
| 289 | 295 | let groups = days.groups() |
Sources/OrgstarMobile/SettingsScreen.swift +61 −6
| @@ -11,6 +11,7 @@ struct SettingsScreen: View { | ||
| 11 | 11 | let model: MobileModel |
| 12 | 12 | @State private var choosing = false |
| 13 | 13 | @State private var calendars: [CalendarChoice] = [] |
| 14 | @State private var reminderLists: [CalendarChoice] = [] | |
| 14 | 15 | @State private var badges: Bool? |
| 15 | 16 | @Environment(\.openURL) private var openURL |
| 16 | 17 | @Environment(\.scenePhase) private var scenePhase |
| @@ -86,6 +87,7 @@ struct SettingsScreen: View { | ||
| 86 | 87 | if badges == false { Text("Turn on Badges in orgstar's notification settings.") } |
| 87 | 88 | } |
| 88 | 89 | calendarSection |
| 90 | reminderSection | |
| 89 | 91 | Section("In use") { |
| 90 | 92 | let _ = model.settingsVersion |
| 91 | 93 | LabeledContent("TODO keywords", value: todoKeywords) |
| @@ -143,6 +145,58 @@ struct SettingsScreen: View { | ||
| 143 | 145 | .task(id: on) { loadCalendars() } |
| 144 | 146 | } |
| 145 | 147 | |
| 148 | /// `agenda-reminders` and `agenda-reminder-lists`, written to config.toml. | |
| 149 | private var reminderSection: some View { | |
| 150 | let _ = model.settingsVersion | |
| 151 | let on = OrgPreferences.agendaReminders() | |
| 152 | let chosen = OrgPreferences.agendaReminderLists() | |
| 153 | return Section { | |
| 154 | Toggle("Show Reminders", isOn: Binding { | |
| 155 | on | |
| 156 | } set: { value in | |
| 157 | model.set("agendaReminders", to: .bool(value)) | |
| 158 | if value { Task { await requestReminders() } } | |
| 159 | }) | |
| 160 | if on { | |
| 161 | if !ReminderLists.isAuthorized { | |
| 162 | Button("Allow Access to Reminders…") { Task { await requestReminders() } } | |
| 163 | } | |
| 164 | ForEach(reminderLists, id: \.id) { list in | |
| 165 | let shown = CalendarEvents.chooses(id: list.id, title: list.title, chosen: chosen) | |
| 166 | Button { | |
| 167 | toggle(list.title, shown: shown, chosen: chosen, among: reminderLists, key: "agendaReminderLists") | |
| 168 | } label: { | |
| 169 | HStack { | |
| 170 | Circle().fill(list.color?.swiftUI ?? .secondary).frame(width: 10, height: 10) | |
| 171 | Text(list.title).foregroundStyle(.primary) | |
| 172 | Spacer() | |
| 173 | if shown { Image(systemName: "checkmark").foregroundStyle(Color.accentColor) } | |
| 174 | } | |
| 175 | } | |
| 176 | .tint(.primary) | |
| 177 | } | |
| 178 | } | |
| 179 | } header: { | |
| 180 | Text("Reminders") | |
| 181 | } footer: { | |
| 182 | Text(on ? "Incomplete reminders with a due date from the checked lists show in the agenda, read-only; overdue ones under today." | |
| 183 | : "Show reminders from Reminders in the agenda, read-only.") | |
| 184 | } | |
| 185 | .task(id: on) { loadReminderLists() } | |
| 186 | } | |
| 187 | ||
| 188 | private func requestReminders() async { | |
| 189 | _ = await model.reminderLists.requestAccess() | |
| 190 | loadReminderLists() | |
| 191 | model.reloadConfig() | |
| 192 | } | |
| 193 | ||
| 194 | private func loadReminderLists() { | |
| 195 | reminderLists = model.reminderLists.lists() | |
| 196 | .sorted { $0.title.localizedStandardCompare($1.title) == .orderedAscending } | |
| 197 | .map { CalendarChoice(id: $0.id, title: $0.title, color: $0.color) } | |
| 198 | } | |
| 199 | ||
| 146 | 200 | private func requestCalendars() async { |
| 147 | 201 | _ = await model.calendarEvents.requestAccess() |
| 148 | 202 | loadCalendars() |
| @@ -155,15 +209,16 @@ struct SettingsScreen: View { | ||
| 155 | 209 | .map { CalendarChoice(id: $0.id, title: $0.title, color: $0.color) } |
| 156 | 210 | } |
| 157 | 211 | |
| 158 | /// Shows or hides a calendar's events; with every calendar checked the setting is empty. | |
| 159 | /// The last checked calendar stays checked, as an empty list means every calendar. | |
| 160 | private func toggle(_ title: String, shown: Bool, chosen: [String]) { | |
| 161 | var titles = calendars.filter { CalendarEvents.chooses(id: $0.id, title: $0.title, chosen: chosen) }.map(\.title) | |
| 212 | /// Shows or hides a calendar's events or a list's reminders; with every one checked the | |
| 213 | /// setting is empty. The last checked one stays checked, as an empty list means every one. | |
| 214 | private func toggle(_ title: String, shown: Bool, chosen: [String], among choices: [CalendarChoice]? = nil, key: String = "calendarEventCalendars") { | |
| 215 | let choices = choices ?? calendars | |
| 216 | var titles = choices.filter { CalendarEvents.chooses(id: $0.id, title: $0.title, chosen: chosen) }.map(\.title) | |
| 162 | 217 | titles.removeAll { $0 == title } |
| 163 | 218 | if !shown { titles.append(title) } |
| 164 | 219 | guard !titles.isEmpty else { return } |
| 165 | let value = Set(titles) == Set(calendars.map(\.title)) ? "" : titles.joined(separator: ", ") | |
| 166 | model.set("calendarEventCalendars", to: .string(value)) | |
| 220 | let value = Set(titles) == Set(choices.map(\.title)) ? "" : titles.joined(separator: ", ") | |
| 221 | model.set(key, to: .string(value)) | |
| 167 | 222 | } |
| 168 | 223 | |
| 169 | 224 | /// The span and start day, worded as the Mac's Settings word the start. |
Tests/OrgAppTests/ReminderListsTests.swift added +60
| @@ -0,0 +1,60 @@ | ||
| 1 | import CoreGraphics | |
| 2 | import Foundation | |
| 3 | import OrgCore | |
| 4 | import OrgPresentation | |
| 5 | import Testing | |
| 6 | @testable import OrgApp | |
| 7 | ||
| 8 | struct ReminderListsTests { | |
| 9 | struct Record: ReminderRecord { | |
| 10 | var recordID = "r1" | |
| 11 | var recordTitle = "Call the bank" | |
| 12 | var recordDue: DateComponents? = DateComponents(year: 2026, month: 10, day: 12, hour: 15, minute: 30) | |
| 13 | var recordListID = "list-1" | |
| 14 | var recordListTitle = "Errands" | |
| 15 | var recordListColor: CGColor? = CGColor(srgbRed: 0, green: 0.5, blue: 1, alpha: 1) | |
| 16 | } | |
| 17 | ||
| 18 | static var utc: Calendar { | |
| 19 | var c = Calendar(identifier: .gregorian) | |
| 20 | c.timeZone = TimeZone(identifier: "UTC")! | |
| 21 | return c | |
| 22 | } | |
| 23 | ||
| 24 | @Test func recordsBecomeAgendaEvents() throws { | |
| 25 | let event = try #require(ReminderLists.event(Record(), calendar: Self.utc)) | |
| 26 | #expect(event.isReminder && !event.isAllDay && event.title == "Call the bank" && event.calendarTitle == "Errands") | |
| 27 | #expect(event.start == event.end && Self.utc.dateComponents([.hour, .minute], from: event.start) == DateComponents(hour: 15, minute: 30)) | |
| 28 | var untimed = Record() | |
| 29 | untimed.recordDue = DateComponents(year: 2026, month: 10, day: 12) | |
| 30 | #expect(ReminderLists.event(untimed, calendar: Self.utc)?.isAllDay == true) | |
| 31 | var none = Record() | |
| 32 | none.recordDue = nil | |
| 33 | #expect(ReminderLists.event(none, calendar: Self.utc) == nil) | |
| 34 | } | |
| 35 | ||
| 36 | @Test func remindersGoOnTheirDayAndOverdueOnesToday() throws { | |
| 37 | let calendar = Self.utc | |
| 38 | let timed = try #require(ReminderLists.event(Record(), calendar: calendar)) | |
| 39 | var untimedRecord = Record() | |
| 40 | untimedRecord.recordID = "r2" | |
| 41 | untimedRecord.recordDue = DateComponents(year: 2026, month: 10, day: 13) | |
| 42 | let untimed = try #require(ReminderLists.event(untimedRecord, calendar: calendar)) | |
| 43 | var lateRecord = Record() | |
| 44 | lateRecord.recordID = "r3" | |
| 45 | lateRecord.recordDue = DateComponents(year: 2026, month: 10, day: 9, hour: 9, minute: 0) | |
| 46 | let late = try #require(ReminderLists.event(lateRecord, calendar: calendar)) | |
| 47 | let today = Days.absolute(calendar.date(from: DateComponents(year: 2026, month: 10, day: 11))!, calendar: calendar) | |
| 48 | let days = Agenda.list([], start: today, days: 4, today: today, now: (8, 0), options: AgendaOptions()) | |
| 49 | let groups = AgendaRows.groups(days, events: [timed, untimed, late], today: today, calendar: calendar) | |
| 50 | let todayGroup = try #require(groups.first { $0.day == today }) | |
| 51 | #expect(todayGroup.overdue.map(\.gutter) == ["2d late"]) | |
| 52 | #expect(todayGroup.overdue.first?.status == .overdue && todayGroup.overdue.first?.icon == .reminder) | |
| 53 | let monday = try #require(groups.first { $0.day == today + 1 }) | |
| 54 | #expect(monday.rows.map(\.gutter) == ["15:30"] && monday.rows[0].category == "Errands" && monday.rows[0].isEvent) | |
| 55 | let tuesday = try #require(groups.first { $0.day == today + 2 }) | |
| 56 | #expect(tuesday.rows.map(\.gutter) == ["Reminder"]) | |
| 57 | // The late reminder isn't repeated on the days after today. | |
| 58 | #expect(!groups.contains { $0.day != today && ($0.rows + $0.overdue).contains { $0.title == "Call the bank" && $0.gutter.hasSuffix("late") } }) | |
| 59 | } | |
| 60 | } | |
docs/manual/guide/07-agenda.org +24
| @@ -217,6 +217,30 @@ Events appear only in the day, week and month view: | ||
| 217 | 217 | |
| 218 | 218 | On the Mac, double-click an event, or select it and press =RET=, to open it in Calendar; its context menu has Show in Calendar. Entry commands such as =t= don't apply to events. |
| 219 | 219 | |
| 220 | * Reminders | |
| 221 | ||
| 222 | The agenda can also show reminders from the Reminders app (EventKit), read-only. It is off by default. To turn it on: | |
| 223 | ||
| 224 | - On the Mac, turn on Settings ▸ Agenda ▸ Show reminders from Reminders, and check the lists to show. | |
| 225 | - On iOS, turn on Settings ▸ Reminders ▸ Show Reminders, and tap the lists to show. | |
| 226 | - Or set the keys in =config.toml=: | |
| 227 | ||
| 228 | #+BEGIN_SRC toml | |
| 229 | [orgstar] | |
| 230 | agenda-reminders = true | |
| 231 | agenda-reminder-lists = "Errands, Work" | |
| 232 | #+END_SRC | |
| 233 | ||
| 234 | =agenda-reminder-lists= names lists by title or identifier, separated by commas; =""= (the default) shows every list. The first time reminders are turned on, orgstar asks for full access to your reminders; if you declined, allow it in System Settings ▸ Privacy & Security ▸ Reminders on the Mac, or in the Settings app on iOS. | |
| 235 | ||
| 236 | Only incomplete reminders with a due date show, in the day, week and month view: | |
| 237 | ||
| 238 | - A reminder with a due time shows at that time among the timed entries, as a timed event does. One with only a due date shows =Reminder= with the all-day events. | |
| 239 | - A reminder due before today shows in today's Overdue group as =2d late=, among the overdue entries by date. | |
| 240 | - The row's category is the list's name, and the dot takes the list's color. | |
| 241 | ||
| 242 | Completing or editing a reminder is done in Reminders. On the Mac, double-click a reminder, or press =RET=, to open it in Reminders; its context menu has Show in Reminders. On iOS, tap it. | |
| 243 | ||
| 220 | 244 | * Done keywords the agenda doesn't know |
| 221 | 245 | |
| 222 | 246 | A keyword that isn't in =org-todo-keywords= or the file's =#+TODO= lines is not a keyword to orgstar, as to Org: it is part of the title. A heading such as =SKIPPED Call the bank= with a =SCHEDULED= date last week is therefore an open entry, and shows as overdue. To make such a word a done state, add it after the ~|~: |
docs/manual/guide/13-configuration.org +5 −1
| @@ -112,6 +112,8 @@ See Themes and Fonts below. | ||
| 112 | 112 | | Blocked entries | Dimmed; Hidden; Shown as usual | Dimmed | =org-agenda-dim-blocked-tasks= | |
| 113 | 113 | | Show events from Calendar | On or off | Off | =calendar-events= | |
| 114 | 114 | | A checkbox for each calendar | On or off | All on | =calendar-event-calendars= | |
| 115 | | Show reminders from Reminders | On or off | Off | =agenda-reminders= | | |
| 116 | | A checkbox for each list | On or off | All on | =agenda-reminder-lists= | | |
| 115 | 117 | | Notify before timed agenda entries | On or off | On | =reminders= | |
| 116 | 118 | | N minutes before | 0 to 120 | 12 | =appt-message-warning-time= | |
| 117 | 119 | | Ask what to do with idle time while clocked in | On or off | Off | =org-clock-idle-time= | |
| @@ -120,7 +122,7 @@ See Themes and Fonts below. | ||
| 120 | 122 | |
| 121 | 123 | An entry's =APPT_WARNTIME= property overrides the lead time. The agenda is covered in [[file:07-agenda.org][The agenda]]. |
| 122 | 124 | |
| 123 | The calendar checkboxes appear once Show events from Calendar is on and orgstar may read your calendars; turning the switch on asks for that access. While every calendar is checked, =calendar-event-calendars= is empty, so calendars you add later show too. The last checked calendar can't be unchecked; turn off Show events from Calendar instead. | |
| 125 | The calendar checkboxes appear once Show events from Calendar is on and orgstar may read your calendars; turning the switch on asks for that access. While every calendar is checked, =calendar-event-calendars= is empty, so calendars you add later show too. The last checked calendar can't be unchecked; turn off Show events from Calendar instead. The Reminders list checkboxes work the same way. See [[file:07-agenda.org][The agenda]]. | |
| 124 | 126 | |
| 125 | 127 | Turning on the idle question sets =org-clock-idle-time= to 15 minutes; turning it off sets it to =0=. The minutes stepper is disabled while the question is off. Idle time and the clock history are covered in [[file:06-dates-and-clocking.org][Dates and clocking]]. |
| 126 | 128 | |
| @@ -365,6 +367,8 @@ Any other key in =[theme]= is a color; see Themes below. | ||
| 365 | 367 | | =reminders= | boolean | =true= | Notify before timed entries. | |
| 366 | 368 | | =calendar-events= | boolean | =false= | Show events from Calendar in the agenda, read-only. | |
| 367 | 369 | | =calendar-event-calendars= | string | =""= | The calendars whose events show, by title or identifier, separated by commas; =""= for all. | |
| 370 | | =agenda-reminders= | boolean | =false= | Show incomplete reminders with a due date from Reminders in the agenda, read-only. | | |
| 371 | | =agenda-reminder-lists= | string | =""= | The Reminders lists shown, by title or identifier, separated by commas; =""= for all. | | |
| 368 | 372 | | =global-capture-hotkey= | boolean | =true= | =⌃⌥Space= opens Capture from any app. | |
| 369 | 373 | |
| 370 | 374 | The default =ignored-folders= is: |
docs/manual/guide/14-ios.org +4 −3
| @@ -179,7 +179,7 @@ The Agenda tab shows the agenda over all your folders, with the span and start d | ||
| 179 | 179 | |
| 180 | 180 | Commands from the agenda change the file directly when it isn't open, and through the editor when it is. If the heading changed since the agenda was built, nothing runs. |
| 181 | 181 | |
| 182 | With =calendar-events= on, the agenda also shows events from the Calendar app; see Settings below. | |
| 182 | With =calendar-events= on, the agenda also shows events from the Calendar app, and with =agenda-reminders= on, reminders from the Reminders app; see Settings below. | |
| 183 | 183 | |
| 184 | 184 | See [[file:07-agenda.org][The agenda]] for the rows, the views and matches, and the differences from the Mac. |
| 185 | 185 | |
| @@ -346,13 +346,14 @@ Import from Emacs reads an Emacs or Doom configuration folder, such as a synced | ||
| 346 | 346 | |
| 347 | 347 | With a configuration folder, settings and structure templates are written to its =config.toml=, and capture templates, key bindings and agenda views to its =capture.toml=, =keymap.toml= and =views.toml=, so the Mac reads them too. Without one, settings are kept on the device. Folders from =org-agenda-files= name the Mac's paths and aren't offered. |
| 348 | 348 | |
| 349 | The Agenda, TODO Dependencies and Calendar sections are the only places the app changes a setting itself: | |
| 349 | The Agenda, TODO Dependencies, Calendar and Reminders sections are the only places the app changes a setting itself, besides Import from Emacs: | |
| 350 | 350 | |
| 351 | 351 | - Show days without entries :: turns =org-agenda-show-all-dates= on or off. |
| 352 | 352 | - Blocked entries :: Dimmed, Hidden or Shown as usual (=org-agenda-dim-blocked-tasks=). |
| 353 | 353 | - TODO Dependencies :: Not done before TODO children (=org-enforce-todo-dependencies=) and Not done with unchecked boxes (=org-enforce-todo-checkbox-dependencies=). |
| 354 | 354 | - Show Calendar Events :: turns on =calendar-events=, and asks for access to your calendars. iOS asks for full access, as Calendar has no read-only level; orgstar only reads. While access is missing the section shows Allow Access to Calendars…; if you declined, allow it in the Settings app under Privacy & Security ▸ Calendars. |
| 355 | 355 | - The calendars :: tap one to show or hide its events (=calendar-event-calendars=). With every calendar checked the setting is empty, so calendars added later show too. |
| 356 | - Show Reminders :: turns on =agenda-reminders= and asks for access to your reminders; Allow Access to Reminders… shows while it is missing. Tap a list to show or hide its reminders (=agenda-reminder-lists=). | |
| 356 | 357 | |
| 357 | 358 | These write =config.toml= in the configuration folder, as the Mac's Settings window does, so the Mac sees the change too. Without a configuration folder they are kept on the device. |
| 358 | 359 | |
| @@ -374,7 +375,7 @@ These settings from =config.toml= apply on iOS: | ||
| 374 | 375 | - =org-use-speed-commands=, with a hardware keyboard |
| 375 | 376 | - =electric-pair-mode=, =spell-check=, =auto-fill-mode= |
| 376 | 377 | - =org-agenda-span=, =org-agenda-start-day=, =org-agenda-start-on-weekday=, =org-deadline-warning-days=, =agenda-include-subfolders=, =org-agenda-show-all-dates=, =org-agenda-skip-scheduled-if-done=, =org-agenda-skip-deadline-if-done=, =org-agenda-search-view-always-boolean=, =org-agenda-search-view-force-full-words=, =org-agenda-log-mode-items=, the =org-agenda-todo-ignore-= settings, =org-agenda-tags-todo-honor-ignore-options= |
| 377 | - =calendar-events=, =calendar-event-calendars= | |
| 378 | - =calendar-events=, =calendar-event-calendars=, =agenda-reminders=, =agenda-reminder-lists= | |
| 378 | 379 | - =reminders=, =appt-message-warning-time= |
| 379 | 380 | - =org-clock-history-length=, =org-clock-into-drawer=, =org-clock-rounding-minutes=, =org-clock-out-remove-zero-time-clocks=, =org-clock-in-switch-to-state=, =org-clock-out-when-done= |
| 380 | 381 | |
ios/Orgstar/Info.plist +2
| @@ -41,6 +41,8 @@ | ||
| 41 | 41 | <string>Face ID unlocks the passphrase of encrypted entries you asked orgstar to remember.</string> |
| 42 | 42 | <key>NSCalendarsFullAccessUsageDescription</key> |
| 43 | 43 | <string>The agenda shows your calendar events alongside your Org entries. orgstar only reads them.</string> |
| 44 | <key>NSRemindersFullAccessUsageDescription</key> | |
| 45 | <string>The agenda shows your reminders alongside your Org entries. orgstar only reads them.</string> | |
| 44 | 46 | <key>NSSupportsLiveActivities</key> |
| 45 | 47 | <true/> |
| 46 | 48 | <key>UIApplicationSceneManifest</key> |
scripts/build-app.sh +2
| @@ -133,6 +133,8 @@ ${feed_keys} | ||
| 133 | 133 | <string>public.app-category.productivity</string> |
| 134 | 134 | <key>NSCalendarsFullAccessUsageDescription</key> |
| 135 | 135 | <string>The agenda shows your calendar events alongside your Org entries. orgstar only reads them.</string> |
| 136 | <key>NSRemindersFullAccessUsageDescription</key> | |
| 137 | <string>The agenda shows your reminders alongside your Org entries. orgstar only reads them.</string> | |
| 136 | 138 | <key>NSHighResolutionCapable</key> |
| 137 | 139 | <true/> |
| 138 | 140 | <key>NSPrincipalClass</key> |
scripts/build-ios-app.sh +2
| @@ -53,6 +53,8 @@ cat > "$app/Info.plist" <<PLIST | ||
| 53 | 53 | <string>Face ID unlocks the passphrase of encrypted entries you asked orgstar to remember.</string> |
| 54 | 54 | <key>NSCalendarsFullAccessUsageDescription</key> |
| 55 | 55 | <string>The agenda shows your calendar events alongside your Org entries. orgstar only reads them.</string> |
| 56 | <key>NSRemindersFullAccessUsageDescription</key> | |
| 57 | <string>The agenda shows your reminders alongside your Org entries. orgstar only reads them.</string> | |
| 56 | 58 | <key>UIDeviceFamily</key> |
| 57 | 59 | <array><integer>1</integer><integer>2</integer></array> |
| 58 | 60 | <key>UILaunchScreen</key> |