Skip to content

Commit

Permalink
fix(ios): crash at the final metro station
Browse files Browse the repository at this point in the history
  • Loading branch information
krystxf committed Nov 15, 2024
1 parent 18432d8 commit c319beb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions apps/mobile/metro-now/metro-now.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 0.2.1;
DEVELOPMENT_ASSET_PATHS = "\"metro-now/Preview Content\"";
DEVELOPMENT_TEAM = R6WU5ABNG2;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -467,7 +467,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 0.2.1;
DEVELOPMENT_ASSET_PATHS = "\"metro-now/Preview Content\"";
DEVELOPMENT_TEAM = R6WU5ABNG2;
ENABLE_PREVIEWS = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@ struct ClosestMetroStopSectionView: View {

var body: some View {
ForEach(closestStop.platforms, id: \.id) { platform in
let routeLabel: String = platform.routes[0].name
let routeLabelBackground: Color = getColorByRouteName(routeLabel)
let platformDepartures: [ApiDeparture]? = departures?.filter { departure in
departure.platformId == platform.id
}
let platformDepartures: [ApiDeparture]? = departures?.filter { $0.platformId == platform.id }

if let platformDepartures, platformDepartures.count > 0 {
if platform.routes.count == 0 {
EmptyView()
} else if let platformDepartures, platformDepartures.count > 0 {
let routeLabel: String = platform.routes[0].name
let nextDeparture = platformDepartures.count > 1 ? platformDepartures[1] : nil

ClosestStopPageListItemView(
routeLabel: routeLabel,
routeLabelBackground: routeLabelBackground,
routeLabelBackground: getColorByRouteName(routeLabel),
headsign: platformDepartures[0].headsign,
departure: platformDepartures[0].departure.predicted,
nextHeadsign: nextDeparture?.headsign,
nextDeparture: nextDeparture?.departure.scheduled
)
} else {
let routeLabel: String = platform.routes[0].name

ClosestStopPageListItemPlaceholderView(
routeLabel: routeLabel,
routeLabelBackground: routeLabelBackground
routeLabelBackground: getColorByRouteName(routeLabel)
)
}
}
Expand Down

0 comments on commit c319beb

Please sign in to comment.