From f17b87a1551c7e4eeff910f42f71faa3d2741bbf Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Tue, 7 Nov 2017 03:52:13 -0600 Subject: [PATCH] Remove AvatarAlignment and AvatarHorizontalAlignment --- Sources/Models/AvatarAlignment.swift | 45 ------------------- .../Models/AvatarHorizontalAlignment.swift | 38 ---------------- .../Supporting/MessageKit+Availability.swift | 37 ++++++++++----- 3 files changed, 25 insertions(+), 95 deletions(-) delete mode 100644 Sources/Models/AvatarAlignment.swift delete mode 100644 Sources/Models/AvatarHorizontalAlignment.swift diff --git a/Sources/Models/AvatarAlignment.swift b/Sources/Models/AvatarAlignment.swift deleted file mode 100644 index b2a20656..00000000 --- a/Sources/Models/AvatarAlignment.swift +++ /dev/null @@ -1,45 +0,0 @@ -/* - MIT License - - Copyright (c) 2017 MessageKit - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ - -import Foundation - -/// An enum representing the verical alignment for an `AvatarView`. -public enum AvatarAlignment { - - /// Aligns the `AvatarView`'s top edge to the cell's top edge. - case cellTop - - /// Aligns the `AvatarView`'s bottom edge to the cell's bottom edge. - case cellBottom - - /// Aligns the `AvatarView`'s top edge to the `MessageContainerView`'s top edge. - case messageTop - - /// Aligns the `AvatarView`'s bottom edge to the `MessageContainerView`s bottom edge. - case messageBottom - - /// Aligns the `AvatarView` center to the `MessageContainerView` center. - case messageCenter - -} diff --git a/Sources/Models/AvatarHorizontalAlignment.swift b/Sources/Models/AvatarHorizontalAlignment.swift deleted file mode 100644 index 51862de4..00000000 --- a/Sources/Models/AvatarHorizontalAlignment.swift +++ /dev/null @@ -1,38 +0,0 @@ -/* - MIT License - - Copyright (c) 2017 MessageKit - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ - -import Foundation - -// MARK: - AvatarVerticalAlignment - -/// An enum representing the horizontal alignment of an `AvatarView`. -internal enum AvatarHorizontalAlignment { - - /// Positions the `AvatarView` on the side closest to the cell's leading edge. - case cellLeading - - /// Positions the `AvatarView` on the side closest to the cell's trailing edge. - case cellTrailing - -} diff --git a/Sources/Supporting/MessageKit+Availability.swift b/Sources/Supporting/MessageKit+Availability.swift index b2f59030..cba8e441 100644 --- a/Sources/Supporting/MessageKit+Availability.swift +++ b/Sources/Supporting/MessageKit+Availability.swift @@ -1,18 +1,18 @@ /* MIT License - + Copyright (c) 2017 MessageKit - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -24,21 +24,34 @@ import Foundation +// MARK: - AvatarAlignment + +@available(*, deprecated: 0.11.0, message: "Removed in MessageKit 0.11.0. Please use AvatarPosition instead.") +public enum AvatarAlignment {} + // MARK: - MessagesLayoutDelegate extension MessagesLayoutDelegate { - @available(*, deprecated: 0.10.0, message: "Removed in MessageKit 0.11.0. Please use avatarPosition(for:at:in:) instead.") - func avatarAlignment(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> AvatarAlignment { + /// Specifies the vertical alignment for the `AvatarView` in a `MessageCollectionViewCell`. + /// + /// - Parameters: + /// - message: The `MessageType` that will be displayed by this cell. + /// - indexPath: The `IndexPath` of the cell. + /// - messagesCollectionView: The `MessagesCollectionView` in which this cell will be displayed. + /// + /// The default value returned by this method is `AvatarAlignment.cellBottom`. + @available(*, deprecated: 0.11.0, message: "Removed in MessageKit 0.11.0. Please use avatarPosition(for:at:in:) instead.") + public func avatarAlignment(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> AvatarAlignment { fatalError("Please use avatarPosition(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> AvatarPosition instead.") } - + } // MARK: - MessagesViewController public extension MessagesViewController { - + @available(*, deprecated: 0.10.0, message: "Removed in MessageKit 0.10.0. Please use the messagesCollectionView.contentInsets.top property.") public var additionalTopContentInset: CGFloat { get { @@ -48,7 +61,7 @@ public extension MessagesViewController { messagesCollectionView.contentInset.top = newValue } } - + } extension MessagesCollectionViewFlowLayout { @@ -60,7 +73,7 @@ extension MessagesCollectionViewFlowLayout { /// /// The default value of this property is `false`. @available(*, deprecated: 0.11.0, message: "Removed in MessageKit 0.11.0. Please use the avatarPosition(for:at:in) delegate method.") - open var avatarAlwaysLeading: Bool { + public var avatarAlwaysLeading: Bool { fatalError("Fatal Error: avatarAlwaysLeading is no longer supported") } @@ -70,8 +83,8 @@ extension MessagesCollectionViewFlowLayout { /// Setting this property to `true` causes `avatarAlwaysLeading` to be set to `false`. /// /// The default value of this property is `false`. - @available(*, deprecated: 0.11.0, message: "Removed in MessageKit 0.11.0. Please use the avatarPosition(for:at:in) delegate method.") - open var avatarAlwaysTrailing: Bool { + @available(*, deprecated: 0.11.0, message: "Removed in MessageKit 0.11.0. Please use the avatarPosition(for:at:in) delegate method instead.") + public var avatarAlwaysTrailing: Bool { fatalError("Fatal Error: avatarAlwaysTrailing is no longer supported") }