mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-05-30 20:22:54 +08:00
settings user list view nits
This commit is contained in:
@@ -18,6 +18,8 @@ final class SettingsUserCell: UICollectionViewCell {
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
contentView.backgroundColor = .white
|
||||
|
||||
label.backgroundColor = .clear
|
||||
label.textAlignment = .left
|
||||
label.numberOfLines = 1
|
||||
@@ -33,9 +35,11 @@ final class SettingsUserCell: UICollectionViewCell {
|
||||
contentView.addSubview(accessoryView)
|
||||
accessoryView.snp.makeConstraints { make in
|
||||
make.size.equalTo(Styles.Sizes.icon)
|
||||
make.right.equalTo(Styles.Sizes.gutter)
|
||||
make.right.equalTo(-Styles.Sizes.gutter)
|
||||
make.centerY.equalTo(contentView)
|
||||
}
|
||||
|
||||
contentView.addBorder(bottom: true, left: Styles.Sizes.gutter)
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
|
||||
@@ -22,8 +22,9 @@ extension SettingsUsersSectionController: IGListBindingSectionControllerDataSour
|
||||
|
||||
func sectionController(_ sectionController: IGListBindingSectionController<IGListDiffable>, viewModelsFor object: Any) -> [IGListDiffable] {
|
||||
guard let object = self.object else { return [] }
|
||||
let focusedLogin = object.focusedLogin
|
||||
return object.allUserSessions
|
||||
.map { SettingsUserModel(name: $0.login, selected: false) }
|
||||
.map { SettingsUserModel(name: $0.login, selected: focusedLogin == $0.login) }
|
||||
.sorted { $0.name < $1.name }
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ final class SettingsViewController: UIViewController {
|
||||
lazy var collectionView: UICollectionView = {
|
||||
let view = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
|
||||
view.alwaysBounceVertical = true
|
||||
view.backgroundColor = Styles.Colors.background
|
||||
view.backgroundColor = Styles.Colors.Gray.lighter
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
@@ -59,6 +59,10 @@ final class GithubSessionManager: NSObject {
|
||||
listeners.append(wrapper)
|
||||
}
|
||||
|
||||
public var focusedLogin: String? {
|
||||
return _focusedKey
|
||||
}
|
||||
|
||||
public var focusedUserSession: GithubUserSession? {
|
||||
guard let focusedKey = _focusedKey else { return nil }
|
||||
return _userSessions[focusedKey]
|
||||
|
||||
Reference in New Issue
Block a user