Skip to content

Commit e83e5f7

Browse files
committed
Merge multiplayer/s6/6b-steer-presence into multiplayer/s6/6d2-member-push
Migration 087 runs after Slice 7's 085 and 086, and the V2 preview upgrade test now lists it.
2 parents 853dff1 + f6c6401 commit e83e5f7

194 files changed

Lines changed: 8745 additions & 847 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/mobile/src/App.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ import {
7575
import { useMobileNavigationTheme } from "./lib/useMobileNavigationTheme";
7676
import { installUiRuntimeMemoryWarningGc } from "./lib/useUiRuntimeMemoryWarningGc";
7777
import { SubscriptionUsageCoordinator } from "./widgets/SubscriptionUsageCoordinator";
78+
import { PresenceWatch } from "./features/threads/PresenceWatch";
79+
import { setPresencePathname } from "./state/presence";
7880
import { installSubscriptionUsageRefresh } from "./widgets/useSubscriptionUsage";
7981
import { GlobalVoiceInputControl } from "./features/voice-input/GlobalVoiceInputControl";
8082
import { restoreSettingsLinkState } from "./features/settings/settings-navigation";
@@ -166,7 +168,9 @@ function handleNavigationStateChange(state: NavigationState | undefined): void {
166168
resolvePendingNewTaskPromptLink(state);
167169
resolvePendingThreadPromptLink(state);
168170
if (!state) return;
169-
setAgentNotificationPathname(workspaceLocationFromState(state).pathname);
171+
const { pathname } = workspaceLocationFromState(state);
172+
setAgentNotificationPathname(pathname);
173+
setPresencePathname(pathname);
170174
recordAppShortcutNavigationState(state);
171175
pruneNewTaskFlowStates(state);
172176
pruneNewTaskBranchCheckouts(state);
@@ -235,6 +239,7 @@ function AppContent() {
235239
<>
236240
<SplashScreenCoordinator />
237241
<SubscriptionUsageCoordinator />
242+
<PresenceWatch />
238243
<GestureHandlerRootView className="flex-1">
239244
<KeyboardProvider statusBarTranslucent>
240245
<SafeAreaProvider>

‎apps/mobile/src/Stack.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ import { SettingsAuthRouteScreen } from "./features/settings/SettingsAuthRouteSc
9696
import { SettingsEnvironmentDetailRouteScreen } from "./features/settings/SettingsEnvironmentDetailRouteScreen";
9797
import { SettingsEnvironmentsRouteScreen } from "./features/settings/SettingsEnvironmentsRouteScreen";
9898
import { SettingsFollowUpRouteScreen } from "./features/settings/SettingsFollowUpRouteScreen";
99+
import { SettingsTeamRouteScreen } from "./features/settings/SettingsTeamRouteScreen";
99100
import {
100101
SettingsEnvironmentMaintenanceRouteScreen,
101102
SettingsThreadsRouteScreen,
@@ -348,6 +349,14 @@ const SETTINGS_SCREENS = {
348349
title: "Microphone",
349350
},
350351
}),
352+
SettingsTeam: createNativeStackScreen({
353+
screen: SettingsTeamRouteScreen,
354+
linking: "settings/team",
355+
options: {
356+
...SETTINGS_PAGE_OPTIONS,
357+
title: "Team",
358+
},
359+
}),
351360
SettingsFollowUp: createNativeStackScreen({
352361
screen: SettingsFollowUpRouteScreen,
353362
linking: "settings/follow-ups",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { memberInitials } from "@t3tools/client-runtime/state/team";
2+
import type { TeamMember } from "@t3tools/contracts";
3+
import { View } from "react-native";
4+
5+
import { AppText as Text } from "./ui/AppText";
6+
7+
const SIZES = {
8+
sm: { box: 18, font: 8 },
9+
md: { box: 24, font: 10 },
10+
} as const;
11+
12+
export function MemberAvatar(props: {
13+
readonly member: Pick<TeamMember, "name" | "color">;
14+
readonly size?: keyof typeof SIZES;
15+
}) {
16+
const size = SIZES[props.size ?? "md"];
17+
return (
18+
<View
19+
accessibilityRole="image"
20+
accessibilityLabel={props.member.name}
21+
className="items-center justify-center rounded-full"
22+
style={{ width: size.box, height: size.box, backgroundColor: props.member.color }}
23+
>
24+
<Text
25+
importantForAccessibility="no"
26+
className="font-t3-bold text-white"
27+
style={{ fontSize: size.font, lineHeight: size.font + 2 }}
28+
>
29+
{memberInitials(props.member.name)}
30+
</Text>
31+
</View>
32+
);
33+
}

‎apps/mobile/src/components/ui/AppSymbol.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import IconArrowsLeftRight from "@tabler/icons-react-native/IconArrowsLeftRight"
2222
import IconArrowsDiagonal2 from "@tabler/icons-react-native/IconArrowsDiagonal2";
2323
import IconArrowsMinimize from "@tabler/icons-react-native/IconArrowsMinimize";
2424
import IconBan from "@tabler/icons-react-native/IconBan";
25+
import IconBell from "@tabler/icons-react-native/IconBell";
26+
import IconBellOff from "@tabler/icons-react-native/IconBellOff";
2527
import IconBellRinging from "@tabler/icons-react-native/IconBellRinging";
2628
import IconBolt from "@tabler/icons-react-native/IconBolt";
2729
import IconBox from "@tabler/icons-react-native/IconBox";
@@ -165,7 +167,9 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
165167
"arrow.uturn.forward": IconArrowForwardUp,
166168
archivebox: IconArchive,
167169
"archivebox.fill": IconArchive,
170+
bell: IconBell,
168171
"bell.badge": IconBellRinging,
172+
"bell.slash": IconBellOff,
169173
"bolt.circle": IconBolt,
170174
"bolt.horizontal.circle": IconBolt,
171175
brain: IconBrain,

‎apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { RelativeTime } from "../../components/RelativeTime";
2828
import { useUniwindTheme } from "../../lib/useUniwindTheme";
2929
import { useServerConfigs } from "../../state/entities";
3030
import { useEnvironmentScope } from "../../state/session";
31+
import { useThreadTeamMenu } from "../../state/team";
3132
import { ThreadSwipeable } from "../home/thread-swipe-actions";
3233
import type { ArchivedThreadGroup, ArchivedThreadSortOrder } from "./archivedThreadList";
3334
import { SettingsScreenContent } from "../settings/components/SettingsScreen";
@@ -192,6 +193,7 @@ function ArchivedThreadRow(props: {
192193
props.thread.environmentId,
193194
AuthOrchestrationOperateScope,
194195
);
196+
const canDelete = useThreadTeamMenu(props.thread)?.canDelete !== false;
195197
const subtitle = [props.environmentLabel, props.thread.branch].filter((part): part is string =>
196198
Boolean(part),
197199
);
@@ -258,6 +260,7 @@ function ArchivedThreadRow(props: {
258260
onDelete={props.onDelete}
259261
onSwipeableClose={props.onSwipeableClose}
260262
onSwipeableWillOpen={props.onSwipeableWillOpen}
263+
{...(canDelete ? {} : { secondaryAction: null })}
261264
primaryAction={{
262265
accessibilityLabel: `Unarchive ${props.thread.title}`,
263266
icon: "arrow.uturn.backward",

‎apps/mobile/src/features/home/HomeScreen.tsx‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { useSearchScrollRestoration } from "../workspace/useSearchScrollRestorat
5858
import { useThreadJumpShortcuts } from "../keyboard/threadKeyboardShortcuts";
5959
import { usePendingThreadOrder } from "../../state/thread-order";
6060
import { threadListEnvironmentsAtom } from "../../state/presentation";
61+
import { useTeamViewers } from "../../state/team";
6162
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
6263
import { useQueuedThreadKeys } from "../../state/use-thread-outbox";
6364
import {
@@ -66,6 +67,7 @@ import {
6667
ThreadListV2SettledShelfHeader,
6768
ThreadListV2ShowMoreRow,
6869
ThreadListV2SnoozedShelfHeader,
70+
ThreadListV2TeamShelfHeader,
6971
ThreadListV2WorkingShelfHeader,
7072
} from "../threads/thread-list-v2-items";
7173
import { useThreadRowProviderInstanceResolver } from "../threads/thread-provider-instance";
@@ -433,12 +435,15 @@ export function HomeScreen(props: HomeScreenProps) {
433435
loaded: shelfPreferencesLoaded,
434436
settledShelfExpanded,
435437
snoozedShelfExpanded,
438+
teamShelfExpanded,
436439
workingShelfEnabled,
437440
workingShelfExpanded,
438441
toggleSettledShelf,
439442
toggleSnoozedShelf,
443+
toggleTeamShelf,
440444
toggleWorkingShelf,
441445
} = useThreadListV2ShelfPreferences();
446+
const teamViewers = useTeamViewers();
442447
const now = useThreadListNow(props.threads);
443448
const listEnvironments = useAtomValue(threadListEnvironmentsAtom);
444449
const {
@@ -478,8 +483,10 @@ export function HomeScreen(props: HomeScreenProps) {
478483
shelfPreferencesLoaded,
479484
workingShelfEnabled,
480485
workingShelfExpanded,
486+
teamShelfExpanded,
481487
snoozedShelfExpanded,
482488
settledShelfExpanded,
489+
teamViewers,
483490
selectedThreadKey,
484491
});
485492
// Called as `props.onSelectThread(...)`, the compiler would cache this handler on the whole
@@ -550,6 +557,16 @@ export function HomeScreen(props: HomeScreenProps) {
550557
/>
551558
);
552559
}
560+
if (item.type === "v2-team-shelf") {
561+
return (
562+
<ThreadListV2TeamShelfHeader
563+
count={item.count}
564+
disabled={item.disabled}
565+
expanded={item.expanded}
566+
onToggle={toggleTeamShelf}
567+
/>
568+
);
569+
}
553570
if (item.type === "v2-snoozed-shelf") {
554571
return (
555572
<ThreadListV2SnoozedShelfHeader
@@ -583,6 +600,8 @@ export function HomeScreen(props: HomeScreenProps) {
583600
snoozed={item.item.snoozed}
584601
pinned={item.item.pinned}
585602
wokeAt={item.item.wokeAt}
603+
owner={item.item.owner}
604+
team={item.item.team}
586605
snoozePresetMinute={item.snoozePresetMinute ?? ""}
587606
snoozeWakeLabelText={item.snoozeWakeLabelText}
588607
timeLabel={item.timeLabel}

‎apps/mobile/src/features/home/useThreadListActions.test.ts‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ vi.mock("../../state/presentation", () => ({
6767
vi.mock("../../state/server", () => ({
6868
environmentServerConfigsAtom: "server-configs",
6969
}));
70+
vi.mock("../../state/team", () => ({
71+
teamViewersAtom: "team-viewers",
72+
}));
7073
vi.mock("../../state/atom-registry", () => ({
7174
appAtomRegistry: {
7275
set: (_atom: string, value: boolean) => {
@@ -81,22 +84,24 @@ vi.mock("../../state/atom-registry", () => ({
8184
? state.shells
8285
: atom === "queued-thread-keys"
8386
? new Set<string>()
84-
: new Map(
85-
[...state.scopes.keys()].map((environmentId) => [
86-
environmentId,
87-
{
88-
environment: {
89-
capabilities: {
90-
threadSettlement: true,
91-
threadSnooze: true,
92-
threadPinning: true,
93-
threadPinReorder: true,
94-
threadTitleRegeneration: true,
87+
: atom === "team-viewers"
88+
? new Map()
89+
: new Map(
90+
[...state.scopes.keys()].map((environmentId) => [
91+
environmentId,
92+
{
93+
environment: {
94+
capabilities: {
95+
threadSettlement: true,
96+
threadSnooze: true,
97+
threadPinning: true,
98+
threadPinReorder: true,
99+
threadTitleRegeneration: true,
100+
},
95101
},
96102
},
97-
},
98-
]),
99-
),
103+
]),
104+
),
100105
},
101106
}));
102107
vi.mock("../../state/use-atom-command", () => ({

‎apps/mobile/src/features/home/useThreadListActions.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { pinOrderKeyBetween } from "@t3tools/client-runtime/state/thread-sort";
1616
import { appAtomRegistry } from "../../state/atom-registry";
1717
import { environmentServerConfigsAtom } from "../../state/server";
1818
import { connectedEnvironmentIdsAtom } from "../../state/presentation";
19+
import { teamViewersAtom } from "../../state/team";
1920
import { readEnvironmentScope } from "../../state/session";
2021
import { environmentThreadShells, threadEnvironment } from "../../state/threads";
2122
import { queuedThreadKeysAtom } from "../../state/use-thread-outbox";
@@ -610,6 +611,7 @@ export function useThreadListActions(): {
610611
queuedThreadKeys: appAtomRegistry.get(queuedThreadKeysAtom),
611612
settlementEnvironmentIds: new Set(configs.keys()),
612613
snoozeEnvironmentIds: new Set(configs.keys()),
614+
teamViewers: appAtomRegistry.get(teamViewersAtom),
613615
});
614616
const assignments = createThreadMovePlanner({
615617
allThreads: shells,

‎apps/mobile/src/features/projects/suggestAppAccess.ts‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import type {
55
} from "@t3tools/contracts";
66
import { appSignInTargetForRemote } from "@t3tools/client-runtime/source-control-clients";
77
import type { AtomCommandResult } from "@t3tools/client-runtime/state/runtime";
8-
import { Alert, Linking } from "react-native";
8+
import { Alert } from "react-native";
99

1010
/**
11-
* After a clone, suggests installing the forge app on the repository's owner when the server is
12-
* signed in with it but the app does not reach the repository.
11+
* After a clone, says when the server is signed in with the forge app but the app does not reach
12+
* the repository, so an admin can install it on the repository's owner.
1313
*/
1414
export async function suggestAppAccessForRemote(
1515
check: (value: {
@@ -26,13 +26,6 @@ export async function suggestAppAccessForRemote(
2626
const owner = target.input.repository.split("/")[0] ?? target.input.repository;
2727
Alert.alert(
2828
`Give ${target.appSignIn.appName} access to ${owner}`,
29-
`It isn't installed there, so GitHub requests for ${target.input.repository} use your own login and its lower rate limit.`,
30-
[
31-
{ text: "Not now", style: "cancel" },
32-
{
33-
text: "Install",
34-
onPress: () => void Linking.openURL(target.appSignIn.installUrl).catch(() => undefined),
35-
},
36-
],
29+
`It isn't installed there, so GitHub requests for ${target.input.repository} use your own login and its lower rate limit. Ask an admin to install the team's GitHub App on ${owner}.`,
3730
);
3831
}

‎apps/mobile/src/features/pull-requests/SourceControlAppAccessNotice.tsx‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
readHostCredentialSettings,
44
sourceControlClients,
55
} from "@t3tools/client-runtime/source-control-clients";
6-
import { Linking, Pressable, View } from "react-native";
6+
import { View } from "react-native";
77

88
import { AppText as Text } from "../../components/ui/AppText";
99
import { useEnvironmentPresentation } from "../../state/presentation";
@@ -46,14 +46,8 @@ export function SourceControlAppAccessNotice(props: {
4646
<View className="mb-4 gap-1 rounded-2xl bg-grouped-card px-4 py-3">
4747
<Text className="text-sm text-foreground-muted">
4848
{appSignIn.appName} isn't installed on {owner}, so requests here use your own GitHub login
49-
and its lower rate limit.
49+
and its lower rate limit. Ask an admin to install the team's GitHub App on {owner}.
5050
</Text>
51-
<Pressable
52-
accessibilityRole="link"
53-
onPress={() => void Linking.openURL(appSignIn.installUrl).catch(() => undefined)}
54-
>
55-
<Text className="text-sm font-t3-bold text-foreground">Install on {owner}</Text>
56-
</Pressable>
5751
</View>
5852
);
5953
}

0 commit comments

Comments
 (0)