settings user list view nits

This commit is contained in:
Ryan Nystrom
2017-05-17 11:25:37 -04:00
parent 6f4e67b965
commit c03d4c4204
4 changed files with 12 additions and 3 deletions

View File

@@ -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) {

View File

@@ -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 }
}

View File

@@ -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
}()

View File

@@ -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]