Skip to content

Commit

Permalink
🔖 - Release 2.0.0 (#245)
Browse files Browse the repository at this point in the history
Co-authored-by: Matan Mashraki <[email protected]>
  • Loading branch information
guytepper and planecore authored Jun 9, 2023
1 parent 48e4078 commit 06f7111
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 40 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ android {
applicationId "com.betterrail"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 46
versionCode 48
versionName "2.0.0"
missingDimensionStrategy "store", "play"
}
Expand Down
21 changes: 10 additions & 11 deletions app/hooks/use-ride-progress/use-ride-progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ export function useRideProgress({ route, enabled }: { route: RouteItem; enabled:

calculateMinutesLeft()

return () => clearInterval(timer)
}, [status, delay, nextStationId])

useEffect(() => {
// recalculate time left route when the user comes back to the app
const listener = (nextAppState: AppStateStatus) => {
if (nextAppState === "active") calculateMinutesLeft()
const subscription = AppState.addEventListener("change", (state) => {
if (state === "active") {
calculateMinutesLeft()
}
})

return () => {
clearInterval(timer)
subscription.remove()
}

const subscription = AppState.addEventListener("change", listener)
return () => subscription.remove()
}, [])
}, [status, delay, nextStationId])

return { status, minutesLeft, stations, nextStationId }
}
2 changes: 1 addition & 1 deletion app/screens/route-details/components/start-ride-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const StartRideButton = observer(function StartRideButton(props: StartRid

const shouldDisplayFirstRideAlert = async () => {
const isFirstRideAlertEnabled = isAfterTargetDate
if (isFirstRideAlertEnabled) return false
if (!isFirstRideAlertEnabled) return false

const firstRideDate = await storage.load("firstRideDate")

Expand Down
20 changes: 10 additions & 10 deletions ios/BetterRail.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = BetterRail/BetterRailDebug.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1196,7 +1196,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
INFOPLIST_FILE = BetterRail/Info.plist;
Expand Down Expand Up @@ -1359,7 +1359,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=watchos*]" = UE6BVYPPFX;
Expand Down Expand Up @@ -1401,7 +1401,7 @@
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=watchos*]" = UE6BVYPPFX;
Expand Down Expand Up @@ -1437,7 +1437,7 @@
CODE_SIGN_ENTITLEMENTS = "WatchBetterRail Extension/WatchBetterRail Extension.entitlements";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=watchos*]" = UE6BVYPPFX;
Expand Down Expand Up @@ -1478,7 +1478,7 @@
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=watchos*]" = UE6BVYPPFX;
Expand Down Expand Up @@ -1516,7 +1516,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = BetterRailWidgetExtensionDebug.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
Expand Down Expand Up @@ -1557,7 +1557,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
Expand Down Expand Up @@ -1590,7 +1590,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = StationIntent/StationIntentDebug.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
Expand Down Expand Up @@ -1629,7 +1629,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 38;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
Expand Down
2 changes: 1 addition & 1 deletion ios/BetterRail/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>38</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/BetterRailWidget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>38</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
3 changes: 3 additions & 0 deletions ios/BetterRailWidget/Live Activity/ActivityUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func getStatusStartDate(context: ActivityViewContext<BetterRailActivityAttribute
let previousTrain = getPreviousTrainFromStationId(route: route, stationId: nextStationId)
// since we're in exchange, use the arrival time of the previous train as the progress start time
return isoDateStringToDate(previousTrain?.arrivalTime ?? "").addMinutes(delay)
} else if (status == .inTransit && train.orignStation == nextStationId && departureDate > Date.now) {
let previousTrain = getPreviousTrainFromStationId(route: route, stationId: nextStationId) ?? train
return isoDateStringToDate(previousTrain.departureTime).addMinutes(delay)
} else {
return departureDate
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ struct BetterRailLiveActivity: Widget {
}

struct LiveActivity_Previews: PreviewProvider {
static let attributes = BetterRailActivityAttributes(activityStartDate: Date(), route: Route(departureTime: "2023-04-09T00:19:00", arrivalTime: "2023-04-09T01:29:00", trains: [Train(delay: IntWithDefaultValue(), trainNumber: 123, orignStation: 3700, destinationStation: 3400, arrivalTime: "", departureTime: "", stopStations: [], routeStations: [RouteStation(stationId: 4600, arrivalTime: "20:50", platform: 4)], originPlatform: 4, destPlatform: 2)]), frequentPushesEnabled: true)
static let contentState = BetterRailActivityAttributes.ContentState(delay: 2, nextStationId: 3700, status: .inTransit)
static let attributes = BetterRailActivityAttributes(activityStartDate: Date(), route: Route(departureTime: "2023-06-09T14:08:00", arrivalTime: "2023-06-09T14:45:00", trains: [Train(delay: IntWithDefaultValue(wrappedValue: 0), trainNumber: 6039, orignStation: 2300, destinationStation: 2800, arrivalTime: "2023-06-09T14:36:00", departureTime: "2023-06-09T14:08:00", stopStations: [StopStation(stationId: 2500, platform: 1, arrivalTime: "2023-06-09T14:20:00", departureTime: "2023-06-09T14:20:00")], routeStations: [RouteStation(stationId: 1600, arrivalTime: "13:16", platform: 1), RouteStation(stationId: 1500, arrivalTime: "13:25", platform: 2), RouteStation(stationId: 1400, arrivalTime: "13:35", platform: 1), RouteStation(stationId: 700, arrivalTime: "13:39", platform: 1), RouteStation(stationId: 1300, arrivalTime: "13:43", platform: 1), RouteStation(stationId: 1220, arrivalTime: "13:47", platform: 1), RouteStation(stationId: 2100, arrivalTime: "13:56", platform: 1), RouteStation(stationId: 2200, arrivalTime: "14:01", platform: 2), RouteStation(stationId: 2300, arrivalTime: "14:08", platform: 2), RouteStation(stationId: 2500, arrivalTime: "14:20", platform: 1), RouteStation(stationId: 2800, arrivalTime: "14:36", platform: 1), RouteStation(stationId: 3500, arrivalTime: "15:02", platform: 5), RouteStation(stationId: 3600, arrivalTime: "15:10", platform: 2), RouteStation(stationId: 3700, arrivalTime: "15:15", platform: 3)], originPlatform: 2, destPlatform: 1), Train(delay: IntWithDefaultValue(wrappedValue: 0), trainNumber: 6239, orignStation: 2800, destinationStation: 2820, arrivalTime: "2023-06-09T14:45:00", departureTime: "2023-06-09T14:41:00", stopStations: [], routeStations: [RouteStation(stationId: 2800, arrivalTime: "14:41", platform: 3), RouteStation(stationId: 2820, arrivalTime: "14:45", platform: 1), RouteStation(stationId: 3100, arrivalTime: "14:51", platform: 1), RouteStation(stationId: 3300, arrivalTime: "15:01", platform: 2), RouteStation(stationId: 3400, arrivalTime: "15:07", platform: 1), RouteStation(stationId: 3500, arrivalTime: "15:16", platform: 4), RouteStation(stationId: 3600, arrivalTime: "15:23", platform: 2), RouteStation(stationId: 3700, arrivalTime: "15:30", platform: 4), RouteStation(stationId: 4600, arrivalTime: "15:32", platform: 3), RouteStation(stationId: 4900, arrivalTime: "15:37", platform: 3), RouteStation(stationId: 4800, arrivalTime: "15:46", platform: 2), RouteStation(stationId: 5000, arrivalTime: "15:53", platform: 3), RouteStation(stationId: 5300, arrivalTime: "16:00", platform: 2), RouteStation(stationId: 5200, arrivalTime: "16:05", platform: 1)], originPlatform: 3, destPlatform: 1)]), frequentPushesEnabled: true)
static let contentState = BetterRailActivityAttributes.ContentState(delay: 2, nextStationId: 2800, status: .inTransit)

static var previews: some View {
attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct CountdownView: View {
let delay: Int

var minutesLeft: Int {
getMinutesLeft(targetDate: targetDate.addMinutes(delay))
getMinutesLeft(targetDate: targetDate)
}

var color: Color {
Expand Down
19 changes: 10 additions & 9 deletions ios/BetterRailWidget/Live Activity/Views/TimeInformation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@ enum ViewPlacement: String {
struct TimeInformation: View {
var vm: ActivityViewModel
var delay: Int { vm.delay }
var departureDate: Date { vm.departureDate }
var arrivalDate: Date { vm.arrivalDate }
var targetDate: Date {
getStatusEndDate(context: vm.context)
}

var placement: ViewPlacement = .lockScreen

var body: some View {
if (vm.status == .arrived) {
VStack(alignment: .trailing) {
Text("ARRIVAL TIME").font(.caption)
Text(formatDateHour(arrivalDate.addMinutes(delay))).font(.system(size: 18, weight: .bold, design: .rounded))
Text(formatDateHour(targetDate)).font(.system(size: 18, weight: .bold, design: .rounded))
}

}
else {
if (vm.status == .waitForTrain || vm.status == .inExchange) {
VStack(alignment: .trailing) {
if (vm.context.attributes.frequentPushesEnabled) {
CountdownView(targetDate: departureDate, delay: delay)
CountdownView(targetDate: targetDate, delay: delay)
.accessibilityLabel("time left depart")
}

Expand All @@ -44,14 +45,14 @@ struct TimeInformation: View {

// hide the original time during delay, if the screen space is limited
if (delay == 0 || delay > 0 && (placement == .lockScreen || vm.isWideScreen)) {
Text(formatDateHour(departureDate))
Text(formatDateHour(targetDate.addMinutes(-delay)))
.bold()
.strikethrough(vm.delay > 0 ? true : false)
.font(vm.isRTL ? .caption : .caption2)
}

if (delay != 0) {
Text(formatDateHour(departureDate.addMinutes(delay)))
Text(formatDateHour(targetDate))
.foregroundColor(Color(uiColor: .systemRed))
.fontWeight(.heavy)
.font(.caption)
Expand All @@ -63,19 +64,19 @@ struct TimeInformation: View {
else {
VStack(alignment: .trailing) {
if (vm.context.attributes.frequentPushesEnabled) {
CountdownView(targetDate: vm.arrivalDate, delay: delay)
CountdownView(targetDate: targetDate, delay: delay)
.accessibilityLabel("time left arrival")
}

HStack (spacing: 2) {
Text("arrive").fontWeight(vm.isEnglish ? .light : .medium)
// we don't have space for both original & updated times in the dynamic island
if (delay == 0 || placement == .lockScreen && delay > 0) {
Text(formatDateHour(arrivalDate)).bold().strikethrough(delay > 0 ? true : false)
Text(formatDateHour(targetDate.addMinutes(-delay))).bold().strikethrough(delay > 0 ? true : false)
}

if (vm.delay != 0) {
Text(formatDateHour(vm.arrivalDate.addMinutes(delay))) .foregroundColor(Color(uiColor: .systemRed)).fontWeight(.heavy)
Text(formatDateHour(targetDate)) .foregroundColor(Color(uiColor: .systemRed)).fontWeight(.heavy)
}
}.font(vm.isEnglish ? .caption2 : .caption)
}
Expand Down
2 changes: 1 addition & 1 deletion ios/StationIntent/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>38</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/WatchBetterRail Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>38</string>
<key>CLKComplicationPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ComplicationController</string>
<key>NSExtension</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/WatchBetterRail/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>38</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down

0 comments on commit 06f7111

Please sign in to comment.