Compare commits
No commits in common. "60c88ded5ec622dd99b06a3ce87801ac45c0f05f" and "f8b79ef34f831234bfa5982174f2edd30aa0f774" have entirely different histories.
60c88ded5e
...
f8b79ef34f
|
@ -16,10 +16,8 @@ struct WellnessPrefsView: View {
|
||||||
showFavAndReblogCount
|
showFavAndReblogCount
|
||||||
notificationsMode
|
notificationsMode
|
||||||
grayscaleImages
|
grayscaleImages
|
||||||
if #available(iOS 15.0, *) {
|
|
||||||
disableInfiniteScrolling
|
disableInfiniteScrolling
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.listStyle(InsetGroupedListStyle())
|
.listStyle(InsetGroupedListStyle())
|
||||||
.navigationBarTitle(Text("Digital Wellness"))
|
.navigationBarTitle(Text("Digital Wellness"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,7 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController<Timel
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if #available(iOS 15.0, *),
|
guard !Preferences.shared.disableInfiniteScrolling || didConfirmLoadMore else {
|
||||||
Preferences.shared.disableInfiniteScrolling && !didConfirmLoadMore {
|
|
||||||
guard !currentSnapshot.itemIdentifiers(inSection: .footer).contains(.confirmLoadMore) else {
|
guard !currentSnapshot.itemIdentifiers(inSection: .footer).contains(.confirmLoadMore) else {
|
||||||
// todo: need something more accurate than "success"/"failure"
|
// todo: need something more accurate than "success"/"failure"
|
||||||
completion(.success(currentSnapshot))
|
completion(.success(currentSnapshot))
|
||||||
|
@ -178,11 +177,11 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController<Timel
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
||||||
var snapshot = currentSnapshot
|
var snapshot = currentSnapshot
|
||||||
let newIdentifiers = statuses.map { Item.status(id: $0.id, state: .unknown) }
|
let identifiers = statuses.map { Item.status(id: $0.id, state: .unknown) }
|
||||||
if let first = snapshot.itemIdentifiers(inSection: .statuses).first {
|
if let first = snapshot.itemIdentifiers(inSection: .statuses).first {
|
||||||
snapshot.insertItems(newIdentifiers, beforeItem: first)
|
snapshot.insertItems(identifiers, beforeItem: first)
|
||||||
} else {
|
} else {
|
||||||
snapshot.appendItems(newIdentifiers, toSection: .statuses)
|
snapshot.appendItems(identifiers, toSection: .statuses)
|
||||||
}
|
}
|
||||||
completion(.success(snapshot))
|
completion(.success(snapshot))
|
||||||
}
|
}
|
||||||
|
@ -206,27 +205,6 @@ extension TimelineTableViewController {
|
||||||
enum Item: Hashable {
|
enum Item: Hashable {
|
||||||
case status(id: String, state: StatusState)
|
case status(id: String, state: StatusState)
|
||||||
case confirmLoadMore
|
case confirmLoadMore
|
||||||
|
|
||||||
static func ==(lhs: Item, rhs: Item) -> Bool {
|
|
||||||
switch (lhs, rhs) {
|
|
||||||
case let (.status(id: a, state: _), .status(id: b, state: _)):
|
|
||||||
return a == b
|
|
||||||
case (.confirmLoadMore, .confirmLoadMore):
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func hash(into hasher: inout Hasher) {
|
|
||||||
switch self {
|
|
||||||
case let .status(id: id, state: _):
|
|
||||||
hasher.combine(0)
|
|
||||||
hasher.combine(id)
|
|
||||||
case .confirmLoadMore:
|
|
||||||
hasher.combine(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue