mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-06 04:23:42 +08:00
Galaxy: Send Android users to the beta group instead of the APK download
This commit is contained in:
@@ -57,7 +57,7 @@ try {
|
||||
const notice = banner(host)
|
||||
assert.ok(notice, 'A native app without an internet-sharing lease still gets an update notice')
|
||||
assert.match(text(notice), /Version 1.1.5 is available.*Installed: 1.1.4/s)
|
||||
assert.ok(all(notice).some(item => item.type === 'a' && item.props.href === './app.apk' && text(item).includes('Update app')))
|
||||
assert.ok(all(notice).some(item => item.type === 'a' && item.props.href === 'https://groups.google.com/g/galaxy-starpilot-android-beta' && text(item).includes('Update app')))
|
||||
assert.ok(all(host).some(item => item.type === 'div' && item.props.class === 'install-state' && text(item).includes('true')),
|
||||
'The main install action is told to render as an update')
|
||||
const root = host.children.find(item => item.type === 'div')
|
||||
|
||||
@@ -13,7 +13,7 @@ assert.ok(Home.template.includes('aria-hidden="true"><svg'))
|
||||
assert.ok(GalaxyPage.template.includes('>Galaxy Access & Install</h2>'))
|
||||
assert.ok(!GalaxyPage.template.includes('Galaxy & App Install'))
|
||||
assert.ok(GalaxyPage.template.includes('Your remote link needs Internet and an active tunnel.'))
|
||||
assert.ok(GalaxyPage.template.includes('Download Android APK'))
|
||||
assert.ok(GalaxyPage.template.includes('join the Android beta on Google Groups'))
|
||||
assert.ok(GalaxyPage.template.includes('Android offline app version:'))
|
||||
assert.ok(GalaxyPage.template.includes('<GalaxyHotspot'))
|
||||
assert.ok(GalaxyPage.template.includes('<GalaxyCompanion v-if="!ios"'), 'The Android companion section is not mounted on iOS')
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { androidInstallHelp, installHelp, InstallApp, rememberInstallPrompt, isIosDevice, isAndroidDevice } from '../web/js/install-app.js'
|
||||
import { ANDROID_BETA_URL, installHelp, InstallApp, rememberInstallPrompt, isIosDevice, isAndroidDevice } from '../web/js/install-app.js'
|
||||
assert.match(installHelp({ secure: true, agent: 'iPhone' }), /Share.*Add to Home Screen/)
|
||||
assert.match(installHelp({ secure: false, agent: 'Android' }), /web app.*https:\/\/galaxy\.firestar\.link/)
|
||||
assert.match(installHelp({ secure: true, agent: 'Android' }), /Install app/)
|
||||
assert.match(androidInstallHelp(), /download the Android app.*locally|locally.*download the Android app/i)
|
||||
assert.equal(ANDROID_BETA_URL, 'https://groups.google.com/g/galaxy-starpilot-android-beta')
|
||||
assert.match(installHelp({ secure: true, agent: 'Chrome' }), /Install app/)
|
||||
const events = new Map()
|
||||
let modeListener
|
||||
@@ -44,7 +44,7 @@ await InstallApp.methods.installWeb.call(late)
|
||||
assert.equal(prompted, 2)
|
||||
InstallApp.beforeUnmount.call(late)
|
||||
|
||||
// Android offers the local APK; tunnel pages explain how to connect locally.
|
||||
// Android sends users to the Google Groups beta instead of a direct APK download.
|
||||
navigator.userAgent = 'Android'
|
||||
let apk
|
||||
globalThis.location = { protocol: 'http:', assign: value => { apk = value } }
|
||||
@@ -57,15 +57,12 @@ assert.equal(apk, undefined, 'Native updates never hand the APK to a browser')
|
||||
delete window.StarPilotApp
|
||||
const android = { ...InstallApp.data() }
|
||||
InstallApp.methods.installAndroid.call(android)
|
||||
assert.equal(apk, './app.apk')
|
||||
assert.equal(apk, ANDROID_BETA_URL)
|
||||
assert.match(InstallApp.template, /Install web app/)
|
||||
assert.match(InstallApp.template, /Direct \(advanced\) · Download APK/)
|
||||
assert.match(InstallApp.template, /Join the Android beta/)
|
||||
assert.doesNotMatch(InstallApp.template, /app\.apk|Download Android APK/)
|
||||
assert.match(InstallApp.template, /Update offline app \(Android\)/)
|
||||
assert.match(InstallApp.template, /android && !ios/)
|
||||
location.protocol = 'https:'
|
||||
InstallApp.methods.installAndroid.call(android)
|
||||
assert.equal(android.help, true)
|
||||
assert.match(android.message, /Android app.*locally|locally.*Android app/i)
|
||||
|
||||
// Choosing the web app on Android always keeps web-install guidance.
|
||||
const webHelp = InstallApp.methods.installHelp.call(android)
|
||||
|
||||
@@ -66,6 +66,6 @@ console.log('Local access: actual Vue component/setup, bounded automatically syn
|
||||
assert.equal(GalaxyPage.components.LocalAccess, LocalAccess)
|
||||
const installStep = GalaxyPage.template.slice(GalaxyPage.template.indexOf('<h3>Install Galaxy</h3>'), GalaxyPage.template.indexOf('</li>', GalaxyPage.template.indexOf('<h3>Install Galaxy</h3>')))
|
||||
assert.ok(installStep.includes('<LocalAccess v-if="!ios" :mode="mode" :on-unauthorized="unauthorized" />'))
|
||||
assert.ok(installStep.indexOf('Download Android APK') < installStep.indexOf('<LocalAccess'))
|
||||
assert.ok(installStep.indexOf('Android users:') < installStep.indexOf('<LocalAccess'))
|
||||
compile(GalaxyPage.template, { decodeEntities: value => value.replaceAll('&', '&') })
|
||||
console.log('Galaxy APK installation exposes authenticated local links with current mode and session handling')
|
||||
|
||||
@@ -87,10 +87,8 @@ export const GalaxyCompanion = {
|
||||
<p v-if="native"><button class="gx-btn gx-btn--tonal" @click="connectionOptions">Bluetooth, Galaxy Wi-Fi or LAN</button></p>
|
||||
<BluetoothNotice v-if="bluetooth" feature="Media transfers and phone internet">Phone internet requires the Galaxy hotspot. Settings and small requests remain available.</BluetoothNotice>
|
||||
<p v-else>Share your phone’s mobile data over Galaxy Wi-Fi. Navigation and online services use your mobile plan. Log uploads, software updates and offline map downloads are blocked.</p>
|
||||
<template v-if="!native"><p>Join TheGalaxy Wi-Fi, download the Android app, then allow your browser to install unknown apps when Android asks.</p>
|
||||
<a v-if="status?.appAvailable && mode === 'local'" class="gx-btn" href="./app.apk">Download Android app</a>
|
||||
<p v-else class="gx-note">Connect locally to a comma with the companion APK installed to download.</p>
|
||||
<img v-if="status?.appAvailable && mode === 'local'" src="./api/companion/qr.svg" class="gx-tunnel__qr" alt="Download app over Galaxy Wi-Fi" />
|
||||
<template v-if="!native"><p>Join the Android beta on Google Groups to get the app, then join TheGalaxy Wi-Fi.</p>
|
||||
<a class="gx-btn" href="https://groups.google.com/g/galaxy-starpilot-android-beta" target="_blank" rel="noopener">Join the Android beta</a>
|
||||
</template>
|
||||
<template v-if="status && mode === 'local'"><p>Status: <strong>{{ status.state }}</strong> {{ status.reason }} · {{ ((native ? nativeBytes : status.bytes) / 1048576).toFixed(1) }} MB today</p>
|
||||
<button v-if="!bluetooth" class="gx-btn gx-btn--tonal" :disabled="busy" @click="toggle">{{ (native ? sharing : status.enabled) ? 'Disable phone internet' : 'Enable phone internet' }}</button>
|
||||
|
||||
@@ -100,7 +100,7 @@ export const GalaxyPage = {
|
||||
<GxNotice v-else-if="showAppUpdate && !ios" tone="warn" title="Android app update available">
|
||||
Version {{ availableAppVersion }} is available. Installed: {{ installedAppVersion }}.
|
||||
<template #actions><button v-if="nativeInstallerAvailable" type="button" class="gx-btn" @click="installAppUpdate">Update app</button>
|
||||
<a v-else class="gx-btn" href="./app.apk">Update app</a>
|
||||
<a v-else class="gx-btn" href="https://groups.google.com/g/galaxy-starpilot-android-beta" target="_blank" rel="noopener">Update app</a>
|
||||
<button type="button" class="gx-btn gx-btn--tonal" aria-label="Dismiss app update notice" @click="dismissAppUpdate">Dismiss</button></template>
|
||||
</GxNotice>
|
||||
<GxState v-if="mode !== 'local'">Connect to your comma to set up remote access.</GxState>
|
||||
@@ -137,7 +137,7 @@ export const GalaxyPage = {
|
||||
<div><h3>Install Galaxy</h3><p>Launch Galaxy from your home screen or desktop.</p></div></div>
|
||||
<div class="gx-aa-step__body"><InstallApp :url="url" :update-available="appUpdateAvailable" />
|
||||
<p v-if="availableAppVersion && !ios">Android offline app version: <strong>{{ availableAppVersion }}</strong><span v-if="installedAppVersion"> · {{ nativeVersion ? 'Installed' : 'Connected phone' }}: {{ installedAppVersion }}</span></p>
|
||||
<p v-if="!ios"><strong>Download Android APK</strong> to use Galaxy over Galaxy Wi-Fi or your local network without Internet. Download it while connected locally from this page.</p>
|
||||
<p v-if="!ios"><strong>Android users:</strong> join the Android beta on Google Groups to get the app for use over Galaxy Wi-Fi or your local network without Internet.</p>
|
||||
<LocalAccess v-if="!ios" :mode="mode" :on-unauthorized="unauthorized" />
|
||||
<p class="gx-note">Your remote link needs Internet and an active tunnel. For offline local access, bookmark your hotspot or local address.</p>
|
||||
</div>
|
||||
|
||||
@@ -18,22 +18,20 @@ export function installHelp({ secure = window.isSecureContext, agent = navigator
|
||||
return 'This browser cannot install Galaxy automatically. Open the browser menu and choose Install app or Add to Home Screen. On a Mac in Safari, choose File → Add to Dock.'
|
||||
}
|
||||
|
||||
export function androidInstallHelp() {
|
||||
return 'Connect locally to your comma, then download the Android app from Galaxy Access & Install. Allow your browser to install unknown apps when Android asks.'
|
||||
}
|
||||
export const ANDROID_BETA_URL = 'https://groups.google.com/g/galaxy-starpilot-android-beta'
|
||||
|
||||
export const InstallApp = {
|
||||
name: 'InstallApp',
|
||||
props: { url: { type: String, default: '' }, updateAvailable: { type: Boolean, default: false } },
|
||||
data: () => ({ prompt: null, installed: false, help: false, message: '',
|
||||
data: () => ({ prompt: null, installed: false, message: '', betaUrl: ANDROID_BETA_URL,
|
||||
android: isAndroidDevice(), ios: isIosDevice() }),
|
||||
computed: { playDistribution() { return window.StarPilotApp?.distribution?.() === 'play' }, onPublicGalaxy() { return window.location?.hostname === 'galaxy.firestar.link' } },
|
||||
mounted() {
|
||||
this.prompt = deferredPrompt
|
||||
this.displayMode = window.matchMedia('(display-mode: standalone)')
|
||||
this.updateInstalled = () => { this.installed = !!window.StarPilotApp || this.displayMode.matches || navigator.standalone === true }
|
||||
this.onPrompt = (event) => { event.preventDefault(); deferredPrompt = event; this.prompt = event; this.help = false }
|
||||
this.onInstalled = () => { this.installed = true; this.prompt = deferredPrompt = null; this.help = false }
|
||||
this.onPrompt = (event) => { event.preventDefault(); deferredPrompt = event; this.prompt = event }
|
||||
this.onInstalled = () => { this.installed = true; this.prompt = deferredPrompt = null }
|
||||
this.updateInstalled()
|
||||
window.addEventListener('beforeinstallprompt', this.onPrompt)
|
||||
window.addEventListener('appinstalled', this.onInstalled)
|
||||
@@ -61,8 +59,7 @@ export const InstallApp = {
|
||||
window.StarPilotApp.installUpdate()
|
||||
return
|
||||
}
|
||||
if (location.protocol === 'http:') location.assign('./app.apk')
|
||||
else { this.message = androidInstallHelp(); this.help = true }
|
||||
location.assign(ANDROID_BETA_URL)
|
||||
},
|
||||
},
|
||||
template: `<div class="gx-install-app">
|
||||
@@ -75,9 +72,8 @@ export const InstallApp = {
|
||||
<a v-else-if="url" class="gx-btn" :href="url" target="_blank" rel="noopener"><i class="bi bi-box-arrow-up-right" aria-hidden="true"></i> Install web app</a>
|
||||
<p v-else class="gx-note">Pair in step 1 to get your install link.</p>
|
||||
<a v-if="ios" class="gx-btn" href="https://apps.apple.com/ca/app/starpilot-bt/id6821039119" target="_blank" rel="noopener"><i class="bi bi-apple" aria-hidden="true"></i> Download StarPilot BT on the App Store</a>
|
||||
<button v-if="android && !ios && !playDistribution && (!installed || updateAvailable)" type="button" class="gx-btn" @click="installAndroid"><i class="bi bi-download" aria-hidden="true"></i><span>{{ updateAvailable ? 'Update offline app (Android)' : 'Direct (advanced) · Download APK' }}</span></button>
|
||||
<a v-if="android" class="gx-btn" href="https://play.google.com/store/apps/details?id=link.firestar.galaxy" target="_blank" rel="noopener">Galaxy on Google Play</a>
|
||||
<button v-if="android && !ios && !playDistribution && updateAvailable" type="button" class="gx-btn" @click="installAndroid"><i class="bi bi-download" aria-hidden="true"></i><span>Update offline app (Android)</span></button>
|
||||
<a v-else-if="android && !ios && !playDistribution && !installed" class="gx-btn" :href="betaUrl" target="_blank" rel="noopener"><i class="bi bi-google-play" aria-hidden="true"></i><span>Join the Android beta</span></a>
|
||||
<p v-if="playDistribution" class="gx-note">Updates come from Google Play.</p>
|
||||
<p v-if="help" class="gx-note gx-install-help">{{ message }}</p>
|
||||
</div>`,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user