diff --git a/mobile/src/files/mobile-diff-image-preview.ts b/mobile/src/files/mobile-diff-image-preview.ts index bb5908d7fca..ff98c31c108 100644 --- a/mobile/src/files/mobile-diff-image-preview.ts +++ b/mobile/src/files/mobile-diff-image-preview.ts @@ -1,10 +1,7 @@ import { buildImageDataUri } from '../../../src/shared/image-data-uri' -// A git.diff result for a binary file. The host (git.diff) already sends base64 -// image bytes plus isImage/mimeType for previewable formats, so mobile can render -// image diffs instead of falling back to "Binary preview unavailable". The -// originalIsBinary/modifiedIsBinary flags tell a deletion (modified side absent) -// apart from a modify whose bytes the host couldn't inline (relay/size-capped). +// originalIsBinary/modifiedIsBinary distinguish a genuine deletion from a modify +// whose bytes the host couldn't inline (relay/size-capped). export type MobileBinaryDiffResult = { kind: 'binary' originalContent?: string @@ -15,12 +12,8 @@ export type MobileBinaryDiffResult = { mimeType?: string } -// Builds a data URI for a binary image diff, preferring the modified (post-change) -// bytes. Only falls back to the original for a genuine deletion — when the modified -// side is absent (not binary). Returns null for non-previewable binaries and when -// the modified side IS a binary image but arrives empty (e.g. a relay working-tree -// read or a >size-cap file), since showing the pre-change image there would be -// silently stale rather than the current content. +// Falls back to the original bytes only for a genuine deletion; a size-capped/relay +// modify returns null instead of the stale pre-change image. export function mobileDiffImageDataUri(result: MobileBinaryDiffResult): string | null { if (result.isImage !== true) { return null diff --git a/mobile/src/files/mobile-file-tab-doc.ts b/mobile/src/files/mobile-file-tab-doc.ts index d4ed498afd2..78977b5fd30 100644 --- a/mobile/src/files/mobile-file-tab-doc.ts +++ b/mobile/src/files/mobile-file-tab-doc.ts @@ -21,9 +21,8 @@ export type MobileFileTabDocRequest = { diffSource?: 'staged' | 'unstaged' | 'branch' | 'commit' } -// Loads the previewable doc for a session file tab: git diffs (text or image), -// previewable images, HTML source, or plain text. Throws 'binary_file', -// 'file_too_large', or the RPC error message; callers map those to error docs. +// Throws 'binary_file'/'file_too_large'/the RPC error message; callers map those +// to error docs. export async function resolveMobileFileTabDoc( client: FileTabDocClient, request: MobileFileTabDocRequest