Minor cleanup (IOS-186)

This commit is contained in:
Nathan Mattes 2023-11-10 13:52:49 +01:00
parent 2f5169d0c3
commit 395da6f0c3
3 changed files with 14 additions and 24 deletions

View File

@ -5,9 +5,7 @@
// Created by Marcus Kida on 22.11.22. // Created by Marcus Kida on 22.11.22.
// //
import os
import UIKit import UIKit
import Combine
import MastodonAsset import MastodonAsset
import MastodonCore import MastodonCore
import MastodonUI import MastodonUI
@ -42,14 +40,11 @@ final class FollowedTagsViewController: UIViewController, NeedsDependency {
super.init(nibName: nil, bundle: nil) super.init(nibName: nil, bundle: nil)
let title = L10n.Scene.FollowedTags.title title = L10n.Scene.FollowedTags.title
self.title = title
view.backgroundColor = .secondarySystemBackground view.backgroundColor = .secondarySystemBackground
view.addSubview(tableView) view.addSubview(tableView)
tableView.pinToParent() tableView.pinToParent()
tableView.delegate = self tableView.delegate = self
refreshControl.addTarget(self, action: #selector(FollowedTagsViewController.refresh(_:)), for: .valueChanged) refreshControl.addTarget(self, action: #selector(FollowedTagsViewController.refresh(_:)), for: .valueChanged)

View File

@ -6,7 +6,6 @@
// //
import UIKit import UIKit
import Combine
import MastodonSDK import MastodonSDK
import MastodonCore import MastodonCore

View File

@ -5,14 +5,11 @@
// Created by Marcus Kida on 23.11.22. // Created by Marcus Kida on 23.11.22.
// //
import os
import UIKit import UIKit
import Combine
import MastodonSDK import MastodonSDK
import MastodonCore import MastodonCore
final class FollowedTagsViewModel: NSObject { final class FollowedTagsViewModel: NSObject {
var disposeBag = Set<AnyCancellable>()
private(set) var followedTags: [Mastodon.Entity.Tag] private(set) var followedTags: [Mastodon.Entity.Tag]
private weak var tableView: UITableView? private weak var tableView: UITableView?
@ -22,9 +19,6 @@ final class FollowedTagsViewModel: NSObject {
let context: AppContext let context: AppContext
let authContext: AuthContext let authContext: AuthContext
// output
let presentHashtagTimeline = PassthroughSubject<HashtagTimelineViewModel, Never>()
init(context: AppContext, authContext: AuthContext) { init(context: AppContext, authContext: AuthContext) {
self.context = context self.context = context
self.authContext = authContext self.authContext = authContext
@ -43,6 +37,7 @@ extension FollowedTagsViewModel {
func fetchFollowedTags(completion: (() -> Void)? = nil ) { func fetchFollowedTags(completion: (() -> Void)? = nil ) {
Task { @MainActor in Task { @MainActor in
do {
followedTags = try await context.apiService.getFollowedTags( followedTags = try await context.apiService.getFollowedTags(
domain: authContext.mastodonAuthenticationBox.domain, domain: authContext.mastodonAuthenticationBox.domain,
query: Mastodon.API.Account.FollowedTagsQuery(limit: nil), query: Mastodon.API.Account.FollowedTagsQuery(limit: nil),
@ -55,6 +50,7 @@ extension FollowedTagsViewModel {
snapshot.appendItems(items, toSection: .main) snapshot.appendItems(items, toSection: .main)
await diffableDataSource?.apply(snapshot) await diffableDataSource?.apply(snapshot)
} catch {}
completion?() completion?()
} }