Compare commits
15 Commits
fe32356bce
...
474064669d
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 474064669d | |
Shadowfacts | 1940368c43 | |
Shadowfacts | 49c9c69b5a | |
Shadowfacts | ff29f2768b | |
Shadowfacts | 942df433b3 | |
Shadowfacts | 5e2b551045 | |
Shadowfacts | 2e64500c35 | |
Shadowfacts | 7b7c05ff68 | |
Shadowfacts | aec5c0b787 | |
Shadowfacts | d8901b38f5 | |
Shadowfacts | 9d7c876e3c | |
Shadowfacts | 455273f322 | |
Shadowfacts | 16347b2ad0 | |
Shadowfacts | 0e1cbce10d | |
Shadowfacts | 8bd6f53f01 |
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,5 +1,18 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2023.4 (71)
|
||||||
|
Features/Improvements:
|
||||||
|
- Allow pinning instance public timelines to the Home tab
|
||||||
|
- Improve UI and retry mechanism when adding account
|
||||||
|
- Increase page size to 40 on a bunch of screens
|
||||||
|
- Update bookmarks screen when posts are bookmarked/unbookmarked
|
||||||
|
- Allow loading older and refreshing bookmarks screen
|
||||||
|
- Tweak follow count button color
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
- Fix timeline position sync not working in certain circumstances
|
||||||
|
- iPadOS: Fix flicker when opening favorite/reblog list in notificationss
|
||||||
|
|
||||||
## 2023.4 (70)
|
## 2023.4 (70)
|
||||||
Features/Improvements:
|
Features/Improvements:
|
||||||
- Add GIF/ALT badges to attachments
|
- Add GIF/ALT badges to attachments
|
||||||
|
|
|
@ -155,6 +155,27 @@ public class Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func revokeAccessToken() async throws {
|
||||||
|
guard let accessToken else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let request = Request<Empty>(method: .post, path: "/oauth/revoke", body: ParametersBody([
|
||||||
|
"token" => accessToken,
|
||||||
|
"client_id" => clientID!,
|
||||||
|
"client_secret" => clientSecret!,
|
||||||
|
]))
|
||||||
|
return try await withCheckedThrowingContinuation({ continuation in
|
||||||
|
self.run(request) { response in
|
||||||
|
switch response {
|
||||||
|
case .failure(let error):
|
||||||
|
continuation.resume(throwing: error)
|
||||||
|
case .success(_, _):
|
||||||
|
continuation.resume()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public func nodeInfo(completion: @escaping Callback<NodeInfo>) {
|
public func nodeInfo(completion: @escaping Callback<NodeInfo>) {
|
||||||
let wellKnown = Request<WellKnown>(method: .get, path: "/.well-known/nodeinfo")
|
let wellKnown = Request<WellKnown>(method: .get, path: "/.well-known/nodeinfo")
|
||||||
run(wellKnown) { result in
|
run(wellKnown) { result in
|
||||||
|
|
|
@ -15,6 +15,17 @@ public enum RequestRange {
|
||||||
case before(id: String, count: Int?)
|
case before(id: String, count: Int?)
|
||||||
/// Chronologically immediately after the given ID
|
/// Chronologically immediately after the given ID
|
||||||
case after(id: String, count: Int?)
|
case after(id: String, count: Int?)
|
||||||
|
|
||||||
|
public func withCount(_ count: Int) -> Self {
|
||||||
|
switch self {
|
||||||
|
case .default, .count(_):
|
||||||
|
return .count(count)
|
||||||
|
case .before(id: let id, count: _):
|
||||||
|
return .before(id: id, count: count)
|
||||||
|
case .after(id: let id, count: _):
|
||||||
|
return .after(id: id, count: count)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension RequestRange {
|
extension RequestRange {
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
D60088EF2980D8B5005B4D00 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60088EE2980D8B5005B4D00 /* StoreKit.framework */; };
|
D60088EF2980D8B5005B4D00 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60088EE2980D8B5005B4D00 /* StoreKit.framework */; };
|
||||||
D60088F22980DAA0005B4D00 /* TipJarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D60088F12980DAA0005B4D00 /* TipJarView.swift */; };
|
D60088F22980DAA0005B4D00 /* TipJarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D60088F12980DAA0005B4D00 /* TipJarView.swift */; };
|
||||||
D60089192981FEBA005B4D00 /* ConfettiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D60089182981FEBA005B4D00 /* ConfettiView.swift */; };
|
D60089192981FEBA005B4D00 /* ConfettiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D60089182981FEBA005B4D00 /* ConfettiView.swift */; };
|
||||||
|
D600891B29848289005B4D00 /* PinnedTimeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = D600891A29848289005B4D00 /* PinnedTimeline.swift */; };
|
||||||
|
D600891D298482F0005B4D00 /* PinnedTimelineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D600891C298482F0005B4D00 /* PinnedTimelineTests.swift */; };
|
||||||
|
D600891F29848DE2005B4D00 /* AddInstancePinnedTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D600891E29848DE2005B4D00 /* AddInstancePinnedTimelineView.swift */; };
|
||||||
D601FA5B29787AB100A8E8B5 /* AccountFollowsListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D601FA5A29787AB100A8E8B5 /* AccountFollowsListViewController.swift */; };
|
D601FA5B29787AB100A8E8B5 /* AccountFollowsListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D601FA5A29787AB100A8E8B5 /* AccountFollowsListViewController.swift */; };
|
||||||
D601FA5D297B2E6F00A8E8B5 /* ConversationCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D601FA5C297B2E6F00A8E8B5 /* ConversationCollectionViewController.swift */; };
|
D601FA5D297B2E6F00A8E8B5 /* ConversationCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D601FA5C297B2E6F00A8E8B5 /* ConversationCollectionViewController.swift */; };
|
||||||
D601FA5F297B339100A8E8B5 /* ExpandThreadCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D601FA5E297B339100A8E8B5 /* ExpandThreadCollectionViewCell.swift */; };
|
D601FA5F297B339100A8E8B5 /* ExpandThreadCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D601FA5E297B339100A8E8B5 /* ExpandThreadCollectionViewCell.swift */; };
|
||||||
|
@ -102,7 +105,6 @@
|
||||||
D627943223A5466600D38C68 /* SelectableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627943123A5466600D38C68 /* SelectableTableViewCell.swift */; };
|
D627943223A5466600D38C68 /* SelectableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627943123A5466600D38C68 /* SelectableTableViewCell.swift */; };
|
||||||
D627943B23A55BA600D38C68 /* NavigableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627943A23A55BA600D38C68 /* NavigableTableViewCell.swift */; };
|
D627943B23A55BA600D38C68 /* NavigableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627943A23A55BA600D38C68 /* NavigableTableViewCell.swift */; };
|
||||||
D627944723A6AC9300D38C68 /* BasicTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D627944623A6AC9300D38C68 /* BasicTableViewCell.xib */; };
|
D627944723A6AC9300D38C68 /* BasicTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D627944623A6AC9300D38C68 /* BasicTableViewCell.xib */; };
|
||||||
D627944A23A6AD6100D38C68 /* BookmarksTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627944923A6AD6100D38C68 /* BookmarksTableViewController.swift */; };
|
|
||||||
D627944D23A9A03D00D38C68 /* ListTimelineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627944C23A9A03D00D38C68 /* ListTimelineViewController.swift */; };
|
D627944D23A9A03D00D38C68 /* ListTimelineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627944C23A9A03D00D38C68 /* ListTimelineViewController.swift */; };
|
||||||
D627944F23A9C99800D38C68 /* EditListAccountsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627944E23A9C99800D38C68 /* EditListAccountsViewController.swift */; };
|
D627944F23A9C99800D38C68 /* EditListAccountsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627944E23A9C99800D38C68 /* EditListAccountsViewController.swift */; };
|
||||||
D627FF76217E923E00CC0648 /* DraftsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627FF75217E923E00CC0648 /* DraftsManager.swift */; };
|
D627FF76217E923E00CC0648 /* DraftsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627FF75217E923E00CC0648 /* DraftsManager.swift */; };
|
||||||
|
@ -323,6 +325,8 @@
|
||||||
D6DD2A45273D6C5700386A6C /* GIFImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD2A44273D6C5700386A6C /* GIFImageView.swift */; };
|
D6DD2A45273D6C5700386A6C /* GIFImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD2A44273D6C5700386A6C /* GIFImageView.swift */; };
|
||||||
D6DD353D22F28CD000A9563A /* ContentWarningCopyMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD353C22F28CD000A9563A /* ContentWarningCopyMode.swift */; };
|
D6DD353D22F28CD000A9563A /* ContentWarningCopyMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD353C22F28CD000A9563A /* ContentWarningCopyMode.swift */; };
|
||||||
D6DD353F22F502EC00A9563A /* Preferences+Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD353E22F502EC00A9563A /* Preferences+Notification.swift */; };
|
D6DD353F22F502EC00A9563A /* Preferences+Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD353E22F502EC00A9563A /* Preferences+Notification.swift */; };
|
||||||
|
D6DD8FFD298495A8002AD3FD /* LogoutService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD8FFC298495A8002AD3FD /* LogoutService.swift */; };
|
||||||
|
D6DD8FFF2984D327002AD3FD /* BookmarksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DD8FFE2984D327002AD3FD /* BookmarksViewController.swift */; };
|
||||||
D6DF95C12533F5DE0027A9B6 /* RelationshipMO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DF95C02533F5DE0027A9B6 /* RelationshipMO.swift */; };
|
D6DF95C12533F5DE0027A9B6 /* RelationshipMO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DF95C02533F5DE0027A9B6 /* RelationshipMO.swift */; };
|
||||||
D6DFC69E242C490400ACC392 /* TrackpadScrollGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DFC69D242C490400ACC392 /* TrackpadScrollGestureRecognizer.swift */; };
|
D6DFC69E242C490400ACC392 /* TrackpadScrollGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DFC69D242C490400ACC392 /* TrackpadScrollGestureRecognizer.swift */; };
|
||||||
D6DFC6A0242C4CCC00ACC392 /* Weak.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DFC69F242C4CCC00ACC392 /* Weak.swift */; };
|
D6DFC6A0242C4CCC00ACC392 /* Weak.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6DFC69F242C4CCC00ACC392 /* Weak.swift */; };
|
||||||
|
@ -422,6 +426,9 @@
|
||||||
D60088F02980D938005B4D00 /* Tusker.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Tusker.storekit; sourceTree = "<group>"; };
|
D60088F02980D938005B4D00 /* Tusker.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Tusker.storekit; sourceTree = "<group>"; };
|
||||||
D60088F12980DAA0005B4D00 /* TipJarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TipJarView.swift; sourceTree = "<group>"; };
|
D60088F12980DAA0005B4D00 /* TipJarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TipJarView.swift; sourceTree = "<group>"; };
|
||||||
D60089182981FEBA005B4D00 /* ConfettiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfettiView.swift; sourceTree = "<group>"; };
|
D60089182981FEBA005B4D00 /* ConfettiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfettiView.swift; sourceTree = "<group>"; };
|
||||||
|
D600891A29848289005B4D00 /* PinnedTimeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedTimeline.swift; sourceTree = "<group>"; };
|
||||||
|
D600891C298482F0005B4D00 /* PinnedTimelineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedTimelineTests.swift; sourceTree = "<group>"; };
|
||||||
|
D600891E29848DE2005B4D00 /* AddInstancePinnedTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddInstancePinnedTimelineView.swift; sourceTree = "<group>"; };
|
||||||
D601FA5A29787AB100A8E8B5 /* AccountFollowsListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountFollowsListViewController.swift; sourceTree = "<group>"; };
|
D601FA5A29787AB100A8E8B5 /* AccountFollowsListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountFollowsListViewController.swift; sourceTree = "<group>"; };
|
||||||
D601FA5C297B2E6F00A8E8B5 /* ConversationCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationCollectionViewController.swift; sourceTree = "<group>"; };
|
D601FA5C297B2E6F00A8E8B5 /* ConversationCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationCollectionViewController.swift; sourceTree = "<group>"; };
|
||||||
D601FA5E297B339100A8E8B5 /* ExpandThreadCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandThreadCollectionViewCell.swift; sourceTree = "<group>"; };
|
D601FA5E297B339100A8E8B5 /* ExpandThreadCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandThreadCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||||
|
@ -502,7 +509,6 @@
|
||||||
D627943123A5466600D38C68 /* SelectableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectableTableViewCell.swift; sourceTree = "<group>"; };
|
D627943123A5466600D38C68 /* SelectableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectableTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
D627943A23A55BA600D38C68 /* NavigableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigableTableViewCell.swift; sourceTree = "<group>"; };
|
D627943A23A55BA600D38C68 /* NavigableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigableTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
D627944623A6AC9300D38C68 /* BasicTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BasicTableViewCell.xib; sourceTree = "<group>"; };
|
D627944623A6AC9300D38C68 /* BasicTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BasicTableViewCell.xib; sourceTree = "<group>"; };
|
||||||
D627944923A6AD6100D38C68 /* BookmarksTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksTableViewController.swift; sourceTree = "<group>"; };
|
|
||||||
D627944C23A9A03D00D38C68 /* ListTimelineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTimelineViewController.swift; sourceTree = "<group>"; };
|
D627944C23A9A03D00D38C68 /* ListTimelineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTimelineViewController.swift; sourceTree = "<group>"; };
|
||||||
D627944E23A9C99800D38C68 /* EditListAccountsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditListAccountsViewController.swift; sourceTree = "<group>"; };
|
D627944E23A9C99800D38C68 /* EditListAccountsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditListAccountsViewController.swift; sourceTree = "<group>"; };
|
||||||
D627FF75217E923E00CC0648 /* DraftsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsManager.swift; sourceTree = "<group>"; };
|
D627FF75217E923E00CC0648 /* DraftsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsManager.swift; sourceTree = "<group>"; };
|
||||||
|
@ -732,6 +738,8 @@
|
||||||
D6DD2A44273D6C5700386A6C /* GIFImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GIFImageView.swift; sourceTree = "<group>"; };
|
D6DD2A44273D6C5700386A6C /* GIFImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GIFImageView.swift; sourceTree = "<group>"; };
|
||||||
D6DD353C22F28CD000A9563A /* ContentWarningCopyMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentWarningCopyMode.swift; sourceTree = "<group>"; };
|
D6DD353C22F28CD000A9563A /* ContentWarningCopyMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentWarningCopyMode.swift; sourceTree = "<group>"; };
|
||||||
D6DD353E22F502EC00A9563A /* Preferences+Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Preferences+Notification.swift"; sourceTree = "<group>"; };
|
D6DD353E22F502EC00A9563A /* Preferences+Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Preferences+Notification.swift"; sourceTree = "<group>"; };
|
||||||
|
D6DD8FFC298495A8002AD3FD /* LogoutService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogoutService.swift; sourceTree = "<group>"; };
|
||||||
|
D6DD8FFE2984D327002AD3FD /* BookmarksViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksViewController.swift; sourceTree = "<group>"; };
|
||||||
D6DF95C02533F5DE0027A9B6 /* RelationshipMO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelationshipMO.swift; sourceTree = "<group>"; };
|
D6DF95C02533F5DE0027A9B6 /* RelationshipMO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelationshipMO.swift; sourceTree = "<group>"; };
|
||||||
D6DFC69D242C490400ACC392 /* TrackpadScrollGestureRecognizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackpadScrollGestureRecognizer.swift; sourceTree = "<group>"; };
|
D6DFC69D242C490400ACC392 /* TrackpadScrollGestureRecognizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackpadScrollGestureRecognizer.swift; sourceTree = "<group>"; };
|
||||||
D6DFC69F242C4CCC00ACC392 /* Weak.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Weak.swift; sourceTree = "<group>"; };
|
D6DFC69F242C4CCC00ACC392 /* Weak.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Weak.swift; sourceTree = "<group>"; };
|
||||||
|
@ -852,6 +860,7 @@
|
||||||
D627FF75217E923E00CC0648 /* DraftsManager.swift */,
|
D627FF75217E923E00CC0648 /* DraftsManager.swift */,
|
||||||
D61F75AE293AF50C00C0B37F /* EditedFilter.swift */,
|
D61F75AE293AF50C00C0B37F /* EditedFilter.swift */,
|
||||||
D65B4B532971F71D00DABDFB /* EditedReport.swift */,
|
D65B4B532971F71D00DABDFB /* EditedReport.swift */,
|
||||||
|
D600891A29848289005B4D00 /* PinnedTimeline.swift */,
|
||||||
);
|
);
|
||||||
path = Models;
|
path = Models;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -873,6 +882,7 @@
|
||||||
D61F75A4293ABD6F00C0B37F /* EditFilterView.swift */,
|
D61F75A4293ABD6F00C0B37F /* EditFilterView.swift */,
|
||||||
D68A76E729527884001DA1B3 /* PinnedTimelinesView.swift */,
|
D68A76E729527884001DA1B3 /* PinnedTimelinesView.swift */,
|
||||||
D68A76E9295285D0001DA1B3 /* AddHashtagPinnedTimelineView.swift */,
|
D68A76E9295285D0001DA1B3 /* AddHashtagPinnedTimelineView.swift */,
|
||||||
|
D600891E29848DE2005B4D00 /* AddInstancePinnedTimelineView.swift */,
|
||||||
);
|
);
|
||||||
path = "Customize Timelines";
|
path = "Customize Timelines";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -928,7 +938,7 @@
|
||||||
D627944823A6AD5100D38C68 /* Bookmarks */ = {
|
D627944823A6AD5100D38C68 /* Bookmarks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
D627944923A6AD6100D38C68 /* BookmarksTableViewController.swift */,
|
D6DD8FFE2984D327002AD3FD /* BookmarksViewController.swift */,
|
||||||
);
|
);
|
||||||
path = Bookmarks;
|
path = Bookmarks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1561,6 +1571,7 @@
|
||||||
D6114E1627F8BB210080E273 /* VersionTests.swift */,
|
D6114E1627F8BB210080E273 /* VersionTests.swift */,
|
||||||
D61F75A029396DE200C0B37F /* SemiCaseSensitiveComparatorTests.swift */,
|
D61F75A029396DE200C0B37F /* SemiCaseSensitiveComparatorTests.swift */,
|
||||||
D6CA8CD92962231F0050C433 /* ArrayUniqueTests.swift */,
|
D6CA8CD92962231F0050C433 /* ArrayUniqueTests.swift */,
|
||||||
|
D600891C298482F0005B4D00 /* PinnedTimelineTests.swift */,
|
||||||
D6D4DDE6212518A200E1C4BB /* Info.plist */,
|
D6D4DDE6212518A200E1C4BB /* Info.plist */,
|
||||||
);
|
);
|
||||||
path = TuskerTests;
|
path = TuskerTests;
|
||||||
|
@ -1655,6 +1666,7 @@
|
||||||
D61F75B4293BD97400C0B37F /* DeleteFilterService.swift */,
|
D61F75B4293BD97400C0B37F /* DeleteFilterService.swift */,
|
||||||
D65B4B6129771A3F00DABDFB /* FetchStatusService.swift */,
|
D65B4B6129771A3F00DABDFB /* FetchStatusService.swift */,
|
||||||
D65B4B6529773AE600DABDFB /* DeleteStatusService.swift */,
|
D65B4B6529773AE600DABDFB /* DeleteStatusService.swift */,
|
||||||
|
D6DD8FFC298495A8002AD3FD /* LogoutService.swift */,
|
||||||
);
|
);
|
||||||
path = API;
|
path = API;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1932,6 +1944,7 @@
|
||||||
D6093FB725BE0CF3004811E6 /* TrendHistoryView.swift in Sources */,
|
D6093FB725BE0CF3004811E6 /* TrendHistoryView.swift in Sources */,
|
||||||
D6EBF01723C55E0D00AE061B /* UISceneSession+MastodonController.swift in Sources */,
|
D6EBF01723C55E0D00AE061B /* UISceneSession+MastodonController.swift in Sources */,
|
||||||
D61F759229365C6C00C0B37F /* CollectionViewController.swift in Sources */,
|
D61F759229365C6C00C0B37F /* CollectionViewController.swift in Sources */,
|
||||||
|
D6DD8FFD298495A8002AD3FD /* LogoutService.swift in Sources */,
|
||||||
04DACE8C212CB14B009840C4 /* MainTabBarViewController.swift in Sources */,
|
04DACE8C212CB14B009840C4 /* MainTabBarViewController.swift in Sources */,
|
||||||
D68E525D24A3E8F00054355A /* SearchViewController.swift in Sources */,
|
D68E525D24A3E8F00054355A /* SearchViewController.swift in Sources */,
|
||||||
D61F75BB293C183100C0B37F /* HTMLConverter.swift in Sources */,
|
D61F75BB293C183100C0B37F /* HTMLConverter.swift in Sources */,
|
||||||
|
@ -2005,6 +2018,7 @@
|
||||||
D6B81F3C2560365300F6E31D /* RefreshableViewController.swift in Sources */,
|
D6B81F3C2560365300F6E31D /* RefreshableViewController.swift in Sources */,
|
||||||
D646C958213B367000269FB5 /* LargeImageShrinkAnimationController.swift in Sources */,
|
D646C958213B367000269FB5 /* LargeImageShrinkAnimationController.swift in Sources */,
|
||||||
D6674AEA23341F7600E8DF94 /* AppShortcutItems.swift in Sources */,
|
D6674AEA23341F7600E8DF94 /* AppShortcutItems.swift in Sources */,
|
||||||
|
D6DD8FFF2984D327002AD3FD /* BookmarksViewController.swift in Sources */,
|
||||||
D646C956213B365700269FB5 /* LargeImageExpandAnimationController.swift in Sources */,
|
D646C956213B365700269FB5 /* LargeImageExpandAnimationController.swift in Sources */,
|
||||||
D667E5F82135C3040057A976 /* Mastodon+Equatable.swift in Sources */,
|
D667E5F82135C3040057A976 /* Mastodon+Equatable.swift in Sources */,
|
||||||
D6B4A4FF2506B81A000C81C1 /* AccountDisplayNameLabel.swift in Sources */,
|
D6B4A4FF2506B81A000C81C1 /* AccountDisplayNameLabel.swift in Sources */,
|
||||||
|
@ -2031,6 +2045,7 @@
|
||||||
D65B4B6629773AE600DABDFB /* DeleteStatusService.swift in Sources */,
|
D65B4B6629773AE600DABDFB /* DeleteStatusService.swift in Sources */,
|
||||||
D61DC84628F498F200B82C6E /* Logging.swift in Sources */,
|
D61DC84628F498F200B82C6E /* Logging.swift in Sources */,
|
||||||
D6B17255254F88B800128392 /* OppositeCollapseKeywordsView.swift in Sources */,
|
D6B17255254F88B800128392 /* OppositeCollapseKeywordsView.swift in Sources */,
|
||||||
|
D600891B29848289005B4D00 /* PinnedTimeline.swift in Sources */,
|
||||||
D6A00B1D26379FC900316AD4 /* PollOptionsView.swift in Sources */,
|
D6A00B1D26379FC900316AD4 /* PollOptionsView.swift in Sources */,
|
||||||
D6DF95C12533F5DE0027A9B6 /* RelationshipMO.swift in Sources */,
|
D6DF95C12533F5DE0027A9B6 /* RelationshipMO.swift in Sources */,
|
||||||
D6ADB6EE28EA74E8009924AB /* UIView+Configure.swift in Sources */,
|
D6ADB6EE28EA74E8009924AB /* UIView+Configure.swift in Sources */,
|
||||||
|
@ -2038,6 +2053,7 @@
|
||||||
D61F75B1293BD85300C0B37F /* CreateFilterService.swift in Sources */,
|
D61F75B1293BD85300C0B37F /* CreateFilterService.swift in Sources */,
|
||||||
D65C6BF525478A9C00A6E89C /* BackgroundableViewController.swift in Sources */,
|
D65C6BF525478A9C00A6E89C /* BackgroundableViewController.swift in Sources */,
|
||||||
D61DC84D28F500D200B82C6E /* ProfileViewController.swift in Sources */,
|
D61DC84D28F500D200B82C6E /* ProfileViewController.swift in Sources */,
|
||||||
|
D600891F29848DE2005B4D00 /* AddInstancePinnedTimelineView.swift in Sources */,
|
||||||
D663626421360D2300C9CBA2 /* AvatarStyle.swift in Sources */,
|
D663626421360D2300C9CBA2 /* AvatarStyle.swift in Sources */,
|
||||||
D693A72A25CF8C1E003A14E2 /* ProfileDirectoryViewController.swift in Sources */,
|
D693A72A25CF8C1E003A14E2 /* ProfileDirectoryViewController.swift in Sources */,
|
||||||
D693A72F25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift in Sources */,
|
D693A72F25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift in Sources */,
|
||||||
|
@ -2054,7 +2070,6 @@
|
||||||
D6CA8CDE296387310050C433 /* SaveToPhotosActivity.swift in Sources */,
|
D6CA8CDE296387310050C433 /* SaveToPhotosActivity.swift in Sources */,
|
||||||
D6B936712829F72900237D0E /* NSManagedObjectContext+Helpers.swift in Sources */,
|
D6B936712829F72900237D0E /* NSManagedObjectContext+Helpers.swift in Sources */,
|
||||||
D68A76EE295369C7001DA1B3 /* AcknowledgementsView.swift in Sources */,
|
D68A76EE295369C7001DA1B3 /* AcknowledgementsView.swift in Sources */,
|
||||||
D627944A23A6AD6100D38C68 /* BookmarksTableViewController.swift in Sources */,
|
|
||||||
D63CC7102911F1E4000E19DE /* UIScrollView+Top.swift in Sources */,
|
D63CC7102911F1E4000E19DE /* UIScrollView+Top.swift in Sources */,
|
||||||
D6F6A557291F4F1600F496A8 /* MuteAccountView.swift in Sources */,
|
D6F6A557291F4F1600F496A8 /* MuteAccountView.swift in Sources */,
|
||||||
D65B4B8B297879E900DABDFB /* AccountFollowsViewController.swift in Sources */,
|
D65B4B8B297879E900DABDFB /* AccountFollowsViewController.swift in Sources */,
|
||||||
|
@ -2228,6 +2243,7 @@
|
||||||
D61F75A129396DE200C0B37F /* SemiCaseSensitiveComparatorTests.swift in Sources */,
|
D61F75A129396DE200C0B37F /* SemiCaseSensitiveComparatorTests.swift in Sources */,
|
||||||
D62FF04823D7CDD700909D6E /* AttributedStringHelperTests.swift in Sources */,
|
D62FF04823D7CDD700909D6E /* AttributedStringHelperTests.swift in Sources */,
|
||||||
D6E426AD25334DA500C02E1C /* FuzzyMatcherTests.swift in Sources */,
|
D6E426AD25334DA500C02E1C /* FuzzyMatcherTests.swift in Sources */,
|
||||||
|
D600891D298482F0005B4D00 /* PinnedTimelineTests.swift in Sources */,
|
||||||
D6114E1727F8BB210080E273 /* VersionTests.swift in Sources */,
|
D6114E1727F8BB210080E273 /* VersionTests.swift in Sources */,
|
||||||
D6CA8CDA2962231F0050C433 /* ArrayUniqueTests.swift in Sources */,
|
D6CA8CDA2962231F0050C433 /* ArrayUniqueTests.swift in Sources */,
|
||||||
D6D4DDE5212518A200E1C4BB /* TuskerTests.swift in Sources */,
|
D6D4DDE5212518A200E1C4BB /* TuskerTests.swift in Sources */,
|
||||||
|
@ -2372,7 +2388,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 70;
|
CURRENT_PROJECT_VERSION = 71;
|
||||||
INFOPLIST_FILE = Tusker/Info.plist;
|
INFOPLIST_FILE = Tusker/Info.plist;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
|
@ -2437,7 +2453,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 70;
|
CURRENT_PROJECT_VERSION = 71;
|
||||||
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
||||||
|
@ -2588,7 +2604,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 70;
|
CURRENT_PROJECT_VERSION = 71;
|
||||||
INFOPLIST_FILE = Tusker/Info.plist;
|
INFOPLIST_FILE = Tusker/Info.plist;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
|
@ -2616,7 +2632,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 70;
|
CURRENT_PROJECT_VERSION = 71;
|
||||||
INFOPLIST_FILE = Tusker/Info.plist;
|
INFOPLIST_FILE = Tusker/Info.plist;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
|
@ -2721,7 +2737,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 70;
|
CURRENT_PROJECT_VERSION = 71;
|
||||||
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
||||||
|
@ -2747,7 +2763,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 70;
|
CURRENT_PROJECT_VERSION = 71;
|
||||||
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
||||||
|
@ -2835,7 +2851,7 @@
|
||||||
repositoryURL = "https://github.com/getsentry/sentry-cocoa.git";
|
repositoryURL = "https://github.com/getsentry/sentry-cocoa.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMinorVersion;
|
kind = upToNextMinorVersion;
|
||||||
minimumVersion = 7.29.0;
|
minimumVersion = 8.0.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
D6552365289870790048A653 /* XCRemoteSwiftPackageReference "ScreenCorners" */ = {
|
D6552365289870790048A653 /* XCRemoteSwiftPackageReference "ScreenCorners" */ = {
|
||||||
|
|
|
@ -269,5 +269,5 @@ private func setInstanceBreadcrumb(instance: Instance, nodeInfo: NodeInfo?) {
|
||||||
"version": nodeInfo.software.version,
|
"version": nodeInfo.software.version,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// LogoutService.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 1/27/23.
|
||||||
|
// Copyright © 2023 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
class LogoutService {
|
||||||
|
let accountInfo: LocalData.UserAccountInfo
|
||||||
|
private let mastodonController: MastodonController
|
||||||
|
|
||||||
|
init(accountInfo: LocalData.UserAccountInfo) {
|
||||||
|
self.accountInfo = accountInfo
|
||||||
|
self.mastodonController = MastodonController.getForAccount(accountInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
func run() {
|
||||||
|
Task.detached {
|
||||||
|
try? await self.mastodonController.client.revokeAccessToken()
|
||||||
|
}
|
||||||
|
MastodonController.removeForAccount(accountInfo)
|
||||||
|
LocalData.shared.removeAccount(accountInfo)
|
||||||
|
let psc = mastodonController.persistentContainer.persistentStoreCoordinator
|
||||||
|
for store in psc.persistentStores {
|
||||||
|
guard let url = store.url else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
try? psc.destroyPersistentStore(at: url, type: .sqlite)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,6 +31,10 @@ class MastodonController: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func removeForAccount(_ account: LocalData.UserAccountInfo) {
|
||||||
|
all.removeValue(forKey: account)
|
||||||
|
}
|
||||||
|
|
||||||
static func resetAll() {
|
static func resetAll() {
|
||||||
all = [:]
|
all = [:]
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,13 +66,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
options.enableSwizzling = false
|
options.enableSwizzling = false
|
||||||
// required to support releases/release health
|
// required to support releases/release health
|
||||||
options.enableAutoSessionTracking = true
|
options.enableAutoSessionTracking = true
|
||||||
options.enableOutOfMemoryTracking = false
|
options.enableWatchdogTerminationTracking = false
|
||||||
options.enableAutoPerformanceTracking = false
|
options.enableAutoPerformanceTracing = false
|
||||||
options.enableNetworkTracking = false
|
options.enableNetworkTracking = false
|
||||||
options.enableAppHangTracking = false
|
options.enableAppHangTracking = false
|
||||||
options.enableCoreDataTracking = false
|
options.enableCoreDataTracing = false
|
||||||
// we don't care about events like battery, keyboard show/hide
|
// we don't care about events like battery, keyboard show/hide
|
||||||
options.enableAutoBreadcrumbTracking = false
|
options.enableAutoBreadcrumbTracking = false
|
||||||
|
options.enableUserInteractionTracing = false
|
||||||
|
|
||||||
options.beforeSend = { event in
|
options.beforeSend = { event in
|
||||||
// just no, why would anyone need this information
|
// just no, why would anyone need this information
|
||||||
|
|
|
@ -25,7 +25,7 @@ public final class AccountPreferences: NSManagedObject {
|
||||||
@NSManaged var pinnedTimelinesData: Data?
|
@NSManaged var pinnedTimelinesData: Data?
|
||||||
|
|
||||||
@LazilyDecoding(from: \AccountPreferences.pinnedTimelinesData, fallback: [])
|
@LazilyDecoding(from: \AccountPreferences.pinnedTimelinesData, fallback: [])
|
||||||
var pinnedTimelines: [Timeline]
|
var pinnedTimelines: [PinnedTimeline]
|
||||||
|
|
||||||
static func `default`(account: LocalData.UserAccountInfo, context: NSManagedObjectContext) -> AccountPreferences {
|
static func `default`(account: LocalData.UserAccountInfo, context: NSManagedObjectContext) -> AccountPreferences {
|
||||||
let prefs = AccountPreferences(context: context)
|
let prefs = AccountPreferences(context: context)
|
||||||
|
|
|
@ -211,7 +211,7 @@ class MastodonCachePersistentStore: NSPersistentCloudKitContainer {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
fatalError("Unable to save managed object context: \(String(describing: error))")
|
fatalError("Unable to save managed object context: \(String(describing: error))")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -545,6 +545,8 @@ class MastodonCachePersistentStore: NSPersistentCloudKitContainer {
|
||||||
guard let timelinePosition = try? self.viewContext.existingObject(with: id) as? TimelinePosition else {
|
guard let timelinePosition = try? self.viewContext.existingObject(with: id) as? TimelinePosition else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// the kvo observer that clears the LazilyDecoding cache doesn't always fire on remote changes, so do it manually
|
||||||
|
timelinePosition.changedRemotely()
|
||||||
NotificationCenter.default.post(name: .timelinePositionChanged, object: timelinePosition)
|
NotificationCenter.default.post(name: .timelinePositionChanged, object: timelinePosition)
|
||||||
}
|
}
|
||||||
if changedAccountPrefs {
|
if changedAccountPrefs {
|
||||||
|
|
|
@ -41,6 +41,10 @@ public final class TimelinePosition: NSManagedObject {
|
||||||
self.createdAt = Date()
|
self.createdAt = Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func changedRemotely() {
|
||||||
|
_statusIDs.removeCachedValue()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// blergh, this is the simplest way of getting the Timeline into a format that A) CoreData can handle and B) is usable in the predicate
|
// blergh, this is the simplest way of getting the Timeline into a format that A) CoreData can handle and B) is usable in the predicate
|
||||||
|
|
|
@ -25,23 +25,4 @@ extension Timeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var image: UIImage {
|
|
||||||
switch self {
|
|
||||||
case .home:
|
|
||||||
return UIImage(systemName: "house.fill")!
|
|
||||||
case let .public(local):
|
|
||||||
if local {
|
|
||||||
return UIImage(systemName: "person.and.person.fill")!
|
|
||||||
} else {
|
|
||||||
return UIImage(systemName: "globe")!
|
|
||||||
}
|
|
||||||
case .list(id: _):
|
|
||||||
return UIImage(systemName: "list.bullet")!
|
|
||||||
case .tag(hashtag: _):
|
|
||||||
return UIImage(systemName: "number")!
|
|
||||||
case .direct:
|
|
||||||
return UIImage(systemName: "enveloep.fill")!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public struct LazilyDecoding<Enclosing: NSObject, Value: Codable> {
|
||||||
private let fallback: Value
|
private let fallback: Value
|
||||||
private var value: Value?
|
private var value: Value?
|
||||||
private var observation: NSKeyValueObservation?
|
private var observation: NSKeyValueObservation?
|
||||||
|
private var skipClearingOnNextUpdate = false
|
||||||
|
|
||||||
init(from keyPath: ReferenceWritableKeyPath<Enclosing, Data?>, fallback: Value) {
|
init(from keyPath: ReferenceWritableKeyPath<Enclosing, Data?>, fallback: Value) {
|
||||||
self.keyPath = keyPath
|
self.keyPath = keyPath
|
||||||
|
@ -37,13 +38,16 @@ public struct LazilyDecoding<Enclosing: NSObject, Value: Codable> {
|
||||||
} else {
|
} else {
|
||||||
guard let data = instance[keyPath: wrapper.keyPath] else { return wrapper.fallback }
|
guard let data = instance[keyPath: wrapper.keyPath] else { return wrapper.fallback }
|
||||||
do {
|
do {
|
||||||
let value = try decoder.decode(Box<Value>.self, from: data)
|
let value = try decoder.decode(Box.self, from: data)
|
||||||
wrapper.value = value.value
|
wrapper.value = value.value
|
||||||
wrapper.observation = instance.observe(wrapper.keyPath, changeHandler: { instance, _ in
|
wrapper.observation = instance.observe(wrapper.keyPath, changeHandler: { instance, _ in
|
||||||
var updated = instance[keyPath: storageKeyPath]
|
var wrapper = instance[keyPath: storageKeyPath]
|
||||||
updated.value = nil
|
if wrapper.skipClearingOnNextUpdate {
|
||||||
updated.observation = nil
|
wrapper.skipClearingOnNextUpdate = false
|
||||||
instance[keyPath: storageKeyPath] = updated
|
} else {
|
||||||
|
wrapper.removeCachedValue()
|
||||||
|
}
|
||||||
|
instance[keyPath: storageKeyPath] = wrapper
|
||||||
})
|
})
|
||||||
instance[keyPath: storageKeyPath] = wrapper
|
instance[keyPath: storageKeyPath] = wrapper
|
||||||
return value.value
|
return value.value
|
||||||
|
@ -55,12 +59,18 @@ public struct LazilyDecoding<Enclosing: NSObject, Value: Codable> {
|
||||||
set {
|
set {
|
||||||
var wrapper = instance[keyPath: storageKeyPath]
|
var wrapper = instance[keyPath: storageKeyPath]
|
||||||
wrapper.value = newValue
|
wrapper.value = newValue
|
||||||
|
wrapper.skipClearingOnNextUpdate = true
|
||||||
instance[keyPath: storageKeyPath] = wrapper
|
instance[keyPath: storageKeyPath] = wrapper
|
||||||
let newData = try! encoder.encode(Box(value: newValue))
|
let newData = try! encoder.encode(Box(value: newValue))
|
||||||
instance[keyPath: wrapper.keyPath] = newData
|
instance[keyPath: wrapper.keyPath] = newData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutating func removeCachedValue() {
|
||||||
|
value = nil
|
||||||
|
observation = nil
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension LazilyDecoding {
|
extension LazilyDecoding {
|
||||||
|
@ -72,7 +82,7 @@ extension LazilyDecoding {
|
||||||
extension LazilyDecoding {
|
extension LazilyDecoding {
|
||||||
// PropertyListEncoder only allows top-level types to be dicts or arrays, which breaks encoding nil-able values.
|
// PropertyListEncoder only allows top-level types to be dicts or arrays, which breaks encoding nil-able values.
|
||||||
// Wrapping everything in a Box ensures that it's always a dict.
|
// Wrapping everything in a Box ensures that it's always a dict.
|
||||||
private struct Box<T: Codable>: Codable {
|
struct Box: Codable {
|
||||||
let value: T
|
let value: Value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,129 @@
|
||||||
|
//
|
||||||
|
// PinnedTimeline.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 1/27/23.
|
||||||
|
// Copyright © 2023 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
enum PinnedTimeline: Codable, Equatable, Hashable {
|
||||||
|
case home
|
||||||
|
case `public`(local: Bool)
|
||||||
|
case tag(hashtag: String)
|
||||||
|
case list(id: String)
|
||||||
|
case instance(URL)
|
||||||
|
|
||||||
|
init(from decoder: Decoder) throws {
|
||||||
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
let type = try container.decode(String.self, forKey: .type)
|
||||||
|
switch type {
|
||||||
|
case "home":
|
||||||
|
self = .home
|
||||||
|
case "public":
|
||||||
|
self = .public(local: try container.decode(Bool.self, forKey: .local))
|
||||||
|
case "tag":
|
||||||
|
self = .tag(hashtag: try container.decode(String.self, forKey: .hashtag))
|
||||||
|
case "list":
|
||||||
|
self = .list(id: try container.decode(String.self, forKey: .listID))
|
||||||
|
case "instance":
|
||||||
|
self = .instance(try container.decode(URL.self, forKey: .instanceURL))
|
||||||
|
default:
|
||||||
|
throw DecodingError.dataCorruptedError(forKey: CodingKeys.type, in: container, debugDescription: "PinnedTimeline type must be one of 'home', 'local', 'tag', 'list', or 'instance'")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
switch self {
|
||||||
|
case .home:
|
||||||
|
try container.encode("home", forKey: .type)
|
||||||
|
case .public(let local):
|
||||||
|
try container.encode("public", forKey: .type)
|
||||||
|
try container.encode(local, forKey: .local)
|
||||||
|
case .tag(let hashtag):
|
||||||
|
try container.encode("tag", forKey: .type)
|
||||||
|
try container.encode(hashtag, forKey: .hashtag)
|
||||||
|
case .list(let id):
|
||||||
|
try container.encode("list", forKey: .type)
|
||||||
|
try container.encode(id, forKey: .listID)
|
||||||
|
case .instance(let url):
|
||||||
|
try container.encode("instance", forKey: .type)
|
||||||
|
try container.encode(url, forKey: .instanceURL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init?(timeline: Timeline) {
|
||||||
|
switch timeline {
|
||||||
|
case .home:
|
||||||
|
self = .home
|
||||||
|
case .public(let local):
|
||||||
|
self = .public(local: local)
|
||||||
|
case .tag(let hashtag):
|
||||||
|
self = .tag(hashtag: hashtag)
|
||||||
|
case .list(let id):
|
||||||
|
self = .list(id: id)
|
||||||
|
case .direct:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var timeline: Timeline? {
|
||||||
|
switch self {
|
||||||
|
case .home:
|
||||||
|
return .home
|
||||||
|
case .public(let local):
|
||||||
|
return .public(local: local)
|
||||||
|
case .tag(let hashtag):
|
||||||
|
return .tag(hashtag: hashtag)
|
||||||
|
case .list(let id):
|
||||||
|
return .list(id: id)
|
||||||
|
case .instance(_):
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var title: String {
|
||||||
|
switch self {
|
||||||
|
case .home:
|
||||||
|
return "Home"
|
||||||
|
case let .public(local):
|
||||||
|
return local ? "Local" : "Federated"
|
||||||
|
case let .tag(hashtag):
|
||||||
|
return "#\(hashtag)"
|
||||||
|
case .list:
|
||||||
|
return "List"
|
||||||
|
case .instance(let url):
|
||||||
|
return url.host!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var image: UIImage {
|
||||||
|
switch self {
|
||||||
|
case .home:
|
||||||
|
return UIImage(systemName: "house.fill")!
|
||||||
|
case let .public(local):
|
||||||
|
if local {
|
||||||
|
return UIImage(systemName: "person.and.person.fill")!
|
||||||
|
} else {
|
||||||
|
return UIImage(systemName: "globe")!
|
||||||
|
}
|
||||||
|
case .list(id: _):
|
||||||
|
return UIImage(systemName: "list.bullet")!
|
||||||
|
case .tag(hashtag: _):
|
||||||
|
return UIImage(systemName: "number")!
|
||||||
|
case .instance(_):
|
||||||
|
return UIImage(systemName: "globe")!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case type
|
||||||
|
case local
|
||||||
|
case hashtag
|
||||||
|
case listID
|
||||||
|
case instanceURL
|
||||||
|
}
|
||||||
|
}
|
|
@ -85,7 +85,7 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
return SearchViewController(mastodonController: mastodonController)
|
return SearchViewController(mastodonController: mastodonController)
|
||||||
|
|
||||||
case .bookmarks:
|
case .bookmarks:
|
||||||
return BookmarksTableViewController(mastodonController: mastodonController)
|
return BookmarksViewController(mastodonController: mastodonController)
|
||||||
|
|
||||||
case .myProfile:
|
case .myProfile:
|
||||||
return MyProfileViewController(mastodonController: mastodonController)
|
return MyProfileViewController(mastodonController: mastodonController)
|
||||||
|
|
|
@ -214,7 +214,7 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
||||||
guard let account = window?.windowScene?.session.mastodonController?.accountInfo else {
|
guard let account = window?.windowScene?.session.mastodonController?.accountInfo else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
LocalData.shared.removeAccount(account)
|
LogoutService(accountInfo: account).run()
|
||||||
if LocalData.shared.onboardingComplete {
|
if LocalData.shared.onboardingComplete {
|
||||||
activateAccount(LocalData.shared.accounts.first!, animated: false)
|
activateAccount(LocalData.shared.accounts.first!, animated: false)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,6 +11,8 @@ import Pachyderm
|
||||||
|
|
||||||
class AccountFollowsListViewController: UIViewController, CollectionViewController {
|
class AccountFollowsListViewController: UIViewController, CollectionViewController {
|
||||||
|
|
||||||
|
private static let pageSize = 40
|
||||||
|
|
||||||
let accountID: String
|
let accountID: String
|
||||||
let mastodonController: MastodonController
|
let mastodonController: MastodonController
|
||||||
let mode: AccountFollowsViewController.Mode
|
let mode: AccountFollowsViewController.Mode
|
||||||
|
@ -92,9 +94,9 @@ class AccountFollowsListViewController: UIViewController, CollectionViewControll
|
||||||
private func request(for range: RequestRange) -> Request<[Account]> {
|
private func request(for range: RequestRange) -> Request<[Account]> {
|
||||||
switch mode {
|
switch mode {
|
||||||
case .following:
|
case .following:
|
||||||
return Account.getFollowing(accountID, range: range)
|
return Account.getFollowing(accountID, range: range.withCount(Self.pageSize))
|
||||||
case .followers:
|
case .followers:
|
||||||
return Account.getFollowers(accountID, range: range)
|
return Account.getFollowers(accountID, range: range.withCount(Self.pageSize))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,196 +0,0 @@
|
||||||
//
|
|
||||||
// BookmarksTableViewController.swift
|
|
||||||
// Tusker
|
|
||||||
//
|
|
||||||
// Created by Shadowfacts on 12/15/19.
|
|
||||||
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import Pachyderm
|
|
||||||
|
|
||||||
class BookmarksTableViewController: EnhancedTableViewController {
|
|
||||||
|
|
||||||
private let statusCell = "statusCell"
|
|
||||||
|
|
||||||
let mastodonController: MastodonController
|
|
||||||
|
|
||||||
private var loaded = false
|
|
||||||
|
|
||||||
var statuses: [(id: String, state: CollapseState)] = []
|
|
||||||
|
|
||||||
var newer: RequestRange?
|
|
||||||
var older: RequestRange?
|
|
||||||
|
|
||||||
init(mastodonController: MastodonController) {
|
|
||||||
self.mastodonController = mastodonController
|
|
||||||
|
|
||||||
super.init(style: .plain)
|
|
||||||
|
|
||||||
dragEnabled = true
|
|
||||||
|
|
||||||
title = NSLocalizedString("Bookmarks", comment: "bookmarks screen title")
|
|
||||||
}
|
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
tableView.rowHeight = UITableView.automaticDimension
|
|
||||||
tableView.estimatedRowHeight = 140
|
|
||||||
tableView.allowsFocus = true
|
|
||||||
|
|
||||||
tableView.register(UINib(nibName: "TimelineStatusTableViewCell", bundle: .main), forCellReuseIdentifier: statusCell)
|
|
||||||
|
|
||||||
tableView.prefetchDataSource = self
|
|
||||||
|
|
||||||
userActivity = UserActivityManager.bookmarksActivity()
|
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(handleStatusDeleted), name: .statusDeleted, object: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
|
||||||
super.viewWillAppear(animated)
|
|
||||||
|
|
||||||
if !loaded {
|
|
||||||
loaded = true
|
|
||||||
|
|
||||||
let request = Client.getBookmarks()
|
|
||||||
mastodonController.run(request) { (response) in
|
|
||||||
guard case let .success(statuses, pagination) = response else { fatalError() }
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
|
||||||
self.statuses.append(contentsOf: statuses.map { ($0.id, .unknown) })
|
|
||||||
self.newer = pagination?.newer
|
|
||||||
self.older = pagination?.older
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.tableView.reloadData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Table view data source
|
|
||||||
|
|
||||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
||||||
return statuses.count
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: statusCell, for: indexPath) as! TimelineStatusTableViewCell
|
|
||||||
cell.delegate = self
|
|
||||||
let (id, state) = statuses[indexPath.row]
|
|
||||||
cell.updateUI(statusID: id, state: state)
|
|
||||||
return cell
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Table view delegate
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
|
||||||
guard indexPath.row == statuses.count, let older = older else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let request = Client.getBookmarks(range: older)
|
|
||||||
mastodonController.run(request) { (response) in
|
|
||||||
guard case let .success(newStatuses, pagination) = response else { fatalError() }
|
|
||||||
self.older = pagination?.older
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: newStatuses) {
|
|
||||||
let newIndexPaths = (self.statuses.count..<(self.statuses.count + newStatuses.count)).map {
|
|
||||||
IndexPath(row: $0, section: 0)
|
|
||||||
}
|
|
||||||
self.statuses.append(contentsOf: newStatuses.map { ($0.id, .unknown) })
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
UIView.performWithoutAnimation {
|
|
||||||
self.tableView.insertRows(at: newIndexPaths, with: .automatic)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
|
||||||
return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.leadingSwipeActionsConfiguration()
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
|
||||||
let cellConfig = (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration()
|
|
||||||
|
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statuses[indexPath.row].id) else {
|
|
||||||
return cellConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
let unbookmarkAction = UIContextualAction(style: .destructive, title: NSLocalizedString("Unbookmark", comment: "unbookmark action title")) { (action, view, completion) in
|
|
||||||
let request = Status.unbookmark(status.id)
|
|
||||||
self.mastodonController.run(request) { (response) in
|
|
||||||
guard case let .success(newStatus, _) = response else { fatalError() }
|
|
||||||
self.mastodonController.persistentContainer.addOrUpdate(status: newStatus)
|
|
||||||
self.statuses.remove(at: indexPath.row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unbookmarkAction.image = UIImage(systemName: "bookmark.fill")
|
|
||||||
|
|
||||||
let config: UISwipeActionsConfiguration
|
|
||||||
if let cellConfig = cellConfig {
|
|
||||||
config = UISwipeActionsConfiguration(actions: cellConfig.actions + [unbookmarkAction])
|
|
||||||
config.performsFirstActionWithFullSwipe = cellConfig.performsFirstActionWithFullSwipe
|
|
||||||
} else {
|
|
||||||
config = UISwipeActionsConfiguration(actions: [unbookmarkAction])
|
|
||||||
config.performsFirstActionWithFullSwipe = false
|
|
||||||
}
|
|
||||||
return config
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc private func handleStatusDeleted(_ notification: Foundation.Notification) {
|
|
||||||
guard let userInfo = notification.userInfo,
|
|
||||||
let accountID = mastodonController.accountInfo?.id,
|
|
||||||
userInfo["accountID"] as? String == accountID,
|
|
||||||
let statusIDs = userInfo["statusIDs"] as? [String] else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let indicesToDelete = statusIDs
|
|
||||||
.compactMap { id in
|
|
||||||
self.statuses.firstIndex(where: { $0.id == id })
|
|
||||||
}
|
|
||||||
self.statuses.remove(atOffsets: IndexSet(indicesToDelete))
|
|
||||||
self.tableView.deleteRows(at: indicesToDelete.map { IndexPath(row: $0, section: 0) }, with: .automatic)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension BookmarksTableViewController: TuskerNavigationDelegate {
|
|
||||||
var apiController: MastodonController! { mastodonController }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension BookmarksTableViewController: ToastableViewController {
|
|
||||||
}
|
|
||||||
|
|
||||||
extension BookmarksTableViewController: MenuActionProvider {
|
|
||||||
}
|
|
||||||
|
|
||||||
extension BookmarksTableViewController: StatusTableViewCellDelegate {
|
|
||||||
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
|
||||||
tableView.beginUpdates()
|
|
||||||
tableView.endUpdates()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension BookmarksTableViewController: UITableViewDataSourcePrefetching, StatusTablePrefetching {
|
|
||||||
func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
|
|
||||||
let ids = indexPaths.map { statuses[$0.row].id }
|
|
||||||
prefetchStatuses(with: ids)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,438 @@
|
||||||
|
//
|
||||||
|
// BookmarksViewController.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/15/19.
|
||||||
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
import Pachyderm
|
||||||
|
import CoreData
|
||||||
|
|
||||||
|
class BookmarksViewController: UIViewController, CollectionViewController, RefreshableViewController {
|
||||||
|
|
||||||
|
private static let pageSize = 40
|
||||||
|
|
||||||
|
let mastodonController: MastodonController
|
||||||
|
|
||||||
|
var collectionView: UICollectionView! {
|
||||||
|
view as? UICollectionView
|
||||||
|
}
|
||||||
|
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
||||||
|
|
||||||
|
private var state = State.unloaded
|
||||||
|
private var newer: RequestRange?
|
||||||
|
private var older: RequestRange?
|
||||||
|
|
||||||
|
init(mastodonController: MastodonController) {
|
||||||
|
self.mastodonController = mastodonController
|
||||||
|
|
||||||
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
|
||||||
|
title = NSLocalizedString("Bookmarks", comment: "bookmarks screen title")
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override func loadView() {
|
||||||
|
var config = UICollectionLayoutListConfiguration(appearance: .plain)
|
||||||
|
config.leadingSwipeActionsConfigurationProvider = { [unowned self] in
|
||||||
|
(collectionView.cellForItem(at: $0) as? TimelineStatusCollectionViewCell)?.leadingSwipeActions()
|
||||||
|
}
|
||||||
|
config.trailingSwipeActionsConfigurationProvider = { [unowned self] in
|
||||||
|
(collectionView.cellForItem(at: $0) as? TimelineStatusCollectionViewCell)?.trailingSwipeActions()
|
||||||
|
}
|
||||||
|
config.itemSeparatorHandler = { [unowned self] indexPath, sectionConfig in
|
||||||
|
guard let item = dataSource.itemIdentifier(for: indexPath) else {
|
||||||
|
return sectionConfig
|
||||||
|
}
|
||||||
|
var config = sectionConfig
|
||||||
|
if item.hideIndicators {
|
||||||
|
config.topSeparatorVisibility = .hidden
|
||||||
|
config.bottomSeparatorVisibility = .hidden
|
||||||
|
} else {
|
||||||
|
config.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
|
||||||
|
config.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in
|
||||||
|
let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment)
|
||||||
|
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||||
|
section.contentInsetsReference = .readableContent
|
||||||
|
}
|
||||||
|
return section
|
||||||
|
}
|
||||||
|
view = UICollectionView(frame: .zero, collectionViewLayout: layout)
|
||||||
|
collectionView.delegate = self
|
||||||
|
collectionView.dragDelegate = self
|
||||||
|
collectionView.allowsFocus = true
|
||||||
|
|
||||||
|
dataSource = createDataSource()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func createDataSource() -> UICollectionViewDiffableDataSource<Section, Item> {
|
||||||
|
let statusCell = UICollectionView.CellRegistration<TimelineStatusCollectionViewCell, (String, CollapseState)> { [unowned self] cell, indexPath, item in
|
||||||
|
cell.delegate = self
|
||||||
|
cell.updateUI(statusID: item.0, state: item.1, filterResult: .allow, precomputedContent: nil)
|
||||||
|
}
|
||||||
|
let loadingCell = UICollectionView.CellRegistration<LoadingCollectionViewCell, Void> { cell, indexPath, itemIdentifier in
|
||||||
|
cell.indicator.startAnimating()
|
||||||
|
}
|
||||||
|
return UICollectionViewDiffableDataSource(collectionView: collectionView) { collectionView, indexPath, itemIdentifier in
|
||||||
|
switch itemIdentifier {
|
||||||
|
case .status(id: let id, state: let state, addedLocally: _):
|
||||||
|
return collectionView.dequeueConfiguredReusableCell(using: statusCell, for: indexPath, item: (id, state))
|
||||||
|
case .loadingIndicator:
|
||||||
|
return collectionView.dequeueConfiguredReusableCell(using: loadingCell, for: indexPath, item: ())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
#if !targetEnvironment(macCatalyst)
|
||||||
|
collectionView.refreshControl = UIRefreshControl()
|
||||||
|
collectionView.refreshControl!.addTarget(self, action: #selector(refresh), for: .valueChanged)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
addKeyCommand(MenuController.refreshCommand(discoverabilityTitle: "Refresh Bookmarks"))
|
||||||
|
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(handleStatusDeleted), name: .statusDeleted, object: nil)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(managedObjectsDidChange), name: .NSManagedObjectContextObjectsDidChange, object: mastodonController.persistentContainer.viewContext)
|
||||||
|
}
|
||||||
|
|
||||||
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
|
clearSelectionOnAppear(animated: animated)
|
||||||
|
|
||||||
|
if case .unloaded = state {
|
||||||
|
Task {
|
||||||
|
await loadInitial()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func apply(snapshot: NSDiffableDataSourceSnapshot<Section, Item>, animatingDifferences: Bool) async {
|
||||||
|
await Task { @MainActor in
|
||||||
|
self.dataSource.apply(snapshot, animatingDifferences: animatingDifferences)
|
||||||
|
}.value
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
private func loadInitial() async {
|
||||||
|
state = .loadingInitial
|
||||||
|
|
||||||
|
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||||
|
snapshot.appendSections([.bookmarks])
|
||||||
|
snapshot.appendItems([.loadingIndicator])
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: false)
|
||||||
|
|
||||||
|
do {
|
||||||
|
let req = Client.getBookmarks(range: .count(BookmarksViewController.pageSize))
|
||||||
|
let (statuses, pagination) = try await mastodonController.run(req)
|
||||||
|
newer = pagination?.newer
|
||||||
|
older = pagination?.older
|
||||||
|
|
||||||
|
await mastodonController.persistentContainer.addAll(statuses: statuses)
|
||||||
|
|
||||||
|
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||||
|
snapshot.appendSections([.bookmarks])
|
||||||
|
snapshot.appendItems(statuses.map { .status(id: $0.id, state: .unknown, addedLocally: false) })
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: true)
|
||||||
|
|
||||||
|
state = .loaded
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
let config = ToastConfiguration(from: error, with: "Error Loading Bookmarks", in: self) { [weak self] toast in
|
||||||
|
toast.dismissToast(animated: true)
|
||||||
|
await self?.loadInitial()
|
||||||
|
}
|
||||||
|
showToast(configuration: config, animated: true)
|
||||||
|
|
||||||
|
await apply(snapshot: NSDiffableDataSourceSnapshot(), animatingDifferences: false)
|
||||||
|
|
||||||
|
state = .unloaded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
private func loadOlder() async {
|
||||||
|
guard case .loaded = state,
|
||||||
|
let older else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
state = .loadingOlder
|
||||||
|
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.appendItems([.loadingIndicator])
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: false)
|
||||||
|
|
||||||
|
do {
|
||||||
|
let req = Client.getBookmarks(range: older.withCount(BookmarksViewController.pageSize))
|
||||||
|
let (statuses, pagination) = try await mastodonController.run(req)
|
||||||
|
self.older = pagination?.older
|
||||||
|
|
||||||
|
await mastodonController.persistentContainer.addAll(statuses: statuses)
|
||||||
|
|
||||||
|
snapshot.deleteItems([.loadingIndicator])
|
||||||
|
snapshot.appendItems(statuses.map { .status(id: $0.id, state: .unknown, addedLocally: false) })
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: true)
|
||||||
|
} catch {
|
||||||
|
let config = ToastConfiguration(from: error, with: "Error Loading Older Bookmarks", in: self) { [weak self] toast in
|
||||||
|
toast.dismissToast(animated: true)
|
||||||
|
await self?.loadOlder()
|
||||||
|
}
|
||||||
|
showToast(configuration: config, animated: true)
|
||||||
|
|
||||||
|
snapshot.deleteItems([.loadingIndicator])
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
state = .loaded
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func handleStatusDeleted(_ notification: Foundation.Notification) {
|
||||||
|
guard let userInfo = notification.userInfo,
|
||||||
|
let accountID = mastodonController.accountInfo?.id,
|
||||||
|
userInfo["accountID"] as? String == accountID,
|
||||||
|
let statusIDs = userInfo["statusIDs"] as? [String] else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
let toDelete = statusIDs.map { id in
|
||||||
|
Item.status(id: id, state: .unknown, addedLocally: false)
|
||||||
|
}.filter { item in
|
||||||
|
snapshot.itemIdentifiers.contains(item)
|
||||||
|
}
|
||||||
|
if !toDelete.isEmpty {
|
||||||
|
snapshot.deleteItems(toDelete)
|
||||||
|
Task {
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func managedObjectsDidChange(_ notification: Foundation.Notification) {
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
func prepend(item: Item) {
|
||||||
|
if let first = snapshot.itemIdentifiers.first {
|
||||||
|
snapshot.insertItems([item], beforeItem: first)
|
||||||
|
} else {
|
||||||
|
snapshot.appendItems([item])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var hasChanges = false
|
||||||
|
if let inserted = notification.userInfo?[NSInsertedObjectsKey] as? Set<NSManagedObject> {
|
||||||
|
for case let status as StatusMO in inserted where status.bookmarked == true {
|
||||||
|
prepend(item: .status(id: status.id, state: .unknown, addedLocally: true))
|
||||||
|
hasChanges = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let updated = notification.userInfo?[NSUpdatedObjectsKey] as? Set<NSManagedObject> {
|
||||||
|
for case let status as StatusMO in updated {
|
||||||
|
let item = Item.status(id: status.id, state: .unknown, addedLocally: true)
|
||||||
|
var exists = snapshot.itemIdentifiers.contains(item)
|
||||||
|
if status.bookmarked == true && !exists {
|
||||||
|
prepend(item: item)
|
||||||
|
hasChanges = true
|
||||||
|
} else if status.bookmarked == false && exists {
|
||||||
|
snapshot.deleteItems([item])
|
||||||
|
hasChanges = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if hasChanges {
|
||||||
|
Task {
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Interaction
|
||||||
|
|
||||||
|
@objc func refresh() {
|
||||||
|
guard case .loaded = state,
|
||||||
|
let newer else {
|
||||||
|
#if !targetEnvironment(macCatalyst)
|
||||||
|
collectionView.refreshControl!.endRefreshing()
|
||||||
|
#endif
|
||||||
|
return
|
||||||
|
}
|
||||||
|
state = .loadingNewer
|
||||||
|
|
||||||
|
Task {
|
||||||
|
|
||||||
|
do {
|
||||||
|
let req = Client.getBookmarks(range: newer.withCount(BookmarksViewController.pageSize))
|
||||||
|
let (statuses, pagination) = try await mastodonController.run(req)
|
||||||
|
self.newer = pagination?.newer
|
||||||
|
|
||||||
|
await mastodonController.persistentContainer.addAll(statuses: statuses)
|
||||||
|
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
let localItems: [String: CollapseState] = Dictionary(uniqueKeysWithValues: snapshot.itemIdentifiers.compactMap({
|
||||||
|
if case .status(id: let id, state: let state, addedLocally: true) = $0 {
|
||||||
|
return (id, state)
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
var newItems: [Item] = []
|
||||||
|
for status in statuses {
|
||||||
|
let state: CollapseState
|
||||||
|
if let existing = localItems[status.id] {
|
||||||
|
state = existing
|
||||||
|
snapshot.deleteItems([.status(id: status.id, state: existing, addedLocally: true)])
|
||||||
|
} else {
|
||||||
|
state = .unknown
|
||||||
|
}
|
||||||
|
newItems.append(.status(id: status.id, state: state, addedLocally: false))
|
||||||
|
}
|
||||||
|
if let first = snapshot.itemIdentifiers.first {
|
||||||
|
snapshot.insertItems(newItems, beforeItem: first)
|
||||||
|
} else {
|
||||||
|
snapshot.appendItems(newItems)
|
||||||
|
}
|
||||||
|
await apply(snapshot: snapshot, animatingDifferences: true)
|
||||||
|
} catch {
|
||||||
|
let config = ToastConfiguration(from: error, with: "Error Refreshing Bookmarks", in: self) { [weak self] toast in
|
||||||
|
toast.dismissToast(animated: true)
|
||||||
|
self?.refresh()
|
||||||
|
}
|
||||||
|
showToast(configuration: config, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !targetEnvironment(macCatalyst)
|
||||||
|
collectionView.refreshControl!.endRefreshing()
|
||||||
|
#endif
|
||||||
|
state = .loaded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController {
|
||||||
|
enum Section {
|
||||||
|
case bookmarks
|
||||||
|
}
|
||||||
|
enum Item: Equatable, Hashable {
|
||||||
|
case status(id: String, state: CollapseState, addedLocally: Bool)
|
||||||
|
case loadingIndicator
|
||||||
|
|
||||||
|
var hideIndicators: Bool {
|
||||||
|
switch self {
|
||||||
|
case .loadingIndicator:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Item, rhs: Item) -> Bool {
|
||||||
|
switch (lhs, rhs) {
|
||||||
|
case (.status(id: let a, _, _), .status(id: let b, _, _)):
|
||||||
|
return a == b
|
||||||
|
case (.loadingIndicator, .loadingIndicator):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func hash(into hasher: inout Hasher) {
|
||||||
|
switch self {
|
||||||
|
case .status(id: let id, _, _):
|
||||||
|
hasher.combine(0)
|
||||||
|
hasher.combine(id)
|
||||||
|
case .loadingIndicator:
|
||||||
|
hasher.combine(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController {
|
||||||
|
enum State {
|
||||||
|
case unloaded
|
||||||
|
case loadingInitial
|
||||||
|
case loaded
|
||||||
|
case loadingOlder
|
||||||
|
case loadingNewer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController: UICollectionViewDelegate {
|
||||||
|
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
|
||||||
|
if indexPath.section == 0,
|
||||||
|
indexPath.row == collectionView.numberOfItems(inSection: indexPath.section) - 1 {
|
||||||
|
Task {
|
||||||
|
await self.loadOlder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
|
||||||
|
if case .status(_, _, _) = dataSource.itemIdentifier(for: indexPath) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||||
|
if case .status(id: let id, state: let state, _) = dataSource.itemIdentifier(for: indexPath) {
|
||||||
|
selected(status: id, state: state.copy())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
|
||||||
|
(collectionView.cellForItem(at: indexPath) as? TimelineStatusCollectionViewCell)?.contextMenuConfiguration()
|
||||||
|
}
|
||||||
|
|
||||||
|
func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
|
||||||
|
MenuPreviewHelper.willPerformPreviewAction(animator: animator, presenter: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController: UICollectionViewDragDelegate {
|
||||||
|
func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
|
||||||
|
(collectionView.cellForItem(at: indexPath) as? TimelineStatusCollectionViewCell)?.dragItemsForBeginning(session: session) ?? []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController: TuskerNavigationDelegate {
|
||||||
|
var apiController: MastodonController! { mastodonController }
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController: StatusCollectionViewCellDelegate {
|
||||||
|
func statusCellNeedsReconfigure(_ cell: StatusCollectionViewCell, animated: Bool, completion: (() -> Void)?) {
|
||||||
|
if let indexPath = collectionView.indexPath(for: cell) {
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.reconfigureItems([dataSource.itemIdentifier(for: indexPath)!])
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func statusCellShowFiltered(_ cell: StatusCollectionViewCell) {
|
||||||
|
// bookmarks aren't filtered
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController: TabBarScrollableViewController {
|
||||||
|
func tabBarScrollToTop() {
|
||||||
|
collectionView.scrollToTop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BookmarksViewController: StatusBarTappableViewController {
|
||||||
|
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult {
|
||||||
|
collectionView.scrollToTop()
|
||||||
|
return .stop
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,7 @@ struct AddHashtagPinnedTimelineView: View {
|
||||||
@EnvironmentObject private var mastodonController: MastodonController
|
@EnvironmentObject private var mastodonController: MastodonController
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
|
||||||
@Binding var pinnedTimelines: [Timeline]
|
@Binding var pinnedTimelines: [PinnedTimeline]
|
||||||
@StateObject private var viewModel = SearchViewModel()
|
@StateObject private var viewModel = SearchViewModel()
|
||||||
@State private var searchTask: Task<Void, Never>?
|
@State private var searchTask: Task<Void, Never>?
|
||||||
@State private var isSearching = false
|
@State private var isSearching = false
|
||||||
|
@ -34,7 +34,7 @@ struct AddHashtagPinnedTimelineView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
list
|
list
|
||||||
.navigationTitle("Search")
|
.navigationTitle("Add Hashtag")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.searchable(text: $viewModel.searchQuery, placement: .navigationBarDrawer(displayMode: .always), prompt: Text("Search for hashtags"))
|
.searchable(text: $viewModel.searchQuery, placement: .navigationBarDrawer(displayMode: .always), prompt: Text("Search for hashtags"))
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
//
|
||||||
|
// AddInstancePinnedTimelineView.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 1/27/23.
|
||||||
|
// Copyright © 2023 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
struct AddInstancePinnedTimelineView: UIViewControllerRepresentable {
|
||||||
|
typealias UIViewControllerType = UINavigationController
|
||||||
|
|
||||||
|
@Binding var pinnedTimelines: [PinnedTimeline]
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
|
||||||
|
func makeUIViewController(context: Context) -> UINavigationController {
|
||||||
|
let vc = InstanceSelectorTableViewController()
|
||||||
|
vc.title = "Add Instance"
|
||||||
|
vc.delegate = context.coordinator
|
||||||
|
vc.navigationItem.leftBarButtonItem = UIBarButtonItem(systemItem: .cancel, primaryAction: UIAction(handler: { _ in
|
||||||
|
dismiss()
|
||||||
|
}))
|
||||||
|
return UINavigationController(rootViewController: vc)
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeCoordinator() -> Coordinator {
|
||||||
|
let coordinator = Coordinator()
|
||||||
|
coordinator.didSelect = {
|
||||||
|
pinnedTimelines.append(.instance($0))
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
return coordinator
|
||||||
|
}
|
||||||
|
|
||||||
|
class Coordinator: InstanceSelectorTableViewControllerDelegate {
|
||||||
|
var didSelect: ((URL) -> Void)?
|
||||||
|
|
||||||
|
func didSelectInstance(url: URL) {
|
||||||
|
didSelect?(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,8 +14,9 @@ struct PinnedTimelinesView: View {
|
||||||
@ObservedObject private var accountPreferences: AccountPreferences
|
@ObservedObject private var accountPreferences: AccountPreferences
|
||||||
|
|
||||||
@State private var isShowingAddHashtagSheet = false
|
@State private var isShowingAddHashtagSheet = false
|
||||||
|
@State private var isShowingAddInstanceSheet = false
|
||||||
// store this separately from AccountPreferences in the view, b/c the @LazilyDecoding wrapper breaks animations
|
// store this separately from AccountPreferences in the view, b/c the @LazilyDecoding wrapper breaks animations
|
||||||
@State private var pinnedTimelines: [Timeline]
|
@State private var pinnedTimelines: [PinnedTimeline]
|
||||||
|
|
||||||
init(accountPreferences: AccountPreferences) {
|
init(accountPreferences: AccountPreferences) {
|
||||||
self.accountPreferences = accountPreferences
|
self.accountPreferences = accountPreferences
|
||||||
|
@ -61,7 +62,7 @@ struct PinnedTimelinesView: View {
|
||||||
})
|
})
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
ForEach([Timeline.home, .public(local: true), .public(local: false)], id: \.id) { timeline in
|
ForEach([PinnedTimeline.home, .public(local: true), .public(local: false)], id: \.id) { timeline in
|
||||||
Button {
|
Button {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
pinnedTimelines.append(timeline)
|
pinnedTimelines.append(timeline)
|
||||||
|
@ -80,12 +81,12 @@ struct PinnedTimelinesView: View {
|
||||||
ForEach(mastodonController.lists, id: \.id) { list in
|
ForEach(mastodonController.lists, id: \.id) { list in
|
||||||
Button {
|
Button {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
pinnedTimelines.append(list.timeline)
|
pinnedTimelines.append(.list(id: list.id))
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Text(list.title)
|
Text(list.title)
|
||||||
}
|
}
|
||||||
.disabled(pinnedTimelines.contains(list.timeline))
|
.disabled(pinnedTimelines.contains(.list(id: list.id)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +95,12 @@ struct PinnedTimelinesView: View {
|
||||||
} label: {
|
} label: {
|
||||||
Label("Hashtag…", systemImage: "number")
|
Label("Hashtag…", systemImage: "number")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
isShowingAddInstanceSheet = true
|
||||||
|
} label: {
|
||||||
|
Label("Instance…", systemImage: "globe")
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Label("Add…", systemImage: "plus")
|
Label("Add…", systemImage: "plus")
|
||||||
.padding(.horizontal, 20)
|
.padding(.horizontal, 20)
|
||||||
|
@ -106,6 +113,10 @@ struct PinnedTimelinesView: View {
|
||||||
.sheet(isPresented: $isShowingAddHashtagSheet, content: {
|
.sheet(isPresented: $isShowingAddHashtagSheet, content: {
|
||||||
AddHashtagPinnedTimelineView(pinnedTimelines: $pinnedTimelines)
|
AddHashtagPinnedTimelineView(pinnedTimelines: $pinnedTimelines)
|
||||||
})
|
})
|
||||||
|
.sheet(isPresented: $isShowingAddInstanceSheet, content: {
|
||||||
|
AddInstancePinnedTimelineView(pinnedTimelines: $pinnedTimelines)
|
||||||
|
.edgesIgnoringSafeArea(.bottom)
|
||||||
|
})
|
||||||
.onReceive(accountPreferences.publisher(for: \.pinnedTimelinesData)) { _ in
|
.onReceive(accountPreferences.publisher(for: \.pinnedTimelinesData)) { _ in
|
||||||
if pinnedTimelines != accountPreferences.pinnedTimelines {
|
if pinnedTimelines != accountPreferences.pinnedTimelines {
|
||||||
pinnedTimelines = accountPreferences.pinnedTimelines
|
pinnedTimelines = accountPreferences.pinnedTimelines
|
||||||
|
@ -119,7 +130,7 @@ struct PinnedTimelinesView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate extension Timeline {
|
fileprivate extension PinnedTimeline {
|
||||||
var id: String {
|
var id: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .home:
|
case .home:
|
||||||
|
@ -130,8 +141,8 @@ fileprivate extension Timeline {
|
||||||
return "list:\(id)"
|
return "list:\(id)"
|
||||||
case .tag(hashtag: let tag):
|
case .tag(hashtag: let tag):
|
||||||
return "tag:\(tag)"
|
return "tag:\(tag)"
|
||||||
case .direct:
|
case .instance(let url):
|
||||||
return "direct"
|
return "instance:\(url.host!)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,7 +334,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect
|
||||||
return
|
return
|
||||||
|
|
||||||
case .bookmarks:
|
case .bookmarks:
|
||||||
show(BookmarksTableViewController(mastodonController: mastodonController), sender: nil)
|
show(BookmarksViewController(mastodonController: mastodonController), sender: nil)
|
||||||
|
|
||||||
case .trendingStatuses:
|
case .trendingStatuses:
|
||||||
show(TrendingStatusesViewController(mastodonController: mastodonController), sender: nil)
|
show(TrendingStatusesViewController(mastodonController: mastodonController), sender: nil)
|
||||||
|
|
|
@ -301,7 +301,7 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
||||||
toPrepend = searchVC
|
toPrepend = searchVC
|
||||||
} else {
|
} else {
|
||||||
switch tabNavigationStack[1] {
|
switch tabNavigationStack[1] {
|
||||||
case is BookmarksTableViewController:
|
case is BookmarksViewController:
|
||||||
exploreItem = .bookmarks
|
exploreItem = .bookmarks
|
||||||
case let listVC as ListTimelineViewController:
|
case let listVC as ListTimelineViewController:
|
||||||
exploreItem = .list(listVC.list)
|
exploreItem = .list(listVC.list)
|
||||||
|
@ -374,7 +374,7 @@ fileprivate extension MainSidebarViewController.Item {
|
||||||
case .explore:
|
case .explore:
|
||||||
return SearchViewController(mastodonController: mastodonController)
|
return SearchViewController(mastodonController: mastodonController)
|
||||||
case .bookmarks:
|
case .bookmarks:
|
||||||
return BookmarksTableViewController(mastodonController: mastodonController)
|
return BookmarksViewController(mastodonController: mastodonController)
|
||||||
case .profileDirectory:
|
case .profileDirectory:
|
||||||
return ProfileDirectoryViewController(mastodonController: mastodonController)
|
return ProfileDirectoryViewController(mastodonController: mastodonController)
|
||||||
case let .list(list):
|
case let .list(list):
|
||||||
|
|
|
@ -118,7 +118,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
"created_at": notification.createdAt.formatted(.iso8601),
|
"created_at": notification.createdAt.formatted(.iso8601),
|
||||||
"account": notification.account.id,
|
"account": notification.account.id,
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
fatalError("missing status for \(group.kind) notification")
|
fatalError("missing status for \(group.kind) notification")
|
||||||
}
|
}
|
||||||
cell.updateUI(statusID: status.id, state: group.statusState!)
|
cell.updateUI(statusID: status.id, state: group.statusState!)
|
||||||
|
@ -173,7 +173,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
"created_at": notif.createdAt.formatted(.iso8601),
|
"created_at": notif.createdAt.formatted(.iso8601),
|
||||||
"account": notif.account.id,
|
"account": notif.account.id,
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,15 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import AuthenticationServices
|
import AuthenticationServices
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
import OSLog
|
||||||
|
|
||||||
protocol OnboardingViewControllerDelegate {
|
protocol OnboardingViewControllerDelegate {
|
||||||
@MainActor
|
@MainActor
|
||||||
func didFinishOnboarding(account: LocalData.UserAccountInfo)
|
func didFinishOnboarding(account: LocalData.UserAccountInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "OnboardingViewController")
|
||||||
|
|
||||||
class OnboardingViewController: UINavigationController {
|
class OnboardingViewController: UINavigationController {
|
||||||
|
|
||||||
var onboardingDelegate: OnboardingViewControllerDelegate?
|
var onboardingDelegate: OnboardingViewControllerDelegate?
|
||||||
|
@ -40,7 +43,78 @@ class OnboardingViewController: UINavigationController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func tryLoginTo(instanceURL: URL) async throws {
|
private func login(to instanceURL: URL) async {
|
||||||
|
let dimmingView = UIView()
|
||||||
|
dimmingView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
dimmingView.backgroundColor = .black.withAlphaComponent(0.1)
|
||||||
|
|
||||||
|
let blur = UIBlurEffect(style: .prominent)
|
||||||
|
let blurView = UIVisualEffectView(effect: blur)
|
||||||
|
blurView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
blurView.layer.cornerRadius = 15
|
||||||
|
blurView.layer.masksToBounds = true
|
||||||
|
|
||||||
|
let spinner = UIActivityIndicatorView(style: .large)
|
||||||
|
spinner.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
spinner.startAnimating()
|
||||||
|
|
||||||
|
let statusLabel = UILabel()
|
||||||
|
statusLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
statusLabel.font = .preferredFont(forTextStyle: .headline)
|
||||||
|
statusLabel.numberOfLines = 0
|
||||||
|
statusLabel.textAlignment = .center
|
||||||
|
|
||||||
|
blurView.contentView.addSubview(spinner)
|
||||||
|
blurView.contentView.addSubview(statusLabel)
|
||||||
|
dimmingView.addSubview(blurView)
|
||||||
|
view.addSubview(dimmingView)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
dimmingView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
|
dimmingView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||||
|
dimmingView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||||
|
dimmingView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||||
|
|
||||||
|
blurView.widthAnchor.constraint(equalToConstant: 150),
|
||||||
|
blurView.heightAnchor.constraint(equalToConstant: 150),
|
||||||
|
blurView.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor),
|
||||||
|
blurView.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor),
|
||||||
|
|
||||||
|
spinner.centerXAnchor.constraint(equalTo: blurView.contentView.centerXAnchor),
|
||||||
|
spinner.bottomAnchor.constraint(equalTo: blurView.contentView.centerYAnchor, constant: -2),
|
||||||
|
statusLabel.leadingAnchor.constraint(equalTo: blurView.contentView.leadingAnchor),
|
||||||
|
statusLabel.trailingAnchor.constraint(equalTo: blurView.contentView.trailingAnchor),
|
||||||
|
statusLabel.topAnchor.constraint(equalTo: blurView.contentView.centerYAnchor, constant: 2),
|
||||||
|
])
|
||||||
|
|
||||||
|
dimmingView.layer.opacity = 0
|
||||||
|
blurView.transform = CGAffineTransform(scaleX: 1.2, y: 1.2)
|
||||||
|
UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseInOut) {
|
||||||
|
dimmingView.layer.opacity = 1
|
||||||
|
blurView.transform = .identity
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
try await tryLogin(to: instanceURL) {
|
||||||
|
statusLabel.text = $0
|
||||||
|
}
|
||||||
|
} catch Error.cancelled {
|
||||||
|
// no-op, don't show an error message
|
||||||
|
} catch {
|
||||||
|
let message: String
|
||||||
|
if let error = error as? Error {
|
||||||
|
message = error.localizedDescription
|
||||||
|
} else {
|
||||||
|
message = error.localizedDescription
|
||||||
|
}
|
||||||
|
let alert = UIAlertController(title: "Error Logging In", message: message, preferredStyle: .alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: .default))
|
||||||
|
self.present(alert, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
dimmingView.removeFromSuperview()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func tryLogin(to instanceURL: URL, updateStatus: (String) -> Void) async throws {
|
||||||
let mastodonController = MastodonController(instanceURL: instanceURL, transient: true)
|
let mastodonController = MastodonController(instanceURL: instanceURL, transient: true)
|
||||||
let clientID: String
|
let clientID: String
|
||||||
let clientSecret: String
|
let clientSecret: String
|
||||||
|
@ -48,27 +122,23 @@ class OnboardingViewController: UINavigationController {
|
||||||
clientID = clientInfo.id
|
clientID = clientInfo.id
|
||||||
clientSecret = clientInfo.secret
|
clientSecret = clientInfo.secret
|
||||||
} else {
|
} else {
|
||||||
|
updateStatus("Registering App")
|
||||||
do {
|
do {
|
||||||
(clientID, clientSecret) = try await mastodonController.registerApp()
|
(clientID, clientSecret) = try await mastodonController.registerApp()
|
||||||
self.clientInfo = (instanceURL, clientID, clientSecret)
|
self.clientInfo = (instanceURL, clientID, clientSecret)
|
||||||
// m.s has problems with (I think) the read replicas not updating fast enough
|
updateStatus("Reticulating Splines")
|
||||||
// so give it some more time to propagate, and prevent invalid_client/etc. errors
|
try await Task.sleep(nanoseconds: 500 * NSEC_PER_MSEC)
|
||||||
if instanceURL.host == "mastodon.social" {
|
|
||||||
try await Task.sleep(nanoseconds: 2 * NSEC_PER_SEC)
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
throw Error.registeringApp(error)
|
throw Error.registeringApp(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateStatus("Logging in")
|
||||||
let authCode = try await getAuthorizationCode(instanceURL: instanceURL, clientID: clientID)
|
let authCode = try await getAuthorizationCode(instanceURL: instanceURL, clientID: clientID)
|
||||||
if instanceURL.host == "mastodon.social" {
|
updateStatus("Authorizing")
|
||||||
try await Task.sleep(nanoseconds: 2 * NSEC_PER_SEC)
|
|
||||||
}
|
|
||||||
let accessToken: String
|
let accessToken: String
|
||||||
do {
|
do {
|
||||||
accessToken = try await mastodonController.authorize(authorizationCode: authCode)
|
accessToken = try await retrying("Getting access token") {
|
||||||
if instanceURL.host == "mastodon.social" {
|
try await mastodonController.authorize(authorizationCode: authCode)
|
||||||
try await Task.sleep(nanoseconds: 2 * NSEC_PER_SEC)
|
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
throw Error.gettingAccessToken(error)
|
throw Error.gettingAccessToken(error)
|
||||||
|
@ -78,9 +148,12 @@ class OnboardingViewController: UINavigationController {
|
||||||
let tempAccountInfo = LocalData.UserAccountInfo(tempInstanceURL: instanceURL, clientID: clientID, clientSecret: clientSecret, accessToken: accessToken)
|
let tempAccountInfo = LocalData.UserAccountInfo(tempInstanceURL: instanceURL, clientID: clientID, clientSecret: clientSecret, accessToken: accessToken)
|
||||||
mastodonController.accountInfo = tempAccountInfo
|
mastodonController.accountInfo = tempAccountInfo
|
||||||
|
|
||||||
|
updateStatus("Checking Credentials")
|
||||||
let ownAccount: Account
|
let ownAccount: Account
|
||||||
do {
|
do {
|
||||||
ownAccount = try await mastodonController.getOwnAccount()
|
ownAccount = try await retrying("Getting own account") {
|
||||||
|
try await mastodonController.getOwnAccount()
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
throw Error.gettingOwnAccount(error)
|
throw Error.gettingOwnAccount(error)
|
||||||
}
|
}
|
||||||
|
@ -91,6 +164,19 @@ class OnboardingViewController: UINavigationController {
|
||||||
self.onboardingDelegate?.didFinishOnboarding(account: accountInfo)
|
self.onboardingDelegate?.didFinishOnboarding(account: accountInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func retrying<T>(_ label: StaticString, action: () async throws -> T) async throws -> T {
|
||||||
|
for attempt in 0..<4 {
|
||||||
|
do {
|
||||||
|
return try await action()
|
||||||
|
} catch {
|
||||||
|
let seconds = (pow(2, attempt) as NSDecimalNumber).uint64Value
|
||||||
|
logger.error("\(label, privacy: .public) failed, waiting \(seconds, privacy: .public)s before retrying. Reason: \(String(describing: error))")
|
||||||
|
try! await Task.sleep(nanoseconds: seconds * NSEC_PER_SEC)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return try await action()
|
||||||
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func getAuthorizationCode(instanceURL: URL, clientID: String) async throws -> String {
|
private func getAuthorizationCode(instanceURL: URL, clientID: String) async throws -> String {
|
||||||
var components = URLComponents(url: instanceURL, resolvingAgainstBaseURL: false)!
|
var components = URLComponents(url: instanceURL, resolvingAgainstBaseURL: false)!
|
||||||
|
@ -160,15 +246,8 @@ extension OnboardingViewController {
|
||||||
extension OnboardingViewController: InstanceSelectorTableViewControllerDelegate {
|
extension OnboardingViewController: InstanceSelectorTableViewControllerDelegate {
|
||||||
func didSelectInstance(url instanceURL: URL) {
|
func didSelectInstance(url instanceURL: URL) {
|
||||||
Task {
|
Task {
|
||||||
do {
|
await self.login(to: instanceURL)
|
||||||
try await self.tryLoginTo(instanceURL: instanceURL)
|
instanceSelector.tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
||||||
} catch Error.cancelled {
|
|
||||||
// no-op, don't show an error message
|
|
||||||
} catch let error as Error {
|
|
||||||
let alert = UIAlertController(title: "Error Logging In", message: error.localizedDescription, preferredStyle: .alert)
|
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: .default))
|
|
||||||
self.present(alert, animated: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class PreferencesNavigationController: UINavigationController {
|
||||||
sceneDelegate.logoutCurrent()
|
sceneDelegate.logoutCurrent()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LocalData.shared.removeAccount(LocalData.shared.getMostRecentAccount()!)
|
LogoutService(accountInfo: LocalData.shared.getMostRecentAccount()!).run()
|
||||||
let accountID = LocalData.shared.getMostRecentAccount()?.id
|
let accountID = LocalData.shared.getMostRecentAccount()?.id
|
||||||
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: UserActivityManager.mainSceneActivity(accountID: accountID), options: nil)
|
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: UserActivityManager.mainSceneActivity(accountID: accountID), options: nil)
|
||||||
UIApplication.shared.requestSceneSessionDestruction(windowScene.session, options: nil)
|
UIApplication.shared.requestSceneSessionDestruction(windowScene.session, options: nil)
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct PreferencesView: View {
|
||||||
indices.remove(index)
|
indices.remove(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
indices.forEach { localData.removeAccount(localData.accounts[$0]) }
|
indices.forEach { LogoutService(accountInfo: localData.accounts[$0]).run() }
|
||||||
|
|
||||||
if logoutFromCurrent {
|
if logoutFromCurrent {
|
||||||
self.logoutPressed()
|
self.logoutPressed()
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct ReportAddStatusView: View {
|
||||||
})
|
})
|
||||||
.task { @MainActor in
|
.task { @MainActor in
|
||||||
do {
|
do {
|
||||||
let req = Account.getStatuses(report.accountID, excludeReplies: false, excludeReblogs: true)
|
let req = Account.getStatuses(report.accountID, range: .count(40), excludeReplies: false, excludeReblogs: true)
|
||||||
let (statuses, _) = try await mastodonController.run(req)
|
let (statuses, _) = try await mastodonController.run(req)
|
||||||
await mastodonController.persistentContainer.addAll(statuses: statuses)
|
await mastodonController.persistentContainer.addAll(statuses: statuses)
|
||||||
self.statuses = statuses.compactMap { mastodonController.persistentContainer.status(for: $0.id) }
|
self.statuses = statuses.compactMap { mastodonController.persistentContainer.status(for: $0.id) }
|
||||||
|
|
|
@ -11,6 +11,8 @@ import Pachyderm
|
||||||
|
|
||||||
class StatusActionAccountListCollectionViewController: UIViewController, CollectionViewController {
|
class StatusActionAccountListCollectionViewController: UIViewController, CollectionViewController {
|
||||||
|
|
||||||
|
private static let pageSize = 40
|
||||||
|
|
||||||
private let statusID: String
|
private let statusID: String
|
||||||
private let actionType: StatusActionAccountListViewController.ActionType
|
private let actionType: StatusActionAccountListViewController.ActionType
|
||||||
private let mastodonController: MastodonController
|
private let mastodonController: MastodonController
|
||||||
|
@ -147,9 +149,9 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
|
||||||
private func request(for range: RequestRange) -> Request<[Account]> {
|
private func request(for range: RequestRange) -> Request<[Account]> {
|
||||||
switch actionType {
|
switch actionType {
|
||||||
case .favorite:
|
case .favorite:
|
||||||
return Status.getFavourites(statusID, range: range)
|
return Status.getFavourites(statusID, range: range.withCount(Self.pageSize))
|
||||||
case .reblog:
|
case .reblog:
|
||||||
return Status.getReblogs(statusID, range: range)
|
return Status.getReblogs(statusID, range: range.withCount(Self.pageSize))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +211,6 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
|
||||||
await apply(snapshot: snapshot)
|
await apply(snapshot: snapshot)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try! await Task.sleep(nanoseconds: 2 * NSEC_PER_SEC)
|
|
||||||
let (accounts, pagination) = try await mastodonController.run(request(for: older))
|
let (accounts, pagination) = try await mastodonController.run(request(for: older))
|
||||||
await mastodonController.persistentContainer.addAll(accounts: accounts)
|
await mastodonController.persistentContainer.addAll(accounts: accounts)
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class StatusActionAccountListViewController: UIViewController {
|
||||||
title = NSLocalizedString("Reblogged By", comment: "status reblogged by accounts list title")
|
title = NSLocalizedString("Reblogged By", comment: "status reblogged by accounts list title")
|
||||||
}
|
}
|
||||||
|
|
||||||
view.backgroundColor = .secondarySystemBackground
|
view.backgroundColor = .systemBackground
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(handleStatusDeleted), name: .statusDeleted, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(handleStatusDeleted), name: .statusDeleted, object: nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,7 +363,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
crumb.data = [
|
crumb.data = [
|
||||||
"statusIDs": position.statusIDs,
|
"statusIDs": position.statusIDs,
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
}()
|
}()
|
||||||
let originalPositionStatusIDs = position.statusIDs
|
let originalPositionStatusIDs = position.statusIDs
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
crumb.data = [
|
crumb.data = [
|
||||||
"unloaded": unloaded
|
"unloaded": unloaded
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
}()
|
}()
|
||||||
let results = await withTaskGroup(of: (String, Result<Status, Swift.Error>).self) { group -> [(String, Result<Status, Swift.Error>)] in
|
let results = await withTaskGroup(of: (String, Result<Status, Swift.Error>).self) { group -> [(String, Result<Status, Swift.Error>)] in
|
||||||
for id in unloaded {
|
for id in unloaded {
|
||||||
|
@ -401,7 +401,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
statuses.append(status)
|
statuses.append(status)
|
||||||
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||||
crumb.message = "Loaded status \(id)"
|
crumb.message = "Loaded status \(id)"
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
let crumb = Breadcrumb(level: .error, category: "TimelineViewController")
|
let crumb = Breadcrumb(level: .error, category: "TimelineViewController")
|
||||||
crumb.message = "Error loading status"
|
crumb.message = "Error loading status"
|
||||||
|
@ -409,7 +409,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
"error": String(describing: error),
|
"error": String(describing: error),
|
||||||
"id": id
|
"id": id
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await mastodonController.persistentContainer.addAll(statuses: statuses, in: mastodonController.persistentContainer.viewContext)
|
await mastodonController.persistentContainer.addAll(statuses: statuses, in: mastodonController.persistentContainer.viewContext)
|
||||||
|
@ -420,14 +420,14 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
crumb.data = [
|
crumb.data = [
|
||||||
"statusIDs": position.statusIDs,
|
"statusIDs": position.statusIDs,
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// if an icloud sync completed in between starting to load the statuses and finishing, try to load again
|
// if an icloud sync completed in between starting to load the statuses and finishing, try to load again
|
||||||
if position.statusIDs != originalPositionStatusIDs {
|
if position.statusIDs != originalPositionStatusIDs {
|
||||||
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||||
crumb.message = "TimelinePosition statusIDs changed, retrying load"
|
crumb.message = "TimelinePosition statusIDs changed, retrying load"
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
return await loadStatusesToRestore(position: position)
|
return await loadStatusesToRestore(position: position)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
crumb.data = [
|
crumb.data = [
|
||||||
"statusIDs": position.statusIDs,
|
"statusIDs": position.statusIDs,
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return !position.statusIDs.isEmpty
|
return !position.statusIDs.isEmpty
|
||||||
|
@ -469,7 +469,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
crumb.data = [
|
crumb.data = [
|
||||||
"statusIDs": position.statusIDs
|
"statusIDs": position.statusIDs
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
dataSource.apply(snapshot, animatingDifferences: false) {
|
dataSource.apply(snapshot, animatingDifferences: false) {
|
||||||
if let centerStatusID,
|
if let centerStatusID,
|
||||||
let index = statusIDs.firstIndex(of: centerStatusID),
|
let index = statusIDs.firstIndex(of: centerStatusID),
|
||||||
|
@ -506,7 +506,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
guard let status = self.mastodonController.persistentContainer.status(for: statusID) else {
|
guard let status = self.mastodonController.persistentContainer.status(for: statusID) else {
|
||||||
let crumb = Breadcrumb(level: .fatal, category: "TimelineViewController")
|
let crumb = Breadcrumb(level: .fatal, category: "TimelineViewController")
|
||||||
crumb.message = "Looking up status \(statusID)"
|
crumb.message = "Looking up status \(statusID)"
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
preconditionFailure("Missing status for filtering")
|
preconditionFailure("Missing status for filtering")
|
||||||
}
|
}
|
||||||
// if the status is a reblog of another one, filter based on that one
|
// if the status is a reblog of another one, filter based on that one
|
||||||
|
@ -589,6 +589,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
guard timelinePosition.centerStatusID != centerVisibleStatusID else {
|
guard timelinePosition.centerStatusID != centerVisibleStatusID else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
stateRestorationLogger.info("Potential restore with centerStatusID: \(timelinePosition.centerStatusID ?? "<none>")")
|
||||||
if !alwaysPrompt {
|
if !alwaysPrompt {
|
||||||
Task {
|
Task {
|
||||||
_ = await restoreState()
|
_ = await restoreState()
|
||||||
|
@ -947,10 +948,11 @@ extension TimelineViewController {
|
||||||
extension TimelineViewController {
|
extension TimelineViewController {
|
||||||
typealias TimelineItem = String // status ID
|
typealias TimelineItem = String // status ID
|
||||||
|
|
||||||
func loadInitial() async throws -> [TimelineItem] {
|
// the maximum mastodon will provide in a single request
|
||||||
try await Task.sleep(nanoseconds: 1 * NSEC_PER_SEC)
|
private static let pageSize = 40
|
||||||
|
|
||||||
let request = Client.getStatuses(timeline: timeline)
|
func loadInitial() async throws -> [TimelineItem] {
|
||||||
|
let request = Client.getStatuses(timeline: timeline, range: .count(TimelineViewController.pageSize))
|
||||||
let (statuses, _) = try await mastodonController.run(request)
|
let (statuses, _) = try await mastodonController.run(request)
|
||||||
|
|
||||||
await withCheckedContinuation { continuation in
|
await withCheckedContinuation { continuation in
|
||||||
|
@ -967,7 +969,7 @@ extension TimelineViewController {
|
||||||
guard case .status(id: let id, _, _) = dataSource.itemIdentifier(for: IndexPath(row: 0, section: statusesSection)) else {
|
guard case .status(id: let id, _, _) = dataSource.itemIdentifier(for: IndexPath(row: 0, section: statusesSection)) else {
|
||||||
throw Error.noNewer
|
throw Error.noNewer
|
||||||
}
|
}
|
||||||
let newer = RequestRange.after(id: id, count: nil)
|
let newer = RequestRange.after(id: id, count: TimelineViewController.pageSize)
|
||||||
|
|
||||||
let request = Client.getStatuses(timeline: timeline, range: newer)
|
let request = Client.getStatuses(timeline: timeline, range: newer)
|
||||||
let (statuses, _) = try await mastodonController.run(request)
|
let (statuses, _) = try await mastodonController.run(request)
|
||||||
|
@ -991,7 +993,7 @@ extension TimelineViewController {
|
||||||
guard case .status(id: let id, _, _) = dataSource.itemIdentifier(for: IndexPath(row: snapshot.numberOfItems(inSection: .statuses) - 1, section: statusesSection)) else {
|
guard case .status(id: let id, _, _) = dataSource.itemIdentifier(for: IndexPath(row: snapshot.numberOfItems(inSection: .statuses) - 1, section: statusesSection)) else {
|
||||||
throw Error.noNewer
|
throw Error.noNewer
|
||||||
}
|
}
|
||||||
let older = RequestRange.before(id: id, count: nil)
|
let older = RequestRange.before(id: id, count: TimelineViewController.pageSize)
|
||||||
|
|
||||||
let request = Client.getStatuses(timeline: timeline, range: older)
|
let request = Client.getStatuses(timeline: timeline, range: older)
|
||||||
let (statuses, _) = try await mastodonController.run(request)
|
let (statuses, _) = try await mastodonController.run(request)
|
||||||
|
@ -1022,13 +1024,13 @@ extension TimelineViewController {
|
||||||
// not really the right error but w/e
|
// not really the right error but w/e
|
||||||
throw Error.noGap
|
throw Error.noGap
|
||||||
}
|
}
|
||||||
range = .before(id: id, count: nil)
|
range = .before(id: id, count: TimelineViewController.pageSize)
|
||||||
case .below:
|
case .below:
|
||||||
guard gapIndexPath.row < statusItemsCount - 1,
|
guard gapIndexPath.row < statusItemsCount - 1,
|
||||||
case .status(id: let id, _, _) = dataSource.itemIdentifier(for: IndexPath(row: gapIndexPath.row + 1, section: gapIndexPath.section)) else {
|
case .status(id: let id, _, _) = dataSource.itemIdentifier(for: IndexPath(row: gapIndexPath.row + 1, section: gapIndexPath.section)) else {
|
||||||
throw Error.noGap
|
throw Error.noGap
|
||||||
}
|
}
|
||||||
range = .after(id: id, count: nil)
|
range = .after(id: id, count: TimelineViewController.pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
let request = Client.getStatuses(timeline: timeline, range: range)
|
let request = Client.getStatuses(timeline: timeline, range: range)
|
||||||
|
|
|
@ -28,7 +28,12 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
||||||
Page(mastodonController: mastodonController, timeline: $0)
|
Page(mastodonController: mastodonController, timeline: $0)
|
||||||
}
|
}
|
||||||
super.init(pages: pages) { page in
|
super.init(pages: pages) { page in
|
||||||
let vc = TimelineViewController(for: page.timeline, mastodonController: page.mastodonController)
|
let vc: TimelineViewController
|
||||||
|
if case .instance(let url) = page.timeline {
|
||||||
|
vc = InstanceTimelineViewController(for: url, parentMastodonController: mastodonController)
|
||||||
|
} else {
|
||||||
|
vc = TimelineViewController(for: page.timeline.timeline!, mastodonController: mastodonController)
|
||||||
|
}
|
||||||
vc.title = page.segmentedControlTitle
|
vc.title = page.segmentedControlTitle
|
||||||
vc.persistsState = true
|
vc.persistsState = true
|
||||||
return vc
|
return vc
|
||||||
|
@ -82,7 +87,7 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectTimeline(_ timeline: Timeline, animated: Bool) {
|
func selectTimeline(_ timeline: PinnedTimeline, animated: Bool) {
|
||||||
self.selectPage(Page(mastodonController: mastodonController, timeline: timeline), animated: animated)
|
self.selectPage(Page(mastodonController: mastodonController, timeline: timeline), animated: animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +96,11 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
||||||
}
|
}
|
||||||
|
|
||||||
func restoreActivity(_ activity: NSUserActivity) {
|
func restoreActivity(_ activity: NSUserActivity) {
|
||||||
guard let timeline = UserActivityManager.getTimeline(from: activity) else {
|
guard let timeline = UserActivityManager.getTimeline(from: activity),
|
||||||
|
let pinned = PinnedTimeline(timeline: timeline) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let page = Page(mastodonController: mastodonController, timeline: timeline)
|
let page = Page(mastodonController: mastodonController, timeline: pinned)
|
||||||
// the pinned timelines may have changed after an iCloud sync, in which case don't restore anything
|
// the pinned timelines may have changed after an iCloud sync, in which case don't restore anything
|
||||||
if pages.contains(page) {
|
if pages.contains(page) {
|
||||||
selectPage(page, animated: false)
|
selectPage(page, animated: false)
|
||||||
|
@ -110,7 +116,7 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
||||||
extension TimelinesPageViewController {
|
extension TimelinesPageViewController {
|
||||||
struct Page: SegmentedPageViewControllerPage {
|
struct Page: SegmentedPageViewControllerPage {
|
||||||
let mastodonController: MastodonController
|
let mastodonController: MastodonController
|
||||||
let timeline: Timeline
|
let timeline: PinnedTimeline
|
||||||
|
|
||||||
static func ==(lhs: Page, rhs: Page) -> Bool {
|
static func ==(lhs: Page, rhs: Page) -> Bool {
|
||||||
return lhs.timeline == rhs.timeline
|
return lhs.timeline == rhs.timeline
|
||||||
|
|
|
@ -216,10 +216,11 @@ class UserActivityManager {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if mastodonController.accountPreferences.pinnedTimelines.contains(timeline) {
|
if let pinned = PinnedTimeline(timeline: timeline),
|
||||||
|
mastodonController.accountPreferences.pinnedTimelines.contains(pinned) {
|
||||||
navigationController.popToRootViewController(animated: false)
|
navigationController.popToRootViewController(animated: false)
|
||||||
let rootController = navigationController.viewControllers.first! as! TimelinesPageViewController
|
let rootController = navigationController.viewControllers.first! as! TimelinesPageViewController
|
||||||
rootController.selectTimeline(timeline, animated: false)
|
rootController.selectTimeline(pinned, animated: false)
|
||||||
} else {
|
} else {
|
||||||
let timeline = TimelineViewController(for: timeline, mastodonController: mastodonController)
|
let timeline = TimelineViewController(for: timeline, mastodonController: mastodonController)
|
||||||
navigationController.pushViewController(timeline, animated: false)
|
navigationController.pushViewController(timeline, animated: false)
|
||||||
|
@ -276,7 +277,7 @@ class UserActivityManager {
|
||||||
mainViewController.select(tab: .explore)
|
mainViewController.select(tab: .explore)
|
||||||
if let navigationController = mainViewController.getTabController(tab: .explore) as? UINavigationController {
|
if let navigationController = mainViewController.getTabController(tab: .explore) as? UINavigationController {
|
||||||
navigationController.popToRootViewController(animated: false)
|
navigationController.popToRootViewController(animated: false)
|
||||||
navigationController.pushViewController(BookmarksTableViewController(mastodonController: mastodonController), animated: false)
|
navigationController.pushViewController(BookmarksViewController(mastodonController: mastodonController), animated: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class ActionNotificationGroupTableViewCell: UITableViewCell {
|
||||||
"created_at": firstNotification.createdAt.formatted(.iso8601),
|
"created_at": firstNotification.createdAt.formatted(.iso8601),
|
||||||
"account": firstNotification.account.id,
|
"account": firstNotification.account.id,
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
SentrySDK.addBreadcrumb(crumb)
|
||||||
fatalError("missing status for favorite/reblog notification")
|
fatalError("missing status for favorite/reblog notification")
|
||||||
}
|
}
|
||||||
self.statusID = status.id
|
self.statusID = status.id
|
||||||
|
|
|
@ -154,14 +154,12 @@ class ProfileHeaderView: UIView {
|
||||||
let followCountTitle = NSMutableAttributedString()
|
let followCountTitle = NSMutableAttributedString()
|
||||||
followCountTitle.append(NSAttributedString(string: followingAbbr, attributes: [
|
followCountTitle.append(NSAttributedString(string: followingAbbr, attributes: [
|
||||||
.font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!,
|
.font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!,
|
||||||
.foregroundColor: UIColor.label,
|
|
||||||
]))
|
]))
|
||||||
followCountTitle.append(NSAttributedString(string: " Following, ", attributes: [
|
followCountTitle.append(NSAttributedString(string: " Following, ", attributes: [
|
||||||
.foregroundColor: UIColor.secondaryLabel,
|
.foregroundColor: UIColor.secondaryLabel,
|
||||||
]))
|
]))
|
||||||
followCountTitle.append(NSAttributedString(string: followersAbbr, attributes: [
|
followCountTitle.append(NSAttributedString(string: followersAbbr, attributes: [
|
||||||
.font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!,
|
.font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!,
|
||||||
.foregroundColor: UIColor.label,
|
|
||||||
]))
|
]))
|
||||||
followCountTitle.append(NSAttributedString(string: " Follower\(account.followersCount == 1 ? "" : "s")", attributes: [
|
followCountTitle.append(NSAttributedString(string: " Follower\(account.followersCount == 1 ? "" : "s")", attributes: [
|
||||||
.foregroundColor: UIColor.secondaryLabel,
|
.foregroundColor: UIColor.secondaryLabel,
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
//
|
||||||
|
// PinnedTimelineTests.swift
|
||||||
|
// TuskerTests
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 1/27/23.
|
||||||
|
// Copyright © 2023 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import XCTest
|
||||||
|
@testable import Tusker
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
final class PinnedTimelineTests: XCTestCase {
|
||||||
|
|
||||||
|
func testDecodeFromTimeline() throws {
|
||||||
|
let timeline = Timeline.public(local: false)
|
||||||
|
let data = try JSONEncoder().encode(timeline)
|
||||||
|
let decoded = try JSONDecoder().decode(PinnedTimeline.self, from: data)
|
||||||
|
switch decoded {
|
||||||
|
case .public(local: false):
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
XCTFail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue