mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Add viewController for notification-requests (IOS-241)
This commit is contained in:
parent
7cdde7797f
commit
5473e7f3f9
@ -161,6 +161,8 @@
|
||||
D83B54F82C2AC2FA00D18A7B /* NotificationFilteringBannerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D83B54F72C2AC2FA00D18A7B /* NotificationFilteringBannerTableViewCell.swift */; };
|
||||
D84738D42BBD9ABE00ECD52B /* TimelineStatusPill.swift in Sources */ = {isa = PBXBuildFile; fileRef = D84738D32BBD9ABE00ECD52B /* TimelineStatusPill.swift */; };
|
||||
D84BB76B2C3BE33800493718 /* NotificationPolicyFilterTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D84BB76A2C3BE33800493718 /* NotificationPolicyFilterTableViewCell.swift */; };
|
||||
D84BB76D2C3D88B000493718 /* DataSourceFacade+Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = D84BB76C2C3D88B000493718 /* DataSourceFacade+Notifications.swift */; };
|
||||
D84BB76F2C3D8DBC00493718 /* NotificationRequestsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D84BB76E2C3D8DBC00493718 /* NotificationRequestsTableViewController.swift */; };
|
||||
D84FA0932AE6915800987F47 /* MBProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = D84FA0922AE6915800987F47 /* MBProgressHUD */; };
|
||||
D852C23C2AC5D02C00309232 /* AboutInstanceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D852C23B2AC5D02C00309232 /* AboutInstanceViewController.swift */; };
|
||||
D852C23E2AC5D03300309232 /* InstanceRulesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D852C23D2AC5D03300309232 /* InstanceRulesViewController.swift */; };
|
||||
@ -796,6 +798,8 @@
|
||||
D83B54F72C2AC2FA00D18A7B /* NotificationFilteringBannerTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationFilteringBannerTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D84738D32BBD9ABE00ECD52B /* TimelineStatusPill.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStatusPill.swift; sourceTree = "<group>"; };
|
||||
D84BB76A2C3BE33800493718 /* NotificationPolicyFilterTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationPolicyFilterTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D84BB76C2C3D88B000493718 /* DataSourceFacade+Notifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataSourceFacade+Notifications.swift"; sourceTree = "<group>"; };
|
||||
D84BB76E2C3D8DBC00493718 /* NotificationRequestsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationRequestsTableViewController.swift; sourceTree = "<group>"; };
|
||||
D84C099D2B0F9E33009E685E /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
D84C099F2B0F9E41009E685E /* Setup.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Setup.md; sourceTree = "<group>"; };
|
||||
D84C09A02B0F9E41009E685E /* How-it-works.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "How-it-works.md"; sourceTree = "<group>"; };
|
||||
@ -1770,6 +1774,7 @@
|
||||
children = (
|
||||
D80EC2622C2978EE009724A5 /* NotificationPolicyViewController.swift */,
|
||||
D84BB76A2C3BE33800493718 /* NotificationPolicyFilterTableViewCell.swift */,
|
||||
D84BB76E2C3D8DBC00493718 /* NotificationRequestsTableViewController.swift */,
|
||||
);
|
||||
path = "Notification Filtering";
|
||||
sourceTree = "<group>";
|
||||
@ -2424,6 +2429,7 @@
|
||||
DB0FCB67279507EF006C02E2 /* DataSourceFacade+Meta.swift */,
|
||||
27D701F4292FC2D60031BCBB /* DataSourceFacade+URL.swift */,
|
||||
DB0FCB79279576A2006C02E2 /* DataSourceFacade+Thread.swift */,
|
||||
D84BB76C2C3D88B000493718 /* DataSourceFacade+Notifications.swift */,
|
||||
DB63F74627990B0600455B82 /* DataSourceFacade+Hashtag.swift */,
|
||||
DB63F7532799491600455B82 /* DataSourceFacade+SearchHistory.swift */,
|
||||
DB159C2A27A17BAC0068DC77 /* DataSourceFacade+Media.swift */,
|
||||
@ -3514,6 +3520,7 @@
|
||||
DBDFF1902805543100557A48 /* DiscoveryPostsViewController.swift in Sources */,
|
||||
DB697DD9278F4CED004EF2F7 /* HomeTimelineViewController+DataSourceProvider.swift in Sources */,
|
||||
DB45FAD725CA6C76005A8AC7 /* UIBarButtonItem.swift in Sources */,
|
||||
D84BB76F2C3D8DBC00493718 /* NotificationRequestsTableViewController.swift in Sources */,
|
||||
D8FAAE432AD047B200DC1832 /* AboutInstanceTableFooterView.swift in Sources */,
|
||||
D808B94E296EFBBA0031EB1E /* StatusEditHistoryTableViewCell.swift in Sources */,
|
||||
D852C23E2AC5D03300309232 /* InstanceRulesViewController.swift in Sources */,
|
||||
@ -3868,6 +3875,7 @@
|
||||
DBD5B1F827BCFD9D00BD6B38 /* DataSourceProvider+TableViewControllerNavigateable.swift in Sources */,
|
||||
0FB3D31E25E534C700AAD544 /* PickServerCategoryCollectionViewCell.swift in Sources */,
|
||||
DB0FCB882796BDA9006C02E2 /* SearchItem.swift in Sources */,
|
||||
D84BB76D2C3D88B000493718 /* DataSourceFacade+Notifications.swift in Sources */,
|
||||
DB6180ED26391C6C0018D199 /* TransitioningMath.swift in Sources */,
|
||||
2A409F832B5955290044E472 /* MastodonStatusThreadViewModel+State.swift in Sources */,
|
||||
2D6DE40026141DF600A63F6A /* SearchViewModel.swift in Sources */,
|
||||
|
@ -205,7 +205,10 @@ extension SceneCoordinator {
|
||||
|
||||
// setting
|
||||
case settings(setting: Setting)
|
||||
|
||||
|
||||
// Notifications
|
||||
case notificationRequests(viewModel: NotificationRequestsViewModel)
|
||||
|
||||
// report
|
||||
case report(viewModel: ReportViewModel)
|
||||
case reportServerRules(viewModel: ReportServerRulesViewModel)
|
||||
@ -558,6 +561,8 @@ private extension SceneCoordinator {
|
||||
case .editStatus(let viewModel):
|
||||
let composeViewController = ComposeViewController(viewModel: viewModel)
|
||||
viewController = composeViewController
|
||||
case .notificationRequests(let viewModel):
|
||||
viewController = NotificationRequestsTableViewController(viewModel: viewModel)
|
||||
}
|
||||
|
||||
setupDependency(for: viewController as? NeedsDependency)
|
||||
|
@ -0,0 +1,25 @@
|
||||
// Copyright © 2024 Mastodon gGmbH. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
import MastodonCore
|
||||
|
||||
extension DataSourceFacade {
|
||||
@MainActor
|
||||
static func coordinateToNotificationRequests(
|
||||
provider: DataSourceProvider & AuthContextProvider
|
||||
) async {
|
||||
provider.coordinator.showLoading()
|
||||
|
||||
do {
|
||||
let notificationRequests = try await provider.context.apiService.notificationRequests(authenticationBox: provider.authContext.mastodonAuthenticationBox)
|
||||
let viewModel = NotificationRequestsViewModel()
|
||||
|
||||
provider.coordinator.hideLoading()
|
||||
|
||||
provider.coordinator.present(scene: .notificationRequests(viewModel: viewModel), transition: .show)
|
||||
} catch {
|
||||
//TODO: Error Handling
|
||||
provider.coordinator.hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
@ -58,8 +58,7 @@ extension UITableViewDelegate where Self: DataSourceProvider & AuthContextProvid
|
||||
)
|
||||
}
|
||||
case .notificationBanner(let policy):
|
||||
//TODO: Coordinate to pending notification-screen
|
||||
break
|
||||
await DataSourceFacade.coordinateToNotificationRequests(provider: self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ class NotificationPolicyViewController: UIViewController {
|
||||
guard let self else { return }
|
||||
|
||||
do {
|
||||
let result = try await viewModel.appContext.apiService.updateNotificationPolicy(
|
||||
_ = try await viewModel.appContext.apiService.updateNotificationPolicy(
|
||||
authenticationBox: authenticationBox,
|
||||
filterNotFollowing: viewModel.notFollowing,
|
||||
filterNotFollowers: viewModel.noFollower,
|
||||
|
@ -0,0 +1,25 @@
|
||||
// Copyright © 2024 Mastodon gGmbH. All rights reserved.
|
||||
|
||||
import UIKit
|
||||
|
||||
struct NotificationRequestsViewModel {
|
||||
|
||||
}
|
||||
|
||||
class NotificationRequestsTableViewController: UIViewController {
|
||||
let tableView: UITableView
|
||||
|
||||
init(viewModel: NotificationRequestsViewModel) {
|
||||
//TODO: Cell, DataSource, Delegate....
|
||||
tableView = UITableView(frame: .zero)
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
tableView.backgroundColor = .systemBackground
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
||||
view.addSubview(tableView)
|
||||
tableView.pinToParent()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
|
||||
}
|
@ -127,7 +127,7 @@ extension NotificationViewController {
|
||||
newAccount: policy.filterNewAccounts,
|
||||
privateMentions: policy.filterPrivateMentions
|
||||
)
|
||||
//TODO: Move to SceneCoordinator
|
||||
//TODO: Move to SceneCoordinator, we'd need a new case for this
|
||||
let notificationPolicyViewController = NotificationPolicyViewController(viewModel: policyViewModel)
|
||||
notificationPolicyViewController.modalPresentationStyle = .formSheet
|
||||
let navigationController = UINavigationController(rootViewController: notificationPolicyViewController)
|
||||
|
Loading…
x
Reference in New Issue
Block a user