Skip to content

Commit 1958cf7

Browse files
Main's list states (#30433) already read each reviewer's reviewState, so this branch's review-decision read, its old-server fallback and their tests give way to main's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 parents 5ef5f21 + c7537d0 commit 1958cf7

46 files changed

Lines changed: 3987 additions & 621 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-agent-notifications/android/src/main/java/expo/modules/t3agentnotifications/AgentActivityPresentation.kt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ internal class ActivityPresentation(data: Map<String, String>, private val activ
126126

127127
fun applyTo(builder: NotificationCompat.Builder, context: Context) {
128128
val tint = phase?.let { ContextCompat.getColor(context, it.color) }
129-
builder.setSmallIcon(R.drawable.agent_activity_mark)
130129
if (tint != null) builder.setColor(tint)
131130
// Tint the summary only when it names an outcome or a request; a plain
132131
// "3 working" stays neutral so the accent keeps meaning something.

‎apps/mobile/modules/t3-agent-notifications/android/src/main/java/expo/modules/t3agentnotifications/AgentNotifications.kt‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,8 @@ object AgentNotifications {
358358
}
359359
}
360360

361-
private fun base(context: Context, channel: String): NotificationCompat.Builder {
362-
val icon = context.resources.getIdentifier("notification_icon", "drawable", context.packageName)
363-
return NotificationCompat.Builder(context, channel)
361+
private fun base(context: Context, channel: String): NotificationCompat.Builder =
362+
NotificationCompat.Builder(context, channel)
364363
.setPriority(
365364
if (channel ==
366365
ALERT_CHANNEL
@@ -371,10 +370,9 @@ object AgentNotifications {
371370
}
372371
)
373372
.setDefaults(if (channel == ALERT_CHANNEL) Notification.DEFAULT_ALL else 0)
374-
.setSmallIcon(if (icon != 0) icon else android.R.drawable.ic_dialog_info)
373+
.setSmallIcon(R.drawable.agent_activity_mark)
375374
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
376375
.setShowWhen(false)
377-
}
378376

379377
private fun contentIntent(
380378
context: Context,

‎apps/mobile/modules/t3-composer-editor/android/src/main/java/expo/modules/t3composereditor/T3ComposerEditorView.kt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import android.view.Gravity
2323
import android.view.GestureDetector
2424
import android.view.MotionEvent
2525
import android.view.KeyEvent
26+
import android.view.View
2627
import android.view.ViewGroup
2728
import android.view.inputmethod.EditorInfo
2829
import android.view.inputmethod.InputConnection
@@ -596,6 +597,9 @@ internal class SelectionAwareEditText(
596597
var maxInputChars = Int.MAX_VALUE
597598
var clipboardFragment = ""
598599

600+
// Keeps autofill services such as SMS verification codes from writing into the draft.
601+
override fun getAutofillType(): Int = View.AUTOFILL_TYPE_NONE
602+
599603
/**
600604
* Editable TextView hints do not ellipsize, so long placeholders wrap and grow the composer.
601605
* Truncate the hint to the measured width instead.

‎apps/mobile/modules/t3-composer-editor/android/src/test/java/expo/modules/t3composereditor/ComposerPasteTest.kt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ class ComposerPasteTest {
180180
assertNull(intercepted)
181181
}
182182

183+
@Test
184+
fun autofillCannotWriteIntoTheDraft() {
185+
assertEquals(
186+
"Autofill services such as SMS verification codes must not target the composer",
187+
View.AUTOFILL_TYPE_NONE,
188+
editor.autofillType,
189+
)
190+
}
191+
183192
private fun dropEditor(): SelectionAwareEditText {
184193
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
185194
return SelectionAwareEditText(activity).apply {

‎apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
447447
private var isReadOnly = false
448448
private var isApplyingControlledValue = false
449449
private var nativeEventCount = 0
450+
private var hasControlledDocument = false
450451
private var resetGeneration = 0
451452
private var lastContentSize = CGSize.zero
452453
private var iconImages: [String: UIImage] = [:]
@@ -483,6 +484,14 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
483484
textView.alwaysBounceVertical = false
484485
textView.showsVerticalScrollIndicator = true
485486
textView.adjustsFontForContentSizeCategory = true
487+
if #available(iOS 26.0, *) {
488+
// UIKit can attach a nearby bar's scroll edge effect to this text view; its backdrop
489+
// then draws over the typed text while the caret stays visible.
490+
let edges = [textView.topEdgeEffect, textView.leftEdgeEffect, textView.bottomEdgeEffect, textView.rightEdgeEffect]
491+
for edge in edges {
492+
edge.isHidden = true
493+
}
494+
}
486495
textView.onPasteImages = { [weak self] urls in
487496
self?.onComposerPasteImages(["uris": urls])
488497
}
@@ -668,12 +677,15 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
668677
}
669678
if isReset {
670679
resetGeneration = document.resetGeneration
671-
nativeEventCount = document.mostRecentEventCount
672680
endComposition()
673681
}
674-
if document.isNativeEcho && !isReset && textView.serializedText() != document.value {
682+
// iOS destroys this view under display: none and mounts a fresh one while JS keeps its
683+
// revision and draft. Continue from them, or JS drops every event the new view sends.
684+
nativeEventCount = document.mostRecentEventCount
685+
if document.isNativeEcho && !isReset && hasControlledDocument && textView.serializedText() != document.value {
675686
return
676687
}
688+
hasControlledDocument = true
677689
if tokensJson != document.tokensJson {
678690
tokensJson = document.tokensJson
679691
tokens = decode([ComposerTokenPayload].self, from: document.tokensJson) ?? []

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
4747
private var contentResetKey = ""
4848

4949
@Volatile private var rowsDecodeGeneration = 0
50-
private var tokensDecodeGeneration = 0
50+
51+
@Volatile private var tokensDecodeGeneration = 0
5152
private val payloadDecodeExecutor = Executors.newSingleThreadExecutor()
5253
private val touchSlop = ViewConfiguration.get(context).scaledTouchSlop
5354
private val minimumFlingVelocity = ViewConfiguration.get(context).scaledMinimumFlingVelocity
@@ -203,6 +204,11 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
203204
tokensDecodeGeneration += 1
204205
val generation = tokensDecodeGeneration
205206
payloadDecodeExecutor.execute {
207+
if (generation != tokensDecodeGeneration ||
208+
Thread.currentThread().isInterrupted
209+
) {
210+
return@execute
211+
}
206212
val decodedTokens = parseTokensObject(value)
207213
post {
208214
if (generation != tokensDecodeGeneration) return@post
@@ -1123,7 +1129,8 @@ private class DiffCanvasView(context: Context) : View(context) {
11231129
}
11241130

11251131
private fun maxHeaderPathOffset(fileId: String): Int {
1126-
val row = rows.firstOrNull { it.kind == "file" && it.resolvedFileId == fileId } ?: return 0
1132+
val rowIndex = fileHeaderIndices.firstOrNull { rows[it].resolvedFileId == fileId } ?: return 0
1133+
val row = rows[rowIndex]
11271134
val top = 0
11281135
val bottom = rowHeight(row)
11291136
val iconRect = drawing.fileHeaderIconRect(top, bottom, style)

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
340340
private var pendingScrollAnimated = false
341341
private var isProgrammaticScrollActive = false
342342
private var rowsDecodeGeneration = 0
343+
private var rowsDecodeCancellation: ReviewDiffRowPreparation?
343344
private var tokensDecodeGeneration = 0
345+
private var tokensDecodeCancellation: ReviewDiffRowPreparation?
344346

345347
let onDebug = EventDispatcher()
346348
let onVisibleFileChange = EventDispatcher()
@@ -387,6 +389,11 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
387389
scrollView.addSubview(contentView)
388390
}
389391

392+
deinit {
393+
rowsDecodeCancellation?.cancel()
394+
tokensDecodeCancellation?.cancel()
395+
}
396+
390397
public override func layoutSubviews() {
391398
super.layoutSubviews()
392399
let anchor = contentView.viewportWidth != bounds.width ? contentView.viewportRowAnchor() : nil
@@ -426,10 +433,15 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
426433

427434
func setRowsJson(_ rowsJson: String) {
428435
contentView.cancelRowPreparation()
436+
rowsDecodeCancellation?.cancel()
437+
let cancellation = ReviewDiffRowPreparation()
438+
rowsDecodeCancellation = cancellation
429439
rowsDecodeGeneration += 1
430440
let generation = rowsDecodeGeneration
431441

432442
payloadDecodeQueue.async { [weak self] in
443+
// Check weak liveness without retaining the view or reading its UIKit state.
444+
guard !cancellation.isCancelled, self != nil else { return }
433445
guard let data = rowsJson.data(using: .utf8) else {
434446
return
435447
}
@@ -475,10 +487,15 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
475487
}
476488

477489
func setTokensJson(_ tokensJson: String) {
490+
tokensDecodeCancellation?.cancel()
491+
let cancellation = ReviewDiffRowPreparation()
492+
tokensDecodeCancellation = cancellation
478493
tokensDecodeGeneration += 1
479494
let generation = tokensDecodeGeneration
480495

481496
payloadDecodeQueue.async { [weak self] in
497+
// Entered decoding may finish; only skip full payloads already obsolete in the queue.
498+
guard !cancellation.isCancelled, self != nil else { return }
482499
guard let data = tokensJson.data(using: .utf8) else {
483500
return
484501
}
@@ -601,8 +618,11 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
601618
self.contentResetKey = contentResetKey
602619
lastVisibleRangeDebugKey = ""
603620
contentView.cancelRowPreparation()
621+
rowsDecodeCancellation?.cancel()
622+
rowsDecodeCancellation = nil
604623
rowsDecodeGeneration += 1
605624
tokensDecodeGeneration += 1
625+
tokensDecodeCancellation?.cancel()
606626
contentView.tokensByRowId = [:]
607627
rows = []
608628
contentView.rows = []
@@ -1909,8 +1929,8 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
19091929

19101930
private func maxHorizontalOffset(for target: (fileId: String, kind: ReviewDiffHorizontalPanKind)) -> CGFloat {
19111931
if target.kind == .fileHeaderPath,
1912-
let row = rows.first(where: { resolvedFileId(for: $0) == target.fileId && $0.kind == "file" }) {
1913-
return maxHeaderPathOffset(for: row)
1932+
let rowIndex = fileHeaderRowIndex(forFileId: target.fileId) {
1933+
return maxHeaderPathOffset(for: rows[rowIndex])
19141934
}
19151935
if codeWrapColumns != nil {
19161936
return 0

‎apps/mobile/modules/t3-review-diff/tests/android/build.gradle‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,39 @@ tasks.register('extractAndroidTestJars') {
4444
}
4545

4646
def moduleRoot = file('../..')
47+
// Count decoder entry without replacing the production executor, parser, or lifecycle.
48+
def instrumentedView = layout.buildDirectory.file('token-fixture/T3ReviewDiffView.kt')
49+
tasks.register('instrumentTokenFixture') {
50+
def original = file("${moduleRoot}/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt")
51+
inputs.file original
52+
outputs.file instrumentedView
53+
doLast {
54+
def source = original.text
55+
def decode = ' val decodedTokens = parseTokensObject(value)'
56+
def publish = ' canvasView.tokensByRowId = decodedTokens'
57+
assert source.count(decode) == 1
58+
assert source.count(publish) == 1
59+
source = source.replace(decode, ' TokenDecodeProbe.enter()\n' + decode)
60+
source = source.replace(publish, publish + '\n TokenDecodeProbe.publish()')
61+
def destination = instrumentedView.get().asFile
62+
destination.parentFile.mkdirs()
63+
destination.text = source
64+
}
65+
}
66+
4767
def sources = files(
68+
instrumentedView,
4869
fileTree('stubs') { include '**/*.kt' },
4970
fileTree('src/test/kotlin') { include '**/*.kt' },
5071
fileTree("${moduleRoot}/android/src/test/java") { include '**/*.kt' },
5172
fileTree("${moduleRoot}/android/src/main/java/expo/modules/t3reviewdiff") {
5273
include '**/*.kt'
53-
exclude '**/T3ReviewDiffModule.kt'
74+
exclude '**/T3ReviewDiffModule.kt', '**/T3ReviewDiffView.kt'
5475
},
5576
)
5677

5778
tasks.register('compileRegression', JavaExec) {
58-
dependsOn 'extractAndroidTestJars'
79+
dependsOn 'extractAndroidTestJars', 'instrumentTokenFixture'
5980
classpath = configurations.compiler
6081
mainClass = 'org.jetbrains.kotlin.cli.jvm.K2JVMCompiler'
6182
inputs.files sources, configurations.testCompileClasspath

0 commit comments

Comments
 (0)