Commit 5d32071ad7
Verified · cmc
Layout: unified · split
Sources/OrgstarMobile/OrgstarMobileApp.swift +15 −10
| @@ -350,16 +350,7 @@ struct RootView: View { | |||
| 350 | model.reloadConfig() | 350 | model.reloadConfig() |
| 351 | Task { await workspace.refresh() } | 351 | Task { await workspace.refresh() } |
| 352 | } | 352 | } |
| 353 | .onOpenURL { url in | 353 | .onOpenURL(perform: handle) |
| 354 | if let link = AppLink(url: url) { | ||
| 355 | open(link) | ||
| 356 | } else if let request = CaptureRequest(link: url.absoluteString) { | ||
| 357 | capture = request | ||
| 358 | } else if case .storeLink(let link, let title)? = OrgProtocol.parse(url.absoluteString) { | ||
| 359 | message = StoredLink.add(StoredLink(link: link, description: title), to: &model.storedLinks) | ||
| 360 | UIPasteboard.general.string = link | ||
| 361 | } | ||
| 362 | } | ||
| 363 | // The Live Activity follows the clock, wherever it starts or stops. | 354 | // The Live Activity follows the clock, wherever it starts or stops. |
| 364 | .task { | 355 | .task { |
| 365 | LiveClock.publish(model.clock) | 356 | LiveClock.publish(model.clock) |
| @@ -401,6 +392,20 @@ struct RootView: View { | |||
| 401 | showWaiting() | 392 | showWaiting() |
| 402 | } | 393 | } |
| 403 | 394 | ||
| 395 | /// A widget's or the Live Activity's link, or an org-protocol URL. | ||
| 396 | private func handle(_ url: URL) { | ||
| 397 | if let link = AppLink(url: url) { | ||
| 398 | open(link) | ||
| 399 | } else if let request = CaptureRequest(link: url.absoluteString) { | ||
| 400 | capture = request | ||
| 401 | } else if case .storeLink(let link, let title)? = OrgProtocol.parse(url.absoluteString) { | ||
| 402 | message = StoredLink.add(StoredLink(link: link, description: title), to: &model.storedLinks) | ||
| 403 | UIPasteboard.general.string = link | ||
| 404 | } else if url.scheme == "org-protocol" { | ||
| 405 | message = "orgstar handles org-protocol capture and store-link" | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 404 | /// A widget's or the Live Activity's link. | 409 | /// A widget's or the Live Activity's link. |
| 405 | private func open(_ link: AppLink) { | 410 | private func open(_ link: AppLink) { |
| 406 | switch link { | 411 | switch link { |
docs/manual/guide/15-alongside-emacs.org +2
| @@ -31,6 +31,8 @@ Emacs and Syncthing don't use file coordination, so these checks can't lock them | |||
| 31 | 31 | ||
| 32 | If the file keeps changing through all three attempts, the save fails with an error and your edits stay unsaved. | 32 | If the file keeps changing through all three attempts, the save fails with an error and your edits stay unsaved. |
| 33 | 33 | ||
| 34 | In the Mac App Store version, when the folder doesn't let orgstar create the temporary file, orgstar writes the file in place instead. | ||
| 35 | |||
| 34 | ** Automatic and explicit saving | 36 | ** Automatic and explicit saving |
| 35 | 37 | ||
| 36 | With =save = "automatic"= (the default), orgstar saves a file one second after you stop typing. With ="explicit"=, only =⌘S= (Save) and =⌥⌘S= (Save All) save. See [[file:13-configuration.org][Configuration]]. The iOS app always saves automatically. | 38 | With =save = "automatic"= (the default), orgstar saves a file one second after you stop typing. With ="explicit"=, only =⌘S= (Save) and =⌥⌘S= (Save All) save. See [[file:13-configuration.org][Configuration]]. The iOS app always saves automatically. |