Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Load Consistency #2159

Merged
merged 3 commits into from
Sep 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions Classes/Issues/NeckLoad/IssueNeckLoadCell.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class IssueNeckLoadSectionController: ListSectionController {
}

override func cellForItem(at index: Int) -> UICollectionViewCell {
guard let cell = collectionContext?.dequeueReusableCell(of: IssueNeckLoadCell.self, for: self, at: index) as? IssueNeckLoadCell
guard let cell = collectionContext?.dequeueReusableCell(of: LoadMoreCell.self, for: self, at: index) as? LoadMoreCell
else { fatalError("Missing collection context, cell incorrect type, or object missing") }
cell.configure(loading: loadingOverride)
return cell
Expand Down
40 changes: 22 additions & 18 deletions Classes/Section Controllers/LoadMore/LoadMoreCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,50 @@ import UIKit
import SnapKit
import IGListKit

final class LoadMoreCell: UICollectionViewCell {

final class LoadMoreCell: SelectableCell {

private let activity = UIActivityIndicatorView(activityIndicatorStyle: .gray)
private let label = UILabel()

override init(frame: CGRect) {
super.init(frame: frame)

accessibilityTraits |= UIAccessibilityTraitButton
isAccessibilityElement = true
label.font = Styles.Text.button.preferredFont
label.textColor = Styles.Colors.Gray.light.color
label.textColor = Styles.Colors.Blue.light.color
contentView.addSubview(label)
label.snp.makeConstraints { make in
make.center.equalTo(contentView)
}

activity.hidesWhenStopped = true
contentView.addSubview(activity)
activity.snp.makeConstraints { make in
make.center.equalTo(contentView)
}
label.text = NSLocalizedString("Load More", comment: "")
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func layoutSubviews() {
super.layoutSubviews()
layoutContentViewForSafeAreaInsets()
}

override var accessibilityLabel: String? {
get { return NSLocalizedString("Load More", comment: "") }
set { }
}

override var isSelected: Bool {
didSet {
if isSelected {
label.alpha = 0.5
} else {
label.alpha = 1
}
}
}


func configure(loading: Bool) {
label.isHidden = loading
loading
? activity.startAnimating()
: activity.stopAnimating()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class LoadMoreSectionController: ListSectionController {
}

override func cellForItem(at index: Int) -> UICollectionViewCell {
guard let cell = collectionContext?.dequeueReusableCell(of: IssueNeckLoadCell.self, for: self, at: index) as? IssueNeckLoadCell else {
guard let cell = collectionContext?.dequeueReusableCell(of: LoadMoreCell.self, for: self, at: index) as? LoadMoreCell else {
fatalError("Missing context, or cell is wrong type")
}
cell.configure(loading: loadingOverride)
Expand Down
4 changes: 0 additions & 4 deletions Freetime.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@
29F3A18C20CD790F00645CB7 /* UIViewController+CommonActionItems.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F3A18B20CD790F00645CB7 /* UIViewController+CommonActionItems.swift */; };
29F7F05C1F2A751B00F6075D /* IssueResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F7F05B1F2A751B00F6075D /* IssueResult.swift */; };
29F7F05F1F2A839100F6075D /* IssueNeckLoadSectionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F7F05E1F2A839100F6075D /* IssueNeckLoadSectionController.swift */; };
29F7F0611F2A83AA00F6075D /* IssueNeckLoadCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F7F0601F2A83AA00F6075D /* IssueNeckLoadCell.swift */; };
29F7F0631F2A875C00F6075D /* IssueNeckLoadModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F7F0621F2A875C00F6075D /* IssueNeckLoadModel.swift */; };
29FB942C1EE750DB0016E6D4 /* IssueLabeledModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29FB942B1EE750DB0016E6D4 /* IssueLabeledModel.swift */; };
29FB942E1EE751F70016E6D4 /* IssueLabeledSectionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29FB942D1EE751F70016E6D4 /* IssueLabeledSectionController.swift */; };
Expand Down Expand Up @@ -909,7 +908,6 @@
29F3A18B20CD790F00645CB7 /* UIViewController+CommonActionItems.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+CommonActionItems.swift"; sourceTree = "<group>"; };
29F7F05B1F2A751B00F6075D /* IssueResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueResult.swift; sourceTree = "<group>"; };
29F7F05E1F2A839100F6075D /* IssueNeckLoadSectionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueNeckLoadSectionController.swift; sourceTree = "<group>"; };
29F7F0601F2A83AA00F6075D /* IssueNeckLoadCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueNeckLoadCell.swift; sourceTree = "<group>"; };
29F7F0621F2A875C00F6075D /* IssueNeckLoadModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IssueNeckLoadModel.swift; sourceTree = "<group>"; };
29FB942B1EE750DB0016E6D4 /* IssueLabeledModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueLabeledModel.swift; sourceTree = "<group>"; };
29FB942D1EE751F70016E6D4 /* IssueLabeledSectionController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueLabeledSectionController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1930,7 +1928,6 @@
29F7F05D1F2A833E00F6075D /* NeckLoad */ = {
isa = PBXGroup;
children = (
29F7F0601F2A83AA00F6075D /* IssueNeckLoadCell.swift */,
29F7F0621F2A875C00F6075D /* IssueNeckLoadModel.swift */,
29F7F05E1F2A839100F6075D /* IssueNeckLoadSectionController.swift */,
);
Expand Down Expand Up @@ -2827,7 +2824,6 @@
29BBD82920CAC7D5004D62FE /* NotificationViewModel.swift in Sources */,
299F63E2205DE1470015D901 /* UIView+DateDetails.swift in Sources */,
9870B9031FC73EE70009719C /* Secrets.swift in Sources */,
29F7F0611F2A83AA00F6075D /* IssueNeckLoadCell.swift in Sources */,
29A5AF451F9298360065D529 /* GitHubClient+Repository.swift in Sources */,
29F7F0631F2A875C00F6075D /* IssueNeckLoadModel.swift in Sources */,
2946FA5120367FC100C37435 /* GithubClient+Merge.swift in Sources */,
Expand Down