mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-31 13:02:11 +00:00
Save current profile one way
Skip updating currentProfile.value when intentionally saving current profile.
This commit is contained in:
parent
03cb05da7e
commit
56fa161e92
@ -185,7 +185,7 @@ extension ProfileManager {
|
|||||||
return profile
|
return profile
|
||||||
}
|
}
|
||||||
|
|
||||||
public func saveProfile(_ profile: Profile, isActive: Bool?) {
|
public func saveProfile(_ profile: Profile, isActive: Bool?, updateIfCurrent: Bool = true) {
|
||||||
guard !profile.isPlaceholder else {
|
guard !profile.isPlaceholder else {
|
||||||
assertionFailure("Placeholder")
|
assertionFailure("Placeholder")
|
||||||
return
|
return
|
||||||
@ -204,8 +204,8 @@ extension ProfileManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMPORTANT: refresh live copy if just saved
|
// IMPORTANT: refresh live copy if just saved (e.g. via intents)
|
||||||
if isCurrentProfile(profile.id) {
|
if updateIfCurrent && isCurrentProfile(profile.id) {
|
||||||
pp_log.info("Saved profile is also current profile, updating...")
|
pp_log.info("Saved profile is also current profile, updating...")
|
||||||
currentProfile.value = profile
|
currentProfile.value = profile
|
||||||
}
|
}
|
||||||
@ -309,14 +309,7 @@ extension ProfileManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func saveCurrentProfile() {
|
public func saveCurrentProfile() {
|
||||||
guard !currentProfile.value.isPlaceholder else {
|
saveProfile(currentProfile.value, isActive: nil, updateIfCurrent: false)
|
||||||
pp_log.debug("No current profile or deleted, not persisting")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
saveProfile(
|
|
||||||
currentProfile.value,
|
|
||||||
isActive: currentProfile.value.id == activeProfileId
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user