From 9467c80e867cbb7b9064818b964e662d25953a2f Mon Sep 17 00:00:00 2001 From: Arul Sharma <31745423+arul28@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:25:48 -0400 Subject: [PATCH 1/2] fix(account): support sign in or account creation --- .../components/account/AccountPage.test.tsx | 44 ++++++ .../components/account/AccountPage.tsx | 51 ++----- .../renderer/components/app/TabNav.test.tsx | 2 +- .../src/renderer/components/app/TabNav.tsx | 6 +- apps/ios/ADE.xcodeproj/project.pbxproj | 8 ++ .../ADE/Services/AccountEmailAuthFlow.swift | 59 ++++++++ apps/ios/ADE/Services/AccountService.swift | 68 +++++++-- .../Account/AccountConnectionsSection.swift | 14 +- .../ADE/Views/Account/AccountSignInView.swift | 22 +-- .../ADETests/AccountEmailAuthFlowTests.swift | 134 ++++++++++++++++++ docs/ARCHITECTURE.md | 2 +- .../sync-and-multi-device/ios-companion.md | 11 ++ 12 files changed, 351 insertions(+), 70 deletions(-) create mode 100644 apps/desktop/src/renderer/components/account/AccountPage.test.tsx create mode 100644 apps/ios/ADE/Services/AccountEmailAuthFlow.swift create mode 100644 apps/ios/ADETests/AccountEmailAuthFlowTests.swift diff --git a/apps/desktop/src/renderer/components/account/AccountPage.test.tsx b/apps/desktop/src/renderer/components/account/AccountPage.test.tsx new file mode 100644 index 000000000..63417f03d --- /dev/null +++ b/apps/desktop/src/renderer/components/account/AccountPage.test.tsx @@ -0,0 +1,44 @@ +/* @vitest-environment jsdom */ + +import React from "react"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { cleanup, fireEvent, render, screen } from "@testing-library/react"; +import { SignInCard } from "./AccountPage"; + +const beginLogin = vi.fn(async () => undefined); + +vi.mock("../../lib/accountLogin", () => ({ + useAccountLogin: () => ({ + phase: "idle", + error: null, + beginLogin, + cancel: vi.fn(), + }), +})); + +describe("AccountPage signed-out card", () => { + afterEach(() => { + cleanup(); + beginLogin.mockClear(); + }); + + it("presents one truthful browser action with combined account language", () => { + render(); + + expect(screen.getByText("Continue to ADE")).toBeTruthy(); + expect(screen.getByText(/account is created automatically/i)).toBeTruthy(); + expect(screen.getByText(/browser page offers the sign-in methods enabled for ADE/i)).toBeTruthy(); + expect(screen.queryByRole("button", { name: /Continue with/i })).toBeNull(); + + fireEvent.click(screen.getByRole("button", { name: "Continue in browser" })); + expect(beginLogin).toHaveBeenCalledTimes(1); + }); + + it("keeps local pairing explicitly available without an account", () => { + render(); + + expect(screen.getByText(/Account access isn't set up on this machine yet/i)).toBeTruthy(); + expect(screen.getByText("Local pairing works without an account.")).toBeTruthy(); + expect(screen.getByRole("button", { name: "Continue in browser" }).hasAttribute("disabled")).toBe(true); + }); +}); diff --git a/apps/desktop/src/renderer/components/account/AccountPage.tsx b/apps/desktop/src/renderer/components/account/AccountPage.tsx index 1cb177546..b9882dd64 100644 --- a/apps/desktop/src/renderer/components/account/AccountPage.tsx +++ b/apps/desktop/src/renderer/components/account/AccountPage.tsx @@ -1,14 +1,11 @@ import { useCallback, useEffect, useMemo, useState } from "react"; import { useNavigate } from "react-router-dom"; import { - AppleLogo, ArrowRight, CircleNotch, DesktopTower, DeviceMobile, - EnvelopeSimple, GithubLogo, - GoogleLogo, Laptop, ShieldCheck, SignOut, @@ -98,7 +95,7 @@ const sectionLabelStyle: CSSProperties = { // Signed-out: the rich sign-in card. // --------------------------------------------------------------------------- -function SignInCard({ +export function SignInCard({ configured, onSignedIn, }: { @@ -110,21 +107,15 @@ function SignInCard({ }); const busy = phase === "starting" || phase === "awaiting"; - const secondary: Array<{ label: string; icon: JSX.Element }> = [ - { label: "Email", icon: }, - { label: "Apple", icon: }, - { label: "Google", icon: }, - ]; - return (
ADE
- Sign in to ADE + Continue to ADE
- One identity for your machines, mobile, and web sessions — so they find each other wherever you are. + Choose a sign-in method in your browser. If you're new, your ADE account is created automatically.
@@ -147,7 +138,7 @@ function SignInCard({ > - Account sign-in isn't set up on this machine yet. You can still pair machines, phones, and web + Account access isn't set up on this machine yet. You can still pair machines, phones, and web clients from Connections.
@@ -170,35 +161,11 @@ function SignInCard({ }), }} > - {busy ? : } - Continue with GitHub + {busy ? : } + Continue in browser - -
-
- or continue with -
-
- -
- {secondary.map((option) => ( - - ))} +
+ The browser page offers the sign-in methods enabled for ADE.
@@ -218,7 +185,7 @@ function SignInCard({ > - Finish signing in in your browser… + Finish in your browser…