@@ -353,9 +353,8 @@ <h1 class="title">Invalid Link</h1>
353353 const openAppBtn = document . getElementById ( 'openAppBtn' ) ;
354354 const githubBtn = document . getElementById ( 'githubBtn' ) ;
355355
356- // Validate: must be "owner/repo" format
356+ // Validate
357357 const match = repo ? repo . match ( / ^ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) $ / ) : null ;
358-
359358 if ( ! match ) {
360359 stateRedirecting . classList . remove ( 'active' ) ;
361360 stateError . classList . add ( 'active' ) ;
@@ -366,21 +365,17 @@ <h1 class="title">Invalid Link</h1>
366365 const repoName = match [ 2 ] ;
367366 const githubUrl = 'https://github.com/' + owner + '/' + repoName ;
368367
369- // Custom scheme URI (works on desktop & iOS)
368+ // URIs
370369 const customSchemeUri = 'githubstore://repo/' + owner + '/' + repoName ;
371-
372- // Android intent:// URI — this is what actually works in Android browsers.
373- // It tells the browser: "try to open this app, and if it's not installed,
374- // go to the fallback URL (Play Store / releases page)".
375370 const intentUri = 'intent://repo/' + owner + '/' + repoName
376371 + '#Intent;scheme=githubstore;package=zed.rainxch.githubstore;'
377372 + 'S.browser_fallback_url=' + encodeURIComponent ( 'https://github.com/rainxchzed/Github-Store/releases/latest' )
378373 + ';end' ;
379374
380- // Detect platform
375+ // Detect platform (MUST be before we use isAndroid)
381376 const ua = navigator . userAgent . toLowerCase ( ) ;
377+ const isAndroid = ua . includes ( 'android' ) ;
382378
383- // The URI to use for opening the app
384379 const openUri = isAndroid ? intentUri : customSchemeUri ;
385380
386381 // Set up UI
@@ -389,14 +384,17 @@ <h1 class="title">Invalid Link</h1>
389384 openAppBtn . href = openUri ;
390385 githubBtn . href = githubUrl ;
391386
392- const isAndroid = ua . includes ( 'android' ) ;
393-
387+ // Auto-redirect only on non-Android (iOS + desktop)
394388 if ( ! isAndroid ) {
395389 setTimeout ( ( ) => {
396390 window . location . replace ( openUri ) ;
397391 } , 1200 ) ;
398392 }
393+
394+ // Optional: log for debugging
395+ console . log ( 'Platform:' , isAndroid ? 'Android' : 'iOS/Desktop' ) ;
396+ console . log ( 'openUri:' , openUri ) ;
399397 } ) ( ) ;
400- </ script >
398+ </ script >
401399</ body >
402400</ html >
0 commit comments