Skip to content

Commit

Permalink
Version 3.33.0
Browse files Browse the repository at this point in the history
  • Loading branch information
webim committed Oct 28, 2020
1 parent 5bfc15e commit 094298a
Show file tree
Hide file tree
Showing 153 changed files with 10,117 additions and 2,319 deletions.
9 changes: 4 additions & 5 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :ios, '9.0'
platform :ios, '10.0'

use_frameworks!

Expand All @@ -12,16 +12,15 @@ target 'WebimClientLibrary_Example' do
pod 'SlackTextViewController', :inhibit_warnings => true
pod 'SnapKit', :inhibit_warnings => true
pod 'SQLite.swift', '0.12.2', :inhibit_warnings => true # WebimClientLibrary dependency – added to inhibit its warnings.
pod 'PopupDialog', '~> 1.0', :inhibit_warnings => true


pod 'Nuke', '~> 8.0'

target 'WebimClientLibrary_Tests' do
inherit! :search_paths
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'WebimClientLibrary' || target.name == 'SQLite.swift' || target.name == 'Cosmos'
if target.name == 'WebimClientLibrary' || target.name == 'SQLite.swift' || target.name == 'Cosmos' || target.name == 'Nuke'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
end
Expand Down
24 changes: 10 additions & 14 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ PODS:
- Cosmos (19.0.3)
- Crashlytics (3.14.0):
- Fabric (~> 1.10.2)
- DynamicBlurView (3.0.1)
- Fabric (1.10.2)
- PopupDialog (1.0.0):
- DynamicBlurView (~> 3.0.1)
- Nuke (8.4.1)
- SlackTextViewController (1.9.6)
- SnapKit (4.2.0)
- SnapKit (5.0.1)
- SQLite.swift (0.12.2):
- SQLite.swift/standard (= 0.12.2)
- SQLite.swift/standard (0.12.2)
- WebimClientLibrary (3.32.0):
- WebimClientLibrary (3.33.0):
- SQLite.swift (= 0.12.2)

DEPENDENCIES:
- Cosmos (~> 19.0.3)
- Crashlytics
- Fabric
- PopupDialog (~> 1.0)
- Nuke (~> 8.0)
- SlackTextViewController
- SnapKit
- SQLite.swift (= 0.12.2)
Expand All @@ -28,9 +26,8 @@ SPEC REPOS:
trunk:
- Cosmos
- Crashlytics
- DynamicBlurView
- Fabric
- PopupDialog
- Nuke
- SlackTextViewController
- SnapKit
- SQLite.swift
Expand All @@ -42,14 +39,13 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Cosmos: a6fb17284281fa12cf4c85c2efecd440a215ec44
Crashlytics: 9220f5bc89e7a618df411b4f639389dbfb0e03d2
DynamicBlurView: b1df5415f9bd31897549e5d7077e5ec120a4d636
Fabric: ea977e3cd9c20425516d3dafd3bf8c941c51223f
PopupDialog: 28f29a1ffe9e1fab32fb258b53d56ca31670e8a2
Nuke: d780e3507a86b86c589ab3cc5cd302d5456f06fb
SlackTextViewController: b854e62c1c156336bc4fd409c6ca79b5773e8f9d
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
SQLite.swift: d2b4642190917051ce6bd1d49aab565fe794eea3
WebimClientLibrary: 59d371e8c3cf13a977f56add0bfc27769f2702d0
WebimClientLibrary: b1b5df11fa7bf8abd4aaef5d407e57d838413c29

PODFILE CHECKSUM: 6e32648b7078df57752b6b95cd2aa7128e22c8b5
PODFILE CHECKSUM: 855d312996046cd3434fca3a4cba56d96623a531

COCOAPODS: 1.9.3
COCOAPODS: 1.10.0
3 changes: 2 additions & 1 deletion Example/Tests/AbstractRequestLoopTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import XCTest
class AbstractRequestLoopTests: XCTestCase {

// MARK: - Properties
private let abstractRequestLoop = AbstractRequestLoopForTests()
private let abstractRequestLoop = AbstractRequestLoopForTests(completionHandlerExecutor: nil,
internalErrorListener: nil)

// MARK: - Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,35 @@ import XCTest
@testable import WebimClientLibrary
@testable import WebimClientLibrary_Example

class ChatViewControllerTests: XCTestCase {
class ChatTableViewControllerTests: XCTestCase {

// MARK: - Properties
var chatViewController: ChatViewController!
var chatTableViewController: ChatTableViewController!

// MARK: - Methods
override func setUp() {
super.setUp()

let storyboard = UIStoryboard(name: "Main",
bundle: nil)
chatViewController = storyboard.instantiateViewController(withIdentifier: "ChatViewController") as? ChatViewController
chatTableViewController = storyboard.instantiateViewController(withIdentifier: "ChatTableViewController") as? ChatTableViewController

}

// MARK: - Tests

func testBackgroundViewNotEmpty() {
func testBackgroundViewEmpty() {
// When: Table view is empty.
let tableView = chatViewController.tableView!
let tableView = chatTableViewController.tableView!
tableView.reloadData()

// Then: Table view background has the message.
let label = tableView.backgroundView as! UILabel
XCTAssertEqual(label.attributedText?.string,
"Send first message to start chat.")
}

func testBackgroundViewEmpty() {
func testBackgroundViewNotEmpty() {
// MARK: Set up
var messages = [Message]()
for index in 0 ... 2 {
Expand All @@ -68,25 +69,27 @@ class ChatViewControllerTests: XCTestCase {
quote: nil,
senderAvatarURLString: nil,
senderName: "Sender name",
sticker: nil,
type: .visitorMessage,
rawData: nil,
data: nil,
text: "Text",
timeInMicrosecond: Int64(index),
attachment: nil,
historyMessage: false,
internalID: nil,
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false)
messageCanBeReplied: false,
messageIsEdited: false)
messages.append(message as Message)
}

// When: Table view is not empty.
chatViewController.set(messages: messages)
chatViewController.tableView?.reloadData()
chatTableViewController.set(messages: messages)
chatTableViewController.tableView?.reloadData()

// Then: Table view background view is empty.
XCTAssertNil(chatViewController.tableView!.backgroundView)
XCTAssertNil(chatTableViewController.tableView!.backgroundView)
}
}
8 changes: 5 additions & 3 deletions Example/Tests/MemoryHistoryStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ class MemoryHistoryStorageTests: XCTestCase {
quote: nil,
senderAvatarURLString: nil,
senderName: "Name",
type: MessageType.operatorMessage,
sticker: nil,
type: .operatorMessage,
rawData: nil,
data: nil,
text: "Text",
timeInMicrosecond: Int64(index),
attachment: nil,
historyMessage: true,
internalID: String(index),
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false))
messageCanBeReplied: false,
messageIsEdited: false))
}

return messages
Expand Down
44 changes: 28 additions & 16 deletions Example/Tests/MessageHolderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ class MessageHolderTests: XCTestCase {
quote: nil,
senderAvatarURLString: MessageImplMockData.avatarURLString.rawValue,
senderName: MessageImplMockData.senderName.rawValue,
sticker: nil,
type: MessageType.operatorMessage,
rawData: nil,
data: nil,
text: MessageImplMockData.text.rawValue,
timeInMicrosecond: Int64(index),
attachment: nil,
historyMessage: true,
internalID: String(index),
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false))
messageCanBeReplied: false,
messageIsEdited: false))
}

messagesCount = messagesCount + numberOfMessages
Expand All @@ -93,17 +95,19 @@ class MessageHolderTests: XCTestCase {
quote: nil,
senderAvatarURLString: MessageImplMockData.avatarURLString.rawValue,
senderName: MessageImplMockData.senderName.rawValue,
sticker: nil,
type: MessageType.operatorMessage,
rawData: nil,
data: nil,
text: MessageImplMockData.text.rawValue,
timeInMicrosecond: Int64(index),
attachment: nil,
historyMessage: false,
internalID: String(index),
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false))
messageCanBeReplied: false,
messageIsEdited: false))
}

messagesCount = messagesCount + numberOfMessages
Expand All @@ -123,17 +127,19 @@ class MessageHolderTests: XCTestCase {
quote: nil,
senderAvatarURLString: message.getSenderAvatarURLString(),
senderName: message.getSenderName(),
sticker: nil,
type: message.getType(),
rawData: nil,
data: message.getData(),
text: message.getText(),
timeInMicrosecond: message.getTimeInMicrosecond(),
attachment: message.getAttachment(),
historyMessage: true,
internalID: String(message.getTimeInMicrosecond()),
rawText: message.getRawText(),
read: message.getRead(),
messageCanBeEdited: message.canBeEdited(),
messageCanBeReplied: false)
messageCanBeReplied: false,
messageIsEdited: false)
result.append(newMessage)
}

Expand All @@ -151,17 +157,19 @@ class MessageHolderTests: XCTestCase {
quote: nil,
senderAvatarURLString: MessageImplMockData.avatarURLString.rawValue,
senderName: MessageImplMockData.senderName.rawValue,
sticker: nil,
type: MessageType.operatorMessage,
rawData: nil,
data: nil,
text: MessageImplMockData.text.rawValue,
timeInMicrosecond: Int64(messagesCount),
attachment: nil,
historyMessage: false,
internalID: String(messagesCount),
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false)
messageCanBeReplied: false,
messageIsEdited: false)
}

private func newEdited(currentChatMessage: MessageImpl) -> MessageImpl {
Expand All @@ -173,17 +181,19 @@ class MessageHolderTests: XCTestCase {
quote: nil,
senderAvatarURLString: currentChatMessage.getSenderAvatarURLString(),
senderName: currentChatMessage.getSenderName(),
sticker: nil,
type: currentChatMessage.getType(),
rawData: nil,
data: nil,
text: (currentChatMessage.getText() + " One more thing."),
timeInMicrosecond: currentChatMessage.getTimeInMicrosecond(),
attachment: nil,
historyMessage: false,
internalID: currentChatMessage.getCurrentChatID(),
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false)
messageCanBeReplied: false,
messageIsEdited: false)
}

private func newEdited(historyMessage: MessageImpl) -> MessageImpl {
Expand All @@ -195,17 +205,19 @@ class MessageHolderTests: XCTestCase {
quote: nil,
senderAvatarURLString: historyMessage.getSenderAvatarURLString(),
senderName: historyMessage.getSenderName(),
sticker: nil,
type: historyMessage.getType(),
rawData: nil,
data: nil,
text: (historyMessage.getText() + " One more thing."),
timeInMicrosecond: historyMessage.getTimeInMicrosecond(),
attachment: nil,
historyMessage: true,
internalID: historyMessage.getHistoryID()?.getDBid(),
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false)
messageCanBeReplied: false,
messageIsEdited: false)
}

private func newMessageHolder(withHistory history: [MessageImpl] = [MessageImpl]()) -> MessageHolder {
Expand Down Expand Up @@ -414,9 +426,9 @@ class MessageHolderTests: XCTestCase {
try messageTracker.getNextMessages(byLimit: 100) { messages in
completionHandlerMessages = messages as? [MessageImpl]
}
// Then: No messages should be received and no history requests should be performed.
// Then: after emptying the history will be made a one more request.
XCTAssertEqual(completionHandlerMessages!, [MessageImpl]())
XCTAssertEqual((messageHolder.getRemoteHistoryProvider() as! RemoteHistoryProviderForTests).numberOfCalls, 1)
XCTAssertEqual((messageHolder.getRemoteHistoryProvider() as! RemoteHistoryProviderForTests).numberOfCalls, 2)

// MARK: Test 4
// When: Resetting 15 messages back and requesting for all messages.
Expand All @@ -426,7 +438,7 @@ class MessageHolderTests: XCTestCase {
}
// Then: 15 messages should be received and no history requests should be preformed.
XCTAssertEqual(completionHandlerMessages!, (history1 + Array(history2[0 ... 4])))
XCTAssertEqual((messageHolder.getRemoteHistoryProvider() as! RemoteHistoryProviderForTests).numberOfCalls, 1)
XCTAssertEqual((messageHolder.getRemoteHistoryProvider() as! RemoteHistoryProviderForTests).numberOfCalls, 2)
}

func testInsertMessagesBetweenOlderHistoryAndCurrentChat() throws {
Expand Down Expand Up @@ -621,7 +633,7 @@ class MessageHolderTests: XCTestCase {
completionHandlerMessages = messages as? [MessageImpl]
}
// Then: Completion handlers should be called first on received history messages.
XCTAssertEqual(completionHandlerMessages!, history1)
XCTAssertEqual(completionHandlerMessages!, Array(history2[5 ... 9]))
}

func testRequestAsManyMessagesAsReceivedWithHistoryForCurrentChat() throws {
Expand Down
Loading

0 comments on commit 094298a

Please sign in to comment.