diff --git a/ios/RideSessionActivity/RideSessionActivity.swift b/ios/RideSessionActivity/RideSessionActivity.swift index 560601dbe..7470c40fa 100644 --- a/ios/RideSessionActivity/RideSessionActivity.swift +++ b/ios/RideSessionActivity/RideSessionActivity.swift @@ -20,15 +20,18 @@ func getRunningStateText( } return String(localized: "next") } + + if stopped { + return String(localized: "stop") + } + if approaching { if isNextLastStop { return String(localized: "soonLast") } return String(localized: "soon") } - if stopped { - return String(localized: "stop") - } + if isNextLastStop { return String(localized: "nextLast") } @@ -126,8 +129,10 @@ struct RideSessionWidget: Widget { } } compactLeading: { HStack { - if context.state.stopped { - Image(systemName: "stop.fill") + if context.state.approaching { + EmptyView() + } else if context.state.stopped { + Image(systemName: "stop.circle") } if context.state.passingStationName.isEmpty { @@ -144,8 +149,10 @@ struct RideSessionWidget: Widget { } else { Text("pass") } - - if !context.state.passingStationName.isEmpty || context.state.stopped { + + if !context.state.passingStationName.isEmpty + || (context.state.stopped && !context.state.approaching) + { EmptyView() } else if context.state.isNextLastStop { Image(systemName: "chevron.forward.to.line") @@ -176,7 +183,7 @@ struct RideSessionWidget: Widget { .opacity(0.75) } } - + Image(systemName: "chevron.forward.dotted.chevron.forward") } } else if context.state.stopped { @@ -389,7 +396,7 @@ struct SmartStackLiveActivityContentView: View { var body: some View { ZStack { VStack(alignment: .leading) { - HStack { + HStack(spacing: 2) { Text(context.state.lineName) .font(.caption) .bold() @@ -401,7 +408,7 @@ struct SmartStackLiveActivityContentView: View { .multilineTextAlignment(.leading) .opacity(0.75) } - + if context.state.passingStationName.isEmpty { Text( getRunningStateText( @@ -413,17 +420,17 @@ struct SmartStackLiveActivityContentView: View { .font(.callout) .bold() .multilineTextAlignment(.leading) - + Text( context.state.stopped - ? context.state.stationName : context.state.nextStationName + ? context.state.stationName : context.state.nextStationName ) .font(.headline) .bold() .multilineTextAlignment(.leading) Text( context.state.stopped - ? context.state.stationNumber : context.state.nextStationNumber + ? context.state.stationNumber : context.state.nextStationNumber ) .font(.caption) .bold() @@ -434,14 +441,14 @@ struct SmartStackLiveActivityContentView: View { .font(.callout) .bold() .multilineTextAlignment(.leading) - + Text( context.state.passingStationName ) .font(.headline) .bold() .multilineTextAlignment(.leading) - + Text( context.state.passingStationNumber ) diff --git a/src/hooks/useUpdateLiveActivities.ts b/src/hooks/useUpdateLiveActivities.ts index 108b711ec..2457390c4 100644 --- a/src/hooks/useUpdateLiveActivities.ts +++ b/src/hooks/useUpdateLiveActivities.ts @@ -90,8 +90,11 @@ export const useUpdateLiveActivities = (): void => { }, [directionalStops, getStationNumberIndex]) const stoppedStation = useMemo( - () => previousStation ?? currentStation, - [currentStation, previousStation] + () => + arrivedFromState && !approachingFromState + ? currentStation + : previousStation, + [approachingFromState, arrivedFromState, currentStation, previousStation] ) const stationName = useMemo( () => (isJapanese ? stoppedStation?.name : stoppedStation?.nameRoman) ?? '',