@agimon-ai/po-native 0.0.1-alpha.76 → 0.0.1-alpha.78
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/package.json +12 -12
- package/src/app/AccountRoute.tsx +14 -5
- package/src/app/App.tsx +191 -68
- package/src/app/OnboardingRoute.tsx +51 -25
- package/src/components/ContextFace.tsx +2 -2
- package/src/screens/AppearanceScreen.tsx +4 -27
- package/src/screens/ContributedSettingsScreen.tsx +24 -4
- package/src/screens/HostedOnboarding.tsx +56 -2
- package/src/screens/HostedOnboardingDesign.stories.tsx +52 -11
- package/src/screens/LanguageScreen.tsx +48 -0
- package/src/screens/PluginCatalogScreen.tsx +2 -0
- package/src/screens/PluginDetailScreen.tsx +51 -41
- package/src/screens/PluginMarketplaceDesign.stories.tsx +20 -0
- package/src/screens/SettingsDirectory.stories.tsx +270 -0
- package/src/screens/SettingsScreen.stories.tsx +20 -8
- package/src/screens/SettingsScreen.tsx +14 -23
- package/src/screens/homeModel.ts +2 -1
- package/src/screens/localPlugins.ts +46 -0
- package/src/screens/usePluginMarketplace.ts +34 -14
- package/src/services/hostActions/index.ts +13 -8
- package/src/services/pairing/index.ts +26 -13
- package/src/services/sessionProfiles/index.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-native",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.78",
|
|
4
4
|
"description": "Po for iOS and Android",
|
|
5
5
|
"homepage": "https://agimon.ai",
|
|
6
6
|
"bugs": {
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
33
|
-
"@agimon-ai/po-expo-signing": "0.0.1-alpha.
|
|
34
|
-
"@agimon-ai/po-identity": "0.0.2-alpha.
|
|
35
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
36
|
-
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.
|
|
37
|
-
"@agimon-ai/po-template-advanced": "0.0.0-alpha.
|
|
38
|
-
"@agimon-ai/po-template-elegant": "0.0.0-alpha.
|
|
39
|
-
"@agimon-ai/po-voice": "0.0.0-alpha.
|
|
40
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
41
|
-
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.
|
|
42
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
32
|
+
"@agimon-ai/po-core": "0.0.0-alpha.198",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.78",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.145",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.198",
|
|
36
|
+
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.70",
|
|
37
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.198",
|
|
38
|
+
"@agimon-ai/po-template-elegant": "0.0.0-alpha.198",
|
|
39
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.198",
|
|
40
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.198",
|
|
41
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.198",
|
|
42
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.198",
|
|
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",
|
package/src/app/AccountRoute.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t, useT } from '@agimon-ai/po-core/native';
|
|
1
|
+
import { currentLocale, t, useT } from '@agimon-ai/po-core/native';
|
|
2
2
|
import {
|
|
3
3
|
accountViewModel,
|
|
4
4
|
createHostedAccountFlow,
|
|
@@ -29,6 +29,7 @@ import { apiTransportForHost } from '../services/apiTransport';
|
|
|
29
29
|
import { type CloudHostRecord, ensureCloudHost, loadCloudHosts } from '../services/cloudHosts';
|
|
30
30
|
import { associateHostAccount, loadHosts } from '../services/deviceTrust';
|
|
31
31
|
import { setCloudProviderKey } from './cloudRuntime';
|
|
32
|
+
import { WithOnboardingLanguage } from './OnboardingRoute';
|
|
32
33
|
|
|
33
34
|
interface AccountRouteProps {
|
|
34
35
|
firstRun?: boolean;
|
|
@@ -208,7 +209,7 @@ function HostedAccountRoute({
|
|
|
208
209
|
return () => flow.dispose();
|
|
209
210
|
}, [flow]);
|
|
210
211
|
const state = useStore(flow.state);
|
|
211
|
-
|
|
212
|
+
const page = (
|
|
212
213
|
<AccountPage
|
|
213
214
|
stack={stack}
|
|
214
215
|
// Outside first run, hosted sign-in starts at the email page.
|
|
@@ -222,6 +223,8 @@ function HostedAccountRoute({
|
|
|
222
223
|
}}
|
|
223
224
|
/>
|
|
224
225
|
);
|
|
226
|
+
// First-run sign-in fills the screen, so it carries the language switch as the onboarding steps do.
|
|
227
|
+
return firstRun && !stack ? <WithOnboardingLanguage>{page}</WithOnboardingLanguage> : page;
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
/** A self-hosted identity home: sign-in, device trust, approval, recovery, hub links and Po Cloud. */
|
|
@@ -235,7 +238,7 @@ function SelfHostedAccountRoute({
|
|
|
235
238
|
onBack,
|
|
236
239
|
stack,
|
|
237
240
|
}: AccountRouteProps & { page?: 'methods'; onBack: () => void }) {
|
|
238
|
-
|
|
241
|
+
useT();
|
|
239
242
|
const [permission, requestPermission] = useCameraPermissions();
|
|
240
243
|
const latest = useRef({ permission, requestPermission, onScan, onUseCloud, onForgetCloud });
|
|
241
244
|
latest.current = { permission, requestPermission, onScan, onUseCloud, onForgetCloud };
|
|
@@ -259,7 +262,13 @@ function SelfHostedAccountRoute({
|
|
|
259
262
|
now,
|
|
260
263
|
},
|
|
261
264
|
// Reached from hosted sign-in, the selected issuer is hosted Po Cloud: never restore it as an identity home.
|
|
262
|
-
{
|
|
265
|
+
{
|
|
266
|
+
firstRun,
|
|
267
|
+
foreground: AppState.currentState === 'active',
|
|
268
|
+
t,
|
|
269
|
+
readLocale: currentLocale,
|
|
270
|
+
...(page ? { page, restore: false } : {}),
|
|
271
|
+
},
|
|
263
272
|
),
|
|
264
273
|
);
|
|
265
274
|
useEffect(() => {
|
|
@@ -272,7 +281,7 @@ function SelfHostedAccountRoute({
|
|
|
272
281
|
}, [flow]);
|
|
273
282
|
const state = useStore(flow.state);
|
|
274
283
|
const linkNotice = useStore(accountLinkNotice);
|
|
275
|
-
const view = accountViewModel(state, { firstRun, linkNotice });
|
|
284
|
+
const view = accountViewModel(state, { firstRun, linkNotice, t });
|
|
276
285
|
const error = view.signInUnavailable
|
|
277
286
|
? t(
|
|
278
287
|
'native.account.signInUnreachable',
|
package/src/app/App.tsx
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
SheetTitle,
|
|
39
39
|
SheetBody,
|
|
40
40
|
UsersIcon,
|
|
41
|
+
ReferenceChip,
|
|
41
42
|
yieldSheets,
|
|
42
43
|
} from '@agimon-ai/po-native-components';
|
|
43
44
|
import {
|
|
@@ -62,6 +63,7 @@ import {
|
|
|
62
63
|
webTabs,
|
|
63
64
|
subscribeWebPluginRegistry,
|
|
64
65
|
pluginSettingsPanels,
|
|
66
|
+
pluginSettingsSections,
|
|
65
67
|
applySessionRemoved,
|
|
66
68
|
applySessionUpsert,
|
|
67
69
|
sessionMoveTarget,
|
|
@@ -84,6 +86,7 @@ import {
|
|
|
84
86
|
liveSessionOptions,
|
|
85
87
|
mentionableSessions,
|
|
86
88
|
resolveSessionReference,
|
|
89
|
+
SESSION_REFERENCE_SCHEME,
|
|
87
90
|
activityWaitingCount,
|
|
88
91
|
sessionStoreFor,
|
|
89
92
|
sessionModes,
|
|
@@ -187,6 +190,7 @@ import { ClientDevices } from '../screens/ClientDevices';
|
|
|
187
190
|
import {
|
|
188
191
|
ContributedSettingsScreen,
|
|
189
192
|
sectionSummary,
|
|
193
|
+
settingsContributionCopy,
|
|
190
194
|
useContributedSettings,
|
|
191
195
|
useSettingsSections,
|
|
192
196
|
} from '../screens/ContributedSettingsScreen';
|
|
@@ -197,6 +201,8 @@ import { HomeAppsSection, HomeAttentionScreen, HomeScreen, type HomeView } from
|
|
|
197
201
|
import { HostDrawer, HostMenuButton } from '../screens/HostDrawer';
|
|
198
202
|
import { FirstSessionWelcome } from '../screens/HostedOnboarding';
|
|
199
203
|
import { ImagesScreen, imagesSummary, useImageSettings } from '../screens/ImagesScreen';
|
|
204
|
+
import { LanguageScreen, languageLabel } from '../screens/LanguageScreen';
|
|
205
|
+
import { pluginPageOf } from '../screens/localPlugins';
|
|
200
206
|
import { McpServersScreen, mcpServersSummary, useMcpServers } from '../screens/McpServersScreen';
|
|
201
207
|
import { MetricsScreen, useMetrics } from '../screens/MetricsScreen';
|
|
202
208
|
import { ALL_CATEGORIES, EXTERNAL_CATEGORY, PluginCatalogScreen } from '../screens/PluginCatalogScreen';
|
|
@@ -216,7 +222,7 @@ import {
|
|
|
216
222
|
SettingsScreen,
|
|
217
223
|
sentenceCase,
|
|
218
224
|
} from '../screens/SettingsScreen';
|
|
219
|
-
import { isCuratedPlugin,
|
|
225
|
+
import { isCuratedPlugin, useCatalogLayers, usePluginMarketplace } from '../screens/usePluginMarketplace';
|
|
220
226
|
import { workspacePageState } from '../screens/workspaceModel';
|
|
221
227
|
import type { ProviderCandidate } from '../screens/WorkspaceProviders';
|
|
222
228
|
import { WorkspaceProvidersSection } from '../screens/WorkspaceProvidersSection';
|
|
@@ -336,6 +342,7 @@ type Routes = {
|
|
|
336
342
|
SettingsPresets: { hostId?: string } | undefined;
|
|
337
343
|
SettingsMetrics: { hostId?: string } | undefined;
|
|
338
344
|
SettingsAppearance: undefined;
|
|
345
|
+
SettingsLanguage: undefined;
|
|
339
346
|
SettingsAccount: undefined;
|
|
340
347
|
SettingsTeam: undefined;
|
|
341
348
|
SettingsPanel: { id: string; title: string; hostId?: string };
|
|
@@ -685,6 +692,38 @@ function LiveSessionScreen({
|
|
|
685
692
|
);
|
|
686
693
|
}
|
|
687
694
|
|
|
695
|
+
/** An `@session:<token>` in a message from `senderId`: that session's name as a chip, or the token once it is gone. */
|
|
696
|
+
function SessionReference({
|
|
697
|
+
reference,
|
|
698
|
+
senderId,
|
|
699
|
+
onOpen,
|
|
700
|
+
onLongPress,
|
|
701
|
+
}: {
|
|
702
|
+
reference: string;
|
|
703
|
+
senderId: string;
|
|
704
|
+
onOpen: (sessionId: string) => void;
|
|
705
|
+
onLongPress?: () => void;
|
|
706
|
+
}) {
|
|
707
|
+
const t = useT();
|
|
708
|
+
// One string, so a store update that leaves this session alone does not re-render the chip.
|
|
709
|
+
const target = useStore(sessionsStore, (state) => {
|
|
710
|
+
const mentioned = resolveSessionReference(
|
|
711
|
+
reference,
|
|
712
|
+
mentionableSessions(state, workspacesStore.state.byId, senderId, Date.now()),
|
|
713
|
+
);
|
|
714
|
+
return mentioned === undefined ? '' : `${mentioned.id}\n${mentioned.name}`;
|
|
715
|
+
});
|
|
716
|
+
if (target === '') return `@${reference}`;
|
|
717
|
+
const [id, name] = target.split('\n') as [string, string];
|
|
718
|
+
return (
|
|
719
|
+
<ReferenceChip
|
|
720
|
+
label={name.trim() || t('native.app.untitled', 'Untitled')}
|
|
721
|
+
reference={`@${reference}`}
|
|
722
|
+
onOpen={() => onOpen(id)}
|
|
723
|
+
onLongPress={onLongPress}
|
|
724
|
+
/>
|
|
725
|
+
);
|
|
726
|
+
}
|
|
688
727
|
function SessionTabTitle({ tab }: { tab: Pick<TransientTab, 'label' | 'translateLabel'> }) {
|
|
689
728
|
const t = useT();
|
|
690
729
|
return (
|
|
@@ -1034,32 +1073,55 @@ function SessionRoute({
|
|
|
1034
1073
|
const resolveFileLink = useFileLinks(sessionId);
|
|
1035
1074
|
// Message text, as in the cockpit: images load from the session's open folders, and a path a plugin
|
|
1036
1075
|
// claims opens that plugin's file view in this session's stack.
|
|
1037
|
-
const markdown = useMemo(
|
|
1038
|
-
|
|
1076
|
+
const markdown = useMemo(() => {
|
|
1077
|
+
const hostId = splitHostId(sessionId)?.hostId;
|
|
1078
|
+
const openMentioned = (id: string) => openSession(hostId === undefined ? id : qualifyHostId(hostId, id));
|
|
1079
|
+
const onFileLink = (label: string, explicit = false) => {
|
|
1080
|
+
// `@session:<token>` opens that session, found among the ones on this session's computer.
|
|
1081
|
+
const mentioned = explicit
|
|
1082
|
+
? undefined
|
|
1083
|
+
: resolveSessionReference(
|
|
1084
|
+
label,
|
|
1085
|
+
mentionableSessions(sessionsStore.state, workspacesStore.state.byId, sessionId, Date.now()),
|
|
1086
|
+
);
|
|
1087
|
+
if (mentioned !== undefined) return () => openMentioned(mentioned.id);
|
|
1088
|
+
const tab = explicit ? fileTabForPath(sessionId, label) : resolveFileLink(label);
|
|
1089
|
+
if (tab === undefined) return undefined;
|
|
1090
|
+
return () => {
|
|
1091
|
+
openTransientTab(ownerSessionId, tab);
|
|
1092
|
+
setActivityOpen(false);
|
|
1093
|
+
inner.current?.navigate('ActivityDetail', { tabId: tab.id }, { pop: true });
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
return {
|
|
1039
1097
|
loadImage: (path: string) => loadSessionImage(sessionId, path),
|
|
1040
|
-
onFileLink
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1098
|
+
onFileLink,
|
|
1099
|
+
// A reference draws as a chip: a session by its live name, a file a plugin claims by its basename.
|
|
1100
|
+
renderReference: (reference: string, options?: { onLongPress?: () => void }) => {
|
|
1101
|
+
if (reference.startsWith(SESSION_REFERENCE_SCHEME))
|
|
1102
|
+
return (
|
|
1103
|
+
<SessionReference
|
|
1104
|
+
reference={reference}
|
|
1105
|
+
senderId={sessionId}
|
|
1106
|
+
onOpen={openMentioned}
|
|
1107
|
+
onLongPress={options?.onLongPress}
|
|
1108
|
+
/>
|
|
1109
|
+
);
|
|
1110
|
+
// Never the explicit path: a generic file preview would claim `space:` before po-space does.
|
|
1111
|
+
const open = onFileLink(reference);
|
|
1112
|
+
if (open === undefined) return undefined;
|
|
1113
|
+
const path = reference.slice(reference.indexOf(':') + 1);
|
|
1114
|
+
return (
|
|
1115
|
+
<ReferenceChip
|
|
1116
|
+
label={path.split('/').at(-1) || path}
|
|
1117
|
+
reference={`@${reference}`}
|
|
1118
|
+
onOpen={open}
|
|
1119
|
+
onLongPress={options?.onLongPress}
|
|
1120
|
+
/>
|
|
1121
|
+
);
|
|
1059
1122
|
},
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
);
|
|
1123
|
+
};
|
|
1124
|
+
}, [sessionId, ownerSessionId, resolveFileLink, openSession]);
|
|
1063
1125
|
const openTab = (tabId: string | null) => {
|
|
1064
1126
|
setActivityOpen(false);
|
|
1065
1127
|
if (!inner.current) return;
|
|
@@ -1372,12 +1434,13 @@ function SessionRoute({
|
|
|
1372
1434
|
name="ActivityDetail"
|
|
1373
1435
|
getId={({ params }) => params.tabId}
|
|
1374
1436
|
options={({ route: detail }) => {
|
|
1375
|
-
const tab =
|
|
1437
|
+
const tab =
|
|
1438
|
+
transientTabs.find((tab) => tab.id === detail.params.tabId) ??
|
|
1439
|
+
webTabs(ownerSessionId).find((tab) => tab.id === detail.params.tabId);
|
|
1376
1440
|
return {
|
|
1377
1441
|
title:
|
|
1378
|
-
tab
|
|
1442
|
+
(tab && 'translateLabel' in tab ? tab.translateLabel?.(t) : undefined) ??
|
|
1379
1443
|
tab?.label ??
|
|
1380
|
-
webTabs(ownerSessionId).find((tab) => tab.id === detail.params.tabId)?.label ??
|
|
1381
1444
|
t('native.app.activity', 'Activity'),
|
|
1382
1445
|
// iOS 26 defaults to a whole-screen back swipe, which steals drags on Author canvases; keep the edge swipe.
|
|
1383
1446
|
fullScreenGestureEnabled: false,
|
|
@@ -1487,12 +1550,16 @@ function SettingsRoute(
|
|
|
1487
1550
|
const installedPlugins =
|
|
1488
1551
|
settingsHost === undefined ? installedWebPlugins() : webPluginRegistryForHost(settingsHost).installedWebPlugins();
|
|
1489
1552
|
// A curated plugin's pages live on its own Plugins screen, so Settings leaves them out.
|
|
1490
|
-
const
|
|
1553
|
+
const catalog = useCatalogLayers(settingsHost);
|
|
1554
|
+
const curated = useMemo(() => catalog && new Set(catalog.flatMap((layer) => layer.packages)), [catalog]);
|
|
1491
1555
|
const listed = (pluginId: string) => !isCuratedPlugin(pluginId, installedPlugins, curated);
|
|
1492
|
-
|
|
1556
|
+
// An opted-in page moves to its plugin's screen, but only once the catalog says which screen that is.
|
|
1557
|
+
const local = useLocalPluginSources(settingsHost);
|
|
1558
|
+
const panels = local.panels.filter((panel) =>
|
|
1559
|
+
panel.pluginPage?.trim() ? pluginPageOf(panel, local.installed, catalog) === undefined : listed(panel.pluginId),
|
|
1560
|
+
);
|
|
1493
1561
|
// A page about the person sits in the Global card, not among the computer's features.
|
|
1494
1562
|
const globalPanels = props.phoneOnly ? [] : panels.filter((panel) => panel.menuGroup === 'global');
|
|
1495
|
-
const panelGroups = useSettingsPanelGroups(props.phoneOnly ? props.computers : undefined);
|
|
1496
1563
|
const sections = useSettingsSections('host', settingsHost).filter((section) => listed(section.pluginId));
|
|
1497
1564
|
const sectionKeys = sections.flatMap((section) => section.fields.map(settingsKeyOf)).join('\n');
|
|
1498
1565
|
const plugins = installedPlugins.length;
|
|
@@ -1545,24 +1612,23 @@ function SettingsRoute(
|
|
|
1545
1612
|
}, [reloadSummary, reloadImages, reloadSections, reloadTeam]),
|
|
1546
1613
|
);
|
|
1547
1614
|
const appearance = useStore(appearanceStore, (state) => state);
|
|
1615
|
+
const locale = useStore(localeStore, (pick) => pick);
|
|
1548
1616
|
const teamName = hostedTeamName.data;
|
|
1549
|
-
const openPanel = (id: string
|
|
1550
|
-
const computer = props.computers?.find((candidate) => candidate.id ===
|
|
1551
|
-
if (
|
|
1617
|
+
const openPanel = (id: string) => {
|
|
1618
|
+
const computer = props.computers?.find((candidate) => candidate.id === settingsHost);
|
|
1619
|
+
if (settingsHost === undefined ? !allowed : computer?.online === false) {
|
|
1552
1620
|
Alert.alert(
|
|
1553
1621
|
t('native.app.tab.settings', 'Settings'),
|
|
1554
1622
|
computer ? t('native.app.computerOffline', '{name} is offline.', { name: computer.label }) : refused,
|
|
1555
1623
|
);
|
|
1556
1624
|
return;
|
|
1557
1625
|
}
|
|
1558
|
-
const panel =
|
|
1559
|
-
(candidate) => candidate.id === id,
|
|
1560
|
-
);
|
|
1626
|
+
const panel = panels.find((candidate) => candidate.id === id);
|
|
1561
1627
|
if (panel)
|
|
1562
1628
|
navigation.navigate('SettingsPanel', {
|
|
1563
1629
|
id,
|
|
1564
1630
|
title: panel.label,
|
|
1565
|
-
...(
|
|
1631
|
+
...(settingsHost === undefined ? {} : { hostId: settingsHost }),
|
|
1566
1632
|
});
|
|
1567
1633
|
};
|
|
1568
1634
|
return (
|
|
@@ -1593,9 +1659,10 @@ function SettingsRoute(
|
|
|
1593
1659
|
{...(mcpServers ? { mcpServers } : {})}
|
|
1594
1660
|
{...(remote ? { remote } : {})}
|
|
1595
1661
|
appearance={appearanceLabel(appearance)}
|
|
1662
|
+
language={languageLabel(locale, nativeLocales())}
|
|
1596
1663
|
{...(teamName ? { team: teamName } : {})}
|
|
1597
1664
|
{...(images ? { images } : {})}
|
|
1598
|
-
plugins={
|
|
1665
|
+
plugins={t('native.app.pluginsInstalled', '{count} installed', { count: plugins })}
|
|
1599
1666
|
sections={sections.map((section) => {
|
|
1600
1667
|
const summary = sectionSummary(section, sectionValues);
|
|
1601
1668
|
return { id: section.id, label: section.label, ...(summary === undefined ? {} : { summary }) };
|
|
@@ -1615,7 +1682,12 @@ function SettingsRoute(
|
|
|
1615
1682
|
}}
|
|
1616
1683
|
{...((props.error ?? loadError) ? { error: props.error ?? loadError } : {})}
|
|
1617
1684
|
onOpen={(section: SettingsSection) => {
|
|
1618
|
-
if (
|
|
1685
|
+
if (
|
|
1686
|
+
section === 'SettingsAppearance' ||
|
|
1687
|
+
section === 'SettingsLanguage' ||
|
|
1688
|
+
section === 'SettingsAccount' ||
|
|
1689
|
+
section === 'SettingsTeam'
|
|
1690
|
+
) {
|
|
1619
1691
|
navigation.navigate(section);
|
|
1620
1692
|
return;
|
|
1621
1693
|
}
|
|
@@ -1626,7 +1698,6 @@ function SettingsRoute(
|
|
|
1626
1698
|
navigation.navigate(section, settingsHost === undefined ? undefined : { hostId: settingsHost });
|
|
1627
1699
|
}}
|
|
1628
1700
|
panels={panels.filter((panel) => panel.menuGroup !== 'global')}
|
|
1629
|
-
panelGroups={panelGroups}
|
|
1630
1701
|
onOpenPanel={openPanel}
|
|
1631
1702
|
/>
|
|
1632
1703
|
);
|
|
@@ -1641,21 +1712,17 @@ function useSettingsPanels(hostId?: string) {
|
|
|
1641
1712
|
useEffect(() => subscribeWebPluginRegistry(() => setVersion((value) => value + 1)), []);
|
|
1642
1713
|
const installed =
|
|
1643
1714
|
hostId === undefined ? pluginSettingsPanels() : webPluginRegistryForHost(hostId).pluginSettingsPanels();
|
|
1644
|
-
return [...installed]
|
|
1645
|
-
(left, right) => (left.order ?? 0) - (right.order ?? 0) || left.id.localeCompare(right.id)
|
|
1646
|
-
|
|
1715
|
+
return [...installed]
|
|
1716
|
+
.sort((left, right) => (left.order ?? 0) - (right.order ?? 0) || left.id.localeCompare(right.id))
|
|
1717
|
+
.map((panel) => ({ ...panel, ...settingsContributionCopy(panel, 'settingsPanels') }));
|
|
1647
1718
|
}
|
|
1648
1719
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
hostId:
|
|
1654
|
-
|
|
1655
|
-
panels: [...webPluginRegistryForHost(id).pluginSettingsPanels()].sort(
|
|
1656
|
-
(left, right) => (left.order ?? 0) - (right.order ?? 0) || left.id.localeCompare(right.id),
|
|
1657
|
-
),
|
|
1658
|
-
}));
|
|
1720
|
+
/** What one computer's registry offers the Plugins screen as private plugins; never another computer's. */
|
|
1721
|
+
function useLocalPluginSources(hostId?: string) {
|
|
1722
|
+
const panels = useSettingsPanels(hostId);
|
|
1723
|
+
const installed =
|
|
1724
|
+
hostId === undefined ? installedWebPlugins('host') : webPluginRegistryForHost(hostId).installedWebPlugins('host');
|
|
1725
|
+
return { panels, installed };
|
|
1659
1726
|
}
|
|
1660
1727
|
|
|
1661
1728
|
function SettingsPanelRoute({ route }: NativeStackScreenProps<Routes, 'SettingsPanel'>) {
|
|
@@ -1780,7 +1847,8 @@ function MetricsRoute({ route }: NativeStackScreenProps<Routes, 'SettingsMetrics
|
|
|
1780
1847
|
|
|
1781
1848
|
function PluginsRoute({ navigation, route }: NativeStackScreenProps<Routes, 'SettingsPlugins'>) {
|
|
1782
1849
|
const hostId = route.params?.hostId;
|
|
1783
|
-
const market = usePluginMarketplace(hostId);
|
|
1850
|
+
const market = usePluginMarketplace(hostId, undefined, useLocalPluginSources(hostId));
|
|
1851
|
+
const listed = [...market.entries, ...market.localEntries];
|
|
1784
1852
|
const [query, setQuery] = useState('');
|
|
1785
1853
|
const [category, setCategory] = useState(ALL_CATEGORIES);
|
|
1786
1854
|
useFocusEffect(
|
|
@@ -1792,8 +1860,8 @@ function PluginsRoute({ navigation, route }: NativeStackScreenProps<Routes, 'Set
|
|
|
1792
1860
|
);
|
|
1793
1861
|
return (
|
|
1794
1862
|
<PluginCatalogScreen
|
|
1795
|
-
plugins={filterEntries(
|
|
1796
|
-
categories={[...new Set(
|
|
1863
|
+
plugins={filterEntries(listed, query, category, ALL_CATEGORIES, EXTERNAL_CATEGORY)}
|
|
1864
|
+
categories={[...new Set(listed.filter((entry) => entry.source === 'po').map((entry) => entry.category))]}
|
|
1797
1865
|
category={category}
|
|
1798
1866
|
onCategoryChange={setCategory}
|
|
1799
1867
|
query={query}
|
|
@@ -1823,9 +1891,10 @@ function PluginsRoute({ navigation, route }: NativeStackScreenProps<Routes, 'Set
|
|
|
1823
1891
|
|
|
1824
1892
|
function PluginRoute({ navigation, route }: NativeStackScreenProps<Routes, 'SettingsPlugin'>) {
|
|
1825
1893
|
const { id, hostId } = route.params;
|
|
1826
|
-
const
|
|
1894
|
+
const local = useLocalPluginSources(hostId);
|
|
1895
|
+
const market = usePluginMarketplace(hostId, undefined, local);
|
|
1827
1896
|
const [setupOpen, setSetupOpen] = useState(false);
|
|
1828
|
-
const plugin = market.entries.find((entry) => entry.id === id);
|
|
1897
|
+
const plugin = [...market.entries, ...market.localEntries].find((entry) => entry.id === id);
|
|
1829
1898
|
if (plugin === undefined) {
|
|
1830
1899
|
return (
|
|
1831
1900
|
<SectionPage>
|
|
@@ -1849,6 +1918,8 @@ function PluginRoute({ navigation, route }: NativeStackScreenProps<Routes, 'Sett
|
|
|
1849
1918
|
const operation = market.installs[id];
|
|
1850
1919
|
const installError = market.startErrors[id] ?? (operation?.state === 'failed' ? operation.error : undefined);
|
|
1851
1920
|
const openPresets = () => navigation.navigate('SettingsPresets', { hostId });
|
|
1921
|
+
// Pages open through the same Settings panel route, so they keep that route's transport and its host.
|
|
1922
|
+
const pages = local.panels.filter((panel) => pluginPageOf(panel, local.installed, market.layers) === id);
|
|
1852
1923
|
return (
|
|
1853
1924
|
<>
|
|
1854
1925
|
<PluginDetailScreen
|
|
@@ -1858,6 +1929,23 @@ function PluginRoute({ navigation, route }: NativeStackScreenProps<Routes, 'Sett
|
|
|
1858
1929
|
presets={market.summaries}
|
|
1859
1930
|
{...(layer?.version === undefined ? {} : { version: layer.version })}
|
|
1860
1931
|
adds={[]}
|
|
1932
|
+
{...(pages.length === 0
|
|
1933
|
+
? {}
|
|
1934
|
+
: {
|
|
1935
|
+
settings: (
|
|
1936
|
+
<>
|
|
1937
|
+
{pages.map((panel, index) => (
|
|
1938
|
+
<NavRow
|
|
1939
|
+
key={panel.id}
|
|
1940
|
+
title={sentenceCase(panel.label)}
|
|
1941
|
+
value={sentenceCase(panel.detail)}
|
|
1942
|
+
last={index === pages.length - 1}
|
|
1943
|
+
onPress={() => navigation.navigate('SettingsPanel', { id: panel.id, title: panel.label, hostId })}
|
|
1944
|
+
/>
|
|
1945
|
+
))}
|
|
1946
|
+
</>
|
|
1947
|
+
),
|
|
1948
|
+
})}
|
|
1861
1949
|
{...(installError === undefined ? {} : { installError })}
|
|
1862
1950
|
{...(operation?.clash === undefined ? {} : { clash: operation.clash })}
|
|
1863
1951
|
onInstall={() => void market.join(plugin, '')}
|
|
@@ -1988,6 +2076,15 @@ function ContributedSection({
|
|
|
1988
2076
|
);
|
|
1989
2077
|
}
|
|
1990
2078
|
|
|
2079
|
+
/** The language Po uses on this phone. Packs arrive with computers, so the list follows the registry. */
|
|
2080
|
+
function LanguageRoute() {
|
|
2081
|
+
useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
|
|
2082
|
+
const locale = useStore(localeStore, (pick) => pick);
|
|
2083
|
+
return (
|
|
2084
|
+
<LanguageScreen {...(locale === undefined ? {} : { locale })} locales={nativeLocales()} onLocale={setLocalePick} />
|
|
2085
|
+
);
|
|
2086
|
+
}
|
|
2087
|
+
|
|
1991
2088
|
/** Theme is this phone's; the layout is `native.template` on the computer whose template the app draws. */
|
|
1992
2089
|
function AppearanceRoute() {
|
|
1993
2090
|
const theme = useStore(appearanceStore, (state) => state);
|
|
@@ -2013,7 +2110,6 @@ function AppearanceRoute() {
|
|
|
2013
2110
|
hostId,
|
|
2014
2111
|
);
|
|
2015
2112
|
useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
|
|
2016
|
-
const locale = useStore(localeStore, (pick) => pick);
|
|
2017
2113
|
const mount =
|
|
2018
2114
|
model.target === 'global'
|
|
2019
2115
|
? ({ scope: 'host' } as const)
|
|
@@ -2027,11 +2123,9 @@ function AppearanceRoute() {
|
|
|
2027
2123
|
<AppearanceScreen
|
|
2028
2124
|
theme={theme}
|
|
2029
2125
|
onTheme={setAppearance}
|
|
2030
|
-
{...(locale === undefined ? {} : { locale })}
|
|
2031
|
-
locales={nativeLocales()}
|
|
2032
|
-
onLocale={setLocalePick}
|
|
2033
2126
|
repositories={repositories}
|
|
2034
|
-
templates={catalog.templates.map(({ id, label, description, pluginId }) => ({
|
|
2127
|
+
templates={catalog.templates.map(({ id, label, description, pluginId, translateCopy }) => ({
|
|
2128
|
+
translateCopy,
|
|
2035
2129
|
id,
|
|
2036
2130
|
label,
|
|
2037
2131
|
description,
|
|
@@ -3250,7 +3344,10 @@ function useHomeApps(
|
|
|
3250
3344
|
return [
|
|
3251
3345
|
{
|
|
3252
3346
|
key,
|
|
3253
|
-
title:
|
|
3347
|
+
title: t(
|
|
3348
|
+
`plugin.${splitHostId(fill.pluginId)?.localId ?? fill.pluginId}.dashboardTiles.${fill.id}.label`,
|
|
3349
|
+
data.title,
|
|
3350
|
+
),
|
|
3254
3351
|
size: data.size,
|
|
3255
3352
|
Icon: data.icon as ComponentType<IconProps> | undefined,
|
|
3256
3353
|
onOpen:
|
|
@@ -3414,7 +3511,7 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
|
|
|
3414
3511
|
const multi = hostStates.length > 1;
|
|
3415
3512
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
3416
3513
|
// Settings names a computer once any is paired, so its calls never ride the implicit session.
|
|
3417
|
-
// With several and All hosts chosen,
|
|
3514
|
+
// With several and All hosts chosen, no host is selected: Settings shows only this phone and the account.
|
|
3418
3515
|
const settingsHost = multi ? scope?.host.id : hostStates[0]?.host.id;
|
|
3419
3516
|
const settingsComputers =
|
|
3420
3517
|
hostStates.length > 1
|
|
@@ -4119,11 +4216,27 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
|
|
|
4119
4216
|
headerBackButtonDisplayMode: 'default',
|
|
4120
4217
|
}}
|
|
4121
4218
|
/>
|
|
4219
|
+
<Stack.Screen
|
|
4220
|
+
name="SettingsLanguage"
|
|
4221
|
+
component={LanguageRoute}
|
|
4222
|
+
options={{
|
|
4223
|
+
title: t('native.settings.language', 'Language'),
|
|
4224
|
+
headerBackTitle: settingsBack(),
|
|
4225
|
+
headerBackButtonDisplayMode: 'default',
|
|
4226
|
+
}}
|
|
4227
|
+
/>
|
|
4122
4228
|
<Stack.Screen
|
|
4123
4229
|
name="SettingsPanel"
|
|
4124
4230
|
component={SettingsPanelRoute}
|
|
4125
4231
|
options={({ route }) => ({
|
|
4126
|
-
title:
|
|
4232
|
+
title: (() => {
|
|
4233
|
+
const panel = (
|
|
4234
|
+
route.params.hostId === undefined
|
|
4235
|
+
? pluginSettingsPanels()
|
|
4236
|
+
: webPluginRegistryForHost(route.params.hostId).pluginSettingsPanels()
|
|
4237
|
+
).find((entry) => entry.id === route.params.id);
|
|
4238
|
+
return panel ? settingsContributionCopy(panel, 'settingsPanels').label : route.params.title;
|
|
4239
|
+
})(),
|
|
4127
4240
|
headerBackTitle: settingsBack(),
|
|
4128
4241
|
headerBackButtonDisplayMode: 'default',
|
|
4129
4242
|
})}
|
|
@@ -4177,7 +4290,17 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
|
|
|
4177
4290
|
name="SettingsSection"
|
|
4178
4291
|
component={ContributedSectionRoute}
|
|
4179
4292
|
options={({ route }) => ({
|
|
4180
|
-
title:
|
|
4293
|
+
title: (() => {
|
|
4294
|
+
const scope = route.params.workspace ? 'workspace' : 'host';
|
|
4295
|
+
const section = (
|
|
4296
|
+
route.params.hostId === undefined
|
|
4297
|
+
? pluginSettingsSections(scope)
|
|
4298
|
+
: webPluginRegistryForHost(route.params.hostId).pluginSettingsSections(scope)
|
|
4299
|
+
).find((entry) => entry.id === route.params.id);
|
|
4300
|
+
return section
|
|
4301
|
+
? sentenceCase(settingsContributionCopy(section, 'settingsSections').label)
|
|
4302
|
+
: route.params.title;
|
|
4303
|
+
})(),
|
|
4181
4304
|
headerBackTitle: route.params.workspace ? workspacesBack() : settingsBack(),
|
|
4182
4305
|
headerBackButtonDisplayMode: 'default',
|
|
4183
4306
|
})}
|