(
note: Pick<ZenNote, "path" | "title">,
action: "open" | "open-window",
messages: {
openingTitle: string;
successTitle: string;
failureTitle: string;
},
)
| 138 | } |
| 139 | |
| 140 | async function openNoteWithDeepLink( |
| 141 | note: Pick<ZenNote, "path" | "title">, |
| 142 | action: "open" | "open-window", |
| 143 | messages: { |
| 144 | openingTitle: string; |
| 145 | successTitle: string; |
| 146 | failureTitle: string; |
| 147 | }, |
| 148 | ): Promise<void> { |
| 149 | await showToast({ |
| 150 | style: Toast.Style.Animated, |
| 151 | title: messages.openingTitle, |
| 152 | message: note.title, |
| 153 | }); |
| 154 | |
| 155 | try { |
| 156 | await open(`zennotes://${action}?path=${encodeURIComponent(note.path)}`); |
| 157 | await showToast({ |
| 158 | style: Toast.Style.Success, |
| 159 | title: messages.successTitle, |
| 160 | message: note.title, |
| 161 | }); |
| 162 | } catch (err) { |
| 163 | await showToast({ |
| 164 | style: Toast.Style.Failure, |
| 165 | title: messages.failureTitle, |
| 166 | message: err instanceof Error ? err.message : String(err), |
| 167 | }); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | export function absoluteNotePath( |
| 172 | vaultRoot: string | null, |
no test coverage detected