Make edit stickier

This commit is contained in:
Thomas Ricouard 2024-01-01 14:13:25 +01:00
parent b93df71431
commit b10ee3091c
3 changed files with 7 additions and 2 deletions

View file

@ -57,6 +57,7 @@ public final class StatusDataControllerProvider {
public var isReblogged: Bool
public var isBookmarked: Bool
public var isFavorited: Bool
public var content: HTMLString
public var favoritesCount: Int
public var reblogsCount: Int
@ -73,6 +74,7 @@ public final class StatusDataControllerProvider {
reblogsCount = status.reblogsCount
repliesCount = status.repliesCount
favoritesCount = status.favouritesCount
content = status.content
}
public func updateFrom(status: AnyStatus) {
@ -83,6 +85,7 @@ public final class StatusDataControllerProvider {
reblogsCount = status.reblogsCount
repliesCount = status.repliesCount
favoritesCount = status.favouritesCount
content = status.content
}
public func toggleFavorite(remoteStatus: String?) async {

View file

@ -122,6 +122,7 @@ public struct StatusDetailView: View {
let isFocused = self.viewModel.statusId == status.id
StatusRowView(viewModel: viewModel)
.id(status.id + (status.editedAt?.asDate.description ?? ""))
.environment(\.extraLeadingInset, !isCompact ? extraInsets : 0)
.environment(\.indentationLevel, !isCompact ? indentationLevel : 0)
.environment(\.isStatusFocused, isFocused)
@ -135,7 +136,6 @@ public struct StatusDetailView: View {
}
}
}
.id(status.id)
#if !os(visionOS)
.listRowBackground(viewModel.highlightRowColor)
#endif

View file

@ -7,13 +7,15 @@ import SwiftUI
struct StatusRowTextView: View {
@Environment(Theme.self) private var theme
@Environment(\.isStatusFocused) private var isFocused
@Environment(StatusDataController.self) private var statusDataController
var viewModel: StatusRowViewModel
var body: some View {
VStack {
HStack {
EmojiTextApp(viewModel.finalStatus.content,
EmojiTextApp(statusDataController.content,
emojis: viewModel.finalStatus.emojis,
language: viewModel.finalStatus.language,
lineLimit: viewModel.lineLimit)