Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): 状态行按钮命中区补足 44,已交给电脑的消息不显示等待

zqchrisb54f4b8df8ea
diff --git a/apps/mobile/src/__tests__/pendingSendItems.test.ts b/apps/mobile/src/__tests__/pendingSendItems.test.ts
index c893b354c1..9c1dcda5dc 100644
--- a/apps/mobile/src/__tests__/pendingSendItems.test.ts
+++ b/apps/mobile/src/__tests__/pendingSendItems.test.ts
@@ -351,12 +351,13 @@ describe('buildPendingSendItems', () => {
});
it('holds local sends as waiting while disconnected, including unfinished uploads, but keeps failures', () => {
- const [ready, uploading, failed] = build({
+ const [ready, uploading, failed, handed] = build({
outboxWaitingFor: 'computer',
outbox: [
outboxItem('ready'),
outboxItem('uploading', { attachmentCount: 1, uploadedCount: 0, thumbnails: [{ key: 'uploading-slot-0', uri: 'file:///a.jpg', ossRef: null, uploading: true }] }),
outboxItem('failed', { failed: true }),
+ outboxItem('handed', { dispatching: true }),
],
});
expect(ready).toMatchObject({ phase: 'waiting', waitingFor: 'computer' });
@@ -365,6 +366,8 @@ describe('buildPendingSendItems', () => {
expect(uploading).toMatchObject({ phase: 'waiting', waitingFor: 'computer' });
expect(uploading.thumbs.every((thumb) => !thumb.uploading)).toBe(true);
expect(failed.phase).toBe('failed');
+ // 已交给电脑的条目在等对账,不是在等着发。
+ expect(handed.phase).toBe('sending');
expect(build({ outbox: [outboxItem('ready')] })[0].phase).toBe('sending');
});
diff --git a/apps/mobile/src/session/PendingSendBubble.tsx b/apps/mobile/src/session/PendingSendBubble.tsx
index 5beb156638..da56ddb07f 100644
--- a/apps/mobile/src/session/PendingSendBubble.tsx
+++ b/apps/mobile/src/session/PendingSendBubble.tsx
@@ -213,7 +213,8 @@ function ThumbCell({
accessibilityLabel={t('message.queue.retryImage')}
accessibilityRole="button"
disabled={!onRetry}
- hitSlop={spacing.xs}
+ // 32 + 两侧各 6 = 44。
+ hitSlop={6}
onPress={(event) => { event.stopPropagation(); onRetry?.(); }}
style={({ pressed }) => [styles.thumbRetry, pressed && styles.pressed]}
testID={`pendingSend.imageRetry.${thumb.key}`}
@@ -684,7 +685,7 @@ function StatusAction({
accessibilityRole="button"
accessibilityState={{ busy: busy || undefined, disabled }}
disabled={disabled}
- hitSlop={{ top: spacing.sm, bottom: spacing.sm, left: spacing.xs, right: spacing.xs }}
+ hitSlop={{ top: spacing.sm, bottom: spacing.sm }}
onPress={disabled ? undefined : onPress}
style={({ pressed }) => [styles.statusAction, pressed && styles.pressed]}
testID={testID}
@@ -766,13 +767,15 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
textAlign: 'right',
},
// 正式用户消息的操作行高 44(触控高度)+ 2 间距 = 46;本行前已有 rowWrap 的 8 间距,补 38。
- statusRow: { alignItems: 'center', flexDirection: 'row', gap: spacing.sm, height: 38, justifyContent: 'flex-end', maxWidth: '100%' },
- statusActions: { alignItems: 'center', flexDirection: 'row', gap: spacing.sm },
+ statusRow: { alignItems: 'center', flexDirection: 'row', gap: spacing.xs, height: 38, justifyContent: 'flex-end', maxWidth: '100%' },
+ // 按钮自带 44 宽的留白,彼此不再加间距。
+ statusActions: { alignItems: 'center', flexDirection: 'row', gap: spacing.xs },
// 说明 / 报错是成句的话:13/18,二级色;失败用报错色。
statusText: { color: colors.textSecondary, flexShrink: 1, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },
statusError: { color: colors.errorText, flexShrink: 1, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },
statusDivider: { backgroundColor: colors.border, height: spacing.md, width: StyleSheet.hairlineWidth },
- statusAction: { justifyContent: 'center', minHeight: 28 },
+ // 可见高 28 + 上下 hitSlop 8 = 44;宽度直接给到 44,短标签(编辑 / 取消)也够,且相邻按钮不重叠。
+ statusAction: { alignItems: 'center', justifyContent: 'center', minHeight: 28, minWidth: 44 },
statusActionText: { color: colors.textSecondary, fontSize: typeScale.footnote, fontWeight: fontWeight.medium, lineHeight: lineHeight.caption },
statusActionTextPrimary: { color: colors.textPrimary },
statusActionTextDisabled: { color: colors.textTertiary, fontWeight: fontWeight.regular },
diff --git a/apps/mobile/src/session/pendingSendItems.ts b/apps/mobile/src/session/pendingSendItems.ts
index 0cdc77a102..5beffd96a6 100644
--- a/apps/mobile/src/session/pendingSendItems.ts
+++ b/apps/mobile/src/session/pendingSendItems.ts
@@ -450,7 +450,8 @@ export function buildPendingSendItems(input: BuildPendingSendItemsInput): Mobile
seen.add(item.clientId);
const uploadsPending = item.attachmentCount > 0 && item.uploadedCount < item.attachmentCount;
// 断开时整条投递(含附件上传)都停着:附件没传完也写「等连上」,图片不再转圈。
- const waitingFor = !item.failed ? input.outboxWaitingFor ?? null : null;
+ // 已交给电脑的条目不是在等着发,保持原有的交接 / 对账状态。
+ const waitingFor = !item.failed && !item.dispatching ? input.outboxWaitingFor ?? null : null;
items.push({
type: 'pending_send',
key: pendingSendItemKey(item.clientId),
diff --git a/apps/mobile/src/session/sessionOutbox.ts b/apps/mobile/src/session/sessionOutbox.ts
index a885a54a26..b49f95dab1 100644
--- a/apps/mobile/src/session/sessionOutbox.ts
+++ b/apps/mobile/src/session/sessionOutbox.ts
@@ -204,6 +204,8 @@ export interface MobileOutboxDisplayItem {
fileCount: number;
fileNames?: string[];
failed: boolean;
+ /** 已交给电脑(发送中 / 待确认 / 电脑已接手):断线时不是「等着发」,而是在等对账。 */
+ dispatching?: boolean;
/** False while a first-message creation record still owns recovery of the draft. */
canCancel?: boolean;
/** 失败原因(附件失败给统一文案,enqueue 失败给 RPC 错误)。 */
@@ -503,6 +505,7 @@ export function outboxDisplayItem(item: MobileOutboxItem): MobileOutboxDisplayIt
fileCount,
fileNames,
failed: item.phase === 'failed',
+ ...(item.phase === 'dispatching' ? { dispatching: true } : {}),
errorText: item.phase !== 'failed'
? null
: (item.enqueueError ?? (item.failedIds.length > 0 ? i18n.t('session.row.attachmentUploadFailed') : null)),