Skip to content

Commit 529f74b

Browse files
committed
feat(mobile): align review comments, guides, and partial Git actions
1 parent 6b7c980 commit 529f74b

53 files changed

Lines changed: 2964 additions & 986 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/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffModule.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class T3ReviewDiffModule : Module() {
6767
"onPressLine",
6868
"onSelectLineRange",
6969
"onPressHunk",
70+
"onPressFileAction",
7071
"onToggleComment",
7172
)
7273

‎apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt‎

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
3030
private val onToggleFile by EventDispatcher()
3131
private val onToggleViewedFile by EventDispatcher()
3232
private val onPressHunk by EventDispatcher()
33+
private val onPressFileAction by EventDispatcher()
3334
private val onPressLine by EventDispatcher()
3435
private val onSelectLineRange by EventDispatcher()
3536
private val onToggleComment by EventDispatcher()
@@ -391,12 +392,17 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
391392

392393
private fun handleRowTap(row: DiffRow, gesture: String, target: RowTapTarget) {
393394
when (row.kind) {
394-
"hunk" -> if (gesture == "tap" && target == RowTapTarget.HUNK_ACTION && !row.hunkActionDisabled) {
395-
onPressHunk(mapOf("rowId" to row.id))
395+
"hunk" -> if (gesture == "tap") {
396+
if (target == RowTapTarget.HUNK_REVERT && !row.hunkRevertActionDisabled)
397+
onPressHunk(mapOf("rowId" to row.id, "action" to "revert"))
398+
else if (target == RowTapTarget.HUNK_ACTION && !row.hunkActionDisabled)
399+
onPressHunk(mapOf("rowId" to row.id, "action" to "stage"))
396400
}
397401
"file" -> {
398402
if (gesture != "tap") return
399-
if (target == RowTapTarget.VIEWED_CHECKBOX) {
403+
if (target == RowTapTarget.FILE_ACTION) {
404+
if (!row.fileActionDisabled) onPressFileAction(mapOf("fileId" to row.resolvedFileId, "rowId" to row.id))
405+
} else if (target == RowTapTarget.VIEWED_CHECKBOX) {
400406
onToggleViewedFile(mapOf("fileId" to row.resolvedFileId))
401407
} else {
402408
onToggleFile(mapOf("fileId" to row.resolvedFileId))
@@ -465,7 +471,9 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
465471
private enum class RowTapTarget {
466472
ROW,
467473
VIEWED_CHECKBOX,
468-
HUNK_ACTION
474+
HUNK_ACTION,
475+
HUNK_REVERT,
476+
FILE_ACTION
469477
}
470478

471479
private enum class HorizontalPanKind {
@@ -500,7 +508,11 @@ internal data class DiffRow(
500508
val commentResolvedSummary: String? = null,
501509
val renameSegments: List<DiffRenameSegment> = emptyList(),
502510
val hunkAction: String? = null,
503-
val hunkActionDisabled: Boolean = false
511+
val hunkActionDisabled: Boolean = false,
512+
val hunkRevertAction: Boolean = false,
513+
val hunkRevertActionDisabled: Boolean = false,
514+
val fileAction: String? = null,
515+
val fileActionDisabled: Boolean = false
504516
) {
505517
val resolvedFileId: String get() = fileId.ifEmpty { id }
506518
}
@@ -723,6 +735,10 @@ private class DiffCanvasView(context: Context) : View(context) {
723735
if (hit.row.kind == "line") clearNativeRange()
724736
val target = if (hit.row.kind == "hunk" && hit.row.hunkAction != null && event.x >= width - 112 * density) {
725737
RowTapTarget.HUNK_ACTION
738+
} else if (hit.row.kind == "hunk" && hit.row.hunkRevertAction && event.x >= width - 224 * density) {
739+
RowTapTarget.HUNK_REVERT
740+
} else if (hit.row.kind == "file" && hit.row.fileAction != null && event.x >= width - 100 * density) {
741+
RowTapTarget.FILE_ACTION
726742
} else if (
727743
showViewedCheckbox && hit.row.kind == "file" &&
728744
drawing.fileHeaderCheckboxRect(
@@ -1164,7 +1180,8 @@ private class DiffCanvasView(context: Context) : View(context) {
11641180
val addText = "+${row.additions}"
11651181
val addWidth = boldTextPaint.measureText(addText)
11661182
val countGap = 4f * density
1167-
val countsRight = if (showViewedCheckbox) checkboxRect.left - 10f * density else width - 16f * density
1183+
val countsRight = if (row.fileAction != null) width - 110f * density
1184+
else if (showViewedCheckbox) checkboxRect.left - 10f * density else width - 16f * density
11681185
val countsX = countsRight - deleteWidth - countGap - addWidth
11691186
val baseline = centeredBaseline(top, bottom, boldTextPaint)
11701187
canvas.drawText(deleteText, countsX, baseline, boldTextPaint)
@@ -1205,6 +1222,16 @@ private class DiffCanvasView(context: Context) : View(context) {
12051222
pathOffset,
12061223
maxPathOffset,
12071224
)
1225+
row.fileAction?.let { label ->
1226+
val rect = RectF(width - 96 * density, top + 7 * density, width - 10 * density, bottom - 7 * density)
1227+
backgroundPaint.color = theme.border
1228+
backgroundPaint.style = Paint.Style.STROKE
1229+
backgroundPaint.strokeWidth = density
1230+
canvas.drawRoundRect(rect, 6 * density, 6 * density, backgroundPaint)
1231+
backgroundPaint.style = Paint.Style.FILL
1232+
drawing.configureUiPaint(boldTextPaint, if (row.fileActionDisabled) theme.mutedText else theme.hunkText, 12 * density, "semibold")
1233+
canvas.drawText(label, rect.centerX() - boldTextPaint.measureText(label) / 2, centeredBaseline(top, bottom, boldTextPaint), boldTextPaint)
1234+
}
12081235
drawBottomBorder(canvas, bottom)
12091236
}
12101237

@@ -1247,7 +1274,8 @@ private class DiffCanvasView(context: Context) : View(context) {
12471274
size = style.fileHeaderMetaFontSizePx,
12481275
weight = style.fileHeaderMetaFontWeight,
12491276
)
1250-
val countsRight = if (showViewedCheckbox) checkboxRect.left - 10f * density else width - 16f * density
1277+
val countsRight = if (row.fileAction != null) width - 110f * density
1278+
else if (showViewedCheckbox) checkboxRect.left - 10f * density else width - 16f * density
12511279
val countsX = countsRight -
12521280
boldTextPaint.measureText("-${row.deletions}") - 4f * density -
12531281
boldTextPaint.measureText("+${row.additions}")
@@ -1286,7 +1314,7 @@ private class DiffCanvasView(context: Context) : View(context) {
12861314
weight = style.hunkFontWeight,
12871315
)
12881316
canvas.save()
1289-
if (row.hunkAction != null) canvas.clipRect(0f, top.toFloat(), width - 112 * density, bottom.toFloat())
1317+
if (row.hunkAction != null) canvas.clipRect(0f, top.toFloat(), width - (if (row.hunkRevertAction) 224 else 112) * density, bottom.toFloat())
12901318
drawScrollableCode(canvas, top, bottom) { codeX ->
12911319
canvas.drawText(
12921320
row.text.ifEmpty { row.content },
@@ -1303,6 +1331,14 @@ private class DiffCanvasView(context: Context) : View(context) {
13031331
drawing.configureUiPaint(boldTextPaint, if (row.hunkActionDisabled) theme.mutedText else theme.hunkText, 13 * density, "semibold")
13041332
canvas.drawText(label, rect.centerX() - boldTextPaint.measureText(label) / 2, centeredBaseline(top, bottom, boldTextPaint), boldTextPaint)
13051333
}
1334+
if (row.hunkRevertAction) {
1335+
val rect = RectF(width - 218 * density, top + 6 * density, width - 118 * density, bottom - 6 * density)
1336+
backgroundPaint.color = theme.headerBackground
1337+
canvas.drawRoundRect(rect, 6 * density, 6 * density, backgroundPaint)
1338+
drawing.configureUiPaint(boldTextPaint, if (row.hunkRevertActionDisabled) theme.mutedText else theme.deleteText, 13 * density, "semibold")
1339+
val label = "Revert hunk"
1340+
canvas.drawText(label, rect.centerX() - boldTextPaint.measureText(label) / 2, centeredBaseline(top, bottom, boldTextPaint), boldTextPaint)
1341+
}
13061342
}
13071343

13081344
private fun drawNoticeRow(canvas: Canvas, row: DiffRow, top: Int, bottom: Int) {
@@ -1599,6 +1635,10 @@ private fun parseRows(value: String): List<DiffRow> = try {
15991635
text = row.optString("text"),
16001636
hunkAction = row.optNullableString("hunkAction"),
16011637
hunkActionDisabled = row.optBoolean("hunkActionDisabled", false),
1638+
hunkRevertAction = row.optBoolean("hunkRevertAction", false),
1639+
hunkRevertActionDisabled = row.optBoolean("hunkRevertActionDisabled", false),
1640+
fileAction = row.optNullableString("fileAction"),
1641+
fileActionDisabled = row.optBoolean("fileActionDisabled", false),
16021642
content = row.optString("content"),
16031643
change = row.optString("change", "context"),
16041644
oldLineNumber = row.optNullableInt("oldLineNumber"),

‎apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffModule.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public class T3ReviewDiffModule: Module {
9797
"onPressLine",
9898
"onSelectLineRange",
9999
"onPressHunk",
100+
"onPressFileAction",
100101
"onToggleComment",
101102
"onPullToRefresh"
102103
)

‎apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift‎

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ private struct ReviewDiffNativeRow: Decodable, Sendable {
2424
let commentSectionTitle: String?
2525
let hunkAction: String?
2626
let hunkActionDisabled: Bool?
27+
let hunkRevertAction: Bool?
28+
let hunkRevertActionDisabled: Bool?
29+
let fileAction: String?
30+
let fileActionDisabled: Bool?
2731
}
2832

2933
private struct ReviewDiffRenameSegment: Decodable, Sendable {
@@ -358,6 +362,7 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
358362
let onPressLine = EventDispatcher()
359363
let onSelectLineRange = EventDispatcher()
360364
let onPressHunk = EventDispatcher()
365+
let onPressFileAction = EventDispatcher()
361366
let onToggleComment = EventDispatcher()
362367
let onPullToRefresh = EventDispatcher()
363368

@@ -392,8 +397,11 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
392397
contentView.onSelectLineRange = { [weak self] payload in
393398
self?.onSelectLineRange(payload)
394399
}
395-
contentView.onPressHunk = { [weak self] rowId in
396-
self?.onPressHunk(["rowId": rowId])
400+
contentView.onPressHunk = { [weak self] rowId, action in
401+
self?.onPressHunk(["rowId": rowId, "action": action])
402+
}
403+
contentView.onPressFileAction = { [weak self] fileId, rowId in
404+
self?.onPressFileAction(["fileId": fileId, "rowId": rowId])
397405
}
398406
contentView.onToggleComment = { [weak self] commentId in
399407
self?.onToggleComment(["commentId": commentId])
@@ -1139,7 +1147,8 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
11391147
var onToggleViewedFile: ((String) -> Void)?
11401148
var onPressLine: (([String: Any]) -> Void)?
11411149
var onSelectLineRange: (([String: Any]) -> Void)?
1142-
var onPressHunk: ((String) -> Void)?
1150+
var onPressHunk: ((String, String) -> Void)?
1151+
var onPressFileAction: ((String, String) -> Void)?
11431152
var onToggleComment: ((String) -> Void)?
11441153
var onDrawMetrics: (([String: Any]) -> Void)?
11451154

@@ -1447,8 +1456,10 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
14471456
let row = rows[rowIndex]
14481457
if row.kind == "hunk", row.hunkAction != nil {
14491458
let rect = CGRect(x: 0, y: rowOffsets[rowIndex] - verticalOffset, width: viewportWidth, height: height(for: row))
1450-
if hunkActionRect(in: rect).contains(point), row.hunkActionDisabled != true {
1451-
onPressHunk?(row.id)
1459+
if row.hunkRevertAction == true, hunkRevertRect(in: rect).contains(point) {
1460+
if row.hunkRevertActionDisabled != true { onPressHunk?(row.id, "revert") }
1461+
} else if hunkActionRect(in: rect).contains(point), row.hunkActionDisabled != true {
1462+
onPressHunk?(row.id, "stage")
14521463
}
14531464
return
14541465
}
@@ -1614,6 +1625,11 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
16141625
let interactiveRects = fileHeaderInteractiveRects(for: row, cardRect: rect)
16151626
let fileId = resolvedFileId(for: row)
16161627

1628+
if row.fileAction != nil, fileActionRect(in: rect).contains(point) {
1629+
if row.fileActionDisabled != true { onPressFileAction?(fileId, row.id) }
1630+
return
1631+
}
1632+
16171633
// Keep the drawn mark small while giving it a full touch target in the file header.
16181634
let checkboxTouchRect = interactiveRects.checkbox.insetBy(dx: -12, dy: -12).intersection(rect)
16191635
if showViewedCheckbox && checkboxTouchRect.contains(point) {
@@ -2186,7 +2202,8 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
21862202
let addWidth = textWidth(addText, font: fileHeaderMetaFont)
21872203
let countsGap = min(style.fileHeaderCountGap, 4)
21882204
let countsWidth = deleteWidth + countsGap + addWidth
2189-
let countsX = interactiveRects.checkbox.minX - 10 - countsWidth
2205+
let countsRight = row.fileAction == nil ? interactiveRects.checkbox.minX : fileActionRect(in: cardRect).minX
2206+
let countsX = countsRight - 10 - countsWidth
21902207
drawSingleLineText(
21912208
deleteText,
21922209
rect: CGRect(x: countsX, y: centerY - 9, width: deleteWidth, height: 18),
@@ -2214,6 +2231,19 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
22142231
)
22152232
}
22162233
drawFileHeaderPathScrollFade(row, pathRect: pathLayout.rect, horizontalOffset: pathOffset, context: context)
2234+
if let action = row.fileAction {
2235+
let button = fileActionRect(in: cardRect).insetBy(dx: 4, dy: 7)
2236+
context.setStrokeColor(theme.border.cgColor)
2237+
context.setLineWidth(1 / traitCollection.displayScale)
2238+
UIBezierPath(roundedRect: button, cornerRadius: 6).stroke()
2239+
drawCenteredText(action, rect: button,
2240+
color: row.fileActionDisabled == true ? theme.mutedText : theme.hunkText,
2241+
font: .systemFont(ofSize: 12, weight: .semibold))
2242+
}
2243+
}
2244+
2245+
private func fileActionRect(in rect: CGRect) -> CGRect {
2246+
CGRect(x: rect.maxX - 100, y: rect.minY, width: 94, height: rect.height)
22172247
}
22182248

22192249
private func drawNoticeRow(_ row: ReviewDiffNativeRow, rect: CGRect, context: CGContext) {
@@ -2331,7 +2361,8 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
23312361
let addWidth = textWidth("+\(additions)", font: fileHeaderMetaFont)
23322362
let countsGap = min(style.fileHeaderCountGap, 4)
23332363
let countsWidth = deleteWidth + countsGap + addWidth
2334-
let countsX = interactiveRects.checkbox.minX - 10 - countsWidth
2364+
let countsRight = row.fileAction == nil ? interactiveRects.checkbox.minX : fileActionRect(in: cardRect).minX
2365+
let countsX = countsRight - 10 - countsWidth
23352366
let pathX = interactiveRects.icon.maxX + 10
23362367
let pathWidth = max(CGFloat(24), countsX - pathX - 12)
23372368
let displayPath: String
@@ -2522,7 +2553,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
25222553
context.fill(rect)
25232554

25242555
context.saveGState()
2525-
let actionWidth: CGFloat = row.hunkAction == nil ? 0 : 112
2556+
let actionWidth: CGFloat = row.hunkAction == nil ? 0 : (row.hunkRevertAction == true ? 224 : 112)
25262557
context.clip(to: CGRect(x: stickyWidth, y: rect.minY, width: max(0, viewportWidth - stickyWidth - actionWidth), height: rect.height))
25272558
drawText(
25282559
row.text ?? "",
@@ -2542,12 +2573,24 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
25422573
UIBezierPath(roundedRect: button, cornerRadius: 6).fill()
25432574
drawCenteredText(action, rect: button, color: row.hunkActionDisabled == true ? theme.mutedText : theme.hunkText, font: .systemFont(ofSize: 13, weight: .semibold))
25442575
}
2576+
if row.hunkRevertAction == true {
2577+
let button = hunkRevertRect(in: rect).insetBy(dx: 6, dy: 6)
2578+
theme.headerBackground.setFill()
2579+
UIBezierPath(roundedRect: button, cornerRadius: 6).fill()
2580+
drawCenteredText("Revert hunk", rect: button,
2581+
color: row.hunkRevertActionDisabled == true ? theme.mutedText : theme.deleteText,
2582+
font: .systemFont(ofSize: 13, weight: .semibold))
2583+
}
25452584
}
25462585

25472586
private func hunkActionRect(in rect: CGRect) -> CGRect {
25482587
CGRect(x: viewportWidth - 112, y: rect.minY, width: 112, height: rect.height)
25492588
}
25502589

2590+
private func hunkRevertRect(in rect: CGRect) -> CGRect {
2591+
CGRect(x: viewportWidth - 224, y: rect.minY, width: 112, height: rect.height)
2592+
}
2593+
25512594
private func drawCodeRow(_ row: ReviewDiffNativeRow, rect: CGRect, context: CGContext) {
25522595
let fileId = resolvedFileId(for: row)
25532596
let horizontalOffset = horizontalOffset(for: fileId)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import IconGitPullRequestClosed from "@tabler/icons-react-native/IconGitPullRequ
55
import IconGitPullRequestDraft from "@tabler/icons-react-native/IconGitPullRequestDraft";
66
import type { SFSymbol } from "expo-symbols";
77
import IconGitPullRequest from "@tabler/icons-react-native/IconGitPullRequest";
8+
import IconFold from "@tabler/icons-react-native/IconFold";
9+
import IconUnfold from "@tabler/icons-react-native/IconUnfold";
810
import IconFileDiff from "@tabler/icons-react-native/IconFileDiff";
911
import { SymbolView as ExpoSymbolView } from "expo-symbols";
1012
import { withUniwind } from "uniwind";
@@ -14,6 +16,8 @@ export type { SFSymbol } from "expo-symbols";
1416
export type { AppSymbolName } from "./AppSymbol";
1517

1618
const CUSTOM_ICONS = {
19+
"diff.collapse": IconFold,
20+
"diff.expand": IconUnfold,
1721
"file.diff": IconFileDiff,
1822
"arrow.triangle.pull": IconGitPullRequest,
1923
"arrow.triangle.merge": IconGitMerge,

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ import IconArrowsLeftRight from "@tabler/icons-react-native/IconArrowsLeftRight"
2424
import IconArrowsDiagonal2 from "@tabler/icons-react-native/IconArrowsDiagonal2";
2525
import IconArrowsMinimize from "@tabler/icons-react-native/IconArrowsMinimize";
2626
import IconBan from "@tabler/icons-react-native/IconBan";
27+
import IconArrowsVertical from "@tabler/icons-react-native/IconArrowsVertical";
28+
import IconFold from "@tabler/icons-react-native/IconFold";
29+
import IconUnfold from "@tabler/icons-react-native/IconUnfold";
30+
import IconSquare from "@tabler/icons-react-native/IconSquare";
31+
import IconSquareCheckFilled from "@tabler/icons-react-native/IconSquareCheckFilled";
2732
import IconBellRinging from "@tabler/icons-react-native/IconBellRinging";
2833
import IconBolt from "@tabler/icons-react-native/IconBolt";
2934
import IconBox from "@tabler/icons-react-native/IconBox";
@@ -173,6 +178,8 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
173178
camera: IconCamera,
174179
car: IconCar,
175180
"chart.bar.xaxis": IconChartBar,
181+
square: IconSquare,
182+
"checkmark.square.fill": IconSquareCheckFilled,
176183
checkmark: IconCheck,
177184
"checkmark.circle": IconCircleCheck,
178185
"checkmark.circle.fill": IconCircleCheck,
@@ -190,6 +197,9 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
190197
"chevron.left.forwardslash.chevron.right": IconCode,
191198
"chevron.right": IconChevronRight,
192199
"chevron.up": IconChevronUp,
200+
"arrow.up.and.down": IconArrowsVertical,
201+
"diff.collapse": IconFold,
202+
"diff.expand": IconUnfold,
193203
desktopcomputer: IconDeviceDesktop,
194204
doc: IconFileText,
195205
"doc.on.doc": IconCopy,
@@ -282,13 +292,25 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
282292
"xmark.circle.fill": IconCircleXFilled,
283293
} satisfies Partial<
284294
Record<
285-
SFSymbol | "git.pull-request.closed" | "git.pull-request.draft" | "git.commit" | "file.diff",
295+
| SFSymbol
296+
| "git.pull-request.closed"
297+
| "git.pull-request.draft"
298+
| "git.commit"
299+
| "file.diff"
300+
| "diff.collapse"
301+
| "diff.expand",
286302
Icon
287303
>
288304
>;
289305
const SF_ICON_LOOKUP: Partial<
290306
Record<
291-
SFSymbol | "git.pull-request.closed" | "git.pull-request.draft" | "git.commit" | "file.diff",
307+
| SFSymbol
308+
| "git.pull-request.closed"
309+
| "git.pull-request.draft"
310+
| "git.commit"
311+
| "file.diff"
312+
| "diff.collapse"
313+
| "diff.expand",
292314
Icon
293315
>
294316
> = ANDROID_ICON_BY_SF_SYMBOL;

‎apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export interface NativeReviewDiffRow {
5252
readonly commentSectionTitle?: string;
5353
readonly hunkAction?: "Stage hunk" | "Unstage hunk";
5454
readonly hunkActionDisabled?: boolean;
55+
readonly hunkRevertAction?: boolean;
56+
readonly hunkRevertActionDisabled?: boolean;
57+
readonly fileAction?: "Stage file" | "Unstage file";
58+
readonly fileActionDisabled?: boolean;
5559
}
5660

5761
export interface NativeReviewDiffWordDiffRange {
@@ -147,7 +151,12 @@ export interface NativeReviewDiffViewProps extends ViewProps {
147151
) => void;
148152
readonly onToggleFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void;
149153
readonly onToggleViewedFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void;
150-
readonly onPressHunk?: (event: NativeSyntheticEvent<{ readonly rowId?: string }>) => void;
154+
readonly onPressHunk?: (
155+
event: NativeSyntheticEvent<{ readonly rowId?: string; readonly action?: "stage" | "revert" }>,
156+
) => void;
157+
readonly onPressFileAction?: (
158+
event: NativeSyntheticEvent<{ readonly fileId?: string; readonly rowId?: string }>,
159+
) => void;
151160
readonly onPressLine?: (
152161
event: NativeSyntheticEvent<{
153162
readonly rowId?: string;

0 commit comments

Comments
 (0)