Skip to content

Commit

Permalink
🐛 - Include updates from favorite stations in announcements screen (#366
Browse files Browse the repository at this point in the history
)
  • Loading branch information
guytepper authored Apr 27, 2024
1 parent 73066e0 commit aec7373
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ android {
applicationId "com.betterrail"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 82
versionName "2.3.0"
versionCode 83
versionName "2.3.1"
missingDimensionStrategy "store", "play"
}

Expand Down
9 changes: 7 additions & 2 deletions app/screens/announcements/use-service-updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import firestore from "@react-native-firebase/firestore"
import { toJS } from "mobx"
import { useStores } from "../../models"
import { userLocale } from "../../i18n"
import { uniq } from "lodash"

export interface ServiceUpdate {
expireAt: Date
Expand All @@ -12,15 +13,19 @@ export interface ServiceUpdate {
}

export function useServiceUpdates() {
const { settings } = useStores()
const { settings, favoriteRoutes } = useStores()

return useQuery("serviceUpdates", async () => {
let data: ServiceUpdate[] = []

// Get all the station that the user has notifications enabled for, including their favorite routes
const favoriteStations = favoriteRoutes.routes.flatMap((route) => [route.originId, route.destinationId])
const notificationsStations = uniq([...toJS(settings.stationsNotifications), ...favoriteStations])

const querySnapshot = await firestore()
.collection("service-updates")
.where("expiresAt", ">", new Date())
.where("stations", "array-contains-any", [...toJS(settings.stationsNotifications), "all-stations"])
.where("stations", "array-contains-any", [...notificationsStations, "all-stations"])
.get()

querySnapshot.forEach((doc) => {
Expand Down
8 changes: 4 additions & 4 deletions ios/BetterRail.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = BetterRail/BetterRailDebug.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
ENABLE_BITCODE = NO;
Expand All @@ -1261,7 +1261,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.3.0;
MARKETING_VERSION = 2.3.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1294,7 +1294,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = UE6BVYPPFX;
INFOPLIST_FILE = BetterRail/Info.plist;
Expand All @@ -1303,7 +1303,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.3.0;
MARKETING_VERSION = 2.3.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
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>17</string>
<string>1</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>17</string>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>NSExtension</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/BetterRailWidget/WatchInfo.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>17</string>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
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>17</string>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down

0 comments on commit aec7373

Please sign in to comment.