diff --git a/.github/ISSUE_TEMPLATE/---bug-report.md b/.github/ISSUE_TEMPLATE/---bug-report.md new file mode 100644 index 00000000..83e5ed4a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/---bug-report.md @@ -0,0 +1,49 @@ +--- +name: "\U0001F41B Bug report" +about: Create a report to help us improve +title: '' +labels: bug? +assignees: '' + +--- + + + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps/code to reproduce the behavior: + + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Environment** +- What version of MessageKit are you using? +- What version of iOS are you running on? +- What version of Swift are you running on? +- What device(s) are you testing on? Are these simulators? +- Is the issue you're experiencing reproducible in the example app? + +**Additional context** +Add any other context about the problem here. + diff --git a/.github/ISSUE_TEMPLATE/--feature-request.md b/.github/ISSUE_TEMPLATE/--feature-request.md new file mode 100644 index 00000000..b64ba303 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/--feature-request.md @@ -0,0 +1,22 @@ +--- +name: "\U0001F4A1Feature request" +about: Suggest an idea for this project +title: '' +labels: feature request +assignees: '' + +--- + + + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/--question-support.md b/.github/ISSUE_TEMPLATE/--question-support.md new file mode 100644 index 00000000..630b2754 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/--question-support.md @@ -0,0 +1,34 @@ +--- +name: "❓ Question/Support" +about: Ask a question about how to use MessageKit +title: '' +labels: question +assignees: '' + +--- + + diff --git a/.github/workflows/ci_pr_example.yml b/.github/workflows/ci_pr_example.yml index cf543790..7906b145 100644 --- a/.github/workflows/ci_pr_example.yml +++ b/.github/workflows/ci_pr_example.yml @@ -1,4 +1,4 @@ -name: PR Example app +name: Build Example app on: pull_request diff --git a/.github/workflows/ci_pr_framework.yml b/.github/workflows/ci_pr_framework.yml index 2d17fbbc..d29f2c16 100644 --- a/.github/workflows/ci_pr_framework.yml +++ b/.github/workflows/ci_pr_framework.yml @@ -1,4 +1,4 @@ -name: PR Framework +name: Build Framework on: pull_request diff --git a/.github/workflows/ci_pr_tests.yml b/.github/workflows/ci_pr_tests.yml index 7a6d51e3..f0c25912 100644 --- a/.github/workflows/ci_pr_tests.yml +++ b/.github/workflows/ci_pr_tests.yml @@ -1,4 +1,4 @@ -name: PR Tests +name: Tests on: pull_request diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index bd9a2ab0..13e9967e 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -1,4 +1,4 @@ -name: PR Danger +name: Danger on: pull_request: @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout the Git repository uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Cache Gems uses: actions/cache@v1 with: diff --git a/Documentation/FAQs.md b/Documentation/FAQs.md index 5ed0760f..ae5ee521 100644 --- a/Documentation/FAQs.md +++ b/Documentation/FAQs.md @@ -5,7 +5,7 @@ - [How can I move the `AvatarView` to prevent it from overlapping text in the `MessageBottomLabel` or `CellTopLabel`?](#how-can-i-move-the-avatarview-to-prevent-it-from-overlapping-text-in-the-messagebottomlabel-or-celltoplabel) - [How can I dismiss the keyboard?](#how-can-i-dismiss-the-keyboard) - [How can I get a reference to the `MessageType` in the `MessageCellDelegate` methods?](#how-can-i-get-a-reference-to-the-messagetype-in-the-messagecelldelegate-methods) - +- [Animations are laggy/Scrolling is not smooth/General poor performance](#animations-are-laggyscrolling-is-not-smoothgeneral-poor-performance) ## Why doesn't the `MessageInputBar` appear in my controller? @@ -105,3 +105,7 @@ func didTapMessage(in cell: MessageCollectionViewCell) { let message = messagesDataSource.messageForItem(at: indexPath, in: messagesCollectionView) } ``` + +## Animations are laggy/Scrolling is not smooth/General poor performance + +In general, if you're experiencing performance issues, you should look through the implementation of your MessageKit delegate methods like `currentSender()`, etc to find any expensive/blocking method calls or operations. Some delegate methods are called many times per message rendered and thus if their implementations are not efficient then performance can significantly degrade. Avoid doing blocking activities like syncronous database lookups, keychain access, networking, etc. in your MessageKit delegate methods. You should instead cache what you need. diff --git a/Example/Sources/Extensions/Settings+UserDefaults.swift b/Example/Sources/Extensions/Settings+UserDefaults.swift index f638cf4c..37e25fac 100644 --- a/Example/Sources/Extensions/Settings+UserDefaults.swift +++ b/Example/Sources/Extensions/Settings+UserDefaults.swift @@ -28,15 +28,15 @@ extension UserDefaults { static let messagesKey = "mockMessages" - // MARK: - Mock Messages + // MARK: Mock Messages func setMockMessages(count: Int) { - set(count, forKey: "mockMessages") + set(count, forKey: UserDefaults.messagesKey) synchronize() } func mockMessagesCount() -> Int { - if let value = object(forKey: "mockMessages") as? Int { + if let value = object(forKey: UserDefaults.messagesKey) as? Int { return value } return 20 diff --git a/Example/Sources/View Controllers/AdvancedExampleViewController.swift b/Example/Sources/View Controllers/AdvancedExampleViewController.swift index a77d1bf0..98081c1c 100644 --- a/Example/Sources/View Controllers/AdvancedExampleViewController.swift +++ b/Example/Sources/View Controllers/AdvancedExampleViewController.swift @@ -130,7 +130,6 @@ final class AdvancedExampleViewController: ChatViewController { messageInputBar.sendButton.image = #imageLiteral(resourceName: "ic_up") messageInputBar.sendButton.title = nil messageInputBar.sendButton.imageView?.layer.cornerRadius = 16 - messageInputBar.middleContentViewPadding.right = -38 let charCountButton = InputBarButtonItem() .configure { $0.title = "0/140" @@ -149,7 +148,9 @@ final class AdvancedExampleViewController: ChatViewController { item.setTitleColor(color, for: .normal) } let bottomItems = [.flexibleSpace, charCountButton] - messageInputBar.middleContentViewPadding.bottom = 8 + + configureInputBarPadding() + messageInputBar.setStackViewItems(bottomItems, forStack: .bottom, animated: false) // This just adds some more flare @@ -165,6 +166,22 @@ final class AdvancedExampleViewController: ChatViewController { } } + /// The input bar will autosize based on the contained text, but we can add padding to adjust the height or width if neccesary + /// See the InputBar diagram here to visualize how each of these would take effect: + /// https://raw.githubusercontent.com/MessageKit/MessageKit/master/Assets/InputBarAccessoryViewLayout.png + private func configureInputBarPadding() { + + // Entire InputBar padding + messageInputBar.padding.bottom = 8 + + // or MiddleContentView padding + messageInputBar.middleContentViewPadding.right = -38 + + // or InputTextView padding + messageInputBar.inputTextView.textContainerInset.bottom = 8 + + } + // MARK: - Helpers func isTimeLabelVisible(at indexPath: IndexPath) -> Bool { diff --git a/README.md b/README.md index 1d12831f..76086b67 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,27 @@ A community-driven replacement for JSQMessagesViewController https://messagekit.github.io
-[](https://circleci.com/gh/MessageKit/MessageKit) -[](https://codecov.io/gh/MessageKit/MessageKit) +[](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22Tests%22) +[](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22Build+Framework%22) +[](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22PR+Example+app%22) +[](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22Danger%22) + +[](https://codecov.io/gh/MessageKit/MessageKit) [](https://github.com/Carthage/Carthage) -
+
- @@ -36,27 +40,32 @@ - Help others learn. ## Vision + See [VISION.md](https://github.com/MessageKit/MessageKit/blob/master/VISION.md) for Goals, Scope, & Technical Considerations. ## Installation + ### [CocoaPods](https://cocoapods.org/) **Recommended** -````ruby + +```ruby # Swift 5.0 pod 'MessageKit' -```` +``` + > For Swift 4.2 use version 3.0.0 -````ruby + +```ruby # Swift 4.2 pod 'MessageKit', '~> 3.0.0' -```` +``` ### [Carthage](https://github.com/Carthage/Carthage) To integrate MessageKit using Carthage, add the following to your `Cartfile`: -```` +``` github "MessageKit/MessageKit" -```` +``` ### [Manual](https://github.com/MessageKit/MessageKit/blob/master/Documentation/MANUAL_INSTALLATION.md) @@ -68,15 +77,17 @@ github "MessageKit/MessageKit" ## Getting Started ### Cell Structure +