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 @@ -34,6 +34,9 @@ import kotlin.math.abs
import org.json.JSONArray
import org.json.JSONObject

internal fun buildOnboardTripSubText(nearestStopName: String): String =
"已上車 · 最近站牌 $nearestStopName"

class RouteTripMonitorService : Service() {
private val ioExecutor = Executors.newSingleThreadExecutor()
private val mainHandler = Handler(Looper.getMainLooper())
Expand Down Expand Up @@ -815,7 +818,7 @@ class RouteTripMonitorService : Service() {
remainingStops == 0 -> "已接近 ${destinationStop.stopName}"
else -> "距離 ${destinationStop.stopName} 還有 $remainingStops 站 · $destinationEtaText"
},
subText = "已上車 · 最近站牌 ${nearestStop.stopName}",
subText = buildOnboardTripSubText(nearestStop.stopName),
progressMax = toProgressMax(journeyPointCount),
progressValue = toProgressValue(currentProgressPoint, journeyPointCount),
shortCriticalText = buildShortCriticalText(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tw.avianjay.taiwanbus.flutter

import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Test

class TripNotificationTextTest {
@Test
fun onboardSubTextOmitsCurrentStopEta() {
val subText = buildOnboardTripSubText("目前站")

assertEquals("已上車 · 最近站牌 目前站", subText)
assertFalse(subText.contains("3 分"))
}
}
Loading