Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(auth): show Apple sign-in on Windows and Linux (#1757)

Guo Yi9fd9e107db93
diff --git a/src/components/AuthenticationStep.tsx b/src/components/AuthenticationStep.tsx
index 2587b7f64..22d0aec71 100644
--- a/src/components/AuthenticationStep.tsx
+++ b/src/components/AuthenticationStep.tsx
@@ -18,7 +18,6 @@ import { AlertCircle, ArrowRight, Building2, Check, Loader2, ChevronLeft } from
import logger from "../utils/logger";
import { EMAIL_REGEX } from "../utils/validation";
import { useDebouncedCallback } from "../hooks/useDebouncedCallback";
-import { getCachedPlatform } from "../utils/platform";
import ForgotPasswordView from "./ForgotPasswordView";
import { CompactOnboardingFrame } from "./onboarding/OnboardingShell";
import {
@@ -166,7 +165,6 @@ export default function AuthenticationStep({
const [error, setError] = useState<string | null>(null);
const [forgotPasswordOpen, setForgotPasswordOpen] = useState(false);
const [oauthProtocolRegistered, setOauthProtocolRegistered] = useState(true);
- const isMacOS = getCachedPlatform() === "darwin";
const needsVerificationRef = useRef(false);
@@ -775,17 +773,13 @@ export default function AuthenticationStep({
onClick: () => handleSocialSignIn("google"),
loading: isSocialLoading === "google",
},
- ...(isMacOS
- ? [
- {
- id: "apple",
- label: "Apple",
- icon: AppleIcon,
- onClick: () => handleSocialSignIn("apple"),
- loading: isSocialLoading === "apple",
- },
- ]
- : []),
+ {
+ id: "apple",
+ label: "Apple",
+ icon: AppleIcon,
+ onClick: () => handleSocialSignIn("apple"),
+ loading: isSocialLoading === "apple",
+ },
{
id: "microsoft",
label: "Microsoft",
diff --git a/test/components/authenticationStep.test.js b/test/components/authenticationStep.test.js
index 1e1ed1126..482f2b4a8 100644
--- a/test/components/authenticationStep.test.js
+++ b/test/components/authenticationStep.test.js
@@ -16,6 +16,7 @@ function createHarness() {
refCursor: 0,
values: {},
refs: {},
+ socialSignIns: [],
effects: [],
cleanups: [],
debouncedCalls: 0,
@@ -74,7 +75,7 @@ async function settleAsyncHandler() {
await new Promise((resolve) => setImmediate(resolve));
}
-test("email authentication discovers accounts, restores drafts, and persists them once per pause", async (t) => {
+async function createAuthenticationRenderer(t) {
installBrowserGlobals(t, { window: { electronAPI: {} } });
// The compact Back control is portalled to body (it has to out-stack the
// onboarding shell's drag band), so rendering reads document.body.
@@ -153,7 +154,10 @@ test("email authentication discovers accounts, restores drafts, and persists the
},
signIn: { async email() { return {}; } },
};
- export async function signInWithSocial() { return {}; }
+ export async function signInWithSocial(provider) {
+ globalThis.__authenticationStepHarness.socialSignIns.push(provider);
+ return {};
+ }
export async function signInWithSSO(email) {
const harness = globalThis.__authenticationStepHarness;
harness.ssoCalls.push(email);
@@ -178,6 +182,8 @@ test("email authentication discovers accounts, restores drafts, and persists the
return children;
}`,
"/utils/logger": `export default { error() {} };`,
+ // Off-macOS on purpose: a platform gate around a provider fails the
+ // Apple sign-in test instead of passing on the Node default.
"/utils/platform": `export function getCachedPlatform() { return "linux"; }`,
"/ForgotPasswordView": `export default function ForgotPasswordView() { return null; }`,
"/OnboardingShell": `
@@ -226,6 +232,12 @@ test("email authentication discovers accounts, restores drafts, and persists the
return render(harness, overrides);
};
+ return { render, typeEmail, submitEmail };
+}
+
+test("email authentication discovers accounts, restores drafts, and persists them once per pause", async (t) => {
+ const { render, typeEmail, submitEmail } = await createAuthenticationRenderer(t);
+
const existingAccount = createHarness();
existingAccount.discoveryResult = { exists: true };
const signIn = await submitEmail(existingAccount, "[email protected]");
@@ -400,3 +412,21 @@ test("email authentication discovers accounts, restores drafts, and persists the
{ authMode: null, email: "[email protected]", fullName: "", ssoDiscovery: null },
]);
});
+
+test("Apple sign-in is offered off macOS and shares the browser sign-in gate", async (t) => {
+ const { render } = await createAuthenticationRenderer(t);
+
+ const harness = createHarness();
+ const appleTile = providerTile(render(harness), "Apple");
+ assert.ok(appleTile, "Apple sign-in should render on Linux");
+ await appleTile.props.onClick();
+ assert.deepEqual(harness.socialSignIns, ["apple"]);
+
+ globalThis.window.electronAPI.getOAuthProtocolRegistered = async () => false;
+ const unregistered = createHarness();
+ render(unregistered);
+ await settleAsyncHandler();
+ const blockedTile = providerTile(render(unregistered), "Apple");
+ assert.equal(blockedTile.props.disabled, true);
+ assert.equal(blockedTile.props.title, "auth.social.protocolUnavailable");
+});