@agimon-ai/po-native 0.0.1-alpha.77 → 0.0.1-alpha.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,7 +52,8 @@ The build script validates required inputs before replacing earlier final artifa
52
52
  | Input | Use |
53
53
  | ------------------------------------- | ------------------------------------------------------------------------------ |
54
54
  | `APPLE_TEAM_ID` | Required iOS signing team |
55
- | `PO_NATIVE_IOS_PROFILE` | Required installed provisioning-profile name |
55
+ | `PO_NATIVE_IOS_PROFILE` | Required installed profile for `ai.po.app` |
56
+ | `PO_NATIVE_IOS_WIDGET_PROFILE` | Required installed profile for `ai.po.app.ExpoWidgetsTarget` |
56
57
  | `PO_NATIVE_IOS_CODE_SIGN_IDENTITY` | Optional signing certificate name; TestFlight defaults to `Apple Distribution` |
57
58
  | `PO_NATIVE_ANDROID_KEYSTORE` | Required Android keystore path |
58
59
  | `PO_NATIVE_ANDROID_KEYSTORE_PASSWORD` | Required keystore password |
@@ -60,15 +61,16 @@ The build script validates required inputs before replacing earlier final artifa
60
61
  | `PO_NATIVE_ANDROID_KEY_PASSWORD` | Required key password |
61
62
  | `JAVA_HOME` | JDK 17; macOS scripts can resolve it through `java_home` |
62
63
 
63
- iOS archives and exports with manual signing (`release-testing` for ad hoc). Android runs `assembleRelease`. Secrets come from the environment or keychain, not generated project files. Outputs are `.build/adhoc/po-native.ipa` or `po-native.apk`, with `SHA256SUMS`. Private per-step logs are under `.build/adhoc/logs/`; work files are under `.build/adhoc/work/`. A failed build preserves the previous final artifact.
64
+ iOS archives and exports with manual signing (`release-testing` for ad hoc). Both iOS profiles must include the `group.ai.po.app` App Group. Android runs `assembleRelease`. Secrets come from the environment or keychain, not generated project files. Outputs are `.build/adhoc/po-native.ipa` or `po-native.apk`, with `SHA256SUMS`. Private per-step logs are under `.build/adhoc/logs/`; work files are under `.build/adhoc/work/`. A failed build preserves the previous final artifact.
64
65
 
65
66
  ### TestFlight export
66
67
 
67
- Install an App Store Connect distribution profile for `ai.po.app` with Push Notifications and the matching Apple Distribution certificate/private key. Run `ios:setup`, then set:
68
+ Install App Store Connect distribution profiles for `ai.po.app` and `ai.po.app.ExpoWidgetsTarget`, with the `group.ai.po.app` App Group on both and Push Notifications on `ai.po.app`. Install the matching Apple Distribution certificate/private key. Run `ios:setup`, then set:
68
69
 
69
70
  ```sh
70
71
  export APPLE_TEAM_ID="YOUR_TEAM_ID"
71
72
  export PO_NATIVE_IOS_PROFILE="YOUR_APP_STORE_CONNECT_PROFILE"
73
+ export PO_NATIVE_IOS_WIDGET_PROFILE="YOUR_WIDGET_APP_STORE_CONNECT_PROFILE"
72
74
  export PO_NATIVE_IOS_CODE_SIGN_IDENTITY="Apple Distribution"
73
75
  export PO_NATIVE_IOS_BUILD_NUMBER="42"
74
76
  export PO_NATIVE_IDENTITY_ISSUER="https://your-identity-home.example"
@@ -77,7 +79,7 @@ pnpm nx run @agimon-ai/po-native:ios:testflight
77
79
 
78
80
  Choose the actual HTTPS identity-home origin, not the example. Production builds require it. The command supplies production APNs and rejects an explicitly configured sandbox environment. Build numbers must increase for submissions and satisfy `CFBundleVersion` (for example `42` or `1.2.3`; first component 1–9999, others 0–99). The marketing version comes from `app.config.ts`.
79
81
 
80
- Before export the script checks the archive's bundle ID, build number, and signed production APNs entitlement. It uses `app-store-connect` export with manual signing. It does not create credentials, alter the Apple portal, upload, or submit. Output is `.build/testflight/po-native.ipa` with `SHA256SUMS`; archive/dSYMs and private logs remain under that directory's `work/` and `logs/` trees. Existing ad hoc outputs stay separate.
82
+ Before export the script checks the archive's bundle ID, build number and signed production APNs entitlement. It also verifies the embedded extension's signature and bundle ID and the App Group entitlement on both targets. It uses `app-store-connect` export with manual signing. It does not create credentials, alter the Apple portal, upload, or submit. Output is `.build/testflight/po-native.ipa` with `SHA256SUMS`; archive/dSYMs and private logs remain under that directory's `work/` and `logs/` trees. Existing ad hoc outputs stay separate.
81
83
 
82
84
  ## Push and remaining acceptance
83
85
 
package/app.config.ts CHANGED
@@ -37,6 +37,8 @@ const config: ExpoConfig = {
37
37
  bundleIdentifier: 'ai.po.app',
38
38
  usesAppleSignIn: true,
39
39
  infoPlist: { NSLocalNetworkUsageDescription: 'Connect to your paired Po computer on your local network.' },
40
+ // Pinned here: expo-widgets otherwise writes 'development' first and expo-notifications keeps it.
41
+ entitlements: { 'aps-environment': apnsEnvironment },
40
42
  // Export compliance answer on App Store Connect: no non-exempt encryption.
41
43
  config: { usesNonExemptEncryption: false },
42
44
  ...(iosBuildNumber ? { buildNumber: iosBuildNumber } : {}),
@@ -78,7 +80,16 @@ const config: ExpoConfig = {
78
80
  },
79
81
  ],
80
82
  '@config-plugins/react-native-webrtc',
83
+ // Xcode mods run in reverse registration order. Generate the extension before signing it.
81
84
  '@agimon-ai/po-expo-signing',
85
+ [
86
+ 'expo-widgets',
87
+ {
88
+ bundleIdentifier: 'ai.po.app.ExpoWidgetsTarget',
89
+ groupIdentifier: 'group.ai.po.app',
90
+ enablePushNotifications: true,
91
+ },
92
+ ],
82
93
  ],
83
94
  };
84
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-native",
3
- "version": "0.0.1-alpha.77",
3
+ "version": "0.0.1-alpha.79",
4
4
  "description": "Po for iOS and Android",
5
5
  "homepage": "https://agimon.ai",
6
6
  "bugs": {
@@ -29,20 +29,21 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@agimon-ai/po-core": "0.0.0-alpha.197",
33
- "@agimon-ai/po-expo-signing": "0.0.1-alpha.77",
34
- "@agimon-ai/po-identity": "0.0.2-alpha.144",
35
- "@agimon-ai/po-native-components": "0.0.0-alpha.197",
36
- "@agimon-ai/po-native-dashboard": "0.0.0-alpha.69",
37
- "@agimon-ai/po-template-advanced": "0.0.0-alpha.197",
38
- "@agimon-ai/po-template-elegant": "0.0.0-alpha.197",
39
- "@agimon-ai/po-voice": "0.0.0-alpha.197",
40
- "@agimon-ai/po-web-components": "0.0.0-alpha.197",
41
- "@agimon-ai/po-web-dashboard": "0.0.0-alpha.197",
42
- "@agimon-ai/po-web-security": "0.0.0-alpha.197",
32
+ "@agimon-ai/po-core": "0.0.0-alpha.199",
33
+ "@agimon-ai/po-expo-signing": "0.0.1-alpha.79",
34
+ "@agimon-ai/po-identity": "0.0.2-alpha.146",
35
+ "@agimon-ai/po-native-components": "0.0.0-alpha.199",
36
+ "@agimon-ai/po-native-dashboard": "0.0.0-alpha.71",
37
+ "@agimon-ai/po-template-advanced": "0.0.0-alpha.199",
38
+ "@agimon-ai/po-template-elegant": "0.0.0-alpha.199",
39
+ "@agimon-ai/po-voice": "0.0.0-alpha.199",
40
+ "@agimon-ai/po-web-components": "0.0.0-alpha.199",
41
+ "@agimon-ai/po-web-dashboard": "0.0.0-alpha.199",
42
+ "@agimon-ai/po-web-security": "0.0.0-alpha.199",
43
43
  "@better-auth/expo": "1.7.12",
44
44
  "@config-plugins/react-native-webrtc": "15.0.2",
45
45
  "@earendil-works/chord": "1.6.1",
46
+ "@expo/ui": "58.0.26",
46
47
  "@expo/vector-icons": "15.1.1",
47
48
  "@gorhom/bottom-sheet": "5.2.14",
48
49
  "@native-html/render": "1.0.4",
@@ -77,6 +78,7 @@
77
78
  "expo-symbols": "~58.0.4",
78
79
  "expo-video": "~58.0.13",
79
80
  "expo-web-browser": "~58.0.7",
81
+ "expo-widgets": "58.0.26",
80
82
  "react": "19.3.0",
81
83
  "react-native": "0.88.1",
82
84
  "react-native-audio-api": "0.13.6",
package/src/app/App.tsx CHANGED
@@ -201,6 +201,7 @@ import { HomeAppsSection, HomeAttentionScreen, HomeScreen, type HomeView } from
201
201
  import { HostDrawer, HostMenuButton } from '../screens/HostDrawer';
202
202
  import { FirstSessionWelcome } from '../screens/HostedOnboarding';
203
203
  import { ImagesScreen, imagesSummary, useImageSettings } from '../screens/ImagesScreen';
204
+ import { LanguageScreen, languageLabel } from '../screens/LanguageScreen';
204
205
  import { pluginPageOf } from '../screens/localPlugins';
205
206
  import { McpServersScreen, mcpServersSummary, useMcpServers } from '../screens/McpServersScreen';
206
207
  import { MetricsScreen, useMetrics } from '../screens/MetricsScreen';
@@ -261,6 +262,7 @@ import {
261
262
  uploadSessionAttachment,
262
263
  } from '../services/hostActions';
263
264
  import { calendarSnapshots } from '../services/hostSnapshots';
265
+ import { useSessionActivity } from '../services/liveActivity';
264
266
  import { recordNativeLog } from '../services/logExport';
265
267
  import { loadNativeAuthorDraft, saveNativeAuthorDraft } from '../services/nativeAuthorDrafts';
266
268
  import { startNativePushRouting } from '../services/nativePush';
@@ -268,6 +270,7 @@ import { NativeRealtimeHost } from '../services/nativeRealtime';
268
270
  import { createNativeAudioSession } from '../services/nativeVoice';
269
271
  import { clearCached, useCachedRequest } from '../services/requestCache';
270
272
  import { whenConnected } from '../services/sessionRuntime';
273
+ import { sessionActivityTarget, type SessionTapTarget } from '../services/sessionTap';
271
274
  import {
272
275
  listMcpServers,
273
276
  listProviders,
@@ -341,6 +344,7 @@ type Routes = {
341
344
  SettingsPresets: { hostId?: string } | undefined;
342
345
  SettingsMetrics: { hostId?: string } | undefined;
343
346
  SettingsAppearance: undefined;
347
+ SettingsLanguage: undefined;
344
348
  SettingsAccount: undefined;
345
349
  SettingsTeam: undefined;
346
350
  SettingsPanel: { id: string; title: string; hostId?: string };
@@ -1610,6 +1614,7 @@ function SettingsRoute(
1610
1614
  }, [reloadSummary, reloadImages, reloadSections, reloadTeam]),
1611
1615
  );
1612
1616
  const appearance = useStore(appearanceStore, (state) => state);
1617
+ const locale = useStore(localeStore, (pick) => pick);
1613
1618
  const teamName = hostedTeamName.data;
1614
1619
  const openPanel = (id: string) => {
1615
1620
  const computer = props.computers?.find((candidate) => candidate.id === settingsHost);
@@ -1656,6 +1661,7 @@ function SettingsRoute(
1656
1661
  {...(mcpServers ? { mcpServers } : {})}
1657
1662
  {...(remote ? { remote } : {})}
1658
1663
  appearance={appearanceLabel(appearance)}
1664
+ language={languageLabel(locale, nativeLocales())}
1659
1665
  {...(teamName ? { team: teamName } : {})}
1660
1666
  {...(images ? { images } : {})}
1661
1667
  plugins={t('native.app.pluginsInstalled', '{count} installed', { count: plugins })}
@@ -1678,7 +1684,12 @@ function SettingsRoute(
1678
1684
  }}
1679
1685
  {...((props.error ?? loadError) ? { error: props.error ?? loadError } : {})}
1680
1686
  onOpen={(section: SettingsSection) => {
1681
- if (section === 'SettingsAppearance' || section === 'SettingsAccount' || section === 'SettingsTeam') {
1687
+ if (
1688
+ section === 'SettingsAppearance' ||
1689
+ section === 'SettingsLanguage' ||
1690
+ section === 'SettingsAccount' ||
1691
+ section === 'SettingsTeam'
1692
+ ) {
1682
1693
  navigation.navigate(section);
1683
1694
  return;
1684
1695
  }
@@ -2067,6 +2078,15 @@ function ContributedSection({
2067
2078
  );
2068
2079
  }
2069
2080
 
2081
+ /** The language Po uses on this phone. Packs arrive with computers, so the list follows the registry. */
2082
+ function LanguageRoute() {
2083
+ useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
2084
+ const locale = useStore(localeStore, (pick) => pick);
2085
+ return (
2086
+ <LanguageScreen {...(locale === undefined ? {} : { locale })} locales={nativeLocales()} onLocale={setLocalePick} />
2087
+ );
2088
+ }
2089
+
2070
2090
  /** Theme is this phone's; the layout is `native.template` on the computer whose template the app draws. */
2071
2091
  function AppearanceRoute() {
2072
2092
  const theme = useStore(appearanceStore, (state) => state);
@@ -2092,7 +2112,6 @@ function AppearanceRoute() {
2092
2112
  hostId,
2093
2113
  );
2094
2114
  useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
2095
- const locale = useStore(localeStore, (pick) => pick);
2096
2115
  const mount =
2097
2116
  model.target === 'global'
2098
2117
  ? ({ scope: 'host' } as const)
@@ -2106,9 +2125,6 @@ function AppearanceRoute() {
2106
2125
  <AppearanceScreen
2107
2126
  theme={theme}
2108
2127
  onTheme={setAppearance}
2109
- {...(locale === undefined ? {} : { locale })}
2110
- locales={nativeLocales()}
2111
- onLocale={setLocalePick}
2112
2128
  repositories={repositories}
2113
2129
  templates={catalog.templates.map(({ id, label, description, pluginId, translateCopy }) => ({
2114
2130
  translateCopy,
@@ -3521,6 +3537,8 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
3521
3537
  const [hydrated, setHydrated] = useState(false);
3522
3538
  const [trustLoaded, setTrustLoaded] = useState(false);
3523
3539
  const [navigationReady, setNavigationReady] = useState(false);
3540
+ const [activitySessionId, setActivitySessionId] = useState<string | null>(null);
3541
+ const sessionActivity = useSessionActivity(activitySessionId, hostStates, trustLoaded);
3524
3542
  // The tree mounts once the last installed templates and plugins are back from disk, so it does not
3525
3543
  // draw the phone's default and then swap; a slow disk waits no longer than BOOT_HOLD_MS.
3526
3544
  const [booted, setBooted] = useState(false);
@@ -3585,6 +3603,7 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
3585
3603
  if (loaded) setPhase(states.length === 1 && !states[0].runtime ? 'pairing' : states.length ? 'ready' : 'pairing');
3586
3604
  };
3587
3605
  const manager = createHostRuntimes({
3606
+ beforeForget: sessionActivity.stopHost,
3588
3607
  changed: reportStates,
3589
3608
  activity: (hostId, owner, state) => {
3590
3609
  if (mounted) setActivityLoad(hostId, owner, state);
@@ -3670,20 +3689,36 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
3670
3689
 
3671
3690
  useEffect(() => {
3672
3691
  if (!trustLoaded || !navigationReady) return;
3673
- const routing = startNativePushRouting({
3674
- hasHost: (hostRef) => hosts.current?.snapshot().some(({ host }) => host.id === hostRef) ?? false,
3675
- openSession: ({ hostRef, sessionId: localId }) => {
3676
- const sessionId = qualifyHostId(hostRef, localId);
3677
- navigation.navigate('Session', {
3678
- sessionId,
3679
- title: sessionsStore.state.byId[sessionId]?.summary.name || t('native.app.session', 'Session'),
3680
- });
3681
- },
3682
- });
3683
- return () => routing.stop();
3692
+ const hasHost = (hostRef: string) => hosts.current?.snapshot().some(({ host }) => host.id === hostRef) ?? false;
3693
+ const openSession = ({ hostRef, sessionId: localId }: SessionTapTarget) => {
3694
+ const sessionId = qualifyHostId(hostRef, localId);
3695
+ navigation.navigate('Session', {
3696
+ sessionId,
3697
+ title: sessionsStore.state.byId[sessionId]?.summary.name || t('native.app.session', 'Session'),
3698
+ });
3699
+ };
3700
+ const routing = startNativePushRouting({ hasHost, openSession });
3701
+ let stopped = false;
3702
+ const openLink = (url: string | null | undefined) => {
3703
+ if (stopped || !url) return;
3704
+ const target = sessionActivityTarget(url, hasHost);
3705
+ if (target) openSession(target);
3706
+ };
3707
+ const links = Linking.addEventListener('url', ({ url }) => openLink(url));
3708
+ void Linking.getInitialURL()
3709
+ .then(openLink)
3710
+ .catch(() => console.warn('Live Activity tap unavailable.'));
3711
+ return () => {
3712
+ stopped = true;
3713
+ routing.stop();
3714
+ links.remove();
3715
+ };
3684
3716
  }, [trustLoaded, navigationReady, navigation]);
3685
3717
 
3686
- const focusSession = useCallback((sessionId: string | null) => hosts.current?.open(sessionId), []);
3718
+ const focusSession = useCallback((sessionId: string | null) => {
3719
+ hosts.current?.open(sessionId);
3720
+ setActivitySessionId(sessionId);
3721
+ }, []);
3687
3722
  const connectCloud = useCallback(async (host: CloudHostRecord) => {
3688
3723
  const manager = hosts.current;
3689
3724
  if (!manager) throw new Error(t('native.app.starting', 'Po is still starting. Try again in a moment.'));
@@ -4202,6 +4237,15 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
4202
4237
  headerBackButtonDisplayMode: 'default',
4203
4238
  }}
4204
4239
  />
4240
+ <Stack.Screen
4241
+ name="SettingsLanguage"
4242
+ component={LanguageRoute}
4243
+ options={{
4244
+ title: t('native.settings.language', 'Language'),
4245
+ headerBackTitle: settingsBack(),
4246
+ headerBackButtonDisplayMode: 'default',
4247
+ }}
4248
+ />
4205
4249
  <Stack.Screen
4206
4250
  name="SettingsPanel"
4207
4251
  component={SettingsPanelRoute}
@@ -104,6 +104,7 @@ function sameHostState(left: HostRuntimeState, right: HostRuntimeState): boolean
104
104
  /** Each host owns its lifetime. A failed reconnect never closes a sibling host. */
105
105
  export function createHostRuntimes(
106
106
  options: {
107
+ beforeForget?: (hostId: string) => Promise<void>;
107
108
  changed?: (states: readonly HostRuntimeState[]) => void;
108
109
  activity?: (hostId: string, owner: string, state: ActivityLoadState) => void;
109
110
  onBundleUpdate?: (host: HostRecord | CloudHostRecord, choice: NativeBundleUpdateChoice) => void;
@@ -724,6 +725,11 @@ export function createHostRuntimes(
724
725
  try {
725
726
  // Stop token renewal first, so a late token cannot enroll this phone with the computer again.
726
727
  entries.get(hostId)?.push?.stop();
728
+ if (options.beforeForget)
729
+ await withinDeadline(
730
+ options.beforeForget(hostId),
731
+ 'Live Activity removal deferred; its registration expires automatically.',
732
+ );
727
733
  const session = currentSession(hostId);
728
734
  if (session)
729
735
  await withinDeadline(
@@ -42,7 +42,7 @@ export function WakePeriodView({
42
42
  <Text style={sessionChoicesStyles.meta}>
43
43
  {t(
44
44
  'native.wake.explainer',
45
- 'How far ahead Po looks for scheduled work. This does not change when events run.',
45
+ 'How long Po waits between check-ins and how far ahead it looks for scheduled work. Upcoming work can skip a check-in without changing when events run.',
46
46
  )}
47
47
  </Text>
48
48
  <Label>{t('native.wake.period', 'Period (minutes)')}</Label>
@@ -0,0 +1,149 @@
1
+ import { AgentAvatar, fontOf } from '@agimon-ai/po-native-components';
2
+ import { Image, Text, View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+
5
+ import profileAvatar from '../../../assets/po-avatars/dev.png';
6
+ import { type DesignScheme, PhoneFrame } from '../../screens/designFrame';
7
+
8
+ // The browser story shows the target layout, not the system's WidgetKit chrome.
9
+ export const meta = { title: 'Native/Design/Session Live Activity', tags: ['style-system', 'mockup', 'native'] };
10
+ export default meta;
11
+
12
+ const sessionName = 'Review component stories';
13
+ const states = [
14
+ { label: 'Working', tone: 'work', photo: true },
15
+ { label: 'Question waiting', tone: 'ask', photo: true },
16
+ { label: 'Approval needed', tone: 'ask', photo: true },
17
+ { label: 'Finished', tone: 'quiet', photo: true },
18
+ { label: 'Status unavailable', tone: 'quiet', photo: false },
19
+ { label: 'Status may be out of date', tone: 'quiet', photo: true },
20
+ ] as const;
21
+
22
+ type Status = (typeof states)[number];
23
+
24
+ function Face({ photo, small = false }: { photo: boolean; small?: boolean }) {
25
+ return photo ? (
26
+ <Image source={profileAvatar} style={styles.avatar(small)} accessible accessibilityLabel="Developer profile" />
27
+ ) : (
28
+ <AgentAvatar name="Developer" size={small ? 'sm' : 'md'} />
29
+ );
30
+ }
31
+
32
+ function StateLine({ status }: { status: Status }) {
33
+ return (
34
+ <View style={styles.stateLine}>
35
+ <View style={styles.dot(status.tone)} />
36
+ <Text style={styles.secondary}>{status.label}</Text>
37
+ </View>
38
+ );
39
+ }
40
+
41
+ function ActivityTarget({ scheme }: { scheme: DesignScheme }) {
42
+ return (
43
+ <PhoneFrame scheme={scheme}>
44
+ <View style={styles.canvas}>
45
+ <Text style={styles.heading}>Lock Screen</Text>
46
+ {states.map((status) => (
47
+ <View key={status.label} style={styles.banner}>
48
+ <Face photo={status.photo} />
49
+ <View style={styles.summary}>
50
+ <Text style={styles.name} numberOfLines={1}>
51
+ {sessionName}
52
+ </Text>
53
+ <StateLine status={status} />
54
+ </View>
55
+ </View>
56
+ ))}
57
+ <Text style={styles.heading}>Dynamic Island</Text>
58
+ <View style={styles.islandRow}>
59
+ <View style={styles.island}>
60
+ <Face photo small />
61
+ </View>
62
+ <View style={styles.island}>
63
+ <Face photo small />
64
+ <View style={styles.dot(states[0].tone)} accessible accessibilityLabel={states[0].label} />
65
+ </View>
66
+ </View>
67
+ <View style={styles.expanded}>
68
+ <Face photo />
69
+ <View style={styles.summary}>
70
+ <Text style={styles.name} numberOfLines={1}>
71
+ {sessionName}
72
+ </Text>
73
+ <StateLine status={states[2]} />
74
+ </View>
75
+ <Text style={styles.secondary} accessibilityLabel="1 approval waiting">
76
+ 1
77
+ </Text>
78
+ </View>
79
+ </View>
80
+ </PhoneFrame>
81
+ );
82
+ }
83
+
84
+ export const Playground = { render: () => <ActivityTarget scheme="dark" /> };
85
+ export const Light = { render: () => <ActivityTarget scheme="light" /> };
86
+
87
+ const styles = StyleSheet.create((theme) => ({
88
+ canvas: { flex: 1, backgroundColor: theme.colors.bg, padding: theme.spacing(5), gap: theme.spacing(2) },
89
+ heading: {
90
+ color: theme.colors.hi,
91
+ fontFamily: fontOf(theme.fontFamily.sans),
92
+ fontSize: theme.fontSize.lg,
93
+ fontWeight: theme.fontWeight.semibold,
94
+ marginVertical: theme.spacing(2),
95
+ },
96
+ banner: {
97
+ flexDirection: 'row',
98
+ alignItems: 'center',
99
+ gap: theme.spacing(3),
100
+ padding: theme.spacing(3),
101
+ borderRadius: theme.borderRadius.lg,
102
+ backgroundColor: theme.colors.panel,
103
+ },
104
+ summary: { flex: 1, minWidth: 0, gap: theme.spacing(1) },
105
+ name: {
106
+ color: theme.colors.hi,
107
+ fontFamily: fontOf(theme.fontFamily.sans),
108
+ fontSize: theme.fontSize.base,
109
+ lineHeight: theme.lineHeight.base,
110
+ fontWeight: theme.fontWeight.semibold,
111
+ },
112
+ secondary: {
113
+ color: theme.colors.dim,
114
+ fontFamily: fontOf(theme.fontFamily.sans),
115
+ fontSize: theme.fontSize.sm,
116
+ lineHeight: theme.lineHeight.sm,
117
+ },
118
+ avatar: (small: boolean) => ({
119
+ width: theme.spacing(small ? 6 : 8),
120
+ height: theme.spacing(small ? 6 : 8),
121
+ borderRadius: theme.borderRadius.full,
122
+ }),
123
+ stateLine: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },
124
+ dot: (tone: Status['tone']) => ({
125
+ width: theme.spacing(2),
126
+ height: theme.spacing(2),
127
+ borderRadius: theme.borderRadius.full,
128
+ backgroundColor: tone === 'work' ? theme.colors.green : tone === 'ask' ? theme.colors.magenta : theme.colors.dim,
129
+ }),
130
+ islandRow: { flexDirection: 'row', gap: theme.spacing(3) },
131
+ island: {
132
+ flexDirection: 'row',
133
+ alignItems: 'center',
134
+ gap: theme.spacing(3),
135
+ minHeight: theme.spacing(11),
136
+ paddingHorizontal: theme.spacing(3),
137
+ borderRadius: theme.borderRadius.full,
138
+ backgroundColor: theme.colors.panel,
139
+ },
140
+ expanded: {
141
+ flexDirection: 'row',
142
+ alignItems: 'center',
143
+ gap: theme.spacing(3),
144
+ minHeight: theme.spacing(16),
145
+ padding: theme.spacing(4),
146
+ borderRadius: theme.borderRadius.lg,
147
+ backgroundColor: theme.colors.panel,
148
+ },
149
+ }));
@@ -1,4 +1,4 @@
1
- import { DEFAULT_LOCALE, type LocaleTag, t } from '@agimon-ai/po-core/native';
1
+ import { t } from '@agimon-ai/po-core/native';
2
2
  import { Button, fontOf, type SelectOption } from '@agimon-ai/po-native-components';
3
3
  import { BUILTIN_THEMES } from '@agimon-ai/po-web-components/theme';
4
4
  import { subscribeWebPluginRegistry, webPluginRegistryRevision } from '@agimon-ai/po-web-dashboard/core';
@@ -53,11 +53,6 @@ export interface AppearanceTemplate {
53
53
  export interface AppearanceScreenProps {
54
54
  theme: Appearance;
55
55
  onTheme: (theme: Appearance) => void;
56
- /** The picked language; absent follows the phone. */
57
- locale?: LocaleTag;
58
- /** Language packs the person's computers contribute; English is always offered. */
59
- locales: readonly { readonly name: LocaleTag; readonly nativeLabel: string }[];
60
- onLocale: (locale: LocaleTag | undefined) => void;
61
56
  /** `host`, or the workspace id whose layout this page edits. */
62
57
  target: string;
63
58
  repositories: readonly SettingsRepository[];
@@ -136,25 +131,6 @@ export function AppearanceScreen(props: AppearanceScreenProps) {
136
131
  </Group>
137
132
  <PluginThemes theme={theme} onTheme={props.onTheme} />
138
133
 
139
- <Group
140
- label={t('native.appearance.language', 'Language')}
141
- hint={t('native.appearance.language.hint', 'Applied at once and remembered on this phone.')}
142
- >
143
- {[
144
- { name: undefined, title: t('native.appearance.language.system', 'Use the phone language') },
145
- { name: DEFAULT_LOCALE, title: 'English' },
146
- ...props.locales.map((locale) => ({ name: locale.name, title: locale.nativeLabel })),
147
- ].map((option, index, all) => (
148
- <CardOption
149
- key={option.name ?? 'system'}
150
- title={option.title}
151
- selected={option.name === props.locale}
152
- onPress={() => props.onLocale(option.name)}
153
- last={index === all.length - 1}
154
- />
155
- ))}
156
- </Group>
157
-
158
134
  <Group
159
135
  label={t('native.appearance.layout', 'Phone layout')}
160
136
  hint={t(
@@ -26,7 +26,10 @@ const INTERESTS = 'Shipping my side project, TypeScript, running.';
26
26
  const noop = (): void => undefined;
27
27
  /** Packs arrive with the person's computers, so before sign-in English is the only language offered. */
28
28
  const NO_PACKS: readonly { name: string; nativeLabel: string }[] = [];
29
- const LOCALES = [{ name: 'zh-CN', nativeLabel: '简体中文' }];
29
+ const LOCALES = [
30
+ { name: 'vi', nativeLabel: 'Tiếng Việt' },
31
+ { name: 'zh-CN', nativeLabel: '简体中文' },
32
+ ];
30
33
 
31
34
  type SignInStep = 'welcome' | 'email' | 'code' | 'team';
32
35
 
@@ -0,0 +1,48 @@
1
+ import { DEFAULT_LOCALE, type LocaleTag, t } from '@agimon-ai/po-core/native';
2
+
3
+ import { CardOption } from './SettingsFields';
4
+ import { Group, SectionPage } from './SettingsScreen';
5
+
6
+ export interface LanguageScreenProps {
7
+ /** The picked language; absent follows the phone. */
8
+ locale?: LocaleTag;
9
+ /** Language packs the person's computers contribute; English is always offered. */
10
+ locales: readonly { readonly name: LocaleTag; readonly nativeLabel: string }[];
11
+ onLocale: (locale: LocaleTag | undefined) => void;
12
+ }
13
+
14
+ /** The name the Settings list shows for the language this phone uses. */
15
+ export function languageLabel(locale: LocaleTag | undefined, locales: LanguageScreenProps['locales']): string {
16
+ if (locale === undefined) return t('native.language.system', 'Use the phone language');
17
+ if (locale === DEFAULT_LOCALE) return 'English';
18
+ return locales.find((option) => option.name === locale)?.nativeLabel ?? locale;
19
+ }
20
+
21
+ /** The language Po uses on this phone. It belongs to the phone, not to any computer. */
22
+ export function LanguageScreen({ locale, locales, onLocale }: LanguageScreenProps) {
23
+ const options = [
24
+ { name: undefined, title: t('native.language.system', 'Use the phone language') },
25
+ { name: DEFAULT_LOCALE, title: 'English' },
26
+ ...locales.map((option) => ({ name: option.name, title: option.nativeLabel })),
27
+ ];
28
+ return (
29
+ <SectionPage
30
+ lede={t('native.language.lede', 'The language Po uses on this phone. It applies at once and is remembered here.')}
31
+ >
32
+ <Group
33
+ label={t('native.language.title', 'Language')}
34
+ hint={t('native.language.hint', 'More languages arrive with the language plugins on your computers.')}
35
+ >
36
+ {options.map((option, index) => (
37
+ <CardOption
38
+ key={option.name ?? 'system'}
39
+ title={option.title}
40
+ selected={option.name === locale}
41
+ onPress={() => onLocale(option.name)}
42
+ last={index === options.length - 1}
43
+ />
44
+ ))}
45
+ </Group>
46
+ </SectionPage>
47
+ );
48
+ }
@@ -12,6 +12,7 @@ import { StyleSheet, UnistylesRuntime } from 'react-native-unistyles';
12
12
 
13
13
  import type { Appearance } from '../app/appearance';
14
14
  import { AppearanceScreen } from './AppearanceScreen';
15
+ import { LanguageScreen } from './LanguageScreen';
15
16
  import { ProvidersScreen } from './ProvidersScreen';
16
17
  import { RemoteControlScreen } from './RemoteControlScreen';
17
18
  import { CardBody, GlobalSettingsView, Group, NavRow, SettingsScreen } from './SettingsScreen';
@@ -158,8 +159,6 @@ function AppearanceStory({ scheme, initial }: { scheme: 'light' | 'dark'; initia
158
159
  <AppearanceScreen
159
160
  theme={theme}
160
161
  onTheme={setTheme}
161
- locales={[{ name: 'zh-CN', nativeLabel: '简体中文' }]}
162
- onLocale={() => undefined}
163
162
  target="global"
164
163
  repositories={REPOSITORIES}
165
164
  templates={TEMPLATES}
@@ -268,6 +267,25 @@ export const GlobalProfileDark = { render: () => <GlobalProfileStory scheme="dar
268
267
  export const AppearanceLight = { render: () => <AppearanceStory scheme="light" initial="system" /> };
269
268
  export const AppearanceDark = { render: () => <AppearanceStory scheme="dark" initial="dark" /> };
270
269
 
270
+ /** Language packs a computer contributes, named in their own language. */
271
+ const LOCALES = [
272
+ { name: 'vi', nativeLabel: 'Tiếng Việt' },
273
+ { name: 'zh-CN', nativeLabel: '简体中文' },
274
+ ];
275
+
276
+ function LanguageStory({ scheme }: { scheme: 'light' | 'dark' }) {
277
+ const [locale, setLocale] = useState<string | undefined>(undefined);
278
+ return (
279
+ <Phone scheme={scheme}>
280
+ <LanguageScreen {...(locale === undefined ? {} : { locale })} locales={LOCALES} onLocale={setLocale} />
281
+ </Phone>
282
+ );
283
+ }
284
+
285
+ /** Its own screen under This phone: the language belongs to the phone, not to how Po looks. */
286
+ export const LanguageLight = { render: () => <LanguageStory scheme="light" /> };
287
+ export const LanguageDark = { render: () => <LanguageStory scheme="dark" /> };
288
+
271
289
  const REPOSITORIES: SettingsRepository[] = [
272
290
  { id: 'r1', name: 'po-internal', path: '/Users/dev/workspace/po-internal', active: true },
273
291
  { id: 'r2', name: 'notes', path: '/Users/dev/.po/workspace/notes', active: false },