Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/gradle/androidx.navigation-naviga…
Browse files Browse the repository at this point in the history
…tion-compose-2.8.2
  • Loading branch information
boringcactus authored Nov 22, 2024
2 parents dab4bb6 + 8647347 commit c97ad7b
Show file tree
Hide file tree
Showing 309 changed files with 20,354 additions and 5,035 deletions.
3 changes: 0 additions & 3 deletions .envrc.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
export FIREBASE_KEY=
export GOOGLE_APP_ID=

# Running Firebase App Check locally requires configuring a special debug key.
# Be sure to populate that separately in `/iosApp/AppCheckCI.xcconfig`

# Optional Variables

# Sentry - needed only to record sentry events from local development
Expand Down
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ _Ticket:_ [Name](URL)

What is this PR for?

- [ ] If you added any user facing strings on iOS, are they included in Localizable.xcstrings?

### Testing

What testing have you done?
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- run: ./gradlew spotlessCheck
- name: shared checks & unit tests
run: ./gradlew shared:check
env:
MAPBOX_SECRET_TOKEN: ${{ secrets.MAPBOX_SECRET_TOKEN }}
MAPBOX_PUBLIC_TOKEN: ${{ secrets.MAPBOX_PUBLIC_TOKEN }}
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ xcuserdata

fastlane/report.xml

iosApp/AppCheckCI.xcconfig
/iosApp/secrets/*
/iosApp/Pods/*
/androidApp/src/main/res/values/secrets.xml
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ruby 3.2.2
java temurin-17.0.9+9
python 3.9.16
nodejs 22.11.0
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source "https://rubygems.org"

gem "cocoapods"
gem "cyclonedx-cocoapods"
gem "fastlane"
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ GEM
highline (~> 2.0.0)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
cyclonedx-cocoapods (1.4.0)
cocoapods (>= 1.10.1, < 2.0)
nokogiri (>= 1.11.2, < 2.0)
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
Expand Down Expand Up @@ -218,6 +221,7 @@ GEM
base64
mini_magick (4.13.2)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.22.3)
molinillo (0.8.0)
multi_json (1.15.0)
Expand All @@ -228,10 +232,18 @@ GEM
naturally (2.2.1)
netrc (0.11.0)
nkf (0.2.0)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
optparse (0.5.0)
os (1.1.4)
plist (3.7.1)
public_suffix (4.0.7)
racc (1.8.1)
rake (13.2.1)
representable (3.2.0)
declarative (< 0.1.0)
Expand Down Expand Up @@ -282,9 +294,11 @@ GEM
PLATFORMS
arm64-darwin-22
ruby
x86_64-darwin-23

DEPENDENCIES
cocoapods
cyclonedx-cocoapods
fastlane

BUNDLED WITH
Expand Down
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,14 @@ Install the tools specified in `.tool-versions`. You can use [asdf](https://asdf

Install [direnv](https://direnv.net/) if you don't already have it, copy `.envrc.example` to `.envrc`, populate any required values, then run `direnv allow`.

Install and set up [the GitHub CLI](https://cli.github.com/manual/).

For Android development, `brew install librsvg`.

For iOS development, `brew install swiftlint`.

### External Dependencies

#### Firebase App Check - [docs](https://firebase.google.com/docs/app-check)

App Check is used to validate that requests to our backend are coming from real instances of our app.

##### ios - [docs](https://firebase.google.com/docs/app-check/ios/custom-resource)

For running in debug mode locally, be sure to populate `FIREBASE_APP_CHECK_CI_TOKEN` in `/iosApp/AppCheckCI.xcconfig`
with the value found in 1pass (see `/iosApp/AppCheckCI.example.xcconfig` for an example).
If you need to generate a new token, from the [App Check console](https://console.firebase.google.com/u/0/project/mbta-app-c574d/appcheck/apps),
go to "Manage debug tokens" for the relevant app.

#### Mapbox - [docs](https://docs.mapbox.com/#maps)

We use mapbox for custom interactive maps.
Expand Down
6 changes: 6 additions & 0 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.compose)
alias(libs.plugins.cycloneDx)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.serialization)
id("check-mapbox-bridge")
Expand Down Expand Up @@ -58,6 +59,11 @@ dependencies {
androidTestImplementation(libs.ktor.client.mock)
}

tasks.cyclonedxBom {
includeConfigs =
listOf("implementationDependenciesMetadata", "releaseImplementationDependenciesMetadata")
}

// https://github.com/mapbox/mapbox-gl-native-android/blob/7f03a710afbd714368084e4b514d3880bad11c27/gradle/gradle-config.gradle
task("accessToken") {
val tokenFile = File("${projectDir}/src/main/res/values/secrets.xml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class DirectionPickerTest {
}
val patterns =
listOf(
RealtimePatterns.ByHeadsign(route, "A", null, listOf(aPattern)),
RealtimePatterns.ByHeadsign(route, "B", null, listOf(bPattern)),
RealtimePatterns.ByHeadsign(route, "A", null, listOf(aPattern), emptyList()),
RealtimePatterns.ByHeadsign(route, "B", null, listOf(bPattern), emptyList()),
)
val patternsByStop =
PatternsByStop(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ class UpcomingTripViewTest {
fun testUpcomingTripViewWithSomeAsTime() {
val instant = Instant.fromEpochSeconds(1722535384)
composeTestRule.setContent {
UpcomingTripView(UpcomingTripViewState.Some(TripInstantDisplay.AsTime(instant)))
UpcomingTripView(UpcomingTripViewState.Some(TripInstantDisplay.Time(instant)))
}
composeTestRule.onNodeWithText(formatTime(instant)).assertIsDisplayed()
}

@Test
fun testUpcomingTripViewWithSomeSchedule() {
fun testUpcomingTripViewWithSomeScheduleTime() {
val instant = Instant.fromEpochSeconds(1722535384)
composeTestRule.setContent {
UpcomingTripView(UpcomingTripViewState.Some(TripInstantDisplay.Schedule(instant)))
UpcomingTripView(UpcomingTripViewState.Some(TripInstantDisplay.ScheduleTime(instant)))
}
composeTestRule.onNodeWithText(formatTime(instant)).assertIsDisplayed()
}
Expand All @@ -95,4 +95,13 @@ class UpcomingTripViewTest {
}
composeTestRule.onNodeWithText("5 min").assertIsDisplayed()
}

@Test
fun testUpcomingTripViewWithSomeScheduleMinutes() {
val instant = Instant.fromEpochSeconds(1722535384)
composeTestRule.setContent {
UpcomingTripView(UpcomingTripViewState.Some(TripInstantDisplay.ScheduleMinutes(5)))
}
composeTestRule.onNodeWithText("5 min").assertIsDisplayed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,13 @@ class NearbyTransitPageTest : KoinTest {
onJoin: (ApiResult<PredictionsByStopJoinResponse>) -> Unit,
onMessage: (ApiResult<PredictionsByStopMessageResponse>) -> Unit
) {
/* no-op */
onJoin(ApiResult.Ok(PredictionsByStopJoinResponse(builder)))
}

override var lastUpdated: Instant? = null

override fun shouldForgetPredictions(predictionCount: Int) = false

override fun disconnect() {
/* no-op */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.mbta.tid.mbta_app.model.LocationType
import com.mbta.tid.mbta_app.model.NearbyStaticData
import com.mbta.tid.mbta_app.model.ObjectCollectionBuilder
import com.mbta.tid.mbta_app.model.RouteType
import com.mbta.tid.mbta_app.model.response.AlertsStreamDataResponse
import com.mbta.tid.mbta_app.model.response.ApiResult
import com.mbta.tid.mbta_app.model.response.GlobalResponse
import com.mbta.tid.mbta_app.model.response.NearbyResponse
Expand Down Expand Up @@ -184,11 +185,13 @@ class NearbyTransitViewTest : KoinTest {
onJoin: (ApiResult<PredictionsByStopJoinResponse>) -> Unit,
onMessage: (ApiResult<PredictionsByStopMessageResponse>) -> Unit
) {
/* no-op */
onJoin(ApiResult.Ok(PredictionsByStopJoinResponse(builder)))
}

override var lastUpdated: Instant? = null

override fun shouldForgetPredictions(predictionCount: Int) = false

override fun disconnect() {
/* no-op */
}
Expand Down Expand Up @@ -231,7 +234,7 @@ class NearbyTransitViewTest : KoinTest {
composeTestRule.setContent {
KoinContext(koinApplication.koin) {
NearbyTransitView(
alertData = null,
alertData = AlertsStreamDataResponse(emptyMap()),
globalResponse = globalResponse,
targetLocation = Position(0.0, 0.0),
setLastLocation = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.mbta.tid.mbta_app.model.ObjectCollectionBuilder
import com.mbta.tid.mbta_app.model.RouteType
import com.mbta.tid.mbta_app.model.StopDetailsDepartures
import com.mbta.tid.mbta_app.model.StopDetailsFilter
import com.mbta.tid.mbta_app.model.response.AlertsStreamDataResponse
import com.mbta.tid.mbta_app.model.response.GlobalResponse
import com.mbta.tid.mbta_app.model.response.PredictionsStreamDataResponse
import kotlin.time.Duration.Companion.minutes
Expand Down Expand Up @@ -104,14 +105,17 @@ class StopDetailsFilteredRouteViewTest {

StopDetailsFilteredRouteView(
departures =
StopDetailsDepartures(
stop,
globalResponse,
null,
PredictionsStreamDataResponse(builder),
null,
emptySet(),
now
checkNotNull(
StopDetailsDepartures.fromData(
stop,
globalResponse,
null,
PredictionsStreamDataResponse(builder),
AlertsStreamDataResponse(emptyMap()),
emptySet(),
now,
useTripHeadsigns = false,
)
),
global = globalResponse,
now = now,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class StopDetailsRouteViewTest {
) to listOf(UpcomingTrip(trip, prediction))
),
parentStopId = stop.id,
alerts = null,
alerts = emptyList(),
hasSchedulesTodayByPattern = null,
allDataLoaded = false
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.mbta.tid.mbta_app.model.ObjectCollectionBuilder
import com.mbta.tid.mbta_app.model.RouteType
import com.mbta.tid.mbta_app.model.StopDetailsDepartures
import com.mbta.tid.mbta_app.model.StopDetailsFilter
import com.mbta.tid.mbta_app.model.response.AlertsStreamDataResponse
import com.mbta.tid.mbta_app.model.response.GlobalResponse
import com.mbta.tid.mbta_app.model.response.PredictionsStreamDataResponse
import kotlin.time.Duration.Companion.minutes
Expand Down Expand Up @@ -100,14 +101,17 @@ class StopDetailsRoutesViewTest {

StopDetailsRoutesView(
departures =
StopDetailsDepartures(
stop,
globalResponse,
null,
PredictionsStreamDataResponse(builder),
null,
emptySet(),
now
checkNotNull(
StopDetailsDepartures.fromData(
stop,
globalResponse,
null,
PredictionsStreamDataResponse(builder),
AlertsStreamDataResponse(emptyMap()),
emptySet(),
now,
useTripHeadsigns = false,
)
),
global = globalResponse,
now = now,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class StopDetailsViewTest {

override var lastUpdated: Instant? = null

override fun shouldForgetPredictions(predictionCount: Int) = false

override fun disconnect() {
/* no-op */
}
Expand Down Expand Up @@ -212,7 +214,7 @@ class StopDetailsViewTest {
listOf(UpcomingTrip(trip, prediction))
),
parentStopId = stop.id,
alerts = null,
alerts = emptyList(),
hasSchedulesTodayByPattern = null,
allDataLoaded = false
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import com.mbta.tid.mbta_app.model.response.ApiResult
import com.mbta.tid.mbta_app.model.response.GlobalResponse
import com.mbta.tid.mbta_app.repositories.IGlobalRepository
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
Expand All @@ -26,6 +29,9 @@ class GetGlobalDataTest {
val requestSync = Channel<Unit>(Channel.RENDEZVOUS)
val globalRepo =
object : IGlobalRepository {
override val state: StateFlow<GlobalResponse?> =
MutableStateFlow<GlobalResponse?>(globalData).asStateFlow()

override suspend fun getGlobalData(): ApiResult<GlobalResponse> {
requestSync.receive()
return ApiResult.Ok(globalData)
Expand Down
Loading

0 comments on commit c97ad7b

Please sign in to comment.