Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ekazaev committed May 12, 2021
1 parent ceb7cf4 commit 4620a29
Show file tree
Hide file tree
Showing 75 changed files with 1,072 additions and 1,162 deletions.
2 changes: 1 addition & 1 deletion ChatLayout.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ChatLayout'
s.version = '1.1.7'
s.version = '1.1.8'
s.summary = 'Chat UI Library. It uses custom UICollectionViewLayout to provide you full control over the presentation.'
s.swift_version = '5.2'

Expand Down
8 changes: 4 additions & 4 deletions Example/ChatLayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
1BE5486E03A837AE2F8457DA /* MockCollectionLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE5467A07C249BDD8C03D51 /* MockCollectionLayout.swift */; };
1BE5496732EAB127C8019477 /* KeyboardInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE54438EB2C5DAB78ACB5F8 /* KeyboardInfo.swift */; };
1BE54AC173D67905A2EF727B /* DefaultImageLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE54A4C633608F47B961133 /* DefaultImageLoader.swift */; };
1BE54AF532AEF1F560A5A912 /* DateAccessoryController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE545F202AA9CBACB504941 /* DateAccessoryController.swift */; };
1BE54BA96464B328D52322A1 /* ImageLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE5493CC008EE770BA9A22F /* ImageLoader.swift */; };
1BE54BC5C70CB9FA1260B54D /* ChatDateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE544BF8E723F3D86B4D774 /* ChatDateFormatter.swift */; };
1BE54C3A0AEA8365F02479C3 /* ManualAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE5499F258CDCA615EA3460 /* ManualAnimator.swift */; };
Expand Down Expand Up @@ -64,7 +65,6 @@
4504F41024FA66F600385590 /* TextBubbleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4504F3D524FA66F500385590 /* TextBubbleController.swift */; };
4504F41124FA66F600385590 /* FullCellContentBubbleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4504F3D624FA66F500385590 /* FullCellContentBubbleController.swift */; };
4504F41224FA66F600385590 /* EditNotifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4504F3D724FA66F500385590 /* EditNotifier.swift */; };
4504F41324FA66F600385590 /* DefaultBubbleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4504F3D824FA66F500385590 /* DefaultBubbleController.swift */; };
4504F41424FA66F600385590 /* EditNotifierDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4504F3D924FA66F500385590 /* EditNotifierDelegate.swift */; };
4504F41524FA66F600385590 /* AvatarPlaceholderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4504F3DB24FA66F500385590 /* AvatarPlaceholderView.swift */; };
4504F41624FA66F600385590 /* AvatarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4504F3DC24FA66F500385590 /* AvatarView.swift */; };
Expand Down Expand Up @@ -112,6 +112,7 @@
1BE545A58CC88CC261D6D6EB /* CachingImageLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CachingImageLoader.swift; sourceTree = "<group>"; };
1BE545B9B5F30BA7924D9582 /* ProcessInfo+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ProcessInfo+Extension.swift"; sourceTree = "<group>"; };
1BE545E2A0EB495C252F9478 /* SwipeNotifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeNotifier.swift; sourceTree = "<group>"; };
1BE545F202AA9CBACB504941 /* DateAccessoryController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateAccessoryController.swift; sourceTree = "<group>"; };
1BE5467A07C249BDD8C03D51 /* MockCollectionLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockCollectionLayout.swift; sourceTree = "<group>"; };
1BE5493CC008EE770BA9A22F /* ImageLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageLoader.swift; sourceTree = "<group>"; };
1BE5496755DDC7FEAAF20F00 /* KeyboardListenerDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardListenerDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -156,7 +157,6 @@
4504F3D524FA66F500385590 /* TextBubbleController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextBubbleController.swift; sourceTree = "<group>"; };
4504F3D624FA66F500385590 /* FullCellContentBubbleController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FullCellContentBubbleController.swift; sourceTree = "<group>"; };
4504F3D724FA66F500385590 /* EditNotifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditNotifier.swift; sourceTree = "<group>"; };
4504F3D824FA66F500385590 /* DefaultBubbleController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultBubbleController.swift; sourceTree = "<group>"; };
4504F3D924FA66F500385590 /* EditNotifierDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditNotifierDelegate.swift; sourceTree = "<group>"; };
4504F3DB24FA66F500385590 /* AvatarPlaceholderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvatarPlaceholderView.swift; sourceTree = "<group>"; };
4504F3DC24FA66F500385590 /* AvatarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvatarView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -221,6 +221,7 @@
isa = PBXGroup;
children = (
1BE542560FF01F7121E86D91 /* DateAccessoryView.swift */,
1BE545F202AA9CBACB504941 /* DateAccessoryController.swift */,
);
path = "Date Accessory View";
sourceTree = "<group>";
Expand Down Expand Up @@ -406,7 +407,6 @@
4504F3D524FA66F500385590 /* TextBubbleController.swift */,
4504F3D624FA66F500385590 /* FullCellContentBubbleController.swift */,
4504F3D724FA66F500385590 /* EditNotifier.swift */,
4504F3D824FA66F500385590 /* DefaultBubbleController.swift */,
4504F3D924FA66F500385590 /* EditNotifierDelegate.swift */,
1BE5411FF1A0B76EF404E0A1 /* UIView+Extension.swift */,
1BE5499F258CDCA615EA3460 /* ManualAnimator.swift */,
Expand Down Expand Up @@ -757,7 +757,6 @@
4504F40E24FA66F600385590 /* TextMessageView.swift in Sources */,
4504F41224FA66F600385590 /* EditNotifier.swift in Sources */,
4504F3F524FA66F600385590 /* DefaultChatController.swift in Sources */,
4504F41324FA66F600385590 /* DefaultBubbleController.swift in Sources */,
4504F41524FA66F600385590 /* AvatarPlaceholderView.swift in Sources */,
4504F41624FA66F600385590 /* AvatarView.swift in Sources */,
4504F40B24FA66F600385590 /* ChatCollectionDataSource.swift in Sources */,
Expand Down Expand Up @@ -791,6 +790,7 @@
1BE546DB3B8341357F3FD91E /* MainContainerView.swift in Sources */,
1BE540F15C168BCEAB24B916 /* DateAccessoryView.swift in Sources */,
1BE54EDDBD81A201D12D68B8 /* SwipeNotifier.swift in Sources */,
1BE54AF532AEF1F560A5A912 /* DateAccessoryController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
30 changes: 12 additions & 18 deletions Example/ChatLayout/Chat/Controller/DefaultChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ final class DefaultChatController: ChatController {
}
}

private func repopulateMessages() {
propagateLatestMessages { sections in
self.delegate?.update(with: sections)
}
}

}

extension DefaultChatController: RandomDataProviderDelegate {
Expand All @@ -198,35 +204,27 @@ extension DefaultChatController: RandomDataProviderDelegate {
appendConvertingToMessages(messages)
markAllMessagesAsReceived {
self.markAllMessagesAsRead {
self.propagateLatestMessages { sections in
self.delegate?.update(with: sections)
}
self.repopulateMessages()
}
}
}

func typingStateChanged(to state: TypingState) {
typingState = state
propagateLatestMessages { sections in
self.delegate?.update(with: sections)
}
repopulateMessages()
}

func lastReadIdChanged(to id: UUID) {
lastReadUUID = id
markAllMessagesAsRead {
self.propagateLatestMessages { sections in
self.delegate?.update(with: sections)
}
self.repopulateMessages()
}
}

func lastReceivedIdChanged(to id: UUID) {
lastReceivedUUID = id
markAllMessagesAsReceived {
self.propagateLatestMessages { sections in
self.delegate?.update(with: sections)
}
self.repopulateMessages()
}
}

Expand Down Expand Up @@ -295,9 +293,7 @@ extension DefaultChatController: RandomDataProviderDelegate {
extension DefaultChatController: ReloadDelegate {

func reloadMessage(with id: UUID) {
propagateLatestMessages(completion: { sections in
self.delegate?.update(with: sections)
})
repopulateMessages()
}

}
Expand All @@ -306,9 +302,7 @@ extension DefaultChatController: EditingAccessoryControllerDelegate {

func deleteMessage(with id: UUID) {
messages = Array(messages.filter { $0.id != id })
propagateLatestMessages(completion: { sections in
self.delegate?.update(with: sections)
})
repopulateMessages()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,8 @@ final class DefaultChatCollectionDataSource: NSObject, ChatCollectionDataSource
return bubbleController
}

private func buildDefaultBubbleController<CustomView>(for bubbleView: ImageMaskedView<CustomView>, messageType: MessageType, bubbleType: Cell.BubbleType) -> BubbleController {
let contentBubbleController = FullCellContentBubbleController(bubbleView: bubbleView)
let bubbleController = DefaultBubbleController(bubbleView: bubbleView, controllerProxy: contentBubbleController, type: messageType, bubbleType: bubbleType)
return bubbleController
}

private func buildBezierBubbleController<CustomView>(for bubbleView: BezierMaskedView<CustomView>, messageType: MessageType, bubbleType: Cell.BubbleType) -> BubbleController {
let contentBubbleController = BezierFullCellContentBubbleController(bubbleView: bubbleView)
let contentBubbleController = FullCellContentBubbleController(bubbleView: bubbleView)
let bubbleController = BezierBubbleController(bubbleView: bubbleView, controllerProxy: contentBubbleController, type: messageType, bubbleType: bubbleType)
return bubbleController
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// ChatLayout
// DateAccessoryController.swift
// https://github.com/ekazaev/ChatLayout
//
// Created by Eugene Kazaev in 2020-2021.
// Distributed under the MIT license.
//

import Foundation

final class DateAccessoryController {

private let date: Date

let accessoryText: String

init(date: Date) {
self.date = date
self.accessoryText = MessageDateFormatter.shared.string(from: date)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,3 @@ final class DateAccessoryView: UIView {
}

}

final class DateAccessoryController {

private let date: Date

let accessoryText: String

init(date: Date) {
self.date = date
self.accessoryText = MessageDateFormatter.shared.string(from: date)
}

}
52 changes: 0 additions & 52 deletions Example/ChatLayout/Chat/View/Other/DefaultBubbleController.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,6 @@ import UIKit

final class FullCellContentBubbleController<CustomView: UIView>: BubbleController {

weak var bubbleView: ImageMaskedView<CustomView>? {
didSet {
setupBubbleView()
}
}

init(bubbleView: ImageMaskedView<CustomView>) {
self.bubbleView = bubbleView
setupBubbleView()
}

private func setupBubbleView() {
guard let bubbleView = bubbleView else {
return
}

UIView.performWithoutAnimation {
bubbleView.backgroundColor = .clear
bubbleView.customView.layoutMargins = .zero
}
}

}

final class BezierFullCellContentBubbleController<CustomView: UIView>: BubbleController {

weak var bubbleView: BezierMaskedView<CustomView>? {
didSet {
setupBubbleView()
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
![](https://habrastorage.org/webt/hn/ez/gq/hnezgqezp8vxg8vy8z7_ozetra0.gif)
![](https://habrastorage.org/webt/gn/ny/qe/gnnyqepf46r4zdhyb4oug8vywvc.gif)
![](https://habrastorage.org/webt/t9/b7/4r/t9b74rdyrkf8lszjuhj_vrbp7-s.gif)
![](https://habrastorage.org/webt/nv/vr/js/nvvrjsqk0fzutq0y-uubjewyqjm.gif)

### What ChatLayout doesn't provide (And why it is good)

Expand Down
4 changes: 2 additions & 2 deletions docs/Classes/CellLayoutContainerView.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
ChatLayout 1.1.7 Docs
ChatLayout 1.1.8 Docs
</a>
(100% documented)
</p>
Expand Down Expand Up @@ -462,7 +462,7 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-04-29)</p>
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-05-12)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes/ChatLayout.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
ChatLayout 1.1.7 Docs
ChatLayout 1.1.8 Docs
</a>
(100% documented)
</p>
Expand Down Expand Up @@ -1282,7 +1282,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-04-29)</p>
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-05-12)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes/ChatLayoutAttributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
ChatLayout 1.1.7 Docs
ChatLayout 1.1.8 Docs
</a>
(100% documented)
</p>
Expand Down Expand Up @@ -421,7 +421,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-04-29)</p>
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-05-12)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes/ChatLayoutInvalidationContext.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
ChatLayout 1.1.7 Docs
ChatLayout 1.1.8 Docs
</a>
(100% documented)
</p>
Expand Down Expand Up @@ -206,7 +206,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-04-29)</p>
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-05-12)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes/ContainerCollectionReusableView.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
ChatLayout 1.1.7 Docs
ChatLayout 1.1.8 Docs
</a>
(100% documented)
</p>
Expand Down Expand Up @@ -382,7 +382,7 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-04-29)</p>
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-05-12)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
Loading

0 comments on commit 4620a29

Please sign in to comment.