Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ function ConfiguredConnectOnboardingRouteScreen() {
cloudEnvironments: null,
});

// Pull-to-refresh tracks its own spinner instead of discovery's refreshing
// flag, so background refreshes (e.g. the sign-in one) don't yank the
// content down.
const [isPullRefreshing, setIsPullRefreshing] = useState(false);
const handlePullRefresh = useCallback(() => {
const [isRefreshing, setIsRefreshing] = useState(false);
const handleRefresh = useCallback(() => {
void (async () => {
setIsPullRefreshing(true);
await refreshRelayEnvironments();
setIsPullRefreshing(false);
setIsRefreshing(true);
try {
await refreshRelayEnvironments();
} finally {
setIsRefreshing(false);
}
})();
}, [refreshRelayEnvironments]);

Expand All @@ -87,14 +87,24 @@ function ConfiguredConnectOnboardingRouteScreen() {
{Platform.OS === "android" ? (
<AndroidSheetHeader
title="Set up T3 Connect"
actions={[{ accessibilityLabel: "Close", icon: "xmark", onPress: handleClose }]}
actions={[
{
accessibilityLabel: "Refresh environments",
disabled: isRefreshing,
icon: "arrow.clockwise",
loading: isRefreshing,
onPress: handleRefresh,
},
{ accessibilityLabel: "Close", icon: "xmark", onPress: handleClose },
]}
/>
) : (
<NativeHeaderToolbar placement="right">
<NativeHeaderToolbar.Button icon="xmark" onPress={handleClose} separateBackground />
</NativeHeaderToolbar>
)}
<ScrollView
nestedScrollEnabled
alwaysBounceVertical
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
Expand All @@ -106,7 +116,9 @@ function ConfiguredConnectOnboardingRouteScreen() {
paddingTop: 16,
}}
refreshControl={
<RefreshControl refreshing={isPullRefreshing} onRefresh={handlePullRefresh} />
Platform.OS === "ios" ? (
<RefreshControl refreshing={isRefreshing} onRefresh={handleRefresh} />
) : undefined
}
>
{isSignedIn ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export function ConnectionsNewRouteScreen({
]}
>
<ScrollView
nestedScrollEnabled
contentInsetAdjustmentBehavior="automatic"
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {

const content = (
<ScrollView
nestedScrollEnabled
className="flex-1"
// The iOS header is translucent and floats over this view; UIKit has to
// inset the content or the first row sits underneath the title.
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/features/threads/ThreadQueueControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
queuedRuns.map(({ run }) => ({ id: run.id, ...rowLayouts.current.get(run.id) }));
const content = (
<ScrollView
nestedScrollEnabled
className="flex-1"
scrollEnabled={draggedRunId === null}
// The iOS header is translucent and floats over this view; UIKit has to
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
) : null}
<MaterialScreenContent fitToContents>
<ScrollView
nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/features/threads/git/GitCommitSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
) : null}
<MaterialScreenContent fitToContents>
<ScrollView
nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {

<MaterialScreenContent fitToContents>
<ScrollView
nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
showsVerticalScrollIndicator={false}
contentContainerClassName="android:gap-2 android:p-2"
Expand Down
19 changes: 11 additions & 8 deletions apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,22 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {

const behindCount = gitStatus.data?.behindCount ?? 0;

// Deterministic pull-to-refresh state. Tying RefreshControl to the query's
// Deterministic refresh state. Tying RefreshControl to the query's
// isPending flag left the spinner stuck (the status query reports pending
// during quiet background refreshes too).
const [isPullRefreshing, setIsPullRefreshing] = useState(false);
const handlePullRefresh = useCallback(async () => {
setIsPullRefreshing(true);
const [isRefreshing, setIsRefreshing] = useState(false);
const handleRefresh = useCallback(async () => {
setIsRefreshing(true);
try {
await gitActions.refreshSelectedThreadGitStatus();
} finally {
setIsPullRefreshing(false);
setIsRefreshing(false);
}
}, [gitActions]);

const content = (
<ScrollView
nestedScrollEnabled
alwaysBounceVertical
className="flex-1 android:bg-sheet-solid ios:bg-screen"
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
Expand All @@ -278,7 +279,9 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
gap: Platform.OS === "android" ? 8 : 14,
}}
refreshControl={
<RefreshControl refreshing={isPullRefreshing} onRefresh={() => void handlePullRefresh()} />
Platform.OS === "ios" || isInspector ? (
<RefreshControl refreshing={isRefreshing} onRefresh={() => void handleRefresh()} />
) : undefined
}
>
<View
Expand Down Expand Up @@ -474,11 +477,11 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
{
id: "refresh",
title: "Refresh repository status",
attributes: { disabled: busy || isPullRefreshing },
attributes: { disabled: busy || isRefreshing },
},
]}
onPressAction={({ nativeEvent }) => {
if (nativeEvent.event === "refresh") void handlePullRefresh();
if (nativeEvent.event === "refresh") void handleRefresh();
}}
>
{(open) => (
Expand Down
Loading