Code review comments

This commit is contained in:
Anton Terehov 2016-08-12 12:00:32 +01:00
parent 9c3b40df1d
commit ed76fe6336
3 changed files with 13 additions and 9 deletions

View File

@ -27,6 +27,10 @@ import Foundation
import UIKit
import Chatto
public struct LiveCameraCellAppearance {
public var backgroundColor: UIColor
}
class LiveCameraCell: UICollectionViewCell {
private struct Constants {
@ -37,9 +41,9 @@ class LiveCameraCell: UICollectionViewCell {
private var iconImageView: UIImageView!
override var backgroundColor: UIColor? {
var appearance: LiveCameraCellAppearance = LiveCameraCellAppearance(backgroundColor: Constants.backgroundColor) {
didSet {
self.contentView.backgroundColor = backgroundColor
self.contentView.backgroundColor = self.appearance.backgroundColor
}
}
@ -55,7 +59,7 @@ class LiveCameraCell: UICollectionViewCell {
private func commonInit() {
self.configureIcon()
self.contentView.backgroundColor = Constants.backgroundColor
self.contentView.backgroundColor = self.appearance.backgroundColor
}
var captureLayer: CALayer? {

View File

@ -53,7 +53,8 @@ public class PhotosChatInputItem: ChatInputItemProtocol {
public class func createDefaultInputViewAppearance() -> PhotosInputViewAppearance {
let defaultColor = UIColor(red: 24.0/255.0, green: 101.0/255.0, blue: 245.0/255.0, alpha: 1)
return PhotosInputViewAppearance(color: defaultColor)
let liveCameraCellAppearence = LiveCameraCellAppearance(backgroundColor: defaultColor)
return PhotosInputViewAppearance(liveCameraCellAppearence: liveCameraCellAppearence)
}
lazy private var internalTabView: UIButton = {

View File

@ -27,10 +27,7 @@ import Photos
import Chatto
public struct PhotosInputViewAppearance {
public var color: UIColor
public init(color: UIColor) {
self.color = color
}
public var liveCameraCellAppearence: LiveCameraCellAppearance
}
protocol PhotosInputViewProtocol {
@ -198,7 +195,9 @@ extension PhotosInputView: UICollectionViewDataSource {
var cell: UICollectionViewCell
if indexPath.item == Constants.liveCameraItemIndex {
let liveCameraCell = collectionView.dequeueReusableCellWithReuseIdentifier("LiveCameraCell", forIndexPath: indexPath) as! LiveCameraCell
liveCameraCell.backgroundColor = self.appearance?.color
if let liveCameraCellAppearence = self.appearance?.liveCameraCellAppearence {
liveCameraCell.appearance = liveCameraCellAppearence
}
self.liveCameraPresenter.cameraAuthorizationStatus = self.cameraAuthorizationStatus
cell = liveCameraCell
} else {