feat: set corner radius for the last cell layer
This commit is contained in:
parent
e70fd532c4
commit
29653ca612
|
@ -170,6 +170,7 @@
|
|||
DB9D6C2425E502C60051B173 /* MosaicImageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D6C2225E502C60051B173 /* MosaicImageViewModel.swift */; };
|
||||
DB9D6C2E25E504AC0051B173 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D6C2D25E504AC0051B173 /* Attachment.swift */; };
|
||||
DB9D6C3825E508BE0051B173 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D6C3725E508BE0051B173 /* Attachment.swift */; };
|
||||
DBBE1B4525F3474B0081417A /* MastodonPickServerAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBBE1B4425F3474B0081417A /* MastodonPickServerAppearance.swift */; };
|
||||
DBD9149025DF6D8D00903DFD /* APIService+Onboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBD9148F25DF6D8D00903DFD /* APIService+Onboarding.swift */; };
|
||||
DBE0821525CD382600FD6BBD /* MastodonRegisterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBE0821425CD382600FD6BBD /* MastodonRegisterViewController.swift */; };
|
||||
DBE0822425CD3F1E00FD6BBD /* MastodonRegisterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBE0822325CD3F1E00FD6BBD /* MastodonRegisterViewModel.swift */; };
|
||||
|
@ -398,6 +399,7 @@
|
|||
DB9D6C2225E502C60051B173 /* MosaicImageViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MosaicImageViewModel.swift; sourceTree = "<group>"; };
|
||||
DB9D6C2D25E504AC0051B173 /* Attachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Attachment.swift; sourceTree = "<group>"; };
|
||||
DB9D6C3725E508BE0051B173 /* Attachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Attachment.swift; sourceTree = "<group>"; };
|
||||
DBBE1B4425F3474B0081417A /* MastodonPickServerAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonPickServerAppearance.swift; sourceTree = "<group>"; };
|
||||
DBD9148F25DF6D8D00903DFD /* APIService+Onboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "APIService+Onboarding.swift"; sourceTree = "<group>"; };
|
||||
DBE0821425CD382600FD6BBD /* MastodonRegisterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonRegisterViewController.swift; sourceTree = "<group>"; };
|
||||
DBE0822325CD3F1E00FD6BBD /* MastodonRegisterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonRegisterViewModel.swift; sourceTree = "<group>"; };
|
||||
|
@ -473,6 +475,7 @@
|
|||
0FB3D30D25E525C000AAD544 /* View */,
|
||||
0FB3D31825E525DE00AAD544 /* CollectionViewCell */,
|
||||
0FB3D2FC25E4CB4B00AAD544 /* TableViewCell */,
|
||||
DBBE1B4425F3474B0081417A /* MastodonPickServerAppearance.swift */,
|
||||
0FAA102625E1126A0017CCDE /* MastodonPickServerViewController.swift */,
|
||||
0FB3D2F625E4C24D00AAD544 /* MastodonPickServerViewModel.swift */,
|
||||
DB1FD44F25F26FA1004CFCFC /* MastodonPickServerViewModel+Diffable.swift */,
|
||||
|
@ -1563,6 +1566,7 @@
|
|||
DB2B3AE925E38850007045F9 /* UIViewPreview.swift in Sources */,
|
||||
DB427DD625BAA00100D1B89D /* AppDelegate.swift in Sources */,
|
||||
DB9D6C0E25E4F9780051B173 /* MosaicImageViewContainer.swift in Sources */,
|
||||
DBBE1B4525F3474B0081417A /* MastodonPickServerAppearance.swift in Sources */,
|
||||
DB98338725C945ED00AD9700 /* Strings.swift in Sources */,
|
||||
DB1FD46025F278AF004CFCFC /* CategoryPickerSection.swift in Sources */,
|
||||
DB45FAB625CA5485005A8AC7 /* UIAlertController.swift in Sources */,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>7</integer>
|
||||
<integer>8</integer>
|
||||
</dict>
|
||||
<key>Mastodon - RTL.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<key>Mastodon.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>8</integer>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
|
|
@ -18,9 +18,11 @@ enum PickServerItem {
|
|||
|
||||
extension PickServerItem {
|
||||
final class ServerItemAttribute: Equatable, Hashable {
|
||||
var isLast: Bool
|
||||
var isExpand: Bool
|
||||
|
||||
init(isExpand: Bool) {
|
||||
init(isLast: Bool, isExpand: Bool) {
|
||||
self.isLast = isLast
|
||||
self.isExpand = isExpand
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,17 @@ extension PickServerSection {
|
|||
|
||||
cell.updateExpandMode(mode: attribute.isExpand ? .expand : .collapse)
|
||||
|
||||
if attribute.isLast {
|
||||
cell.containerView.layer.maskedCorners = [
|
||||
.layerMinXMaxYCorner,
|
||||
.layerMaxXMaxYCorner
|
||||
]
|
||||
cell.containerView.layer.cornerCurve = .continuous
|
||||
cell.containerView.layer.cornerRadius = MastodonPickServerAppearance.tableViewCornerRadius
|
||||
} else {
|
||||
cell.containerView.layer.cornerRadius = 0
|
||||
}
|
||||
|
||||
cell.expandMode
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { mode in
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
//
|
||||
// MastodonPickServerAppearance.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021/3/6.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
enum MastodonPickServerAppearance {
|
||||
static let tableViewCornerRadius: CGFloat = 10
|
||||
}
|
|
@ -76,7 +76,7 @@ extension MastodonPickServerViewController {
|
|||
emptyStateView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
emptyStateView.leadingAnchor.constraint(equalTo: view.readableContentGuide.leadingAnchor),
|
||||
emptyStateView.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor),
|
||||
nextStepButton.topAnchor.constraint(equalTo: emptyStateView.bottomAnchor, constant: 7)
|
||||
nextStepButton.topAnchor.constraint(equalTo: emptyStateView.bottomAnchor, constant: 21),
|
||||
])
|
||||
|
||||
// fix AutoLayout warning when observe before view appear
|
||||
|
@ -107,7 +107,7 @@ extension MastodonPickServerViewController {
|
|||
tableView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
nextStepButton.topAnchor.constraint(equalTo: tableView.bottomAnchor, constant: 7)
|
||||
nextStepButton.topAnchor.constraint(equalTo: tableView.bottomAnchor, constant: 7),
|
||||
])
|
||||
|
||||
switch viewModel.mode {
|
||||
|
@ -181,16 +181,16 @@ extension MastodonPickServerViewController {
|
|||
guard let self = self else { return }
|
||||
switch state {
|
||||
case .none:
|
||||
self.emptyStateView.networkIndicatorImageView.isHidden = true
|
||||
self.emptyStateView.activityIndicatorView.stopAnimating()
|
||||
self.emptyStateView.infoLabel.isHidden = true
|
||||
self.emptyStateView.isHidden = true
|
||||
case .loading:
|
||||
self.emptyStateView.isHidden = false
|
||||
self.emptyStateView.networkIndicatorImageView.isHidden = true
|
||||
self.emptyStateView.activityIndicatorView.startAnimating()
|
||||
self.emptyStateView.infoLabel.isHidden = false
|
||||
self.emptyStateView.infoLabel.text = L10n.Scene.ServerPicker.EmptyState.findingServers
|
||||
self.emptyStateView.infoLabel.textAlignment = self.traitCollection.layoutDirection == .rightToLeft ? .right : .left
|
||||
case .badNetwork:
|
||||
self.emptyStateView.isHidden = false
|
||||
self.emptyStateView.networkIndicatorImageView.isHidden = false
|
||||
self.emptyStateView.activityIndicatorView.stopAnimating()
|
||||
self.emptyStateView.infoLabel.isHidden = false
|
||||
|
|
|
@ -100,10 +100,14 @@ class MastodonPickServerViewModel: NSObject {
|
|||
// TODO: handle filter
|
||||
var serverItems: [PickServerItem] = []
|
||||
for server in indexedServers {
|
||||
let attribute = oldSnapshotServerItemAttributeDict[server.domain] ?? PickServerItem.ServerItemAttribute(isExpand: false)
|
||||
let attribute = oldSnapshotServerItemAttributeDict[server.domain] ?? PickServerItem.ServerItemAttribute(isLast: false, isExpand: false)
|
||||
attribute.isLast = false
|
||||
let item = PickServerItem.server(server: server, attribute: attribute)
|
||||
serverItems.append(item)
|
||||
}
|
||||
if case let .server(_, attribute) = serverItems.last {
|
||||
attribute.isLast = true
|
||||
}
|
||||
snapshot.appendItems(serverItems, toSection: .servers)
|
||||
|
||||
diffableDataSource.apply(snapshot)
|
||||
|
|
|
@ -24,7 +24,7 @@ class PickServerSearchCell: UITableViewCell {
|
|||
.layerMaxXMinYCorner
|
||||
]
|
||||
view.layer.cornerCurve = .continuous
|
||||
view.layer.cornerRadius = 10
|
||||
view.layer.cornerRadius = MastodonPickServerAppearance.tableViewCornerRadius
|
||||
return view
|
||||
}()
|
||||
|
||||
|
|
|
@ -45,6 +45,12 @@ extension PickServerEmptyStateView {
|
|||
|
||||
private func _init() {
|
||||
backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
|
||||
layer.maskedCorners = [
|
||||
.layerMinXMaxYCorner,
|
||||
.layerMaxXMaxYCorner
|
||||
]
|
||||
layer.cornerCurve = .continuous
|
||||
layer.cornerRadius = MastodonPickServerAppearance.tableViewCornerRadius
|
||||
|
||||
let topPaddingView = UIView()
|
||||
topPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
|
Loading…
Reference in New Issue