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 #!/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 # Install Ruby Bundler
gem install bundler:2.3.11 gem install bundler:2.3.11

View File

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

View File

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