Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,13 @@ class ScanSessionCoordinator(
barcodePayload: String? = null,
code: String? = null,
boxNumber: Int? = null,
stepOverride: String? = null,
) = recorder.record(
ScanLogEvent(
atEpochMillis = System.currentTimeMillis(),
sessionId = null,
source = source,
step = step,
step = stepOverride ?: step,
event = event,
reason = reason,
destination = destination,
Expand Down Expand Up @@ -578,6 +579,8 @@ class ScanSessionCoordinator(
// verdicts still deserve the part number they were about.
code = match?.code ?: recordedCode(scan.qrPayload, scan.barcodePayload),
boxNumber = match?.boxNumber,
// The verdict belongs to the result step, as on iOS.
stepOverride = ScanLogStep.RESULT,
)
} else if (previous.scan is ScanState.Result && reduction.effects.isEmpty()) {
// The reducer deliberately swallows callbacks while a result is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ class ScanSessionCoordinatorTest {
assertNull(barcodeAccepted.qrPayload)

val match = log.events[2]
assertEquals(ScanLogStep.BARCODE, match.step)
assertEquals(ScanLogStep.RESULT, match.step)
assertEquals(qrPayload, match.qrPayload)
assertEquals(barcodePayload, match.barcodePayload)
assertEquals("BCJH-52-81GG", match.code)
Expand Down
8 changes: 5 additions & 3 deletions ios/CodeMatch/Features/Scanner/ScannerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ final class ScannerViewModel: ObservableObject {
cancelAutoAdvanceCountdown()
guard !isEndingSession else { return }
// アクティブセッションのidが残っているうちに記録する。
log("session_end")
// セッション系のイベントは工程を持たない(Android と同じ `none`)。
log("session_end", stepOverride: "none")
isEndingSession = true
scanLocked = true
focusPoint = nil
Expand Down Expand Up @@ -840,14 +841,15 @@ final class ScannerViewModel: ObservableObject {
barcode: String? = nil,
code: String? = nil,
boxNumber: Int? = nil,
message: String? = nil
message: String? = nil,
stepOverride: String? = nil
) {
scanLog.record(
ScanLogEvent(
at: Date(),
session: historyStore.activeSession?.id,
source: inputSource.scanLogValue,
step: step.scanLogValue,
step: stepOverride ?? step.scanLogValue,
event: event,
reason: reason,
destination: destination?.rawValue,
Expand Down
2 changes: 1 addition & 1 deletion ios/CodeMatchTests/BluetoothScannerFlowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ final class BluetoothScannerFlowTests: XCTestCase {
let events = loggedEvents(context.scanLog)
XCTAssertEqual(events.map(\.event), ["session_end"])
XCTAssertEqual(events[0].session, sessionID)
XCTAssertEqual(events[0].step, "qr")
XCTAssertEqual(events[0].step, "none")
XCTAssertEqual(events[0].source, "camera")
}

Expand Down
Loading