Skip to content

Commit

Permalink
Fix settings preview
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentTreguier committed Sep 30, 2024
1 parent e202a9d commit 6e79e69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 0 additions & 13 deletions Fyreplace/Views/Screens/SettingsScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,6 @@ struct SettingsScreen: View, SettingsScreenProtocol {
}
}
}

private func updateAvatar(with item: PhotosPickerItem) async {
if let data = try? await item.loadTransferable(type: Data.self) {
await updateAvatar(with: data)
} else {
eventBus.send(
.failure(
title: "Settings.Error.Image.Title",
text: "Settings.Error.Image.Message"
)
)
}
}
}

#Preview {
Expand Down
13 changes: 13 additions & 0 deletions Fyreplace/Views/Screens/SettingsScreenProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ extension SettingsScreenProtocol {
}
}

func updateAvatar(with item: PhotosPickerItem) async {
if let data = try? await item.loadTransferable(type: Data.self) {
await updateAvatar(with: data)
} else {
eventBus.send(
.failure(
title: "Settings.Error.Image.Title",
text: "Settings.Error.Image.Message"
)
)
}
}

func updateAvatar(with data: Data) async {
await call {
let response = try await api.setCurrentUserAvatar(body: .binary(.init(data)))
Expand Down

0 comments on commit 6e79e69

Please sign in to comment.