(previous: string)
| 165 | } |
| 166 | |
| 167 | const start = (previous: string) => { |
| 168 | if (!settings.general.releaseNotes()) { |
| 169 | markSeen() |
| 170 | return |
| 171 | } |
| 172 | |
| 173 | const fetcher = platform.fetch ?? fetch |
| 174 | const controller = new AbortController() |
| 175 | onCleanup(() => { |
| 176 | controller.abort() |
| 177 | clearTimer() |
| 178 | }) |
| 179 | |
| 180 | fetcher(CHANGELOG_URL, { |
| 181 | signal: controller.signal, |
| 182 | headers: { Accept: "application/json" }, |
| 183 | }) |
| 184 | .then((response) => (response.ok ? (response.json() as Promise<unknown>) : undefined)) |
| 185 | .then((json) => { |
| 186 | if (!json) return |
| 187 | const highlights = loadReleaseHighlights(json, platform.version, previous) |
| 188 | if (controller.signal.aborted) return |
| 189 | |
| 190 | if (highlights.length === 0) { |
| 191 | markSeen() |
| 192 | return |
| 193 | } |
| 194 | |
| 195 | timer = setTimeout(() => { |
| 196 | timer = undefined |
| 197 | markSeen() |
| 198 | dialog.show(() => <DialogReleaseNotes highlights={highlights} />) |
| 199 | }, 500) |
| 200 | }) |
| 201 | .catch(() => undefined) |
| 202 | } |
| 203 | |
| 204 | createEffect(() => { |
| 205 | if (state.started) return |
no test coverage detected