Fix issue with deleting status from timeline
This commit is contained in:
parent
3755213931
commit
cab647636c
|
@ -172,20 +172,15 @@ public class HomeTimelineService {
|
|||
|
||||
// Collection with statuses to remove from database.
|
||||
var dbStatusesToRemove: [StatusData] = []
|
||||
let allDbStatuses = StatusDataHandler.shared.getAllStatuses(accountId: account.id, viewContext: backgroundContext)
|
||||
|
||||
// Find statuses to delete (older then the last one from API).
|
||||
if let lastStatus = statuses.last {
|
||||
let dbOlderStatuses = StatusDataHandler.shared.getAllOlderStatuses(accountId: account.id,
|
||||
statusId: lastStatus.id,
|
||||
viewContext: backgroundContext)
|
||||
if !dbOlderStatuses.isEmpty {
|
||||
dbStatusesToRemove.append(contentsOf: dbOlderStatuses)
|
||||
}
|
||||
// Find statuses to delete (not exiting in the API results).
|
||||
for dbStatus in allDbStatuses where !statuses.contains(where: { status in status.id == dbStatus.id }) {
|
||||
dbStatusesToRemove.append(dbStatus)
|
||||
}
|
||||
|
||||
// Find statuses to delete (duplicates).
|
||||
var existingStatusIds: [String] = []
|
||||
let allDbStatuses = StatusDataHandler.shared.getAllStatuses(accountId: account.id, viewContext: backgroundContext)
|
||||
for dbStatus in allDbStatuses {
|
||||
if existingStatusIds.contains(where: { $0 == dbStatus.id }) {
|
||||
dbStatusesToRemove.append(dbStatus)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// https://mczachurski.dev
|
||||
// Copyright © 2023 Marcin Czachurski and the repository contributors.
|
||||
// Licensed under the MIT License.
|
||||
// Licensed under the Apache License 2.0.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
|
|
@ -31,7 +31,7 @@ public struct TagWidget: View {
|
|||
.fontWeight(.semibold)
|
||||
}
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.vertical, 6)
|
||||
.padding(.vertical, 4)
|
||||
.background(Capsule().foregroundColor(self.color))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue