@agimon-ai/po-native 0.0.1-alpha.21 → 0.0.1-alpha.23
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/App.tsx +10 -3
- package/src/components/homeApps.ts +29 -8
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.23",
|
|
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.143",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.23",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.90",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.143",
|
|
36
|
+
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.15",
|
|
37
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.143",
|
|
38
|
+
"@agimon-ai/po-template-elegant": "0.0.0-alpha.143",
|
|
39
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.143",
|
|
40
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.143",
|
|
41
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.143",
|
|
42
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.143",
|
|
43
43
|
"@better-auth/expo": "1.7.12",
|
|
44
44
|
"@config-plugins/react-native-webrtc": "15.0.2",
|
|
45
45
|
"@earendil-works/chord": "1.5.1",
|
package/src/app/App.tsx
CHANGED
|
@@ -2431,7 +2431,7 @@ function useHomeApps(
|
|
|
2431
2431
|
const calendarHost = useCalendarHostProps(hostStates, undefined);
|
|
2432
2432
|
const openWorkspace = useOpenWorkspace();
|
|
2433
2433
|
return homeAppEntries(
|
|
2434
|
-
hostStates.map(({ host }) => host),
|
|
2434
|
+
hostStates.map(({ host, status }) => ({ ...host, connected: status === 'connected' })),
|
|
2435
2435
|
(hostId) => {
|
|
2436
2436
|
const registry = webPluginRegistryForHost(hostId);
|
|
2437
2437
|
return [...registry.dashboardTileFills({ scope: 'host' }), ...registry.legacyHomeAppFills()].sort(
|
|
@@ -2441,7 +2441,7 @@ function useHomeApps(
|
|
|
2441
2441
|
left.id.localeCompare(right.id),
|
|
2442
2442
|
);
|
|
2443
2443
|
},
|
|
2444
|
-
).flatMap<NativeDashboardTile>(({ hostId, fill, key }) => {
|
|
2444
|
+
).flatMap<NativeDashboardTile>(({ hostId, fill, key, global }) => {
|
|
2445
2445
|
const Card = fill.component;
|
|
2446
2446
|
if (!Card) return [];
|
|
2447
2447
|
const registry = webPluginRegistryForHost(hostId);
|
|
@@ -2460,7 +2460,14 @@ function useHomeApps(
|
|
|
2460
2460
|
sessionId: null,
|
|
2461
2461
|
// The card reads the same computers as the page it opens.
|
|
2462
2462
|
...calendarHost,
|
|
2463
|
-
|
|
2463
|
+
// A global tile reads a shared backend: give it only its serving computer so it calls once.
|
|
2464
|
+
host: {
|
|
2465
|
+
...calendarHost.host,
|
|
2466
|
+
hostId,
|
|
2467
|
+
...(global
|
|
2468
|
+
? { connectedHosts: calendarHost.host.connectedHosts.filter((entry) => entry.hostId === hostId) }
|
|
2469
|
+
: {}),
|
|
2470
|
+
},
|
|
2464
2471
|
openWorkspace: (id: string) => openWorkspace(splitHostId(id) ? id : qualifyHostId(hostId, id)),
|
|
2465
2472
|
openSettings,
|
|
2466
2473
|
openPage: (pageId: string) => {
|
|
@@ -34,28 +34,49 @@ export function placeTiles(sizes: readonly HomeTileSize[], columns: number) {
|
|
|
34
34
|
interface HomeHost {
|
|
35
35
|
id: string;
|
|
36
36
|
person?: { issuer: string; subject: string };
|
|
37
|
+
connected?: boolean;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
type FillScope = { combinesComputers?: unknown; dataScope?: unknown } | undefined;
|
|
41
|
+
|
|
39
42
|
/**
|
|
40
43
|
* One card per computer, except for a plugin whose page joins every computer (its fill sets
|
|
41
44
|
* `data.combinesComputers`, as the calendar does): that one shows once per person. Unlinked
|
|
42
45
|
* computers join the phone's one account, or share a card of their own when it holds several.
|
|
46
|
+
* A fill with `data.dataScope: 'global'` reads a shared backend, so it also shows once per person,
|
|
47
|
+
* from that person's first connected computer, and is marked `global` so it reads only that one.
|
|
43
48
|
*/
|
|
44
49
|
export function homeAppEntries<T extends { pluginId: string; id: string; data?: unknown }>(
|
|
45
50
|
hosts: readonly HomeHost[],
|
|
46
51
|
read: (hostId: string) => readonly T[],
|
|
47
52
|
) {
|
|
48
|
-
const seen = new Set<string>();
|
|
49
53
|
const people = new Set(hosts.flatMap((host) => (host.person ? [JSON.stringify(host.person)] : [])));
|
|
50
54
|
const unlinked = people.size === 1 ? [...people][0]! : 'unlinked';
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const fills = hosts.map((host) => ({ host, fills: read(host.id) }));
|
|
56
|
+
const keyOf = (host: HomeHost, fill: T) => {
|
|
57
|
+
const scope = fill.data as FillScope;
|
|
58
|
+
const perPerson = scope?.combinesComputers === true || scope?.dataScope === 'global';
|
|
59
|
+
const owner = perPerson ? (host.person ? JSON.stringify(host.person) : unlinked) : host.id;
|
|
60
|
+
return JSON.stringify([owner, splitHostId(fill.pluginId)?.localId ?? fill.pluginId, fill.id]);
|
|
61
|
+
};
|
|
62
|
+
// A global fill is served by the first connected computer that has it, else the first one.
|
|
63
|
+
const globalHost = new Map<string, string>();
|
|
64
|
+
for (const connectedPass of [true, false])
|
|
65
|
+
for (const { host, fills: hostFills } of fills)
|
|
66
|
+
if ((host.connected !== false) === connectedPass)
|
|
67
|
+
for (const fill of hostFills)
|
|
68
|
+
if ((fill.data as FillScope)?.dataScope === 'global') {
|
|
69
|
+
const key = keyOf(host, fill);
|
|
70
|
+
if (!globalHost.has(key)) globalHost.set(key, host.id);
|
|
71
|
+
}
|
|
72
|
+
const seen = new Set<string>();
|
|
73
|
+
return fills.flatMap(({ host, fills: hostFills }) =>
|
|
74
|
+
hostFills.flatMap((fill) => {
|
|
75
|
+
const key = keyOf(host, fill);
|
|
76
|
+
const chosen = globalHost.get(key);
|
|
77
|
+
if (seen.has(key) || (chosen !== undefined && chosen !== host.id)) return [];
|
|
57
78
|
seen.add(key);
|
|
58
|
-
return [{ hostId: host.id, fill, key }];
|
|
79
|
+
return [{ hostId: host.id, fill, key, global: chosen !== undefined }];
|
|
59
80
|
}),
|
|
60
81
|
);
|
|
61
82
|
}
|