Import initial remote profiles (#859)

Crucial on clean install.
This commit is contained in:
Davide 2024-11-13 12:11:29 +01:00 committed by GitHub
parent 008b78cc7c
commit 1b9b9cbd5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 7 deletions

View File

@ -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