Skip to content

Commit

Permalink
Merge branch 'master' into development-patch-from-master
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
kinoroy committed Jun 29, 2020
2 parents 1918e55 + 9567f87 commit b0280fc
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 32 deletions.
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/---bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: "\U0001F41B Bug report"
about: Create a report to help us improve
title: ''
labels: bug?
assignees: ''

---

<!--
Hi, thanks so much for opening an issue! 🤗
To better pinpoint (and solve) the issue you're experiencing, we could use some information on your behalf.
-->

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps/code to reproduce the behavior:
<!--
If the bug can be reproduced in the MessageKit example app, this is really helpful to us!
In some cases it can be really helpful to provide a short example of your code.
If so, please wrap these code blocks in backticks, like this:
```swift
*your code goes here*
```
Please, *do not* submit screenshots of code, instead copy and paste it as above.
-->

**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.
<!-- When referencing a dependency manager-related issue (think CocoaPods, Carthage, SwiftPM), please add its configuration file and version here. -->
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/--feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: "\U0001F4A1Feature request"
about: Suggest an idea for this project
title: ''
labels: feature request
assignees: ''

---

<!-- Hey! Thanks so much for wanting to help improve MessageKit 😃 We always welcome PRs. If you would also be interested in implementing your feature request, please let us know! -->

**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.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/--question-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "❓ Question/Support"
about: Ask a question about how to use MessageKit
title: ''
labels: question
assignees: ''

---

<!--
🛑 Read this 🛑
Before you open an issue. Please check the following to see if your question is answered there:
- The quick start guide: https://github.com/MessageKit/MessageKit/blob/master/Documentation/QuickStart.md
- The FAQ: https://github.com/MessageKit/MessageKit/blob/master/Documentation/FAQs.md
- The example project: https://github.com/MessageKit/MessageKit/tree/master/Example
Please also search through previous issues to see if your question was previously addressed.
Also consider posting(/crossposting) your question to StackOverflow (with the tag 'messagekit').
⚠️ If you need to include code, please wrap it in backticks so it will get Swift highlighting like this:
```swift
*your code goes here*
```
Please, do not upload screenshots of code.
If relevant, please let us know the following things:
- 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 reproducable in the example app?
Please make sure your title describes your issue well. We will try our best to answer your question in a timely manner. Remember that this project is run by helpful volunteers, and we can't make any guarantees on turnaround time.
-->
2 changes: 1 addition & 1 deletion .github/workflows/ci_pr_example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Example app
name: Build Example app

on: pull_request

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_pr_framework.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Framework
name: Build Framework

on: pull_request

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_pr_tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Tests
name: Tests

on: pull_request

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Danger
name: Danger

on:
pull_request:
Expand All @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion Documentation/FAQs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down Expand Up @@ -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.
6 changes: 3 additions & 3 deletions Example/Sources/Extensions/Settings+UserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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 {
Expand Down
57 changes: 35 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,27 @@
A community-driven replacement for JSQMessagesViewController https://messagekit.github.io
</p>

[![CircleCI](https://circleci.com/gh/MessageKit/MessageKit.svg?style=svg)](https://circleci.com/gh/MessageKit/MessageKit)
[![codecov](https://codecov.io/gh/MessageKit/MessageKit/branch/development/graph/badge.svg)](https://codecov.io/gh/MessageKit/MessageKit)
[![Tests](https://github.com/MessageKit/MessageKit/workflows/Tests/badge.svg)](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22Tests%22)
[![Build framework](https://github.com/MessageKit/MessageKit/workflows/Build%20Framework/badge.svg)](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22Build+Framework%22)
[![Build example app](https://github.com/MessageKit/MessageKit/workflows/Build%20Example%20app/badge.svg)](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22PR+Example+app%22)
[![Danger](https://github.com/MessageKit/MessageKit/workflows/Danger/badge.svg)](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22Danger%22)

[![codecov](https://codecov.io/gh/MessageKit/MessageKit/branch/master/graph/badge.svg)](https://codecov.io/gh/MessageKit/MessageKit)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
<a href="https://swift.org">
<img src="https://img.shields.io/badge/Swift-5-green.svg" alt="Swift" />
<img src="https://img.shields.io/badge/Swift-5-green.svg" alt="Swift" />
</a>
<a href="https://cocoapods.org/">
<img src="https://cocoapod-badges.herokuapp.com/v/MessageKit/badge.png" alt="CocoaPods">
<img src="https://cocoapod-badges.herokuapp.com/v/MessageKit/badge.png" alt="CocoaPods">
</a>
<a href="https://developer.apple.com/xcode">
<img src="https://img.shields.io/badge/Xcode-11-blue.svg" alt="Xcode">
<img src="https://img.shields.io/badge/Xcode-11-blue.svg" alt="Xcode">
</a>
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-red.svg" alt="MIT">
<img src="https://img.shields.io/badge/License-MIT-red.svg" alt="MIT">
</a>
<a href="https://github.com/MessageKit/MessageKit/issues">
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="Contributions Welcome">
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="Contributions Welcome">
</a>

<p align="center">
Expand All @@ -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)

Expand All @@ -68,15 +77,17 @@ github "MessageKit/MessageKit"
## Getting Started

### Cell Structure

<p>
<img src="https://raw.githubusercontent.com/MessageKit/MessageKit/master/Assets/CellStructure.png" title="CellStructure">
</p>

Each default cell is a subclass of [`MessageContentCell`](https://github.com/MessageKit/MessageKit/blob/master/Sources/Views/Cells/MessageContentCell.swift) which has 7 parts. From top down we have a: `cellTopLabel`, `messageTopLabel`, `messageContainerView`, `messageBottomLabel`, `cellBottomLabel` with the `avatarView` and `accessoryView` on either side respectively. Above we see the basic [`TextMessageCell`](https://github.com/MessageKit/MessageKit/blob/master/Sources/Views/Cells/TextMessageCell.swift) which uses a `MessageLabel` as its main content.
Each default cell is a subclass of [`MessageContentCell`](https://github.com/MessageKit/MessageKit/blob/master/Sources/Views/Cells/MessageContentCell.swift) which has 7 parts. From top down we have a: `cellTopLabel`, `messageTopLabel`, `messageContainerView`, `messageBottomLabel`, `cellBottomLabel` with the `avatarView` and `accessoryView` on either side respectively. Above we see the basic [`TextMessageCell`](https://github.com/MessageKit/MessageKit/blob/master/Sources/Views/Cells/TextMessageCell.swift) which uses a `MessageLabel` as its main content.

This structure will allow you to create a layout that suits your needs as you can customize the size, appearance and padding of each. If you need something more advanced you can implement a custom cell, which we show how to do in the [Example](https://github.com/MessageKit/MessageKit/tree/master/Example) project.

### MessageInputBar Structure

<p>
<img src="https://raw.githubusercontent.com/MessageKit/MessageKit/master/Assets/InputBarAccessoryViewLayout.png" title="InputBarAccessoryViewLayout">
</p>
Expand All @@ -89,7 +100,7 @@ Please have a look at the [Quick Start guide](https://github.com/MessageKit/Mess

We recommend you start by looking at the [Example](https://github.com/MessageKit/MessageKit/tree/master/Example) project or write a question with the "messagekit" tag on [Stack Overflow](https://stackoverflow.com/questions/tagged/messagekit). You can also look at previous issues here on GitHib with the **"Question"** tag.

For more on how to use the MessageInputBar, see the dependency it is based on [InputBarAccessoryView](https://github.com/nathantannar4/InputBarAccessoryView). You can also see this [short guide]([https://github.com/MessageKit/MessageKit/blob/master/Documentation/MessageInputBar.md)
For more on how to use the MessageInputBar, see the dependency it is based on [InputBarAccessoryView](https://github.com/nathantannar4/InputBarAccessoryView). You can also see this [short guide]([https://github.com/MessageKit/MessageKit/blob/master/Documentation/MessageInputBar.md)

## Default Cells

Expand Down Expand Up @@ -127,16 +138,16 @@ If you choose to use the `.custom` kind you are responsible for all of the cells
## Contributing

Great! Look over these things first.

- Please read our [Code of Conduct](https://github.com/MessageKit/MessageKit/blob/master/CODE_OF_CONDUCT.md)
- Check the [Contributing Guide Lines](https://github.com/MessageKit/MessageKit/blob/master/CONTRIBUTING.md).
- Come join us on [Slack](https://join.slack.com/t/messagekit/shared_invite/MjI4NzIzNzMyMzU0LTE1MDMwODIzMDUtYzllYzIyNTU4MA) and 🗣 don't be a stranger.
- Check out the [current issues](https://github.com/MessageKit/MessageKit/issues) and see if you can tackle any of those.
- Download the project and check out the current code base. Suggest any improvements by opening a new issue.
- Come join us on [Slack](https://join.slack.com/t/messagekit/shared_invite/MjI4NzIzNzMyMzU0LTE1MDMwODIzMDUtYzllYzIyNTU4MA) and 🗣 don't be a stranger.
- Check out the [current issues](https://github.com/MessageKit/MessageKit/issues) and see if you can tackle any of those.
- Download the project and check out the current code base. Suggest any improvements by opening a new issue.
- Check out the [What's Next](#whats-next) section :point_down: to see where we are headed.
- Check [StackOverflow](https://stackoverflow.com/questions/tagged/messagekit)
- Install [SwiftLint](https://github.com/realm/SwiftLint) too keep yourself in :neckbeard: style.
- Be kind and helpful.

- Install [SwiftLint](https://github.com/realm/SwiftLint) too keep yourself in :neckbeard: style.
- Be kind and helpful.

## What's Next?

Expand All @@ -163,7 +174,7 @@ Add your app to the list of apps using this library and make a pull request.
- [SmooveText](https://apps.apple.com/np/app/smoove-text/id1362792811)
- [COYO Engage](https://apps.apple.com/app/coyo-engage/id1341588804)

*Please provide attribution, it is greatly appreciated.*
_Please provide attribution, it is greatly appreciated._

## Core Team

Expand All @@ -177,7 +188,9 @@ Add your app to the list of apps using this library and make a pull request.
Many thanks to [**the contributors**](https://github.com/MessageKit/MessageKit/graphs/contributors) of this project.

## License

MessageKit is released under the [MIT License](https://github.com/MessageKit/MessageKit/blob/master/LICENSE.md).

## Inspiration

Inspired by [JSQMessagesViewController](https://github.com/jessesquires/JSQMessagesViewController) :point_left: :100:

0 comments on commit b0280fc

Please sign in to comment.