Skip to content

Commit 1cfe0c6

Browse files
msfstefclaude
andcommitted
Clean up agents-mobile auth logging and legal link
- Gate the cloud-auth console.warn calls behind __DEV__ via an exported devWarn helper (reused from CloudAuthContext) so token-exchange / HTTP-status details don't get written to production device logs. - Point the account-deletion link at electric.ax to match the terms/privacy URLs (it was on a different domain). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4f31ffe commit 1cfe0c6

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

packages/agents-mobile/src/lib/CloudAuthContext.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createContext, useContext, useEffect, useMemo, useState } from 'react'
22
import * as Linking from 'expo-linking'
33
import {
44
cloudAuth,
5+
devWarn,
56
getCloudBaseUrl,
67
isCallbackUrl,
78
type CloudAuthProvider,
@@ -68,7 +69,7 @@ export function CloudAuthProvider({
6869
}
6970
})
7071
.catch((err) => {
71-
console.warn(`[agents-mobile] cloud-auth getInitialURL failed:`, err)
72+
devWarn(`[agents-mobile] cloud-auth getInitialURL failed:`, err)
7273
})
7374
return () => subscription.remove()
7475
}, [])

packages/agents-mobile/src/lib/cloudAuth.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export { getCloudServiceIdFromServerUrl } from './cloudAgentUrls'
2424
* param the client sent.
2525
*/
2626

27+
// Auth diagnostics help in development but shouldn't write token-exchange
28+
// / HTTP-status details to production device logs (logcat / Console.app).
29+
export const devWarn = (...args: Array<unknown>): void => {
30+
if (__DEV__) console.warn(...args)
31+
}
32+
2733
export type CloudAuthProvider = `github` | `google`
2834

2935
export type CloudAuthStatus =
@@ -577,11 +583,11 @@ export class CloudAuth {
577583
body: `{}`,
578584
})
579585
} catch (err) {
580-
console.warn(`[agents-mobile] cloud-auth: getTokenForAgents fetch:`, err)
586+
devWarn(`[agents-mobile] cloud-auth: getTokenForAgents fetch:`, err)
581587
return null
582588
}
583589
if (!res.ok) {
584-
console.warn(
590+
devWarn(
585591
`[agents-mobile] cloud-auth: getTokenForAgents returned ${res.status}`
586592
)
587593
return null
@@ -617,25 +623,25 @@ export class CloudAuth {
617623
body: `{"json":{}}`,
618624
})
619625
} catch (err) {
620-
console.warn(`[agents-mobile] cloud-auth: whoami fetch failed:`, err)
626+
devWarn(`[agents-mobile] cloud-auth: whoami fetch failed:`, err)
621627
return
622628
}
623629
if (res.status === 401 || res.status === 403) {
624-
console.warn(
630+
devWarn(
625631
`[agents-mobile] cloud-auth: whoami returned ${res.status}; signing out`
626632
)
627633
await this.signOut()
628634
return
629635
}
630636
if (!res.ok) {
631-
console.warn(`[agents-mobile] cloud-auth: whoami returned ${res.status}`)
637+
devWarn(`[agents-mobile] cloud-auth: whoami returned ${res.status}`)
632638
return
633639
}
634640
let body: unknown
635641
try {
636642
body = await res.json()
637643
} catch (err) {
638-
console.warn(`[agents-mobile] cloud-auth: whoami body parse:`, err)
644+
devWarn(`[agents-mobile] cloud-auth: whoami body parse:`, err)
639645
return
640646
}
641647
const result = parseWhoamiUserResponse(body)
@@ -709,7 +715,7 @@ export class CloudAuth {
709715
try {
710716
listener(next)
711717
} catch (err) {
712-
console.warn(`[agents-mobile] cloud-auth listener threw:`, err)
718+
devWarn(`[agents-mobile] cloud-auth listener threw:`, err)
713719
}
714720
}
715721
}

packages/agents-mobile/src/screens/AccountScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useCloudAuth } from '../lib/CloudAuthContext'
99
import { fontSize, lineHeight, radii, spacing } from '../lib/theme'
1010
import type { Tokens } from '../lib/theme'
1111

12-
const DELETE_ACCOUNT_URL = `https://electric-sql.com/about/legal/delete-account`
12+
const DELETE_ACCOUNT_URL = `https://electric.ax/about/legal/delete-account`
1313

1414
/**
1515
* Settings → Account screen. Mirrors the desktop's `AccountPage` —

0 commit comments

Comments
 (0)