Read updated profiles from function argument

Coming from a "will" publisher, the value in ProfileRepository is
not up-to-date. Use the function argument instead.

Fixes #367
This commit is contained in:
Davide De Rosa 2023-10-14 19:27:11 +02:00
parent cc6c8a90d7
commit d7f14aa3b4
2 changed files with 6 additions and 3 deletions

View File

@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased ## 2.2.1 (2023-10-14)
### Fixed
- Persisted profile is overwritten with its former value. [#367](https://github.com/passepartoutvpn/passepartout-apple/issues/367)
## 2.2.0 (2023-10-10) ## 2.2.0 (2023-10-10)

View File

@ -371,8 +371,7 @@ extension ProfileManager {
currentProfile.value = .placeholder currentProfile.value = .placeholder
} }
let newProfile = profileRepository.profile(withId: currentProfile.value.id) if let newProfile = newProfiles[currentProfile.value.id], newProfile != currentProfile.value {
if let newProfile = newProfile, newProfile != currentProfile.value {
pp_log.info("Current profile remotely updated") pp_log.info("Current profile remotely updated")
currentProfile.value = newProfile currentProfile.value = newProfile
} }