Skip to content
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

fix: Public share link behaviour on login and logout #1394

Merged
merged 4 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kDrive/UI/Controller/LoginDelegateHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import kDriveCore
import kDriveResources

public final class LoginDelegateHandler: InfomaniakLoginDelegate {
@LazyInjectService var deeplinkService: DeeplinkServiceable
@LazyInjectService var accountManager: AccountManageable
@LazyInjectService var router: AppNavigable

Expand Down Expand Up @@ -64,6 +65,7 @@ public final class LoginDelegateHandler: InfomaniakLoginDelegate {
UserDefaults.shared.legacyIsFirstLaunch = false
UserDefaults.shared.numberOfConnections = 1
_ = router.showMainViewController(driveFileManager: driveFileManager, selectedIndex: nil)
deeplinkService.processDeeplinksPostAuthentication()
}

private func didCompleteLoginWithError(_ error: Error,
Expand Down
3 changes: 3 additions & 0 deletions kDriveCore/Data/Cache/AccountManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public class AccountManager: RefreshTokenDelegate, AccountManageable {
@LazyInjectService var notificationHelper: NotificationsHelpable
@LazyInjectService var networkLogin: InfomaniakNetworkLoginable
@LazyInjectService var appNavigable: AppNavigable
@LazyInjectService var deeplinkService: DeeplinkServiceable

private static let appIdentifierPrefix = Bundle.main.infoDictionary!["AppIdentifierPrefix"] as! String
private static let group = "com.infomaniak.drive"
Expand Down Expand Up @@ -546,6 +547,8 @@ public class AccountManager: RefreshTokenDelegate, AccountManageable {

public func logoutCurrentAccountAndSwitchToNextIfPossible() {
Task { @MainActor in
deeplinkService.clearLastPublicShare()

if let currentAccount {
removeTokenAndAccount(account: currentAccount)
}
Expand Down
2 changes: 1 addition & 1 deletion kDriveCore/Utils/Deeplinks/DeeplinkService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class DeeplinkService: DeeplinkServiceable {
return
}

Task {
Task { @MainActor in
await UniversalLinksHelper.processPublicShareLink(lastPublicShareLink)
clearLastPublicShare()
}
Expand Down
Loading