Skip to content

Commit

Permalink
Capture AppStateManager to avoid handling weak self
Browse files Browse the repository at this point in the history
  • Loading branch information
Pietro Caselani committed Dec 16, 2019
1 parent cc9d107 commit a43803a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions CouchTrackerCore/TraktLogin/TraktLoginService.swift
Expand Up @@ -17,12 +17,10 @@ public final class TraktLoginService: TraktLoginInteractor {

public func allowedToProcess(request: URLRequest) -> Completable {
return policyDecider.allowedToProceed(with: request)
.flatMapCompletable { [weak self] result -> Completable in
guard let strongSelf = self else { return Completable.empty() }

.flatMapCompletable { [appStateManager] result -> Completable in
guard result == .authenticated else { return Completable.empty() }

return strongSelf.appStateManager.login()
return appStateManager.login()
}
}
}

0 comments on commit a43803a

Please sign in to comment.