Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Status from CoreData #1167

Merged
merged 63 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b010b61
Remove usage of Status (IOS-176)
kimar Nov 22, 2023
9ce078c
Fix loading of home timeline (IOS-176)
kimar Nov 22, 2023
d0893d5
Fix notifications timeline loading (IOS-176)
kimar Nov 22, 2023
e3f3e2c
Merge branch 'develop' into remove_status
kimar Nov 22, 2023
36d4f6e
Fix threads not working (IOS-176)
kimar Nov 22, 2023
9809e69
Fix favorite action (IOS-176)
kimar Nov 22, 2023
e0671eb
Reimplement favorite/reblog state (IOS-176)
kimar Nov 23, 2023
1dfcf40
Merge branch 'develop' into remove_status
kimar Nov 23, 2023
c7d62d5
Fix handling of (re-)reblogged and favorites state in home timeline (…
kimar Nov 27, 2023
4cb845e
Fix manual refresh of home timeline not working (IOS-176)
kimar Nov 27, 2023
faac99c
Fix duplicate entry after reblog (IOS-176)
kimar Nov 27, 2023
9c5e193
Reimplement timeline anchoring (IOS-176)
kimar Nov 27, 2023
cc3f1d0
Merge branch 'develop' into remove_status
kimar Nov 27, 2023
8316651
Fix tabbar avatar not visible (IOS-176)
kimar Nov 27, 2023
a322a46
Don't try to resolve self-relationship
kimar Nov 28, 2023
167e0e4
Fix translate not working (IOS-176)
kimar Nov 28, 2023
03aeb1f
Merge branch 'develop' into remove_status
kimar Nov 28, 2023
9fed54d
Fix compile issues after resolving merge conflicts
kimar Nov 28, 2023
45accb2
Fix CW cannot be hidden (IOS-176)
kimar Nov 28, 2023
7ad0b15
Fix bookmarked state (IOS-176)
kimar Nov 28, 2023
66b2bfd
Fix missing case in StatusFetchedResultsController
kimar Nov 28, 2023
1f73bee
Improve StatusFetchedResultsController update handling (IOS-176)
kimar Nov 28, 2023
112dce0
Improve flickering when interacting with posts (IOS-176)
kimar Dec 1, 2023
38423a1
Preserve isSensitiveToggled state when interacting with posts (IOS-176)
kimar Dec 1, 2023
28cdd67
Fix sensitive toggled state for reblogs (IOS-176)
kimar Dec 1, 2023
e6ba8db
Merge branch 'develop' into remove_status
kimar Dec 1, 2023
837d8dd
Fix user profile not loaded from status on home timeline (IOS-176)
kimar Dec 1, 2023
5532324
Implement caching for home timeline items (IOS-176)
kimar Dec 1, 2023
b57f38d
Fix status eventuall nil MastodonNotification
kimar Dec 4, 2023
63e45d6
Fix notifications show empty view (IOS-198)
kimar Dec 4, 2023
a1cd169
Implement cache for Notifications (IOS-200)
kimar Dec 4, 2023
69a92c3
Fix eventually incorrect domain used
kimar Dec 4, 2023
7323cb9
Fix missing poll information (IOS-201)
kimar Dec 4, 2023
0f3c50b
Fix non-ui-thread modification in when editing poll (IOS-203)
kimar Dec 4, 2023
86d3088
Remove unused code
kimar Dec 4, 2023
a4db8a2
Fix Poll appearance / layout / issues (IOS-201)
kimar Dec 5, 2023
c30fb73
Fix status deletion not updating data model (IOS-205)
kimar Dec 5, 2023
1754375
Fix favorited post might lose repost header (IOS-206)
kimar Dec 7, 2023
d1ba457
Remove status persistence (IOS-176)
kimar Dec 7, 2023
b0bdaac
Fix CW layout issues (IOS-207)
kimar Dec 8, 2023
ab689d3
Fix status thread CW not shown and interacted status not updated (IOS…
kimar Dec 8, 2023
7fb8fca
Fix issue caused by duplicate IDs after reloadingtimeline
kimar Dec 12, 2023
31796f1
Implement thread reload after publishing reply (IOS-176)
kimar Dec 13, 2023
9167260
Update datasource on delete statuses in timelines and thread (IOS-212)
kimar Dec 14, 2023
d759a4b
Update posts on timeline and thread if edited (IOS-211)
kimar Dec 14, 2023
22324f4
Fix Polls not showing up (IOS-213)
kimar Dec 14, 2023
275fa53
Fix DataSourceFacade+Bookmark protocol constraints (IOS-176)
kimar Dec 27, 2023
82cc0f2
Tie JSON cache to domain based unique identifier
kimar Dec 27, 2023
f6e5f53
Remove unused code
kimar Dec 27, 2023
4874615
Fix incorrectly named variable
kimar Dec 27, 2023
80df919
Remove switch case
kimar Dec 27, 2023
405b175
Implement alternative Author for DataSourceFacade.MenuContext (IOS-176)
kimar Dec 27, 2023
bf433e3
Address PR Feedback (IOS-176)
kimar Dec 28, 2023
2018d7c
Hide loading spinner after network requesty
kimar Jan 2, 2024
54b020f
Remove dead code
kimar Jan 2, 2024
c354eeb
Move poll query code to MastodonStatus
kimar Jan 2, 2024
0045e7d
Fix "reposted by ..." disappears when post get's (un-)favorited
kimar Jan 3, 2024
7af1bea
Rename classes
kimar Jan 3, 2024
4561dc5
Merge branch 'develop' into remove_status
kimar Jan 4, 2024
c1ad3e2
Rename properties
kimar Jan 4, 2024
97bfdab
Remove unused property
kimar Jan 4, 2024
f50d48d
Remove redundant main actor dispatch
kimar Jan 4, 2024
8e0c45f
Revert data propagation order in SearchResultViewModel
kimar Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,13 @@ extension DataSourceFacade {
for: user,
authenticationBox: dependency.authContext.mastodonAuthenticationBox)
}

static func responseToShowHideReblogAction(
dependency: NeedsDependency & AuthContextProvider,
user: Mastodon.Entity.Account
) async throws {
_ = try await dependency.context.apiService.toggleShowReblogs(
for: user,
authenticationBox: dependency.authContext.mastodonAuthenticationBox)
}
}
3 changes: 2 additions & 1 deletion Mastodon/Protocol/Provider/DataSourceFacade+Status.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ extension DataSourceFacade {
extension DataSourceFacade {

struct MenuContext {
let author: ManagedObjectRecord<MastodonUser>?
let author: ManagedObjectRecord<MastodonUser>? // todo: Remove once IOS-192 is ready
let authorEntity: Mastodon.Entity.Account?
let statusViewModel: StatusView.ViewModel?
let button: UIButton?
let barButtonItem: UIBarButtonItem?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extension NotificationTableViewCellDelegate where Self: DataSourceProvider & Aut
action: action,
menuContext: .init(
author: author,
authorEntity: notification.entity.account,
statusViewModel: nil,
button: button,
barButtonItem: nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,10 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider & AuthConte
assertionFailure("only works for status data provider")
return
}

let status = _status.reblog ?? _status

let _author: ManagedObjectRecord<MastodonUser>? = try await self.context.managedObjectContext.perform {
let status = _status.reblog ?? _status
let request = MastodonUser.sortedFetchRequest
request.predicate = MastodonUser.predicate(domain: self.authContext.mastodonAuthenticationBox.domain, id: status.entity.account.id)
request.fetchLimit = 1
Expand Down Expand Up @@ -518,6 +520,7 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider & AuthConte
action: action,
menuContext: .init(
author: author,
authorEntity: status.entity.account,
statusViewModel: statusViewModel,
button: button,
barButtonItem: nil
Expand Down
1 change: 1 addition & 0 deletions Mastodon/Scene/Profile/ProfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ extension ProfileViewController: MastodonMenuDelegate {
action: action,
menuContext: DataSourceFacade.MenuContext(
author: userRecord,
authorEntity: nil,
statusViewModel: nil,
button: nil,
barButtonItem: self.moreMenuBarButtonItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,38 @@ extension APIService {

return try result.get()
}

public func toggleShowReblogs(
for user: Mastodon.Entity.Account,
authenticationBox: MastodonAuthenticationBox
) async throws -> Mastodon.Response.Content<Mastodon.Entity.Relationship> {

let result: Result<Mastodon.Response.Content<Mastodon.Entity.Relationship>, Error>

let relationship = try await Mastodon.API.Account.relationships(
session: session,
domain: authenticationBox.domain,
query: .init(ids: [user.id]),
authorization: authenticationBox.userAuthorization
).singleOutput().value.first

let oldShowReblogs = relationship?.showingReblogs == true
let newShowReblogs = (oldShowReblogs == false)

do {
let response = try await Mastodon.API.Account.follow(
session: session,
domain: authenticationBox.domain,
accountID: user.id,
followQueryType: .follow(query: .init(reblogs: newShowReblogs)),
authorization: authenticationBox.userAuthorization
).singleOutput()

result = .success(response)
} catch {
result = .failure(error)
}

return try result.get()
}
}
Loading