This commit is contained in:
Thomas Ricouard 2023-01-24 06:56:28 +01:00
parent ffe1a1dba0
commit dd5e6b91c0
3 changed files with 16 additions and 16 deletions

View file

@ -76,7 +76,7 @@ struct ConversationMessageView: View {
}
}
.onAppear {
isLiked = message.favorited == true
isLiked = message.favourited == true
}
}
@ -102,7 +102,7 @@ struct ConversationMessageView: View {
status = try await client.post(endpoint: Statuses.favorite(id: message.id))
}
withAnimation {
isLiked = status.favorited == true
isLiked = status.favourited == true
}
} catch { }
}

View file

@ -36,9 +36,9 @@ public protocol AnyStatus {
var mentions: [Mention] { get }
var repliesCount: Int { get }
var reblogsCount: Int { get }
var favoritesCount: Int { get }
var favouritesCount: Int { get }
var card: Card? { get }
var favorited: Bool? { get }
var favourited: Bool? { get }
var reblogged: Bool? { get }
var pinned: Bool? { get }
var bookmarked: Bool? { get }
@ -77,9 +77,9 @@ public struct Status: AnyStatus, Decodable, Identifiable, Equatable, Hashable {
public let mentions: [Mention]
public let repliesCount: Int
public let reblogsCount: Int
public let favoritesCount: Int
public let favouritesCount: Int
public let card: Card?
public let favorited: Bool?
public let favourited: Bool?
public let reblogged: Bool?
public let pinned: Bool?
public let bookmarked: Bool?
@ -105,9 +105,9 @@ public struct Status: AnyStatus, Decodable, Identifiable, Equatable, Hashable {
mentions: [],
repliesCount: 0,
reblogsCount: 0,
favoritesCount: 0,
favouritesCount: 0,
card: nil,
favorited: false,
favourited: false,
reblogged: false,
pinned: false,
bookmarked: false,
@ -150,9 +150,9 @@ public struct ReblogStatus: AnyStatus, Decodable, Identifiable, Equatable, Hasha
public let mentions: [Mention]
public let repliesCount: Int
public let reblogsCount: Int
public let favoritesCount: Int
public let favouritesCount: Int
public let card: Card?
public let favorited: Bool?
public let favourited: Bool?
public let reblogged: Bool?
public let pinned: Bool?
public let bookmarked: Bool?

View file

@ -44,17 +44,17 @@ public class StatusRowViewModel: ObservableObject {
self.isRemote = isRemote
self.showActions = showActions
if let reblog = status.reblog {
isFavorited = reblog.favorited == true
isFavorited = reblog.favourited == true
isReblogged = reblog.reblogged == true
isPinned = reblog.pinned == true
isBookmarked = reblog.bookmarked == true
} else {
isFavorited = status.favorited == true
isFavorited = status.favourited == true
isReblogged = status.reblogged == true
isPinned = status.pinned == true
isBookmarked = status.bookmarked == true
}
favoritesCount = status.reblog?.favoritesCount ?? status.favoritesCount
favoritesCount = status.reblog?.favouritesCount ?? status.favouritesCount
reblogsCount = status.reblog?.reblogsCount ?? status.reblogsCount
repliesCount = status.reblog?.repliesCount ?? status.repliesCount
displaySpoiler = !(status.reblog?.spoilerText.asRawText ?? status.spoilerText.asRawText).isEmpty
@ -209,17 +209,17 @@ public class StatusRowViewModel: ObservableObject {
private func updateFromStatus(status: Status) {
if let reblog = status.reblog {
isFavorited = reblog.favorited == true
isFavorited = reblog.favourited == true
isReblogged = reblog.reblogged == true
isPinned = reblog.pinned == true
isBookmarked = reblog.bookmarked == true
} else {
isFavorited = status.favorited == true
isFavorited = status.favourited == true
isReblogged = status.reblogged == true
isPinned = status.pinned == true
isBookmarked = status.bookmarked == true
}
favoritesCount = status.reblog?.favoritesCount ?? status.favoritesCount
favoritesCount = status.reblog?.favouritesCount ?? status.favouritesCount
reblogsCount = status.reblog?.reblogsCount ?? status.reblogsCount
repliesCount = status.reblog?.repliesCount ?? status.repliesCount
}