Merge branch 'development' into licence-header
@@ -1,6 +1,10 @@
|
||||
name: PR Danger
|
||||
|
||||
on: pull_request
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
# - development
|
||||
|
||||
jobs:
|
||||
danger:
|
||||
|
||||
@@ -13,7 +13,6 @@ custom_rules:
|
||||
severity: warning # violation severity. optional.
|
||||
opt_in_rules:
|
||||
- explicit_top_level_acl
|
||||
explicit_acl: error
|
||||
explicit_top_level_acl: error
|
||||
included:
|
||||
- Sources
|
||||
- Sources
|
||||
|
||||
@@ -2,6 +2,18 @@
|
||||
|
||||
The changelog for `MessageKit`. Also see the [releases](https://github.com/MessageKit/MessageKit/releases) on GitHub.
|
||||
|
||||
## Upcoming release
|
||||
|
||||
### Fixed
|
||||
|
||||
### Added
|
||||
|
||||
- Added option to use Photo messages with remote image URL in Example project [#1294](https://github.com/MessageKit/MessageKit/pull/1294) by [@martinpucik](https://github.com/martinpucik)
|
||||
|
||||
### Changed
|
||||
|
||||
- **Breaking Change** Dropped support for iOS 9 and iOS 10 [#1261](https://github.com/MessageKit/MessageKit/pull/1261) by [@kaspik](https://github.com/kaspik)
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -142,6 +142,16 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
13FCBEED2424D36900CB489F /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
882B5E7F1CF7D53600B6E160 /* Info.plist */,
|
||||
882B5E791CF7D53600B6E160 /* Assets.xcassets */,
|
||||
882B5E7A1CF7D53600B6E160 /* LaunchScreen.storyboard */,
|
||||
);
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
385C2924211FF3310010B4BA /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -172,6 +182,7 @@
|
||||
385C2933211FF3670010B4BA /* Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
385C292A211FF3450010B4BA /* Settings+UserDefaults.swift */,
|
||||
385C292F211FF3630010B4BA /* UIColor+Extensions.swift */,
|
||||
385C2930211FF3630010B4BA /* UIViewController+Extensions.swift */,
|
||||
);
|
||||
@@ -259,17 +270,14 @@
|
||||
children = (
|
||||
882B5E781CF7D53600B6E160 /* AppDelegate.swift */,
|
||||
50739F9421C5075D008CA369 /* AudioController */,
|
||||
385C2949211FF3930010B4BA /* View Controllers */,
|
||||
385C293A211FF3800010B4BA /* Data Generation */,
|
||||
385C2933211FF3670010B4BA /* Extensions */,
|
||||
385C292E211FF3540010B4BA /* Layout */,
|
||||
385C2929211FF33D0010B4BA /* Models */,
|
||||
385C2924211FF3310010B4BA /* Views */,
|
||||
13FCBEED2424D36900CB489F /* Resources */,
|
||||
5074EF4B2163554900D82952 /* Sounds */,
|
||||
882B5E791CF7D53600B6E160 /* Assets.xcassets */,
|
||||
882B5E7F1CF7D53600B6E160 /* Info.plist */,
|
||||
882B5E7A1CF7D53600B6E160 /* LaunchScreen.storyboard */,
|
||||
385C292A211FF3450010B4BA /* Settings+UserDefaults.swift */,
|
||||
385C2933211FF3670010B4BA /* Extensions */,
|
||||
385C2949211FF3930010B4BA /* View Controllers */,
|
||||
385C2924211FF3310010B4BA /* Views */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
@@ -483,11 +491,17 @@
|
||||
"${PODS_ROOT}/Target Support Files/Pods-ChatExample/Pods-ChatExample-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/InputBarAccessoryView/InputBarAccessoryView.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/MessageKit/MessageKit.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PINCache/PINCache.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PINOperation/PINOperation.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PINRemoteImage/PINRemoteImage.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/InputBarAccessoryView.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MessageKit.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINCache.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINOperation.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINRemoteImage.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
@@ -523,7 +537,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
|
||||
shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
@@ -647,7 +661,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -699,7 +713,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -714,7 +728,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Sources/Resources/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.ChatExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -728,7 +742,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Sources/Resources/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.ChatExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
LastUpgradeVersion = "1130"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -40,8 +40,17 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
codeCoverageEnabled = "YES"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "882B5E321CF7D4B900B6E160"
|
||||
BuildableName = "ChatExample.app"
|
||||
BlueprintName = "ChatExample"
|
||||
ReferencedContainer = "container:ChatExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@@ -54,17 +63,6 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "882B5E321CF7D4B900B6E160"
|
||||
BuildableName = "ChatExample.app"
|
||||
BlueprintName = "ChatExample"
|
||||
ReferencedContainer = "container:ChatExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -86,8 +84,6 @@
|
||||
ReferencedContainer = "container:ChatExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
LastUpgradeVersion = "1130"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -23,8 +23,6 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -36,8 +34,6 @@
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -48,7 +48,7 @@ GEM
|
||||
cocoapods-trunk (1.4.1)
|
||||
nap (>= 0.8, < 2.0)
|
||||
netrc (~> 0.11)
|
||||
cocoapods-try (1.1.0)
|
||||
cocoapods-try (1.2.0)
|
||||
colored2 (3.1.2)
|
||||
concurrent-ruby (1.1.6)
|
||||
escape (0.0.4)
|
||||
@@ -71,9 +71,9 @@ GEM
|
||||
thread_safe (0.3.6)
|
||||
typhoeus (1.3.1)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
xcodeproj (1.15.0)
|
||||
xcodeproj (1.16.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
source 'https://cdn.cocoapods.org/'
|
||||
|
||||
platform :ios, '9.0'
|
||||
platform :ios, '11.0'
|
||||
|
||||
target 'ChatExample' do
|
||||
use_frameworks!
|
||||
pod 'MessageKit', :path => '../'
|
||||
pod 'SwiftLint', '~> 0.39.1'
|
||||
pod 'PINRemoteImage', '~> 3.0.0', :subspecs => ['iOS', 'PINCache']
|
||||
|
||||
target 'ChatExampleTests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
|
||||
target 'ChatExampleUITests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
target 'ChatExampleTests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
|
||||
target 'ChatExampleUITests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,13 +4,36 @@ PODS:
|
||||
- InputBarAccessoryView/Core (4.3.2)
|
||||
- MessageKit (3.1.0):
|
||||
- InputBarAccessoryView (~> 4.3.0)
|
||||
- PINCache (3.0.1-beta.8):
|
||||
- PINCache/Arc-exception-safe (= 3.0.1-beta.8)
|
||||
- PINCache/Core (= 3.0.1-beta.8)
|
||||
- PINCache/Arc-exception-safe (3.0.1-beta.8):
|
||||
- PINCache/Core
|
||||
- PINCache/Core (3.0.1-beta.8):
|
||||
- PINOperation (~> 1.1.1)
|
||||
- PINOperation (1.1.2)
|
||||
- PINRemoteImage/Core (3.0.0):
|
||||
- PINOperation
|
||||
- PINRemoteImage/iOS (3.0.0):
|
||||
- PINRemoteImage/Core
|
||||
- PINRemoteImage/PINCache (3.0.0):
|
||||
- PINCache (= 3.0.1-beta.8)
|
||||
- PINRemoteImage/Core
|
||||
- SwiftLint (0.39.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- MessageKit (from `../`)
|
||||
- PINRemoteImage/iOS (~> 3.0.0)
|
||||
- PINRemoteImage/PINCache (~> 3.0.0)
|
||||
- SwiftLint (~> 0.39.1)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- InputBarAccessoryView
|
||||
- PINCache
|
||||
- PINOperation
|
||||
- PINRemoteImage
|
||||
- SwiftLint
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
MessageKit:
|
||||
@@ -18,8 +41,12 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
InputBarAccessoryView: 7985d418040a05fe894bd4b8328dd43ab35517c3
|
||||
MessageKit: 3beb578737a5aa2bba25cc27c7b6d6faa09af5a7
|
||||
MessageKit: 3c593dc22f7465f74822e4a873ef3157a3e05080
|
||||
PINCache: 534fd41d358d828dfdf227a0d327f3673a65e20b
|
||||
PINOperation: 24b774353ca248fcf87d67b2d61eef42087c125a
|
||||
PINRemoteImage: e2b89e19fb6e77ffc099f9d9f3b3fe1745e3f9f9
|
||||
SwiftLint: 55e96a4a4d537d4a3156859fc1c54bd24851a046
|
||||
|
||||
PODFILE CHECKSUM: 90bd12ca685503630d7fe716609f4974660ed5ee
|
||||
PODFILE CHECKSUM: cf0af8a506e2b58d4d51b99e165b58c56c26d619
|
||||
|
||||
COCOAPODS: 1.9.1
|
||||
|
||||
@@ -36,6 +36,7 @@ final internal class SampleData {
|
||||
case Text
|
||||
case AttributedText
|
||||
case Photo
|
||||
case PhotoFromURL = "Photo from URL"
|
||||
case Video
|
||||
case Audio
|
||||
case Emoji
|
||||
@@ -69,6 +70,11 @@ final internal class SampleData {
|
||||
var now = Date()
|
||||
|
||||
let messageImages: [UIImage] = [#imageLiteral(resourceName: "img1"), #imageLiteral(resourceName: "img2")]
|
||||
let messageImageURLs: [URL] = [URL(string: "https://placekitten.com/g/200/300")!,
|
||||
URL(string: "https://placekitten.com/g/300/300")!,
|
||||
URL(string: "https://placekitten.com/g/300/400")!,
|
||||
URL(string: "https://placekitten.com/g/400/400")!]
|
||||
|
||||
let emojis = [
|
||||
"👍",
|
||||
"😂😂😂",
|
||||
@@ -143,21 +149,16 @@ final internal class SampleData {
|
||||
}
|
||||
|
||||
func randomMessageType() -> MessageTypes {
|
||||
var messageTypes = [MessageTypes]()
|
||||
for type in MessageTypes.allCases {
|
||||
if UserDefaults.standard.bool(forKey: "\(type.rawValue)" + " Messages") {
|
||||
messageTypes.append(type)
|
||||
}
|
||||
}
|
||||
return messageTypes.random()!
|
||||
return MessageTypes.allCases.compactMap {
|
||||
guard UserDefaults.standard.bool(forKey: "\($0.rawValue)" + " Messages") else { return nil }
|
||||
return $0
|
||||
}.random()!
|
||||
}
|
||||
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
func randomMessage(allowedSenders: [MockUser]) -> MockMessage {
|
||||
let randomNumberSender = Int(arc4random_uniform(UInt32(allowedSenders.count)))
|
||||
|
||||
let uniqueID = UUID().uuidString
|
||||
let user = allowedSenders[randomNumberSender]
|
||||
let user = allowedSenders.random()!
|
||||
let date = dateAddingRandomTime()
|
||||
|
||||
switch randomMessageType() {
|
||||
@@ -169,23 +170,21 @@ final internal class SampleData {
|
||||
let attributedText = attributedString(with: randomSentence)
|
||||
return MockMessage(attributedText: attributedText, user: user, messageId: uniqueID, date: date)
|
||||
case .Photo:
|
||||
let randomNumberImage = Int(arc4random_uniform(UInt32(messageImages.count)))
|
||||
let image = messageImages[randomNumberImage]
|
||||
let image = messageImages.random()!
|
||||
return MockMessage(image: image, user: user, messageId: uniqueID, date: date)
|
||||
case .PhotoFromURL:
|
||||
let imageURL: URL = messageImageURLs.random()!
|
||||
return MockMessage(imageURL: imageURL, user: user, messageId: uniqueID, date: date)
|
||||
case .Video:
|
||||
let randomNumberImage = Int(arc4random_uniform(UInt32(messageImages.count)))
|
||||
let image = messageImages[randomNumberImage]
|
||||
let image = messageImages.random()!
|
||||
return MockMessage(thumbnail: image, user: user, messageId: uniqueID, date: date)
|
||||
case .Audio:
|
||||
let randomNumberSound = Int(arc4random_uniform(UInt32(sounds.count)))
|
||||
let soundURL = sounds[randomNumberSound]
|
||||
let soundURL = sounds.random()!
|
||||
return MockMessage(audioURL: soundURL, user: user, messageId: uniqueID, date: date)
|
||||
case .Emoji:
|
||||
let randomNumberEmoji = Int(arc4random_uniform(UInt32(emojis.count)))
|
||||
return MockMessage(emoji: emojis[randomNumberEmoji], user: user, messageId: uniqueID, date: date)
|
||||
return MockMessage(emoji: emojis.random()!, user: user, messageId: uniqueID, date: date)
|
||||
case .Location:
|
||||
let randomNumberLocation = Int(arc4random_uniform(UInt32(locations.count)))
|
||||
return MockMessage(location: locations[randomNumberLocation], user: user, messageId: uniqueID, date: date)
|
||||
return MockMessage(location: locations.random()!, user: user, messageId: uniqueID, date: date)
|
||||
case .Url:
|
||||
return MockMessage(text: "https://github.com/MessageKit", user: user, messageId: uniqueID, date: date)
|
||||
case .Phone:
|
||||
@@ -193,8 +192,7 @@ final internal class SampleData {
|
||||
case .Custom:
|
||||
return MockMessage(custom: "Someone left the conversation", user: system, messageId: uniqueID, date: date)
|
||||
case .ShareContact:
|
||||
let randomContact = Int(arc4random_uniform(UInt32(contactsToShare.count)))
|
||||
return MockMessage(contact: contactsToShare[randomContact], user: user, messageId: uniqueID, date: date)
|
||||
return MockMessage(contact: contactsToShare.random()!, user: user, messageId: uniqueID, date: date)
|
||||
}
|
||||
}
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
|
||||
@@ -52,6 +52,11 @@ private struct ImageMediaItem: MediaItem {
|
||||
self.placeholderImage = UIImage()
|
||||
}
|
||||
|
||||
init(imageURL: URL) {
|
||||
self.url = imageURL
|
||||
self.size = CGSize(width: 240, height: 240)
|
||||
self.placeholderImage = UIImage(imageLiteralResourceName: "image_message_placeholder")
|
||||
}
|
||||
}
|
||||
|
||||
private struct MockAudiotem: AudioItem {
|
||||
@@ -121,6 +126,11 @@ internal struct MockMessage: MessageType {
|
||||
self.init(kind: .photo(mediaItem), user: user, messageId: messageId, date: date)
|
||||
}
|
||||
|
||||
init(imageURL: URL, user: MockUser, messageId: String, date: Date) {
|
||||
let mediaItem = ImageMediaItem(imageURL: imageURL)
|
||||
self.init(kind: .photo(mediaItem), user: user, messageId: messageId, date: date)
|
||||
}
|
||||
|
||||
init(thumbnail: UIImage, user: MockUser, messageId: String, date: Date) {
|
||||
let mediaItem = ImageMediaItem(image: thumbnail)
|
||||
self.init(kind: .video(mediaItem), user: user, messageId: messageId, date: date)
|
||||
|
||||
@@ -76,12 +76,10 @@ final class MockSocket {
|
||||
onNewMessageCode?(message)
|
||||
queuedMessage = nil
|
||||
} else {
|
||||
let sender = arc4random_uniform(1) % 2 == 0 ? connectedUsers.first! : connectedUsers.last!
|
||||
SampleData.shared.getMessages(count: 1, allowedSenders: [sender]) { (message) in
|
||||
queuedMessage = message.first
|
||||
}
|
||||
let sender = connectedUsers.random()!
|
||||
let message = SampleData.shared.randomMessage(allowedSenders: [sender])
|
||||
queuedMessage = message
|
||||
onTypingStatusCode?()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 729 B After Width: | Height: | Size: 729 B |
|
Before Width: | Height: | Size: 969 B After Width: | Height: | Size: 969 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "image_message_placeholder.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -26,6 +26,7 @@ import UIKit
|
||||
import MapKit
|
||||
import MessageKit
|
||||
import InputBarAccessoryView
|
||||
import PINRemoteImage
|
||||
|
||||
final class AdvancedExampleViewController: ChatViewController {
|
||||
|
||||
@@ -353,6 +354,14 @@ extension AdvancedExampleViewController: MessagesDisplayDelegate {
|
||||
accessoryView.layer.cornerRadius = accessoryView.frame.height / 2
|
||||
accessoryView.backgroundColor = UIColor.primaryColor.withAlphaComponent(0.3)
|
||||
}
|
||||
|
||||
func configureMediaMessageImageView(_ imageView: UIImageView, for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) {
|
||||
if case MessageKind.photo(let media) = message.kind, let imageURL = media.url {
|
||||
imageView.pin_setImage(from: imageURL)
|
||||
} else {
|
||||
imageView.pin_cancelImageDownload()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Location Messages
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
import MessageKit
|
||||
import InputBarAccessoryView
|
||||
import PINRemoteImage
|
||||
|
||||
final class AutocompleteExampleViewController: ChatViewController {
|
||||
|
||||
@@ -336,6 +337,14 @@ extension AutocompleteExampleViewController: MessagesDisplayDelegate {
|
||||
accessoryView.layer.cornerRadius = accessoryView.frame.height / 2
|
||||
accessoryView.backgroundColor = UIColor.primaryColor.withAlphaComponent(0.3)
|
||||
}
|
||||
|
||||
func configureMediaMessageImageView(_ imageView: UIImageView, for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) {
|
||||
if case MessageKind.photo(let media) = message.kind, let imageURL = media.url {
|
||||
imageView.pin_setImage(from: imageURL)
|
||||
} else {
|
||||
imageView.pin_cancelImageDownload()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - MessagesLayoutDelegate
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import UIKit
|
||||
import MapKit
|
||||
import MessageKit
|
||||
import PINRemoteImage
|
||||
|
||||
final class BasicExampleViewController: ChatViewController {
|
||||
override func configureMessageCollectionView() {
|
||||
@@ -71,6 +72,14 @@ extension BasicExampleViewController: MessagesDisplayDelegate {
|
||||
let avatar = SampleData.shared.getAvatarFor(sender: message.sender)
|
||||
avatarView.set(avatar: avatar)
|
||||
}
|
||||
|
||||
func configureMediaMessageImageView(_ imageView: UIImageView, for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) {
|
||||
if case MessageKind.photo(let media) = message.kind, let imageURL = media.url {
|
||||
imageView.pin_setImage(from: imageURL)
|
||||
} else {
|
||||
imageView.pin_cancelImageDownload()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Location Messages
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2019 MessageKit
|
||||
Copyright (c) 2017-2020 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
|
||||
@@ -28,24 +28,30 @@ import InputBarAccessoryView
|
||||
|
||||
/// A base class for the example controllers
|
||||
class ChatViewController: MessagesViewController, MessagesDataSource {
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
return .lightContent
|
||||
}
|
||||
|
||||
/// The `BasicAudioController` controll the AVAudioPlayer state (play, pause, stop) and udpate audio cell UI accordingly.
|
||||
open lazy var audioController = BasicAudioController(messageCollectionView: messagesCollectionView)
|
||||
|
||||
var messageList: [MockMessage] = []
|
||||
// MARK: - Public properties
|
||||
|
||||
/// The `BasicAudioController` controll the AVAudioPlayer state (play, pause, stop) and udpate audio cell UI accordingly.
|
||||
lazy var audioController = BasicAudioController(messageCollectionView: messagesCollectionView)
|
||||
|
||||
lazy var messageList: [MockMessage] = []
|
||||
|
||||
let refreshControl = UIRefreshControl()
|
||||
|
||||
let formatter: DateFormatter = {
|
||||
private(set) lazy var refreshControl: UIRefreshControl = {
|
||||
let control = UIRefreshControl()
|
||||
control.addTarget(self, action: #selector(loadMoreMessages), for: .valueChanged)
|
||||
return control
|
||||
}()
|
||||
|
||||
// MARK: - Private properties
|
||||
|
||||
private let formatter: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .medium
|
||||
return formatter
|
||||
}()
|
||||
|
||||
|
||||
// MARK: - Lifecycle
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@@ -69,6 +75,10 @@ class ChatViewController: MessagesViewController, MessagesDataSource {
|
||||
MockSocket.shared.disconnect()
|
||||
audioController.stopAnyOngoingPlaying()
|
||||
}
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
return .lightContent
|
||||
}
|
||||
|
||||
func loadFirstMessages() {
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
@@ -83,8 +93,7 @@ class ChatViewController: MessagesViewController, MessagesDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
func loadMoreMessages() {
|
||||
@objc func loadMoreMessages() {
|
||||
DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 1) {
|
||||
SampleData.shared.getMessages(count: 20) { messages in
|
||||
DispatchQueue.main.async {
|
||||
@@ -104,8 +113,7 @@ class ChatViewController: MessagesViewController, MessagesDataSource {
|
||||
scrollsToBottomOnKeyboardBeginsEditing = true // default false
|
||||
maintainPositionOnKeyboardFrameChanged = true // default false
|
||||
|
||||
messagesCollectionView.addSubview(refreshControl)
|
||||
refreshControl.addTarget(self, action: #selector(loadMoreMessages), for: .valueChanged)
|
||||
messagesCollectionView.refreshControl = refreshControl
|
||||
}
|
||||
|
||||
func configureMessageInputBar() {
|
||||
@@ -143,50 +151,46 @@ class ChatViewController: MessagesViewController, MessagesDataSource {
|
||||
|
||||
return messagesCollectionView.indexPathsForVisibleItems.contains(lastIndexPath)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - MessagesDataSource
|
||||
|
||||
|
||||
func currentSender() -> SenderType {
|
||||
return SampleData.shared.currentSender
|
||||
}
|
||||
|
||||
|
||||
func numberOfSections(in messagesCollectionView: MessagesCollectionView) -> Int {
|
||||
return messageList.count
|
||||
}
|
||||
|
||||
|
||||
func messageForItem(at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> MessageType {
|
||||
return messageList[indexPath.section]
|
||||
}
|
||||
|
||||
|
||||
func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
|
||||
if indexPath.section % 3 == 0 {
|
||||
return NSAttributedString(string: MessageKitDateFormatter.shared.string(from: message.sentDate), attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 10), NSAttributedString.Key.foregroundColor: UIColor.darkGray])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func cellBottomLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
|
||||
|
||||
return NSAttributedString(string: "Read", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 10), NSAttributedString.Key.foregroundColor: UIColor.darkGray])
|
||||
}
|
||||
|
||||
|
||||
func messageTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
|
||||
let name = message.sender.displayName
|
||||
return NSAttributedString(string: name, attributes: [NSAttributedString.Key.font: UIFont.preferredFont(forTextStyle: .caption1)])
|
||||
}
|
||||
|
||||
|
||||
func messageBottomLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
|
||||
|
||||
let dateString = formatter.string(from: message.sentDate)
|
||||
return NSAttributedString(string: dateString, attributes: [NSAttributedString.Key.font: UIFont.preferredFont(forTextStyle: .caption2)])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - MessageCellDelegate
|
||||
|
||||
extension ChatViewController: MessageCellDelegate {
|
||||
|
||||
func didTapAvatar(in cell: MessageCollectionViewCell) {
|
||||
print("Avatar tapped")
|
||||
}
|
||||
@@ -261,7 +265,6 @@ extension ChatViewController: MessageCellDelegate {
|
||||
// MARK: - MessageLabelDelegate
|
||||
|
||||
extension ChatViewController: MessageLabelDelegate {
|
||||
|
||||
func didSelectAddress(_ addressComponents: [String: String]) {
|
||||
print("Address Selected: \(addressComponents)")
|
||||
}
|
||||
@@ -293,15 +296,12 @@ extension ChatViewController: MessageLabelDelegate {
|
||||
func didSelectCustom(_ pattern: String, match: String?) {
|
||||
print("Custom data detector patter selected: \(pattern)")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - MessageInputBarDelegate
|
||||
|
||||
extension ChatViewController: InputBarAccessoryViewDelegate {
|
||||
|
||||
func inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {
|
||||
|
||||
// Here we can parse for which substrings were autocompleted
|
||||
let attributedText = messageInputBar.inputTextView.attributedText!
|
||||
let range = NSRange(location: 0, length: attributedText.length)
|
||||
|
||||
@@ -46,16 +46,12 @@ final internal class LaunchViewController: UITableViewController {
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
if #available(iOS 11.0, *) {
|
||||
navigationController?.navigationBar.prefersLargeTitles = true
|
||||
}
|
||||
navigationController?.navigationBar.prefersLargeTitles = true
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
if #available(iOS 11.0, *) {
|
||||
navigationController?.navigationBar.prefersLargeTitles = false
|
||||
}
|
||||
navigationController?.navigationBar.prefersLargeTitles = false
|
||||
}
|
||||
|
||||
// MARK: - UITableViewDataSource
|
||||
@@ -100,9 +96,7 @@ final internal class LaunchViewController: UITableViewController {
|
||||
|
||||
func openURL(_ url: URL) {
|
||||
let webViewController = SFSafariViewController(url: url)
|
||||
if #available(iOS 10.0, *) {
|
||||
webViewController.preferredControlTintColor = .primaryColor
|
||||
}
|
||||
webViewController.preferredControlTintColor = .primaryColor
|
||||
present(webViewController, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,7 @@ final class NavigationController: UINavigationController {
|
||||
navigationBar.tintColor = .white
|
||||
navigationBar.barTintColor = .primaryColor
|
||||
navigationBar.titleTextAttributes = [.foregroundColor: UIColor.white]
|
||||
if #available(iOS 11.0, *) {
|
||||
navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
|
||||
}
|
||||
navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
|
||||
navigationBar.shadowImage = UIImage()
|
||||
navigationBar.setBackgroundImage(UIImage(), for: .default)
|
||||
view.backgroundColor = .primaryColor
|
||||
@@ -50,17 +48,13 @@ final class NavigationController: UINavigationController {
|
||||
navigationBar.barTintColor = .primaryColor
|
||||
navigationBar.tintColor = .white
|
||||
navigationBar.titleTextAttributes = [.foregroundColor: UIColor.white]
|
||||
if #available(iOS 11.0, *) {
|
||||
navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
|
||||
}
|
||||
navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
|
||||
} else if style == .lightContent {
|
||||
navigationBar.shadowImage = nil
|
||||
navigationBar.barTintColor = .white
|
||||
navigationBar.tintColor = UIColor(red: 0, green: 0.5, blue: 1, alpha: 1)
|
||||
navigationBar.titleTextAttributes = [.foregroundColor: UIColor.black]
|
||||
if #available(iOS 11.0, *) {
|
||||
navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.black]
|
||||
}
|
||||
navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.black]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ final internal class SettingsViewController: UITableViewController {
|
||||
return .lightContent
|
||||
}
|
||||
|
||||
let cells = ["Mock messages count", "Text Messages", "AttributedText Messages", "Photo Messages", "Video Messages", "Audio Messages", "Emoji Messages", "Location Messages", "Url Messages", "Phone Messages", "ShareContact Messages"]
|
||||
let cells = ["Mock messages count", "Text Messages", "AttributedText Messages", "Photo Messages", "Photo from URL Messages", "Video Messages", "Audio Messages", "Emoji Messages", "Location Messages", "Url Messages", "Phone Messages", "ShareContact Messages"]
|
||||
|
||||
// MARK: - Picker
|
||||
|
||||
|
||||
@@ -28,11 +28,7 @@ final class ChatExampleUITests: XCTestCase {
|
||||
continueAfterFailure = false
|
||||
// UI tests must launch the application that they test.
|
||||
// Doing this in setup will make sure it happens for each test method.
|
||||
if #available(iOS 9.0, *) {
|
||||
XCUIApplication().launch()
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
XCUIApplication().launch()
|
||||
|
||||
// In UI tests it’s important to set the initial state
|
||||
// - such as interface orientation - required for your tests before they run.
|
||||
|
||||
@@ -30,11 +30,12 @@ GEM
|
||||
thor (~> 0.19)
|
||||
faraday (0.17.3)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-http-cache (2.0.0)
|
||||
faraday (~> 0.8)
|
||||
faraday-http-cache (2.2.0)
|
||||
faraday (>= 0.8)
|
||||
git (1.6.0)
|
||||
rchardet (~> 1.8)
|
||||
kramdown (2.1.0)
|
||||
kramdown (2.2.1)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
multipart-post (2.1.1)
|
||||
@@ -44,9 +45,10 @@ GEM
|
||||
faraday (>= 0.9)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
open4 (1.3.4)
|
||||
public_suffix (4.0.3)
|
||||
public_suffix (4.0.4)
|
||||
rake (13.0.1)
|
||||
rchardet (1.8.0)
|
||||
rexml (3.2.4)
|
||||
sawyer (0.8.2)
|
||||
addressable (>= 2.3.5)
|
||||
faraday (> 0.8, < 2.0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2019 MessageKit
|
||||
Copyright (c) 2017-2020 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
|
||||
|
||||
@@ -11,17 +11,11 @@ Pod::Spec.new do |s|
|
||||
s.source = { :git => 'https://github.com/MessageKit/MessageKit.git', :tag => s.version }
|
||||
s.source_files = 'Sources/**/*.swift'
|
||||
|
||||
s.pod_target_xcconfig = {
|
||||
"SWIFT_VERSION" => "5.0",
|
||||
}
|
||||
|
||||
s.swift_version = '5.0'
|
||||
|
||||
s.ios.deployment_target = '9.0'
|
||||
s.ios.deployment_target = '11.0'
|
||||
s.ios.resource_bundle = { 'MessageKitAssets' => 'Assets/MessageKitAssets.bundle/Images' }
|
||||
|
||||
s.requires_arc = true
|
||||
|
||||
s.dependency 'InputBarAccessoryView', '~> 4.3.0'
|
||||
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
5073C11D2175BEC60040EAD5 /* AudioMessageSizeCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5073C11C2175BEC60040EAD5 /* AudioMessageSizeCalculator.swift */; };
|
||||
5073C1232175C1980040EAD5 /* sound1.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 5073C1222175C1980040EAD5 /* sound1.m4a */; };
|
||||
50FF34552237FE4C0004DCD7 /* ContactItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50FF34542237FE4C0004DCD7 /* ContactItem.swift */; };
|
||||
50FF34572237FE6A0004DCD7 /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50FF34562237FE6A0004DCD7 /* UIImage+Extension.swift */; };
|
||||
50FF34572237FE6A0004DCD7 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50FF34562237FE6A0004DCD7 /* UIImage+Extensions.swift */; };
|
||||
50FF34592237FE850004DCD7 /* ContactMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50FF34582237FE840004DCD7 /* ContactMessageCell.swift */; };
|
||||
50FF345B2237FE9C0004DCD7 /* ContactMessageSizeCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50FF345A2237FE9C0004DCD7 /* ContactMessageSizeCalculator.swift */; };
|
||||
88916B2D1CF0DF2F00469F91 /* MessageKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88916B221CF0DF2F00469F91 /* MessageKit.framework */; };
|
||||
@@ -163,7 +163,7 @@
|
||||
5073C11C2175BEC60040EAD5 /* AudioMessageSizeCalculator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioMessageSizeCalculator.swift; sourceTree = "<group>"; };
|
||||
5073C1222175C1980040EAD5 /* sound1.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = sound1.m4a; sourceTree = "<group>"; };
|
||||
50FF34542237FE4C0004DCD7 /* ContactItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactItem.swift; sourceTree = "<group>"; };
|
||||
50FF34562237FE6A0004DCD7 /* UIImage+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Extension.swift"; sourceTree = "<group>"; };
|
||||
50FF34562237FE6A0004DCD7 /* UIImage+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Extensions.swift"; sourceTree = "<group>"; };
|
||||
50FF34582237FE840004DCD7 /* ContactMessageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactMessageCell.swift; sourceTree = "<group>"; };
|
||||
50FF345A2237FE9C0004DCD7 /* ContactMessageSizeCalculator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactMessageSizeCalculator.swift; sourceTree = "<group>"; };
|
||||
88916B221CF0DF2F00469F91 /* MessageKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MessageKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -399,7 +399,7 @@
|
||||
B09643981F295D43004D0129 /* Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50FF34562237FE6A0004DCD7 /* UIImage+Extension.swift */,
|
||||
50FF34562237FE6A0004DCD7 /* UIImage+Extensions.swift */,
|
||||
0EE91E651FDEC887005420A2 /* CGRect+Extensions.swift */,
|
||||
B7A03F671F8669EB006AEF79 /* Bundle+Extensions.swift */,
|
||||
B7A03F681F8669EB006AEF79 /* NSAttributedString+Extensions.swift */,
|
||||
@@ -695,7 +695,7 @@
|
||||
1F6C040C206A2891007BDE44 /* MessageContentCell.swift in Sources */,
|
||||
B7A03F2C1F866895006AEF79 /* DetectorType.swift in Sources */,
|
||||
B7A03F271F866895006AEF79 /* Avatar.swift in Sources */,
|
||||
50FF34572237FE6A0004DCD7 /* UIImage+Extension.swift in Sources */,
|
||||
50FF34572237FE6A0004DCD7 /* UIImage+Extensions.swift in Sources */,
|
||||
1F82D1431FB1B75B00B81A88 /* AvatarPosition.swift in Sources */,
|
||||
1FF377AC20087DA2004FD648 /* MessagesViewController+Keyboard.swift in Sources */,
|
||||
);
|
||||
@@ -783,7 +783,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -838,7 +838,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -865,7 +865,6 @@
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Sources/Supporting/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.MessageKit;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -891,7 +890,6 @@
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Sources/Supporting/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.MessageKit;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</p>
|
||||
|
||||
[](https://circleci.com/gh/MessageKit/MessageKit)
|
||||
[](https://codecov.io/gh/MessageKit/MessageKit)
|
||||
[](https://codecov.io/gh/MessageKit/MessageKit)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
<a href="https://swift.org">
|
||||
<img src="https://img.shields.io/badge/Swift-5-green.svg" alt="Swift" />
|
||||
@@ -58,7 +58,7 @@ 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)
|
||||
### [Manual](https://github.com/MessageKit/MessageKit/blob/master/Documentation/MANUAL_INSTALLATION.md)
|
||||
|
||||
## Requirements
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ internal extension MessagesViewController {
|
||||
func addKeyboardObservers() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleKeyboardDidChangeState(_:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleTextViewDidBeginEditing(_:)), name: UITextView.textDidBeginEditingNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.adjustScrollViewTopInset), name: UIDevice.orientationDidChangeNotification, object: nil)
|
||||
}
|
||||
|
||||
func removeKeyboardObservers() {
|
||||
@@ -105,19 +104,6 @@ internal extension MessagesViewController {
|
||||
|
||||
// MARK: - Inset Computation
|
||||
|
||||
@objc
|
||||
func adjustScrollViewTopInset() {
|
||||
if #available(iOS 11.0, *) {
|
||||
// No need to add to the top contentInset
|
||||
} else {
|
||||
let navigationBarInset = navigationController?.navigationBar.frame.height ?? 0
|
||||
let statusBarInset: CGFloat = UIApplication.shared.isStatusBarHidden ? 0 : 20
|
||||
let topInset = navigationBarInset + statusBarInset
|
||||
messagesCollectionView.contentInset.top = topInset
|
||||
messagesCollectionView.scrollIndicatorInsets.top = topInset
|
||||
}
|
||||
}
|
||||
|
||||
private func requiredScrollViewBottomInset(forKeyboardFrame keyboardFrame: CGRect) -> CGFloat {
|
||||
// we only need to adjust for the part of the keyboard that covers (i.e. intersects) our collection view;
|
||||
// see https://developer.apple.com/videos/play/wwdc2017/242/ for more details
|
||||
@@ -137,16 +123,11 @@ internal extension MessagesViewController {
|
||||
return max(0, inputAccessoryViewHeight + additionalBottomInset - automaticallyAddedBottomInset)
|
||||
}
|
||||
|
||||
/// iOS 11's UIScrollView can automatically add safe area insets to its contentInset,
|
||||
/// UIScrollView can automatically add safe area insets to its contentInset,
|
||||
/// which needs to be accounted for when setting the contentInset based on screen coordinates.
|
||||
///
|
||||
/// - Returns: The distance automatically added to contentInset.bottom, if any.
|
||||
private var automaticallyAddedBottomInset: CGFloat {
|
||||
if #available(iOS 11.0, *) {
|
||||
return messagesCollectionView.adjustedContentInset.bottom - messagesCollectionView.contentInset.bottom
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
return messagesCollectionView.adjustedContentInset.bottom - messagesCollectionView.contentInset.bottom
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -130,13 +130,10 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
|
||||
addKeyboardObservers()
|
||||
messageCollectionViewBottomInset = requiredInitialScrollViewBottomInset()
|
||||
}
|
||||
adjustScrollViewTopInset()
|
||||
}
|
||||
|
||||
open override func viewSafeAreaInsetsDidChange() {
|
||||
if #available(iOS 11.0, *) {
|
||||
super.viewSafeAreaInsetsDidChange()
|
||||
}
|
||||
super.viewSafeAreaInsetsDidChange()
|
||||
messageCollectionViewBottomInset = requiredInitialScrollViewBottomInset()
|
||||
}
|
||||
|
||||
@@ -153,8 +150,8 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
|
||||
|
||||
private func setupDefaults() {
|
||||
extendedLayoutIncludesOpaqueBars = true
|
||||
automaticallyAdjustsScrollViewInsets = false
|
||||
view.backgroundColor = .backgroundColor
|
||||
messagesCollectionView.contentInsetAdjustmentBehavior = .never
|
||||
messagesCollectionView.keyboardDismissMode = .interactive
|
||||
messagesCollectionView.alwaysBounceVertical = true
|
||||
messagesCollectionView.backgroundColor = .backgroundColor
|
||||
@@ -172,17 +169,11 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
|
||||
private func setupConstraints() {
|
||||
messagesCollectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
let top = messagesCollectionView.topAnchor.constraint(equalTo: view.topAnchor, constant: topLayoutGuide.length)
|
||||
let top = messagesCollectionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor)
|
||||
let bottom = messagesCollectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||
if #available(iOS 11.0, *) {
|
||||
let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor)
|
||||
let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
|
||||
NSLayoutConstraint.activate([top, bottom, trailing, leading])
|
||||
} else {
|
||||
let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor)
|
||||
let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
|
||||
NSLayoutConstraint.activate([top, bottom, trailing, leading])
|
||||
}
|
||||
let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor)
|
||||
let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
|
||||
NSLayoutConstraint.activate([top, bottom, trailing, leading])
|
||||
}
|
||||
|
||||
// MARK: - Typing Indicator API
|
||||
|
||||
@@ -65,9 +65,6 @@ internal extension UIColor {
|
||||
return UIColor(red: 15/255, green: 135/255, blue: 255/255, alpha: 1.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal extension UIColor {
|
||||
|
||||
static var backgroundColor: UIColor {
|
||||
if #available(iOS 13, *) {
|
||||
|
||||