Skip to content

Commit

Permalink
Revert "Moderation Warning Notifications (IOS-264) (#1287)"
Browse files Browse the repository at this point in the history
This reverts commit 794ffc0.
  • Loading branch information
zeitschlag authored May 14, 2024
1 parent 794ffc0 commit d054471
Show file tree
Hide file tree
Showing 29 changed files with 59 additions and 285 deletions.
10 changes: 0 additions & 10 deletions Localization/StringsConvertor/input/Base.lproj/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,6 @@
"accepted": "Accepted",
"reject": "reject",
"rejected": "Rejected"
},
"warning": {
"none": "Your account has received a moderation warning.",
"disable": "Your account has been disabled.",
"mark_statuses_as_sensitive": "Some of your posts have been marked as sensitive.",
"delete_statuses": "Some of your posts have been removed.",
"sensitive": "Your posts will be marked as sensitive from now on.",
"silence": "Your account has been limited.",
"suspend": "Your account has been suspended.",
"learn_more": "Learn More"
}
},
"thread": {
Expand Down
10 changes: 0 additions & 10 deletions Localization/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,6 @@
"accepted": "Accepted",
"reject": "reject",
"rejected": "Rejected"
},
"warning": {
"none": "Your account has received a moderation warning.",
"disable": "Your account has been disabled.",
"mark_statuses_as_sensitive": "Some of your posts have been marked as sensitive.",
"delete_statuses": "Some of your posts have been removed.",
"sensitive": "Your posts will be marked as sensitive from now on.",
"silence": "Your account has been limited.",
"suspend": "Your account has been suspended.",
"learn_more": "Learn More"
}
},
"thread": {
Expand Down
16 changes: 10 additions & 6 deletions Mastodon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
D87BFC8F291EC26A00FEE264 /* MastodonLoginServerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87BFC8E291EC26A00FEE264 /* MastodonLoginServerTableViewCell.swift */; };
D886FBD329DF710F00272017 /* WelcomeSeparatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D886FBD229DF710F00272017 /* WelcomeSeparatorView.swift */; };
D8916DC029211BE500124085 /* ContentSizedTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8916DBF29211BE500124085 /* ContentSizedTableView.swift */; };
D8A0729D2BEBA8D7001A4C7C /* AccountWarningNotificationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A0729C2BEBA8D7001A4C7C /* AccountWarningNotificationCell.swift */; };
D8A6AB6C291C5136003AB663 /* MastodonLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A6AB6B291C5136003AB663 /* MastodonLoginViewController.swift */; };
D8B5E4EE2A4EB8930008970C /* NotificationSettingTableViewToggleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8B5E4ED2A4EB8920008970C /* NotificationSettingTableViewToggleCell.swift */; };
D8B5E4F02A4EB8A00008970C /* NotificationSettingTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8B5E4EF2A4EB8A00008970C /* NotificationSettingTableViewCell.swift */; };
Expand Down Expand Up @@ -797,7 +796,6 @@
D87DC50E2A17C32F00219C5F /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = el; path = el.lproj/Intents.stringsdict; sourceTree = "<group>"; };
D886FBD229DF710F00272017 /* WelcomeSeparatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeSeparatorView.swift; sourceTree = "<group>"; };
D8916DBF29211BE500124085 /* ContentSizedTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentSizedTableView.swift; sourceTree = "<group>"; };
D8A0729C2BEBA8D7001A4C7C /* AccountWarningNotificationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountWarningNotificationCell.swift; sourceTree = "<group>"; };
D8A6AB6B291C5136003AB663 /* MastodonLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonLoginViewController.swift; sourceTree = "<group>"; };
D8A6FE6129325F5900666A47 /* Intents.stringsdict */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; path = Intents.stringsdict; sourceTree = "<group>"; };
D8A6FE6229325F5900666A47 /* app.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = app.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1486,7 +1484,6 @@
DB023D2727A0FABD005AC798 /* NotificationTableViewCellDelegate.swift */,
DB63F76E279A7D1100455B82 /* NotificationTableViewCell.swift */,
DB63F774279A997D00455B82 /* NotificationTableViewCell+ViewModel.swift */,
D8A0729C2BEBA8D7001A4C7C /* AccountWarningNotificationCell.swift */,
);
path = Cell;
sourceTree = "<group>";
Expand Down Expand Up @@ -1568,6 +1565,7 @@
DB0617F927855B460030EE79 /* Profile */,
DB4F097926A039C400D62E92 /* Status */,
DB65C63527A2AF52008BAC2E /* Report */,
DB0617F727855B010030EE79 /* Notification */,
DB4F097726A039A200D62E92 /* Search */,
);
path = Diffable;
Expand Down Expand Up @@ -1923,6 +1921,15 @@
path = Onboarding;
sourceTree = "<group>";
};
DB0617F727855B010030EE79 /* Notification */ = {
isa = PBXGroup;
children = (
2D35237926256D920031AF25 /* NotificationSection.swift */,
2D7867182625B77500211898 /* NotificationItem.swift */,
);
path = Notification;
sourceTree = "<group>";
};
DB0617F827855B170030EE79 /* User */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2647,8 +2654,6 @@
D80F627E2B5C32E400877059 /* NotificationView */,
DB9D6BF725E4F5690051B173 /* NotificationViewController.swift */,
2D607AD726242FC500B70763 /* NotificationViewModel.swift */,
2D35237926256D920031AF25 /* NotificationSection.swift */,
2D7867182625B77500211898 /* NotificationItem.swift */,
);
path = Notification;
sourceTree = "<group>";
Expand Down Expand Up @@ -3440,7 +3445,6 @@
DB5B54AE2833C15F00DEF8B2 /* UserListViewModel+Diffable.swift in Sources */,
DB482A3F261331E8008AE74C /* UserTimelineViewModel+State.swift in Sources */,
DB3E6FE02806A4ED00B035AE /* DiscoveryHashtagsViewModel.swift in Sources */,
D8A0729D2BEBA8D7001A4C7C /* AccountWarningNotificationCell.swift in Sources */,
2D38F1F725CD47AC00561493 /* HomeTimelineViewModel+LoadOldestState.swift in Sources */,
DB0FCB7427956939006C02E2 /* DataSourceFacade+Status.swift in Sources */,
D81A22782AB4782400905D71 /* SearchResultOverviewSection.swift in Sources */,
Expand Down
3 changes: 0 additions & 3 deletions Mastodon.xcodeproj/xcshareddata/IDETemplateMacros.plist

This file was deleted.

3 changes: 1 addition & 2 deletions Mastodon/Coordinator/SceneCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ final public class SceneCoordinator {
from: from,
transition: .show
)
case .moderationWarning:
break

case ._other:
assertionFailure()
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,20 @@ extension NotificationSection {
configuration: Configuration
) -> UITableViewDiffableDataSource<NotificationSection, NotificationItem> {
tableView.register(NotificationTableViewCell.self, forCellReuseIdentifier: String(describing: NotificationTableViewCell.self))
tableView.register(AccountWarningNotificationCell.self, forCellReuseIdentifier: AccountWarningNotificationCell.reuseIdentifier)
tableView.register(TimelineBottomLoaderTableViewCell.self, forCellReuseIdentifier: String(describing: TimelineBottomLoaderTableViewCell.self))

return UITableViewDiffableDataSource(tableView: tableView) { tableView, indexPath, item -> UITableViewCell? in
switch item {
case .feed(let feed):
if let notification = feed.notification, let accountWarning = notification.accountWarning {
let cell = tableView.dequeueReusableCell(withIdentifier: AccountWarningNotificationCell.reuseIdentifier, for: indexPath) as! AccountWarningNotificationCell
cell.configure(with: accountWarning)
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: NotificationTableViewCell.self), for: indexPath) as! NotificationTableViewCell
configure(
context: context,
tableView: tableView,
cell: cell,
viewModel: NotificationTableViewCell.ViewModel(value: .feed(feed)),
configuration: configuration
)
return cell
}

let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: NotificationTableViewCell.self), for: indexPath) as! NotificationTableViewCell
configure(
context: context,
tableView: tableView,
cell: cell,
viewModel: NotificationTableViewCell.ViewModel(value: .feed(feed)),
configuration: configuration
)
return cell
case .feedLoader:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: TimelineBottomLoaderTableViewCell.self), for: indexPath) as! TimelineBottomLoaderTableViewCell
cell.activityIndicatorView.startAnimating()
Expand Down
2 changes: 1 addition & 1 deletion Mastodon/Protocol/Provider/DataSourceFacade+Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ extension DataSourceFacade {
else {
return
}
let mentions = status.entity.mentions
let mentions = status.entity.mentions ?? []

guard let mention = mentions.first(where: { $0.url == href }) else {
_ = provider.coordinator.present(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & AuthContextProvid
target: .status, // remove reblog wrapper
status: status
)
} else if let accountWarning = notification.entity.accountWarning {
let url = Mastodon.API.disputesEndpoint(domain: authContext.mastodonAuthenticationBox.domain, strikeId: accountWarning.id)
_ = coordinator.present(
scene: .safari(url: url),
from: self,
transition: .safariPresent(animated: true, completion: nil)
)

} else {
await DataSourceFacade.coordinateToProfileScene(
provider: self,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ extension NotificationView {
quoteStatusView.configure(status: status)
setQuoteStatusViewDisplay()
}
case .moderationWarning:
// case handled in `AccountWarningNotificationCell.swift`
break
case ._other:
setAuthorContainerBottomPaddingViewDisplay()
assertionFailure()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ extension MastodonPickServerViewController {

authenticationViewModel.isAuthenticating.send(true)

context.apiService.instance(domain: server.domain, authenticationBox: nil)
context.apiService.instance(domain: server.domain)
.compactMap { [weak self] response -> AnyPublisher<MastodonPickServerViewModel.SignUpResponseFirst, Error>? in
guard let self = self else { return nil }
guard response.value.registrations != false else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ extension MastodonPickServerViewModel {
self.unindexedServers.value = nil
return self.context.apiService.webFinger(domain: domain)
.flatMap { domain -> AnyPublisher<Result<Mastodon.Response.Content<[Mastodon.Entity.Server]>, Error>, Never> in
return self.context.apiService.instance(domain: domain, authenticationBox: nil)
return self.context.apiService.instance(domain: domain)
.map { response -> Result<Mastodon.Response.Content<[Mastodon.Entity.Server]>, Error>in
let newResponse = response.map { [Mastodon.Entity.Server(domain: domain, instance: $0)] }
return Result.success(newResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension MastodonRegisterViewController {
viewController.context = context
viewController.coordinator = coordinator

let instanceResponse = try await context.apiService.instance(domain: domain, authenticationBox: nil).singleOutput()
let instanceResponse = try await context.apiService.instance(domain: domain).singleOutput()
let applicationResponse = try await context.apiService.createApplication(domain: domain).singleOutput()
let accessTokenResponse = try await context.apiService.applicationAccessToken(
domain: domain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ extension WelcomeViewController {

authenticationViewModel.isAuthenticating.send(true)

context.apiService.instance(domain: server.domain, authenticationBox: nil)
context.apiService.instance(domain: server.domain)
.compactMap { [weak self] response -> AnyPublisher<MastodonPickServerViewModel.SignUpResponseFirst, Error>? in
guard let self = self else { return nil }
guard response.value.registrations != false else {
Expand Down
2 changes: 1 addition & 1 deletion Mastodon/Scene/Report/Report/ReportViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ReportViewModel {
// bind server rules
Task { @MainActor in
do {
let response = try await context.apiService.instance(domain: authContext.mastodonAuthenticationBox.domain, authenticationBox: authContext.mastodonAuthenticationBox)
let response = try await context.apiService.instance(domain: authContext.mastodonAuthenticationBox.domain)
.timeout(3, scheduler: DispatchQueue.main)
.singleOutput()
let rules = response.value.rules ?? []
Expand Down
4 changes: 2 additions & 2 deletions Mastodon/Scene/Settings/SettingsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ extension SettingsCoordinator: SettingsViewControllerDelegate {
let serverDetailsViewController = ServerDetailsViewController(domain: domain, appContext: appContext, authContext: authContext, sceneCoordinator: sceneCoordinator)
serverDetailsViewController.delegate = self

appContext.apiService.instanceV2(domain: domain, authenticationBox: authContext.mastodonAuthenticationBox)
appContext.apiService.instanceV2(domain: domain)
.sink { _ in

} receiveValue: { content in
serverDetailsViewController.update(with: content.value)
}
.store(in: &disposeBag)

appContext.apiService.extendedDescription(domain: domain, authenticationBox: authContext.mastodonAuthenticationBox)
appContext.apiService.extendedDescription(domain: domain)
.sink { _ in

} receiveValue: { content in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,18 @@ import MastodonSDK
extension APIService {

public func instance(
domain: String,
authenticationBox: MastodonAuthenticationBox?
domain: String
) -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Instance>, Error> {
return Mastodon.API.Instance.instance(session: session, authorization: authenticationBox?.userAuthorization, domain: domain)
return Mastodon.API.Instance.instance(session: session, domain: domain)
}

public func instanceV2(
domain: String,
authenticationBox: MastodonAuthenticationBox?
domain: String
) -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.V2.Instance>, Error> {
return Mastodon.API.V2.Instance.instance(session: session, authorization: authenticationBox?.userAuthorization, domain: domain)
return Mastodon.API.V2.Instance.instance(session: session, domain: domain)
}

public func extendedDescription(
domain: String,
authenticationBox: MastodonAuthenticationBox?
) -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.ExtendedDescription>, Error> {
return Mastodon.API.Instance.extendedDescription(session: session, authorization: authenticationBox?.userAuthorization, domain: domain)
public func extendedDescription(domain: String) -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.ExtendedDescription>, Error> {
return Mastodon.API.Instance.extendedDescription(session: session, domain: domain)
}
}
Loading

0 comments on commit d054471

Please sign in to comment.