diff --git a/ChattoAdditions/ChattoAdditions.xcodeproj/project.pbxproj b/ChattoAdditions/ChattoAdditions.xcodeproj/project.pbxproj index 1e7cd62..d6f04b0 100644 --- a/ChattoAdditions/ChattoAdditions.xcodeproj/project.pbxproj +++ b/ChattoAdditions/ChattoAdditions.xcodeproj/project.pbxproj @@ -77,7 +77,7 @@ C3C0CC8B1BFE49700052747C /* PhotosInputViewItemSizeCalculatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C0CC7D1BFE49700052747C /* PhotosInputViewItemSizeCalculatorTests.swift */; }; C3C0CC8C1BFE49700052747C /* TextChatInputItemTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C0CC7E1BFE49700052747C /* TextChatInputItemTests.swift */; }; C3C0CC8D1BFE49700052747C /* ObservableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C0CC7F1BFE49700052747C /* ObservableTests.swift */; }; - C3C9BC8F1D11540D00F3A54E /* TabInputButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C9BC8E1D11540D00F3A54E /* TabInputButton.swift */; }; + C3C9BC8F1D11540D00F3A54E /* ChatInputButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C9BC8E1D11540D00F3A54E /* ChatInputButton.swift */; }; C3EFA6B01C03607A0063CE22 /* BaseMessagePresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3EFA6AF1C03607A0063CE22 /* BaseMessagePresenterTests.swift */; }; CA073E791C47F5B9009D5EBF /* Chatto.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA073E781C47F5B9009D5EBF /* Chatto.framework */; }; F6D04BA71CA46C0200E803FA /* PhotosInputPlaceholderDataProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6D04BA61CA46C0200E803FA /* PhotosInputPlaceholderDataProviderTests.swift */; }; @@ -168,7 +168,7 @@ C3C0CC7E1BFE49700052747C /* TextChatInputItemTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextChatInputItemTests.swift; sourceTree = ""; }; C3C0CC7F1BFE49700052747C /* ObservableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObservableTests.swift; sourceTree = ""; }; C3C0CC961BFE4A2A0052747C /* ChattoAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChattoAdditions.h; sourceTree = ""; }; - C3C9BC8E1D11540D00F3A54E /* TabInputButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabInputButton.swift; sourceTree = ""; }; + C3C9BC8E1D11540D00F3A54E /* ChatInputButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatInputButton.swift; sourceTree = ""; }; C3EFA6AF1C03607A0063CE22 /* BaseMessagePresenterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseMessagePresenterTests.swift; sourceTree = ""; }; CA073E781C47F5B9009D5EBF /* Chatto.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Chatto.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Chatto-gyrilfusfbpmohajjvmmctphuabr/Build/Products/Debug-iphoneos/Chatto.framework"; sourceTree = ""; }; F6D04BA61CA46C0200E803FA /* PhotosInputPlaceholderDataProviderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotosInputPlaceholderDataProviderTests.swift; sourceTree = ""; }; @@ -332,13 +332,13 @@ C3C0CC051BFE496A0052747C /* ChatInputBar.xib */, C3C0CC061BFE496A0052747C /* ChatInputBarAppearance.swift */, C3C0CC071BFE496A0052747C /* ChatInputBarPresenter.swift */, + C3C9BC8E1D11540D00F3A54E /* ChatInputButton.swift */, C3C0CC081BFE496A0052747C /* ChatInputItem.swift */, C3C0CC091BFE496A0052747C /* ChatInputItemView.swift */, C3C0CC0A1BFE496A0052747C /* ExpandableTextView.swift */, C3C0CC0B1BFE496A0052747C /* HorizontalStackScrollView.swift */, C3C0CC0C1BFE496A0052747C /* Photos */, C3C0CC161BFE496A0052747C /* ReusableXibView.swift */, - C3C9BC8E1D11540D00F3A54E /* TabInputButton.swift */, C3C0CC171BFE496A0052747C /* Text */, ); path = Input; @@ -573,7 +573,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C3C9BC8F1D11540D00F3A54E /* TabInputButton.swift in Sources */, + C3C9BC8F1D11540D00F3A54E /* ChatInputButton.swift in Sources */, C3C0CC311BFE496A0052747C /* ChatItemDecorationAttributes.swift in Sources */, C3C0CC3B1BFE496A0052747C /* PhotoMessageCollectionViewCellDefaultStyle.swift in Sources */, C38658B21BFE55620012F181 /* AnimationUtils.swift in Sources */, diff --git a/ChattoAdditions/Source/Input/TabInputButton.swift b/ChattoAdditions/Source/Input/ChatInputButton.swift similarity index 91% rename from ChattoAdditions/Source/Input/TabInputButton.swift rename to ChattoAdditions/Source/Input/ChatInputButton.swift index 1fc589d..60378a9 100644 --- a/ChattoAdditions/Source/Input/TabInputButton.swift +++ b/ChattoAdditions/Source/Input/ChatInputButton.swift @@ -24,7 +24,7 @@ import Foundation -public struct TabInputButtonAppearance { +public struct ChatInputButtonAppearance { public var images: [UIControlState: UIImage] public var size: CGSize? @@ -34,11 +34,11 @@ public struct TabInputButtonAppearance { } } -public class TabInputButton: UIButton { +public class ChatInputButton: UIButton { - static public func makeInputButton(withAppearance appearance: TabInputButtonAppearance) -> TabInputButton { + static public func makeInputButton(withAppearance appearance: ChatInputButtonAppearance) -> ChatInputButton { let images = appearance.images - let button = TabInputButton(type: .Custom) + let button = ChatInputButton(type: .Custom) button.exclusiveTouch = true images.forEach { (state, image) in button.setImage(image, forState: state) diff --git a/ChattoAdditions/Source/Input/Photos/PhotosChatInputItem.swift b/ChattoAdditions/Source/Input/Photos/PhotosChatInputItem.swift index c23498c..d7f75c0 100644 --- a/ChattoAdditions/Source/Input/Photos/PhotosChatInputItem.swift +++ b/ChattoAdditions/Source/Input/Photos/PhotosChatInputItem.swift @@ -32,23 +32,23 @@ public class PhotosChatInputItem: ChatInputItemProtocol { public var photosPermissionHandler: (() -> Void)? public weak var presentingController: UIViewController? - let buttonAppearance: TabInputButtonAppearance - public init(presentingController: UIViewController?, tabInputButtonAppearance: TabInputButtonAppearance = Class.createDefaultButtonAppearance()) { + let buttonAppearance: ChatInputButtonAppearance + public init(presentingController: UIViewController?, buttonAppearance: ChatInputButtonAppearance = Class.createDefaultButtonAppearance()) { self.presentingController = presentingController - self.buttonAppearance = tabInputButtonAppearance + self.buttonAppearance = buttonAppearance } - public class func createDefaultButtonAppearance() -> TabInputButtonAppearance { + public class func createDefaultButtonAppearance() -> ChatInputButtonAppearance { let images: [UIControlState: UIImage] = [ .Normal: UIImage(named: "camera-icon-unselected", inBundle: NSBundle(forClass: Class.self), compatibleWithTraitCollection: nil)!, .Selected: UIImage(named: "camera-icon-selected", inBundle: NSBundle(forClass: Class.self), compatibleWithTraitCollection: nil)!, .Highlighted: UIImage(named: "camera-icon-selected", inBundle: NSBundle(forClass: Class.self), compatibleWithTraitCollection: nil)! ] - return TabInputButtonAppearance(images: images, size: nil) + return ChatInputButtonAppearance(images: images, size: nil) } lazy private var internalTabView: UIButton = { - return TabInputButton.makeInputButton(withAppearance: self.buttonAppearance) + return ChatInputButton.makeInputButton(withAppearance: self.buttonAppearance) }() lazy var photosInputView: PhotosInputViewProtocol = { diff --git a/ChattoAdditions/Source/Input/Text/TextChatInputItem.swift b/ChattoAdditions/Source/Input/Text/TextChatInputItem.swift index 083fe55..feeac04 100644 --- a/ChattoAdditions/Source/Input/Text/TextChatInputItem.swift +++ b/ChattoAdditions/Source/Input/Text/TextChatInputItem.swift @@ -28,22 +28,22 @@ public class TextChatInputItem { typealias Class = TextChatInputItem public var textInputHandler: ((String) -> Void)? - let buttonAppearance: TabInputButtonAppearance - public init(tabInputButtonAppearance: TabInputButtonAppearance = Class.createDefaultButtonAppearance()) { - self.buttonAppearance = tabInputButtonAppearance + let buttonAppearance: ChatInputButtonAppearance + public init(buttonAppearance: ChatInputButtonAppearance = Class.createDefaultButtonAppearance()) { + self.buttonAppearance = buttonAppearance } - public class func createDefaultButtonAppearance() -> TabInputButtonAppearance { + public class func createDefaultButtonAppearance() -> ChatInputButtonAppearance { let images: [UIControlState: UIImage] = [ .Normal: UIImage(named: "text-icon-unselected", inBundle: NSBundle(forClass: TextChatInputItem.self), compatibleWithTraitCollection: nil)!, .Selected: UIImage(named: "text-icon-selected", inBundle: NSBundle(forClass: TextChatInputItem.self), compatibleWithTraitCollection: nil)!, .Highlighted: UIImage(named: "text-icon-selected", inBundle: NSBundle(forClass: TextChatInputItem.self), compatibleWithTraitCollection: nil)! ] - return TabInputButtonAppearance(images: images, size: nil) + return ChatInputButtonAppearance(images: images, size: nil) } - lazy private var internalTabView: TabInputButton = { - return TabInputButton.makeInputButton(withAppearance: self.buttonAppearance) + lazy private var internalTabView: ChatInputButton = { + return ChatInputButton.makeInputButton(withAppearance: self.buttonAppearance) }() public var selected = false {