Merge pull request #431 from mastodon/fix-pick-server-margin

Fix pick server margin missing issue
This commit is contained in:
CMK 2022-05-11 20:17:34 +08:00 committed by GitHub
commit 7f1bce4d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,8 @@
#!/bin/bash
# workaround https://github.com/CocoaPods/CocoaPods/issues/11355
sed -i '' $'1s/^/source "https:\\/\\/github.com\\/CocoaPods\\/Specs.git"\\\n\\\n/' Podfile
# Install Ruby Bundler
gem install bundler:2.3.11

View File

@ -92,7 +92,7 @@ extension MastodonPickServerViewController {
tableView.topAnchor.constraint(equalTo: view.topAnchor),
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
tableView.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor),
])
navigationActionView.translatesAutoresizingMaskIntoConstraints = false
@ -107,10 +107,10 @@ extension MastodonPickServerViewController {
])
navigationActionView
.observe(\.bounds, options: [.initial, .new]) { [weak self] navigationActionView, _ in
.observe(\.bounds, options: [.initial, .new]) { [weak self] _, _ in
guard let self = self else { return }
let inset = navigationActionView.frame.height
self.tableView.contentInset.bottom = inset
let inset = self.navigationActionView.frame.height
self.viewModel.additionalTableViewInsets.bottom = inset
}
.store(in: &observations)
@ -149,7 +149,8 @@ extension MastodonPickServerViewController {
KeyboardResponderService
.configure(
scrollView: tableView,
layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher(),
additionalSafeAreaInsets: viewModel.$additionalTableViewInsets.eraseToAnyPublisher()
)
.store(in: &disposeBag)

View File

@ -46,7 +46,8 @@ class MastodonPickServerViewModel: NSObject {
let unindexedServers = CurrentValueSubject<[Mastodon.Entity.Server]?, Never>([]) // set nil when loading
let viewWillAppear = PassthroughSubject<Void, Never>()
let viewDidAppear = CurrentValueSubject<Void, Never>(Void())
@Published var additionalTableViewInsets: UIEdgeInsets = .zero
// output
var diffableDataSource: UITableViewDiffableDataSource<PickServerSection, PickServerItem>?
private(set) lazy var loadIndexedServerStateMachine: GKStateMachine = {