Skip to content

Port native review diff surface to Android #4

Description

@HorusGoul

Context

@t3tools/mobile-review-diff-native provides the iOS native review diff renderer, registering T3ReviewDiffSurface from apps/mobile/modules/t3-review-diff.

The module config is Apple-only today, and ReviewSheet currently force-resolves the native view before rendering file diffs.

Why this matters

This is the largest Android parity gap. The native diff surface is not just decoration; it is part of review rendering, interaction, and performance control.

The current JS/native contract includes:

  • flattened file/hunk/line/notice/comment rows
  • syntax tokens and incremental token patches
  • visible-range debug events used to drive incremental highlighting
  • collapsed file state
  • viewed-file checkboxes
  • selected row state for review comment selection
  • collapsed inline comments
  • line tap and long-press events
  • word-level diff highlighting
  • initial scroll-to-row behavior for source/file navigation

Feature examples

  • The Files Changed review sheet should render large diffs smoothly on Android.
  • Users should be able to collapse files, mark files viewed, select lines/ranges, and create review comments.
  • Source file viewing can use the same surface when present, with JS fallback remaining available.

Acceptance criteria

  • Add an Android implementation of T3ReviewDiffSurface matching NativeReviewDiffViewProps in apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts.
  • Support row rendering for file headers, hunks, code lines, notices, and comments.
  • Support token JSON, token patch JSON, reset keys, selected rows, collapsed files/comments, and viewed files.
  • Emit visible-range/debug information required by useNativeReviewDiffBridge / useNativeReviewDiffHighlighting.
  • Emit file toggle, viewed toggle, line press/long-press, and comment toggle events.
  • Either provide Android parity for ReviewSheet or add a robust JS fallback path so Android does not crash when the native view is absent.
  • Add focused tests for bridge serialization and Android-native interaction/rendering behavior where practical.

Current test coverage note

There are TypeScript tests for the diff model, adapter, bridge, highlighter, word diff, availability, and native view resolution (nativeReviewDiffSurface.test.ts, useNativeReviewDiffBridge.test.ts, reviewModel.test.ts, etc.). I did not find Swift/UIKit tests for T3ReviewDiffView itself, and there is no Android native implementation test yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions