Skip to content

Commit d4fede5

Browse files
committed
Merge PR #5537: Desktop — use dev Firebase config for dev builds
Resolved conflicts: test.sh (kept all entries), transcribe.py (formatting only), test files (took #5537 versions).
2 parents 8f8c5a0 + 6d8b57e commit d4fede5

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

desktop/Desktop/Sources/AuthService.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,19 @@ class AuthService {
8383
private let kAuthTokenExpiry = "auth_tokenExpiry"
8484
private let kAuthTokenUserId = "auth_tokenUserId" // User ID that owns the stored token
8585

86-
// Firebase Web API key (from GoogleService-Info.plist)
87-
private let firebaseApiKey = "AIzaSyD9dzBdglc7IO9pPDIOvqnCoTis_xKkkC8"
86+
// Firebase Web API key (read from active GoogleService-Info.plist at runtime)
87+
private let firebaseApiKey: String = {
88+
if let path = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist"),
89+
let dict = NSDictionary(contentsOfFile: path),
90+
let key = dict["API_KEY"] as? String {
91+
return key
92+
}
93+
// Dev builds must not silently fall back to prod credentials
94+
if Bundle.main.bundleIdentifier?.hasSuffix("-dev") == true {
95+
fatalError("AuthService: GoogleService-Info.plist missing or has no API_KEY in dev build — check that run.sh copied GoogleService-Info-Dev.plist")
96+
}
97+
return "AIzaSyD9dzBdglc7IO9pPDIOvqnCoTis_xKkkC8" // fallback to prod (prod builds only)
98+
}()
8899

89100
// MARK: - User Name Properties
90101

desktop/Desktop/Sources/GoogleService-Info-Dev.plist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<key>ANDROID_CLIENT_ID</key>
1010
<string>208440318997-1ek8tj5oa9ljmnh8tgehk27nqpivivbf.apps.googleusercontent.com</string>
1111
<key>API_KEY</key>
12-
<string>AIzaSyD9dzBdglc7IO9pPDIOvqnCoTis_xKkkC8</string>
12+
<string>AIzaSyBK-G7KmEoC72mR10gmQyb2NFBbZyDvcqM</string>
1313
<key>GCM_SENDER_ID</key>
14-
<string>208440318997</string>
14+
<string>1031333818730</string>
1515
<key>PLIST_VERSION</key>
1616
<string>1</string>
1717
<key>BUNDLE_ID</key>
1818
<string>com.omi.desktop-dev</string>
1919
<key>PROJECT_ID</key>
20-
<string>based-hardware</string>
20+
<string>based-hardware-dev</string>
2121
<key>STORAGE_BUCKET</key>
22-
<string>based-hardware.firebasestorage.app</string>
22+
<string>based-hardware-dev.firebasestorage.app</string>
2323
<key>IS_ADS_ENABLED</key>
2424
<false></false>
2525
<key>IS_ANALYTICS_ENABLED</key>
@@ -31,6 +31,6 @@
3131
<key>IS_SIGNIN_ENABLED</key>
3232
<true></true>
3333
<key>GOOGLE_APP_ID</key>
34-
<string>1:208440318997:ios:a1906bb92fe244810e421c</string>
34+
<string>1:1031333818730:ios:3bea63d8e4f41dbfafb513</string>
3535
</dict>
3636
</plist>

desktop/dev.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,12 @@ cp Desktop/Info.plist "$APP_BUNDLE/Contents/Info.plist"
8585
/usr/libexec/PlistBuddy -c "Set :CFBundleDisplayName $APP_NAME" "$APP_BUNDLE/Contents/Info.plist"
8686
/usr/libexec/PlistBuddy -c "Set :CFBundleURLTypes:0:CFBundleURLSchemes:0 omi-computer-dev" "$APP_BUNDLE/Contents/Info.plist"
8787

88-
# Copy GoogleService-Info.plist for Firebase
89-
cp Desktop/Sources/GoogleService-Info.plist "$APP_BUNDLE/Contents/Resources/"
88+
# Copy GoogleService-Info.plist for Firebase (dev version for com.omi.desktop-dev)
89+
if [ -f "Desktop/Sources/GoogleService-Info-Dev.plist" ]; then
90+
cp -f Desktop/Sources/GoogleService-Info-Dev.plist "$APP_BUNDLE/Contents/Resources/GoogleService-Info.plist"
91+
else
92+
cp -f Desktop/Sources/GoogleService-Info.plist "$APP_BUNDLE/Contents/Resources/"
93+
fi
9094

9195
# Copy resource bundle (contains app assets like herologo.png, omi-with-rope-no-padding.webp, etc.)
9296
SWIFT_BUILD_DIR="Desktop/.build/debug"

desktop/reset-and-run.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,12 @@ cp Desktop/Info.plist "$APP_BUNDLE/Contents/Info.plist"
381381
/usr/libexec/PlistBuddy -c "Set :CFBundleDisplayName $APP_NAME" "$APP_BUNDLE/Contents/Info.plist"
382382
/usr/libexec/PlistBuddy -c "Set :CFBundleURLTypes:0:CFBundleURLSchemes:0 omi-computer-dev" "$APP_BUNDLE/Contents/Info.plist"
383383

384-
# Copy GoogleService-Info.plist for Firebase
385-
cp Desktop/Sources/GoogleService-Info.plist "$APP_BUNDLE/Contents/Resources/"
384+
# Copy GoogleService-Info.plist for Firebase (dev version for com.omi.desktop-dev)
385+
if [ -f "Desktop/Sources/GoogleService-Info-Dev.plist" ]; then
386+
cp -f Desktop/Sources/GoogleService-Info-Dev.plist "$APP_BUNDLE/Contents/Resources/GoogleService-Info.plist"
387+
else
388+
cp -f Desktop/Sources/GoogleService-Info.plist "$APP_BUNDLE/Contents/Resources/"
389+
fi
386390

387391
# Copy .env.app (app runtime secrets only) and add API URL
388392
if [ -f ".env.app" ]; then

0 commit comments

Comments
 (0)