From 1b9b9cbd5c96b4be05c64c4b18e4cb5e8b31290a Mon Sep 17 00:00:00 2001 From: Davide Date: Wed, 13 Nov 2024 12:11:29 +0100 Subject: [PATCH] Import initial remote profiles (#859) Crucial on clean install. --- .../CommonLibrary/Business/ProfileManager.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift b/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift index fa8c43dd..043443b4 100644 --- a/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift +++ b/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift @@ -352,7 +352,7 @@ extension ProfileManager { let newRepository = remoteRepositoryBlock(isRemoteImportingEnabled) let initialProfiles = try await newRepository.fetchProfiles() - reloadRemoteProfiles(initialProfiles, importing: false) + reloadRemoteProfiles(initialProfiles) remoteRepository = newRepository remoteRepository? @@ -360,7 +360,7 @@ extension ProfileManager { .dropFirst() .receive(on: DispatchQueue.main) .sink { [weak self] in - self?.reloadRemoteProfiles($0, importing: true) + self?.reloadRemoteProfiles($0) } .store(in: &remoteSubscriptions) } @@ -393,7 +393,7 @@ private extension ProfileManager { } } - func reloadRemoteProfiles(_ result: [Profile], importing: Bool) { + func reloadRemoteProfiles(_ result: [Profile]) { pp_log(.App.profiles, .info, "Reload remote profiles: \(result.map(\.id))") allRemoteProfiles = result.reduce(into: [:]) { $0[$1.id] = $1 @@ -402,10 +402,6 @@ private extension ProfileManager { waitingObservers.remove(.remote) } - guard importing else { - return - } - Task.detached { [weak self] in guard let self else { return