Skip to content

Commit

Permalink
Save avatar again if saveRoundAvatar is turned on
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Oct 27, 2024
1 parent b0b3b6f commit d2209c6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion Planet/Views/My/MyPlanetEditView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ struct MyPlanetEditView: View {
if !name.trim().isEmpty {
planet.name = name.trim()
}
var resaveAvatar = false
planet.about = about.trim()
planet.domain = domain.trim()
if planet.authorName != authorName {
Expand All @@ -782,7 +783,15 @@ struct MyPlanetEditView: View {
}
}
planet.templateName = templateName
planet.saveRoundAvatar = saveRoundAvatar
if planet.saveRoundAvatar != saveRoundAvatar {
planet.saveRoundAvatar = saveRoundAvatar
if saveRoundAvatar {
// Read the avatar file on disk and resave it
if let avatar = planet.avatar {
resaveAvatar = true
}
}
}
planet.doNotIndex = doNotIndex
planet.plausibleEnabled = plausibleEnabled
planet.plausibleDomain = plausibleDomain.trim()
Expand All @@ -809,6 +818,16 @@ struct MyPlanetEditView: View {
Task {
planet.updateTemplateSettings(settings: userSettings)
try planet.save()
if resaveAvatar {
Task.detached {
do {
try planet.updateAvatar(path: planet.publicAvatarPath)
}
catch {
debugPrint("failed to save circularized avatar image: \(error)")
}
}
}
Task(priority: .background) {
try await planet.rebuild()
}
Expand Down
2 changes: 1 addition & 1 deletion Planet/versioning.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 2277
CURRENT_PROJECT_VERSION = 2282

0 comments on commit d2209c6

Please sign in to comment.