@@ -6,6 +6,8 @@ import { log } from "../../shared/logger"
66import { getConfigLoadErrors , clearConfigLoadErrors } from "../../shared/config-errors"
77import type { AutoUpdateCheckerOptions } from "./types"
88
9+ const SISYPHUS_SPINNER = [ "·" , "•" , "●" , "○" , "◌" , "◦" , " " ]
10+
911export function createAutoUpdateCheckerHook ( ctx : PluginInput , options : AutoUpdateCheckerOptions = { } ) {
1012 const { showStartupToast = true , isSisyphusEnabled = false , autoUpdate = true } = options
1113
@@ -133,19 +135,31 @@ async function showConfigErrorsIfAny(ctx: PluginInput): Promise<void> {
133135
134136async function showVersionToast ( ctx : PluginInput , version : string | null , message : string ) : Promise < void > {
135137 const displayVersion = version ?? "unknown"
136- await ctx . client . tui
137- . showToast ( {
138- body : {
139- title : `OhMyOpenCode ${ displayVersion } ` ,
140- message,
141- variant : "info" as const ,
142- duration : 5000 ,
143- } ,
144- } )
145- . catch ( ( ) => { } )
138+ await showSpinnerToast ( ctx , displayVersion , message )
146139 log ( `[auto-update-checker] Startup toast shown: v${ displayVersion } ` )
147140}
148141
142+ async function showSpinnerToast ( ctx : PluginInput , version : string , message : string ) : Promise < void > {
143+ const totalDuration = 5000
144+ const frameInterval = 100
145+ const totalFrames = Math . floor ( totalDuration / frameInterval )
146+
147+ for ( let i = 0 ; i < totalFrames ; i ++ ) {
148+ const spinner = SISYPHUS_SPINNER [ i % SISYPHUS_SPINNER . length ]
149+ await ctx . client . tui
150+ . showToast ( {
151+ body : {
152+ title : `${ spinner } OhMyOpenCode ${ version } ` ,
153+ message,
154+ variant : "info" as const ,
155+ duration : frameInterval + 50 ,
156+ } ,
157+ } )
158+ . catch ( ( ) => { } )
159+ await new Promise ( resolve => setTimeout ( resolve , frameInterval ) )
160+ }
161+ }
162+
149163async function showUpdateAvailableToast (
150164 ctx : PluginInput ,
151165 latestVersion : string ,
@@ -183,16 +197,7 @@ async function showLocalDevToast(ctx: PluginInput, version: string | null, isSis
183197 const message = isSisyphusEnabled
184198 ? "Sisyphus running in local development mode."
185199 : "Running in local development mode. oMoMoMo..."
186- await ctx . client . tui
187- . showToast ( {
188- body : {
189- title : `OhMyOpenCode ${ displayVersion } (dev)` ,
190- message,
191- variant : "warning" as const ,
192- duration : 5000 ,
193- } ,
194- } )
195- . catch ( ( ) => { } )
200+ await showSpinnerToast ( ctx , `${ displayVersion } (dev)` , message )
196201 log ( `[auto-update-checker] Local dev toast shown: v${ displayVersion } ` )
197202}
198203
0 commit comments