Skip to content

Comments

fix: add authentication callback#3

Merged
sirily11 merged 1 commit intomainfrom
callback
Feb 8, 2026
Merged

fix: add authentication callback#3
sirily11 merged 1 commit intomainfrom
callback

Conversation

@sirily11
Copy link
Contributor

@sirily11 sirily11 commented Feb 8, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 8, 2026 08:59
@sirily11 sirily11 enabled auto-merge (squash) February 8, 2026 08:59
@autopilot-project-manager autopilot-project-manager bot added the bug Something isn't working label Feb 8, 2026
@sirily11 sirily11 merged commit 5211341 into main Feb 8, 2026
6 checks passed
@sirily11 sirily11 deleted the callback branch February 8, 2026 09:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional authentication callbacks to RxSignInView so integrators can react to sign-in success/failure from SwiftUI, and documents the new API in the README.

Changes:

  • Add onAuthSuccess / onAuthFailed callback parameters to both RxSignInView initializers.
  • Invoke callbacks after manager.authenticate() completes or throws.
  • Update README usage examples to show callback-based integration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Sources/RxAuthSwiftUI/RxSignInView.swift Adds callback properties/initializers and calls them from the sign-in button action.
README.md Documents new callback parameters with usage examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 75 to 81
Task {
do {
try await manager.authenticate()
onAuthSuccess?()
} catch {
// Error is handled by the manager
onAuthFailed?(error)
}
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Task { ... } created here is not guaranteed to run on MainActor. After await manager.authenticate() returns, execution can resume off-main, so onAuthSuccess/onAuthFailed may be invoked on a background executor (problematic for UI/navigation work). Make the task main-actor isolated (e.g., Task { @MainActor in ... }) or dispatch the callback invocations back to MainActor.

Copilot uses AI. Check for mistakes.
Comment on lines 13 to 18
public init(
manager: OAuthManager,
appearance: RxSignInAppearance = RxSignInAppearance()
appearance: RxSignInAppearance = RxSignInAppearance(),
onAuthSuccess: (() -> Void)? = nil,
onAuthFailed: ((Error) -> Void)? = nil
) where Header == Never {
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onAuthSuccess/onAuthFailed are stored on the view, so the corresponding initializer parameters need to be @escaping (otherwise this won’t compile under Swift’s non-escaping default). Given Swift 6 strict concurrency, also consider annotating these callback types as @MainActor/@Sendable so they can be safely captured from the Task used by the button action.

Copilot uses AI. Check for mistakes.
Comment on lines 28 to 33
public init(
manager: OAuthManager,
appearance: RxSignInAppearance = RxSignInAppearance(),
onAuthSuccess: (() -> Void)? = nil,
onAuthFailed: ((Error) -> Void)? = nil,
@ViewBuilder header: () -> Header
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as the simple init: onAuthSuccess/onAuthFailed are stored properties, so these parameters should be @escaping (and ideally @MainActor/@Sendable in Swift 6) to avoid compile-time escaping/sendability errors when captured by Task.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant