Skip to content

Commit

Permalink
Don’t let the AuthenticationController get deallocated before the aut…
Browse files Browse the repository at this point in the history
…horization completes
  • Loading branch information
whattherestimefor committed Nov 22, 2024
1 parent 6d4e876 commit 7a62a52
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ final class AuthenticationViewModel {
private let stateStreamContinuation: AsyncStream<State>.Continuation

var disposeBag = Set<AnyCancellable>()
var authenticationController: MastodonAuthenticationController?

// input
let input = CurrentValueSubject<String, Never>("")
Expand Down Expand Up @@ -75,9 +76,10 @@ extension AuthenticationViewModel {
do {
let application = try await APIService.shared.createApplication(domain: server.domain)
guard let authenticateInfo = AuthenticateInfo(domain: server.domain, application: application) else { throw AuthenticationError.badCredentials }
let authenticationController = MastodonAuthenticationController(
authenticationController = MastodonAuthenticationController(
authenticateURL: authenticateInfo.authorizeURL
)
guard let authenticationController else { return }
authenticationController.authenticationSession?.presentationContextProvider = contextProvider
authenticate(
info: authenticateInfo,
Expand Down

0 comments on commit 7a62a52

Please sign in to comment.