Files
orca/mobile/src/components/ProtocolBlockScreen.tsx
T
Jinwoo HongandOrca 7944293815 Improve mobile terminal streaming performance (#1700)
* Improve mobile terminal streaming performance

Co-authored-by: Orca <help@stably.ai>

* Add mobile clear terminal action

Co-authored-by: Orca <help@stably.ai>

* Fix terminal connection test mock

Co-authored-by: Orca <help@stably.ai>

* WIP: mobile markdown tabs before rebase

Co-authored-by: Orca <help@stably.ai>

* Add mobile markdown editing

Co-authored-by: Orca <help@stably.ai>

* Harden mobile tab and markdown sync

Co-authored-by: Orca <help@stably.ai>

* Fix mobile terminal reconnect loading race

Co-authored-by: Orca <help@stably.ai>

* Polish mobile terminal keyboard behavior

Co-authored-by: Orca <help@stably.ai>

* Simplify mobile markdown editor chrome

Co-authored-by: Orca <help@stably.ai>

* Move mobile markdown actions to top

Co-authored-by: Orca <help@stably.ai>

* Use app modals for markdown discard

Co-authored-by: Orca <help@stably.ai>

* Dismiss keyboard before markdown confirmations

Co-authored-by: Orca <help@stably.ai>

* Add mobile file explorer

Co-authored-by: Orca <help@stably.ai>

* Fix mobile file explorer type narrowing

Co-authored-by: Orca <help@stably.ai>

* Fix mobile files navigation param

Co-authored-by: Orca <help@stably.ai>

* Show mobile files connection wait state

Co-authored-by: Orca <help@stably.ai>

* Preview text files on mobile

Co-authored-by: Orca <help@stably.ai>

* Simplify mobile file previews

Co-authored-by: Orca <help@stably.ai>

* Clarify unavailable mobile file types

Co-authored-by: Orca <help@stably.ai>

* Fix mobile subscription and preview review issues

Co-authored-by: Orca <help@stably.ai>

* Keep fallback terminals visible on mobile

Co-authored-by: Orca <help@stably.ai>

* Keep mobile terminal tap active

Co-authored-by: Orca <help@stably.ai>

* Preserve mobile terminal fallback order

Co-authored-by: Orca <help@stably.ai>

* Fix mobile session tab authority

Co-authored-by: Orca <help@stably.ai>

* Run mobile tests in mobile CI lane

Co-authored-by: Orca <help@stably.ai>

* Bump mobile app version to 0.0.7

Co-authored-by: Orca <help@stably.ai>

* Allow main window IPC wiring size

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-12 14:38:12 -07:00

116 lines
3.9 KiB
TypeScript

import { Linking, Platform, Pressable, StyleSheet, Text, View } from 'react-native'
import { router } from 'expo-router'
import { colors, radii, spacing, typography } from '../theme/mobile-theme'
import type { CompatVerdict } from '../transport/protocol-compat'
import { MOBILE_PROTOCOL_VERSION } from '../transport/protocol-version'
const RELEASES_URL = 'https://github.com/stablyai/orca/releases'
const IOS_APP_STORE_URL = 'itms-apps://apps.apple.com/app/orca-ide/id6766130217'
type Props = {
verdict: Extract<CompatVerdict, { kind: 'blocked' }>
}
export function ProtocolBlockScreen({ verdict }: Props) {
const isMobileTooOld = verdict.reason === 'mobile-too-old'
const mobileUpdateTarget =
Platform.OS === 'ios'
? { label: 'Open App Store', url: IOS_APP_STORE_URL, storeName: 'the App Store' }
: { label: null, url: null, storeName: 'your mobile app store' }
const primaryAction = isMobileTooOld
? mobileUpdateTarget.url && mobileUpdateTarget.label
? { label: mobileUpdateTarget.label, url: mobileUpdateTarget.url }
: null
: { label: 'Open GitHub Releases', url: RELEASES_URL }
const title = isMobileTooOld ? 'Update Orca Mobile' : 'Update Orca desktop'
const body = isMobileTooOld
? `The Orca desktop on this host requires Orca Mobile v${verdict.requiredMobileVersion ?? '?'}+. You have v${MOBILE_PROTOCOL_VERSION}.\n\nUpdate Orca Mobile from ${mobileUpdateTarget.storeName} to continue.`
: `Orca Mobile requires Orca desktop v${verdict.requiredDesktopVersion ?? '?'}+ to use this host. The desktop is reporting v${verdict.desktopVersion}.`
return (
<View style={styles.container}>
<View style={styles.card}>
<Text style={styles.title}>{title}</Text>
<Text style={styles.body}>{body}</Text>
{/* Why: desktop updates come from GitHub; mobile update links depend
on the native store available for this platform. */}
{primaryAction ? (
<Pressable
style={({ pressed }) => [styles.primaryButton, pressed && styles.pressed]}
onPress={() => {
void Linking.openURL(primaryAction.url)
}}
>
<Text style={styles.primaryButtonText}>{primaryAction.label}</Text>
</Pressable>
) : null}
<Pressable
style={({ pressed }) => [styles.secondaryButton, pressed && styles.pressed]}
onPress={() => {
// Why: route back to the host list so the user can pair a
// different host instead of getting trapped on this screen.
router.replace('/')
}}
>
<Text style={styles.secondaryButtonText}>Pair a different host</Text>
</Pressable>
</View>
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.bgBase,
justifyContent: 'center',
paddingHorizontal: spacing.lg
},
card: {
backgroundColor: colors.bgPanel,
borderRadius: radii.card,
padding: spacing.lg,
borderWidth: 1,
borderColor: colors.borderSubtle
},
title: {
fontSize: typography.titleSize,
fontWeight: '700',
color: colors.textPrimary,
marginBottom: spacing.sm
},
body: {
fontSize: typography.bodySize,
color: colors.textSecondary,
lineHeight: 20,
marginBottom: spacing.lg
},
primaryButton: {
backgroundColor: colors.textPrimary,
paddingVertical: spacing.sm + 2,
borderRadius: radii.button,
alignItems: 'center',
marginBottom: spacing.sm
},
primaryButtonText: {
fontSize: typography.bodySize,
fontWeight: '600',
color: colors.bgBase
},
secondaryButton: {
backgroundColor: colors.bgRaised,
paddingVertical: spacing.sm + 2,
borderRadius: radii.button,
alignItems: 'center'
},
secondaryButtonText: {
fontSize: typography.bodySize,
fontWeight: '600',
color: colors.textPrimary
},
pressed: {
opacity: 0.7
}
})