Skip to content

T-11: Preferences pane — Sign in/out + diagnostic copy #228

@kirich1409

Description

@kirich1409

Description

Create GitHubIntegrationFeature/Views/GitHubPreferencesView.swift:

public struct GitHubPreferencesView: View {
    public let store: StoreOf<GitHubFeature>
    public init(store: StoreOf<GitHubFeature>)
}

States (by auth)

  1. Not signed in (.signedOut):
    • Title "Connect to GitHub", description "Sign in to show CI status for your branches"
    • Button "Sign in with GitHub".signInTapped
    • Scope disclaimer (smaller muted text):
      "Relay will request the repo scope, which grants read and write access to all your repositories. Only read functionality is currently used. We plan to migrate to GitHub Apps with narrower permissions in a future update."
  2. Signing in (.signingIn): ProgressView() + "Authorizing…".
  3. Signed in (.signedIn(info)):
    • "Signed in as @\(login)"
    • Rate limit: "API: \(remaining) / \(limit) requests remaining, resets in \(resetIn)"
    • Buttons: "Sign out" (.signOutTapped), "Refresh now" (.refreshNowTapped(nil)), "Copy diagnostic info"
  4. Error (.error(err)): use preferencesErrorState(for: err) from T-14 — card with title/message/action.

Diagnostic copy

On click, pasteboard receives:

Relay GitHub Integration diagnostic
Date: <ISO8601>
Signed in as: @<login>
Scopes: <repo, ...>
Rate limit: <remaining>/<limit>, resets at <resetAt ISO8601>
Last fetch: <lastFetchedAt> (Xs ago) | null
Last error: <err.humanDescription> | none
Client version: Relay/<bundleVersion>

Never include token, code, state, code_verifier.

Integration

Add "GitHub" section (icon cloud.fill) to existing Settings/Preferences window.

Spec reference

See swarm-report/github-integration-decomposition.md#t-11. Diagnostic copy — sanctioned addition (BA support-load risk).

Relationships

Acceptance criteria

  • Not signed → Sign-in button + scope disclaimer visible
  • Signing in → spinner + "Authorizing…"
  • Signed in → @username + rate limit + 3 buttons
  • Error → card from T-14 with correct action
  • Sign in triggers .signInTapped, Sign out .signOutTapped, Refresh .refreshNowTapped(nil)
  • Copy diagnostic: pasteboard contains expected fields; no substring token, code, verifier, state (unit-tested by grepping pasteboard)
  • VoiceOver: Tab-order natural, all labels set
  • @Preview for 4 auth states

Complexity

M

Suggested agent

developer-workflow:swiftui-developer

Module / Layer

GitHubIntegrationFeature / UI (Views)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions