Skip to content

Commit

Permalink
Tweek filtering bug and update alert time
Browse files Browse the repository at this point in the history
  • Loading branch information
steviek committed Apr 8, 2024
1 parent a5dea3e commit f697ed9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion alerts.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"SATURDAY",
"SUNDAY"
],
"start": "17:00",
"start": "20:00",
"end": "05:00",
"from": "2024-04-06",
"to": "2024-06-30"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.sixbynine.transit.path.api.Station
import com.sixbynine.transit.path.time.NewYorkTimeZone
import com.sixbynine.transit.path.time.now
import kotlinx.datetime.DayOfWeek
import kotlinx.datetime.Instant
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.LocalTime
Expand Down Expand Up @@ -245,8 +246,8 @@ fun Alert.hidesTrain(stationName: String, headSign: String): Boolean {
return false
}

fun Alert.hidesTrainNow(stationName: String, headSign: String): Boolean {
val dateTime = now().toLocalDateTime(NewYorkTimeZone)
fun Alert.hidesTrainAt(stationName: String, headSign: String, time: Instant): Boolean {
val dateTime = time.toLocalDateTime(NewYorkTimeZone)
return isActiveAt(dateTime) && hidesTrain(stationName, headSign)
}

Expand Down
4 changes: 2 additions & 2 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ android {
applicationId = "com.sixbynine.transit.path"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 30
versionName = "2024.04.07.1"
versionCode = 31
versionName = "2024.04.07.2"
resourceConfigurations += setOf("en", "es")
}
buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.sixbynine.transit.path.api.Stations
import com.sixbynine.transit.path.api.TrainFilter
import com.sixbynine.transit.path.api.alerts.GithubAlerts
import com.sixbynine.transit.path.api.alerts.GithubAlertsRepository
import com.sixbynine.transit.path.api.alerts.hidesTrainNow
import com.sixbynine.transit.path.api.alerts.hidesTrainAt
import com.sixbynine.transit.path.api.isEastOf
import com.sixbynine.transit.path.api.isInNewJersey
import com.sixbynine.transit.path.api.isInNewYork
Expand Down Expand Up @@ -145,9 +145,10 @@ object WidgetDataFetcher {
data[station.pathApiName]
?.filterNot { train ->
stationAlerts.any { alert ->
alert.hidesTrainNow(
alert.hidesTrainAt(
stationName = station.pathApiName,
headSign = train.headsign
headSign = train.headsign,
time = train.projectedArrival,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion iosApp/iosApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>CFBundleShortVersionString</key>
<string>2.3</string>
<key>CFBundleVersion</key>
<string>9</string>
<string>10</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
Expand Down

0 comments on commit f697ed9

Please sign in to comment.