Skip to content

fix(auth): make AuthClient an Actor #664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 14, 2025
Merged

fix(auth): make AuthClient an Actor #664

merged 4 commits into from
Feb 14, 2025

Conversation

grdsdev
Copy link
Collaborator

@grdsdev grdsdev commented Feb 13, 2025

This pull request includes significant changes to the AuthClient class in Sources/Auth/AuthClient.swift to improve concurrency handling and integrate Combine for handling app lifecycle changes.

Concurrency improvements:

  • Changed AuthClient from a final class to an actor to leverage Swift's concurrency model.

To keep backward compatibility, had to mark a few properties and methods of AuthClient as nonisolated, the nonisolated mark, shall be removed on a next major release.

Combine integration:

Because of the change from class to actor, I had to change the way we observe the notification center.

  • Added Combine import conditionally based on availability.
  • Refactored observeAppLifecycleChanges to use Combine publishers for handling app lifecycle notifications.

These changes improve the concurrency model of AuthClient and modernize the handling of app lifecycle events using Combine.

@grdsdev grdsdev marked this pull request as ready for review February 13, 2025 18:28
@grdsdev grdsdev requested a review from dshukertjr February 13, 2025 18:28
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13312951371

Details

  • 46 of 62 (74.19%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 74.38%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Sources/Auth/AuthClient.swift 46 62 74.19%
Files with Coverage Reduction New Missed Lines %
Sources/Auth/AuthClient.swift 2 88.5%
Totals Coverage Status
Change from base Build 13261463260: -0.1%
Covered Lines: 5011
Relevant Lines: 6737

💛 - Coveralls

@grdsdev grdsdev merged commit bdf1961 into main Feb 14, 2025
23 of 24 checks passed
@grdsdev grdsdev deleted the guilherme/fix-crash-auth branch February 14, 2025 10:24
grdsdev added a commit that referenced this pull request Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants