mirror of
https://github.com/stablyai/orca.git
synced 2026-10-19 16:03:26 +00:00
fix(mobile): version-agnostic update links so release URLs never go stale
This commit is contained in:
@@ -46,7 +46,7 @@ export function UpdateNudgeBanner({
|
||||
return null
|
||||
}
|
||||
|
||||
const storeUrl = getMobileAppUpdateUrl(Platform.OS, recommendedVersion)
|
||||
const storeUrl = getMobileAppUpdateUrl(Platform.OS)
|
||||
return (
|
||||
<View style={styles.banner}>
|
||||
<Text style={styles.text}>Update the Orca app for the best experience</Text>
|
||||
|
||||
@@ -3,19 +3,18 @@ import { getMobileAppUpdateUrl } from './mobile-app-update-link'
|
||||
|
||||
describe('getMobileAppUpdateUrl', () => {
|
||||
it('uses the native App Store listing on iOS', () => {
|
||||
expect(getMobileAppUpdateUrl('ios', '0.0.31')).toBe(
|
||||
expect(getMobileAppUpdateUrl('ios')).toBe(
|
||||
'itms-apps://apps.apple.com/app/orca-ide/id6766130217'
|
||||
)
|
||||
})
|
||||
|
||||
it('links Android to the exact advertised GitHub release', () => {
|
||||
expect(getMobileAppUpdateUrl('android', '0.0.31')).toBe(
|
||||
'https://github.com/stablyai/orca/releases/tag/mobile-android-v0.0.31'
|
||||
it('links Android to the mobile-filtered GitHub releases list', () => {
|
||||
expect(getMobileAppUpdateUrl('android')).toBe(
|
||||
'https://github.com/stablyai/orca/releases?q=mobile-android'
|
||||
)
|
||||
expect(getMobileAppUpdateUrl('android')).toBe('https://github.com/stablyai/orca/releases')
|
||||
})
|
||||
|
||||
it('fails open without a supported distribution', () => {
|
||||
expect(getMobileAppUpdateUrl('web', '0.0.31')).toBeNull()
|
||||
expect(getMobileAppUpdateUrl('web')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
const IOS_APP_STORE_URL = 'itms-apps://apps.apple.com/app/orca-ide/id6766130217'
|
||||
const ANDROID_RELEASES_URL = 'https://github.com/stablyai/orca/releases'
|
||||
// Why: filter to mobile release tags so daily desktop releases don't bury the
|
||||
// newest APK; deliberately version-agnostic so the link never goes stale.
|
||||
const ANDROID_RELEASES_URL = 'https://github.com/stablyai/orca/releases?q=mobile-android'
|
||||
|
||||
// Why: Android ships from versioned GitHub releases while iOS ships through
|
||||
// the App Store; keep both update surfaces aligned with the actual distribution.
|
||||
export function getMobileAppUpdateUrl(
|
||||
platform: string,
|
||||
recommendedVersion?: string
|
||||
): string | null {
|
||||
// Why: Android ships from GitHub releases while iOS ships through the App
|
||||
// Store; both surfaces always show the newest build without naming a version.
|
||||
export function getMobileAppUpdateUrl(platform: string): string | null {
|
||||
if (platform === 'ios') {
|
||||
return IOS_APP_STORE_URL
|
||||
}
|
||||
if (platform === 'android') {
|
||||
return recommendedVersion
|
||||
? `${ANDROID_RELEASES_URL}/tag/mobile-android-v${encodeURIComponent(recommendedVersion)}`
|
||||
: ANDROID_RELEASES_URL
|
||||
return ANDROID_RELEASES_URL
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user