A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix(mobile): polish sign-in and repair Android auth handoff
Amruth Pillaib242aadcf2d5
diff --git a/apps/mobile/app/(auth)/sign-in.tsx b/apps/mobile/app/(auth)/sign-in.tsxindex 0702df26f..7d73866b0 100644--- a/apps/mobile/app/(auth)/sign-in.tsx+++ b/apps/mobile/app/(auth)/sign-in.tsx@@ -2,7 +2,7 @@ import { useLingui } from "@lingui/react/macro";import { useQuery } from "@tanstack/react-query";import { useRouter, useLocalSearchParams } from "expo-router";import { ActivityIndicator, ScrollView, View } from "react-native";-import { AuthHeader, hostOf } from "@/auth/auth-header";+import { AuthHeader, PrivacyPolicyLink, hostOf } from "@/auth/auth-header";import { getFlags, isAllowedServer, toOrigin } from "@/auth/oauth";import { useSession } from "@/auth/session";import { useSignIn } from "@/auth/use-sign-in";@@ -21,7 +21,7 @@ function useTargetServer(): string {export default function SignInScreen() {const router = useRouter();const { t } = useLingui();- const { space } = useTheme();+ const { size, space } = useTheme();const server = useTargetServer();const host = hostOf(server);const { attempt, start, cancel, reset } = useSignIn();@@ -30,11 +30,15 @@ export default function SignInScreen() {const changeServer = () => router.push(routes.server());return (- <Screen scroll={false} edges={["top", "bottom"]}>+ <Screen+ scroll={false}+ edges={["top", "bottom"]}+ contentStyle={{ width: "100%", maxWidth: size.panel, alignSelf: "center" }}+ ><ScrollViewstyle={{ flex: 1 }}contentInsetAdjustmentBehavior="automatic"- contentContainerStyle={{ gap: space.s6 }}+ contentContainerStyle={{ flexGrow: 1, justifyContent: "center", gap: space.s8, paddingVertical: space.s8 }}>{attempt.state === "waiting" ? (<Waiting onCancel={cancel} />@@ -112,6 +116,7 @@ export default function SignInScreen() {/></Card>) : null}+ <PrivacyPolicyLink /></Screen>);}@@ -127,11 +132,13 @@ function Waiting({ onCancel }: WaitingProps) {return (<><AuthHeader />- <View style={{ gap: space.s3, alignItems: "flex-start", paddingHorizontal: space.s2 }}>+ <View style={{ gap: space.s4, alignItems: "center", paddingHorizontal: space.s2 }}><ActivityIndicator size="large" color={colors.accent} />- <Text variant="heading">{t`Finish signing in in the browser`}</Text>- <Text color="ink2">{t`When you're done, the browser closes and you come back here.`}</Text>- <Button label={t`Cancel`} variant="secondary" onPress={onCancel} />+ <Text variant="heading" align="center">{t`Finish signing in in the browser`}</Text>+ <Text color="ink2" align="center">{t`When you're done, the browser closes and you come back here.`}</Text>+ <View style={{ alignSelf: "center" }}>+ <Button label={t`Cancel`} variant="secondary" onPress={onCancel} />+ </View></View></>);diff --git a/apps/mobile/src/auth/auth-header.tsx b/apps/mobile/src/auth/auth-header.tsxindex f6008f559..f5906f08f 100644--- a/apps/mobile/src/auth/auth-header.tsx+++ b/apps/mobile/src/auth/auth-header.tsx@@ -1,7 +1,8 @@import { useLingui } from "@lingui/react/macro";+import { Image } from "expo-image";import { openBrowserAsync } from "expo-web-browser";import { View } from "react-native";-import { Button, Icon, Text, showToast, useTheme } from "@/ui";+import { Button, Text, showToast, useTheme } from "@/ui";type AuthHeaderProps = {subtitle?: string | undefined;@@ -10,26 +11,36 @@ type AuthHeaderProps = {/** The app mark and name at the top of the sign-in screens. */export function AuthHeader({ subtitle }: AuthHeaderProps) {const { t } = useLingui();- const { colors, radius, space } = useTheme();+ const { radius, space } = useTheme();return (- <View style={{ gap: space.s3, paddingTop: space.s6, paddingHorizontal: space.s2 }}>- <View+ <View style={{ alignItems: "center", gap: space.s4, paddingHorizontal: space.s2 }}>+ <Image+ source={require("../../assets/icon.png")}+ accessible={false}style={{- width: 52,- height: 52,+ width: space.s12 * 2,+ height: space.s12 * 2,borderRadius: radius.r2xl,- alignItems: "center",- justifyContent: "center",- backgroundColor: colors.accent,+ marginBottom: space.s2,}}- >- <Icon name="file-text" filled size={28} color={colors.onAccent} />- </View>- <Text variant="display" accessibilityRole="header">+ />+ <Text variant="display" align="center" accessibilityRole="header">{t`Reactive Resume`}</Text>- {subtitle ? <Text color="ink2">{subtitle}</Text> : null}+ {subtitle ? (+ <Text color="ink2" align="center">+ {subtitle}+ </Text>+ ) : null}+ </View>+ );+}++export function PrivacyPolicyLink() {+ const { t } = useLingui();+ return (+ <View style={{ alignSelf: "center" }}><Buttonlabel={t`Privacy policy`}variant="link"diff --git a/apps/mobile/src/features/workspace/parts.tsx b/apps/mobile/src/features/workspace/parts.tsxindex 4a189f463..e18a3a2e3 100644--- a/apps/mobile/src/features/workspace/parts.tsx+++ b/apps/mobile/src/features/workspace/parts.tsx@@ -5,7 +5,7 @@ import type { GenerateTask, WorkspaceTab } from "@reactive-resume/schema/career"import type { ReactNode } from "react";import { t } from "@lingui/core/macro";import { useLingui } from "@lingui/react/macro";-import { useEffect, useState } from "react";+import { Children, useEffect, useState } from "react";import { ActivityIndicator, Pressable, View } from "react-native";import { AIProviderSetupSheet, useHasAIProvider } from "@/features/ai/providers";import { ReportAiContent } from "@/features/ai/report-content";@@ -158,12 +158,26 @@ export function StatusPill({ status }: { status: EvidenceStatus }) {}/** Names exactly what an AI action sends, and where. */-export function PrivacyLine({ children }: { children: string }) {+type PrivacyLineProps = { children: string; centered?: boolean };++export function PrivacyLine({ children, centered = false }: PrivacyLineProps) {const { colors, size, space } = useTheme();return (- <View style={{ flexDirection: "row", gap: space.s1 }}>+ <View+ style={{+ width: centered ? "100%" : undefined,+ flexDirection: centered ? "column" : "row",+ alignItems: centered ? "center" : "flex-start",+ gap: space.s1,+ }}+ ><Icon name="lock" size={size.icon.meta} color={colors.ink3} />- <Text variant="caption" color="ink3" style={{ flex: 1 }}>+ <Text+ variant="caption"+ color="ink3"+ align={centered ? "center" : undefined}+ style={centered ? undefined : { flex: 1 }}+ >{children}</Text></View>@@ -174,7 +188,9 @@ export function PrivacyLine({ children }: { children: string }) {* Where an AI button's data goes, or, with no usable connection, a button that adds one in place. Tabs show their AI* buttons only when `useHasAIProvider().defaultProvider` is set.*/-export function AiNotice({ sends }: { sends?: string | undefined }) {+type AiNoticeProps = { sends?: string | undefined; centered?: boolean };++export function AiNotice({ sends, centered = false }: AiNoticeProps) {const { t } = useLingui();const connection = useHasAIProvider();const [setup, setSetup] = useState(false);@@ -198,7 +214,7 @@ export function AiNotice({ sends }: { sends?: string | undefined }) {const label = provider.label;return (<>- <PrivacyLine>+ <PrivacyLine centered={centered}>{sends ??t`Sends this application's posting, notes and documents, plus Knowledge that's switched on, to ${label}.`}</PrivacyLine>@@ -232,7 +248,13 @@ export function EmptyNotice({ title, message, children }: EmptyNoticeProps) {{message}</Text>) : null}- {children}+ {Children.map(children, (child) => (+ <View+ style={{ width: "100%", flexDirection: "row", flexWrap: "wrap", justifyContent: "center", gap: space.s3 }}+ >+ {child}+ </View>+ ))}</View>);}diff --git a/apps/mobile/src/features/workspace/tabs/fit.tsx b/apps/mobile/src/features/workspace/tabs/fit.tsxindex 50c50d1fe..680bfb758 100644--- a/apps/mobile/src/features/workspace/tabs/fit.tsx+++ b/apps/mobile/src/features/workspace/tabs/fit.tsx@@ -48,7 +48,7 @@ function Fit({ application, version }: WorkspaceTabProps) {title={t`Check this role against your evidence`}message={t`Each requirement in the posting is checked against the facts and stories in your Knowledge. Gaps show as missing evidence, never missing ability.`}>- <AiNotice />+ <AiNotice centered />{provider ? (<Button icon="list-checks" label={checkLabel} loading={generate.isPending} onPress={check} />) : null}diff --git a/apps/mobile/src/features/workspace/tabs/prepare.tsx b/apps/mobile/src/features/workspace/tabs/prepare.tsxindex 080f4115d..a8b543335 100644--- a/apps/mobile/src/features/workspace/tabs/prepare.tsx+++ b/apps/mobile/src/features/workspace/tabs/prepare.tsx@@ -98,12 +98,12 @@ function PlanEmpty({ application, interview }: PlanEmptyProps) {loading={generate.isPending}onPress={() => void generate.run({ task: "briefing", interviewId: interview.id }).catch(() => undefined)}/>- <PrivacyLine>+ <PrivacyLine centered>{t`Sends this application (posting, notes, interview details) and Knowledge that's switched on to ${name}.`}</PrivacyLine></>) : (- <AiNotice />+ <AiNotice centered />)}</EmptyNotice>);diff --git a/apps/web/src/features/auth/native-callback.test.tsx b/apps/web/src/features/auth/native-callback.test.tsxnew file mode 100644index 000000000..e65fae5a0--- /dev/null+++ b/apps/web/src/features/auth/native-callback.test.tsx@@ -0,0 +1,77 @@+// @vitest-environment happy-dom++import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { i18n } from "@lingui/core";+import { I18nProvider } from "@lingui/react";+import { androidCallbackIntent } from "./native-callback";+import { Route } from "@/routes/auth/native-callback";++const response = "?code=one%2Btwo%26three&state=state%2Fvalue&iss=https%3A%2F%2Fresume.example%2Fapi%2Fauth";+const intent = `intent://rxresu.me/auth/native-callback${response}#Intent;scheme=https;package=me.rxresu;end`;++beforeEach(() => {+ i18n.loadAndActivate({ locale: "en-US", messages: {} });+ window.history.replaceState(null, "", `/auth/native-callback${response}`);+ vi.spyOn(navigator, "userAgent", "get").mockReturnValue("Mozilla/5.0 (Linux; Android 17)");+ vi.spyOn(window.location, "assign").mockImplementation(() => {});+});++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+});++function renderCallback() {+ const Callback = Route.options.component;+ if (!Callback) throw new Error("Native callback route needs a component.");+ return render(+ <I18nProvider i18n={i18n}>+ <Callback />+ </I18nProvider>,+ );+}++describe("native sign-in browser fallback", () => {+ it("opens the Android package directly and keeps the OAuth response out of markup", () => {+ const { container } = renderCallback();+ expect(window.location.assign).toHaveBeenCalledExactlyOnceWith(intent);+ expect(container.innerHTML).not.toContain("code=");+ expect(container.innerHTML).not.toContain("state=");+ });++ it("can retry with a user gesture when the browser blocks automatic opening", () => {+ renderCallback();+ vi.mocked(window.location.assign).mockClear();+ fireEvent.click(screen.getByRole("link", { name: "Try opening the app again" }));+ expect(window.location.assign).toHaveBeenCalledExactlyOnceWith(intent);+ });++ it("returns OAuth errors to the app too", () => {+ window.history.replaceState(null, "", "/auth/native-callback?error=access_denied&state=cancelled");+ renderCallback();+ expect(window.location.assign).toHaveBeenCalledExactlyOnceWith(+ "intent://rxresu.me/auth/native-callback?error=access_denied&state=cancelled#Intent;scheme=https;package=me.rxresu;end",+ );+ });++ it("retains the iOS HTTPS callback without automatically reopening it", () => {+ vi.spyOn(navigator, "userAgent", "get").mockReturnValue("Mozilla/5.0 (iPhone)");+ renderCallback();+ expect(window.location.assign).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole("link", { name: "Try opening the app again" }));+ expect(window.location.assign).toHaveBeenCalledExactlyOnceWith(window.location.href);+ });++ it("does not automatically launch the app without an authorization response", () => {+ window.history.replaceState(null, "", "/auth/native-callback");+ renderCallback();+ expect(window.location.assign).not.toHaveBeenCalled();+ });++ it("keeps untrusted query values inside the fixed callback and package", () => {+ expect(androidCallbackIntent("?code=x#Intent;scheme=evil;package=other;end")).toBe(+ "intent://rxresu.me/auth/native-callback?code=x%23Intent;scheme=evil;package=other;end#Intent;scheme=https;package=me.rxresu;end",+ );+ });+});diff --git a/apps/web/src/features/auth/native-callback.ts b/apps/web/src/features/auth/native-callback.tsnew file mode 100644index 000000000..b40161b71--- /dev/null+++ b/apps/web/src/features/auth/native-callback.ts@@ -0,0 +1,6 @@+/** Explicit Android package intent bypasses disabled App Links, retaining the registered HTTPS OAuth response. */+export function androidCallbackIntent(search: string): string {+ const callback = new URL("https://rxresu.me/auth/native-callback");+ callback.search = search;+ return `intent://${callback.host}${callback.pathname}${callback.search}#Intent;scheme=https;package=me.rxresu;end`;+}diff --git a/apps/web/src/routes/auth/native-callback.tsx b/apps/web/src/routes/auth/native-callback.tsxindex be7f529f4..b5ad9a5bb 100644--- a/apps/web/src/routes/auth/native-callback.tsx+++ b/apps/web/src/routes/auth/native-callback.tsx@@ -1,11 +1,26 @@import { Trans } from "@lingui/react/macro";import { createFileRoute } from "@tanstack/react-router";+import { useEffect } from "react";+import { androidCallbackIntent } from "@/features/auth/native-callback";export const Route = createFileRoute("/auth/native-callback")({component: NativeCallbackPage,});+function openApp() {+ // Build only at navigation time: authorization codes must never enter rendered markup.+ window.location.assign(+ /Android/i.test(navigator.userAgent) ? androidCallbackIntent(window.location.search) : window.location.href,+ );+}+function NativeCallbackPage() {+ useEffect(() => {+ const params = new URLSearchParams(window.location.search);+ if (/Android/i.test(navigator.userAgent) && params.has("state") && (params.has("code") || params.has("error")))+ openApp();+ }, []);+return (<div className="space-y-4 text-center"><h1 className="text-xl font-semibold">@@ -19,8 +34,7 @@ function NativeCallbackPage() {className="inline-flex min-h-11 items-center underline underline-offset-4"onClick={(event) => {event.preventDefault();- // Keep the authorization response out of rendered markup.- window.location.assign(window.location.href);+ openApp();}}><Trans>Try opening the app again</Trans>diff --git a/docs/contributing/mobile-release-handoff.md b/docs/contributing/mobile-release-handoff.mdindex 0ceb86ede..b6aec20fb 100644--- a/docs/contributing/mobile-release-handoff.md+++ b/docs/contributing/mobile-release-handoff.md@@ -119,6 +119,7 @@ Protected Apple deployment values are local at `/Users/amruth/.config/rxresu/app- [ ] `/.well-known/apple-app-site-association` returns valid JSON with the expected team/app association.- [ ] `/.well-known/assetlinks.json` returns valid JSON containing package and Play signing fingerprint above. At the last live check on 2026-10-17, **both association URLs returned plain `OK`**, so HTTP 200 alone is insufficient.- [ ] A fresh store-installed app completes browser login and opens `/auth/native-callback` in the app; test cancellation and an expired session too.+- [ ] Repeat Android browser login with **Open supported links** disabled. The callback page targets package `me.rxresu` through an Android intent while retaining the registered HTTPS callback and its OAuth query. If the browser blocks automatic opening, **Try opening the app again** must finish the handoff with a tap. This web fallback also supports existing store binaries; native sign-in still validates state, issuer and PKCE.- [ ] Private reports persist in production and are visible to the authorized operator. Verify export includes the account's reports.- [ ] Test erasure with a separately created disposable account, including attachments/provider tokens and report cascade. Keep the primary reviewer account available.- [ ] Public support/privacy/deletion URLs show the final instructions, retention details, contact information, and shared-content policy.