Skip to content

Commit

Permalink
📈 - Added Apple Watch telemetry (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
guytepper authored Oct 7, 2023
1 parent 1a7d9ad commit 00b0253
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 20 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 72
versionCode 73
versionName "2.2.0"
missingDimensionStrategy "store", "play"
}
Expand Down
2 changes: 1 addition & 1 deletion app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function App() {
if (languageCode) {
setUserLanguage(languageCode)
setLocaleReady(true)
analytics().setUserProperties({ userLocale: languageCode })
analytics().setUserProperty("user_locale", languageCode)
} else {
setInitialLanguage()
}
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export let dateDelimiter = " "
export let dateLocale = "en-US"
export const deviceLocale = Localization.locale

analytics().setUserProperties({ deviceLocale })
analytics().setUserProperty("device_locale", deviceLocale)

export function getInitialLanguage(): LanguageCode {
if (Localization.locale.startsWith("he")) {
Expand Down
14 changes: 13 additions & 1 deletion app/models/favorites/favorites.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import { Instance, SnapshotOut, types } from "mobx-state-tree"
import { Platform } from "react-native"
import { getIsWatchAppInstalled, updateApplicationContext, WatchPayload } from "react-native-watch-connectivity"
import analytics from "@react-native-firebase/analytics"
import { getIsWatchAppInstalled, updateApplicationContext, getIsPaired, WatchPayload } from "react-native-watch-connectivity"
import Shortcuts from "react-native-quick-actions-shortcuts"
import { stationLocale, stationsObject } from "../../data/stations"
import { translate } from "../../i18n"

if (Platform.OS === "ios") {
// set analytics user property for apple watch
getIsPaired().then((isPaired) => {
analytics().setUserProperty("apple_watch_paired", isPaired ? "true" : "false")
})

getIsWatchAppInstalled().then((isInstalled) => {
analytics().setUserProperty("apple_watch_app_installed", isInstalled ? "true" : "false")
})
}

export const favoriteRouteSchema = {
id: types.string,
originId: types.string,
Expand Down
2 changes: 1 addition & 1 deletion app/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const fontScale = PixelRatio.getFontScale()
const colorScheme = Appearance.getColorScheme()
export const isDarkMode = colorScheme === "dark"

analytics().setUserProperties({ colorScheme, fontScale: `${fontScale}` })
analytics().setUserProperties({ color_scheme: colorScheme, font_scale: `${fontScale}` })
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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 = 9;
CURRENT_PROJECT_VERSION = 10;
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>9</string>
<string>10</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>9</string>
<string>10</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>9</string>
<string>10</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>9</string>
<string>10</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>9</string>
<string>10</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down

0 comments on commit 00b0253

Please sign in to comment.