diff --git a/src/components/AuthenticationStep.tsx b/src/components/AuthenticationStep.tsx index 71545b599..c10b9c17c 100644 --- a/src/components/AuthenticationStep.tsx +++ b/src/components/AuthenticationStep.tsx @@ -14,7 +14,6 @@ import { Button } from "./ui/button"; import { Input } from "./ui/input"; import { AlertCircle, ArrowRight, Building2, Check, Loader2, ChevronLeft } from "lucide-react"; import logger from "../utils/logger"; -import { getCachedPlatform } from "../utils/platform"; import ForgotPasswordView from "./ForgotPasswordView"; import { CompactOnboardingFrame } from "./onboarding/OnboardingShell"; @@ -139,7 +138,6 @@ export default function AuthenticationStep({ const [error, setError] = useState(null); const [forgotPasswordOpen, setForgotPasswordOpen] = useState(false); const [oauthProtocolRegistered, setOauthProtocolRegistered] = useState(true); - const isMacOS = getCachedPlatform() === "darwin"; const needsVerificationRef = useRef(false); @@ -612,17 +610,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 fa6d73e54..b5e43815e 100644 --- a/test/components/authenticationStep.test.js +++ b/test/components/authenticationStep.test.js @@ -15,6 +15,7 @@ function createHarness(values = {}) { refCursor: 0, values, refs: {}, + socialSignIns: [], discoveryCalls: [], discoveryResult: { exists: false }, discoveryError: null, @@ -39,7 +40,7 @@ async function settleAsyncHandler() { await new Promise((resolve) => setImmediate(resolve)); } -test("email authentication discovers accounts before choosing sign-in or sign-up", async (t) => { +test("authentication discovers accounts and exposes Apple sign-in off macOS", async (t) => { installBrowserGlobals(t, { window: { electronAPI: {} } }); t.after(() => { delete globalThis.__authenticationStepHarness; @@ -98,7 +99,10 @@ test("email authentication discovers accounts before choosing sign-in or sign-up }, signIn: { async email() { return {}; } }, }; - export async function signInWithSocial() { return {}; } + export async function signInWithSocial(provider) { + globalThis.__authenticationStepHarness.socialSignIns.push(provider); + return {}; + } export async function signInWithSSO() { return {}; } export function updateLastSignInTime() {} `, @@ -198,4 +202,13 @@ test("email authentication discovers accounts before choosing sign-in or sign-up assert.equal(duplicateRace.values[AUTH_MODE_INDEX], "sign-in"); assert.equal(duplicateRace.values[PASSWORD_INDEX], ""); assert.equal(duplicateRace.values[ERROR_INDEX], "auth.errors.accountExistsSignIn"); + + const linuxSocialSignIn = createHarness(); + const appleProvider = findElement( + render(linuxSocialSignIn), + (node) => node.props?.label === "Apple" && typeof node.props?.onClick === "function" + ); + assert.ok(appleProvider, "Apple sign-in should render on Linux"); + await appleProvider.props.onClick(); + assert.deepEqual(linuxSocialSignIn.socialSignIns, ["apple"]); });