Skip to content

Commit

Permalink
Version 3.42.0
Browse files Browse the repository at this point in the history
  • Loading branch information
webim committed Oct 17, 2024
1 parent c71efad commit e75ceda
Show file tree
Hide file tree
Showing 100 changed files with 1,647 additions and 582 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "stephencelis/SQLite.swift" == 0.13.3
github "stephencelis/SQLite.swift" == 0.15.0
8 changes: 4 additions & 4 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
platform :ios, '11.0'
platform :ios, '13.0'
workspace 'WebimMobileSDK'
use_frameworks!

install! 'cocoapods', :deterministic_uuids => false

target 'WebimMobileSDK_Example' do
pod 'WebimMobileSDK'
pod 'WebimMobileWidget', '1.2.1'
pod 'WebimMobileWidget', '1.2.4'
pod 'WebimKeyboard', '1.0.2'

pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'

Expand All @@ -26,7 +26,7 @@ target 'WebimMobileSDK_Example' do
installer.pods_project.targets.each do |target|

target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['SWIFT_VERSION'] = '5.0'
end

Expand Down
1 change: 0 additions & 1 deletion Example/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<false/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict/>
</array>
</dict>
</plist>
4 changes: 3 additions & 1 deletion Example/Tests/AbstractRequestLoopTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class AbstractRequestLoopTests: XCTestCase {

// MARK: - Properties
private let abstractRequestLoop = AbstractRequestLoopForTests(completionHandlerExecutor: nil,
internalErrorListener: nil)
internalErrorListener: nil,
requestHeader: nil,
baseURL: MessageImplMockData.serverURLString.rawValue)

private let webimServerSideSettingsResponse = """
webimApplyServerSideSettings({
Expand Down
4 changes: 3 additions & 1 deletion Example/Tests/ActionRequestLoopTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class ActionRequestLoopTests: XCTestCase {
// MARK: - Properties
private let actionRequestLoop = ActionRequestLoopForTests(completionHandlerExecutor: ExecIfNotDestroyedHandlerExecutor(sessionDestroyer: SessionDestroyer(userDefaultsKey: ActionRequestLoopTests.userDefaultsKey),
queue: DispatchQueue.global()),
internalErrorListener: InternalErrorListenerForTests() as InternalErrorListener)
internalErrorListener: InternalErrorListenerForTests() as InternalErrorListener,
requestHeader: nil,
baseURL: MessageImplMockData.serverURLString.rawValue)

// MARK: - Tests
func testStart() {
Expand Down
57 changes: 29 additions & 28 deletions Example/Tests/DeltaCallbackTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DeltaCallbackTests: XCTestCase {
let queue = DispatchQueue.main
let execIfNotDestroyedHandlerExecutor = ExecIfNotDestroyedHandlerExecutor(sessionDestroyer: sessionDestroyer, queue: queue)
let listener = InternalErrorListenerForTests()
actionRequestLoop = ActionRequestLoopForTests(completionHandlerExecutor: execIfNotDestroyedHandlerExecutor, internalErrorListener: listener)
actionRequestLoop = ActionRequestLoopForTests(completionHandlerExecutor: execIfNotDestroyedHandlerExecutor, internalErrorListener: listener, requestHeader: nil, baseURL: MessageImplMockData.serverURLString.rawValue)
let currentChatMessageMapper = CurrentChatMessageMapper(withServerURLString: serverURLString)
let sendingFactory = SendingFactory(withServerURLString: serverURLString)
let operatorFactory = OperatorFactory(withServerURLString: serverURLString)
Expand All @@ -64,8 +64,7 @@ class DeltaCallbackTests: XCTestCase {
let memHistoryMetaInfo = MemoryHistoryMetaInformationStorage()
let locationSettingsHolder = LocationSettingsHolder(userDefaultsKey: locationSettingsHolderUserDefaultsKey)

webimActions = WebimActionsImpl(baseURL: serverURLString,
actionRequestLoop: actionRequestLoop)
webimActions = WebimActionsImpl(actionRequestLoop: actionRequestLoop)

let messageComposingHandler = MessageComposingHandler(webimActions: webimActions!, queue: queue)
let remoteHistoryProvider = RemoteHistoryProvider(webimActions: webimActions!,
Expand All @@ -77,6 +76,7 @@ class DeltaCallbackTests: XCTestCase {
reachedEndOfRemoteHistory: true)

messageStream = MessageStreamImpl(serverURLString: serverURLString,
location: "mobile",
currentChatMessageFactoriesMapper: currentChatMessageMapper,
sendingMessageFactory: sendingFactory,
operatorFactory: operatorFactory,
Expand Down Expand Up @@ -622,31 +622,32 @@ class MessageMapperForTests: MessageMapper {

override func map(message: MessageItem) -> MessageImpl? {
return MessageImpl(serverURLString: "Some",
clientSideID: "Some",
serverSideID: nil,
keyboard: nil,
keyboardRequest: nil,
operatorID: nil,
quote: nil,
senderAvatarURLString: "Some",
senderName: "Some",
sendStatus: .sent,
sticker: nil,
type: .visitorMessage,
rawData: nil,
data: nil,
text: "Some",
timeInMicrosecond: 12,
historyMessage: false,
internalID: nil,
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false,
messageIsEdited: false,
visitorReactionInfo: nil,
visitorCanReact: nil,
visitorChangeReaction: nil)
clientSideID: "Some",
serverSideID: nil,
keyboard: nil,
keyboardRequest: nil,
operatorID: nil,
quote: nil,
senderAvatarURLString: "Some",
senderName: "Some",
sendStatus: .sent,
sticker: nil,
type: .visitorMessage,
rawData: nil,
data: nil,
text: "Some",
timeInMicrosecond: 12,
historyMessage: false,
internalID: nil,
rawText: nil,
read: false,
messageCanBeEdited: false,
messageCanBeReplied: false,
messageIsEdited: false,
visitorReactionInfo: nil,
visitorCanReact: nil,
visitorChangeReaction: nil,
group: nil)
}
}

Expand Down
8 changes: 5 additions & 3 deletions Example/Tests/DeltaRequestLoopTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class DeltaRequestLoopTests: XCTestCase {
visitorJSONString: nil,
sessionID: nil,
prechat: nil,
authorizationData: nil)
authorizationData: nil,
requestHeader: nil)
}

override func tearDown() {
Expand Down Expand Up @@ -104,7 +105,7 @@ class DeltaRequestLoopTests: XCTestCase {

XCTAssertNil(deltaRequestLoop?.getAuthorizationData())
XCTAssertEqual(deltaRequestLoop!.since,
0)
"0")
XCTAssertTrue(deltaRequestLoop!.initializationRunned)
}

Expand All @@ -113,7 +114,8 @@ class DeltaRequestLoopTests: XCTestCase {

// When: DeltaRequestLoop started without AuthorizationData.
deltaRequestLoop?.start()
usleep(1_000_000)
deltaRequestLoop?.resume()
usleep(5_000_000)

// Then: Initialization should be requested, but delta should not.
XCTAssertNil(deltaRequestLoop?.getAuthorizationData())
Expand Down
4 changes: 2 additions & 2 deletions Example/Tests/DeltaResponseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DeltaResponseTests: XCTestCase {
// MARK: - Constants
private static let DELTA_RESPONSE_JSON_STRING = """
{
"revision" : 12,
"revision" : "12",
"deltaList" : [
{
"id" : "80a332f6fced40f290a5e8ace4a6d11c",
Expand Down Expand Up @@ -76,7 +76,7 @@ class DeltaResponseTests: XCTestCase {
let deltaResponseItem = DeltaResponse(jsonDictionary: deltaResponseDictionary)

XCTAssertEqual(deltaResponseItem.getRevision(),
12)
"12")
XCTAssertNil(deltaResponseItem.getFullUpdate())
XCTAssertEqual(deltaResponseItem.getDeltaList()!.count,
3)
Expand Down
6 changes: 4 additions & 2 deletions Example/Tests/ExampleTests/ChatTableViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ import UIKit
import XCTest
@testable import WebimMobileSDK
@testable import WebimMobileSDK_Example
@testable import WebimMobileWidget

class ChatViewControllerTests: XCTestCase {

// MARK: - Properties
var chatTableViewController = ChatViewController.loadViewControllerFromXib()
var chatTableViewController = ChatViewController()

// MARK: - Methods
override func setUp() {
Expand Down Expand Up @@ -68,7 +69,8 @@ class ChatViewControllerTests: XCTestCase {
messageIsEdited: false,
visitorReactionInfo: nil,
visitorCanReact: nil,
visitorChangeReaction: nil)
visitorChangeReaction: nil,
group: nil)
messages.append(message as Message)
}

Expand Down
6 changes: 3 additions & 3 deletions Example/Tests/FAQActionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FAQActionsTests: XCTestCase {

let faqDestroyer = FAQDestroyer()
let queue = DispatchQueue.global()
let baseURL = "https://wmtest6.webim.ru/"
let baseURL = "https://wmtest6.webim.ru"
var completionHandlerExecutor: ExecIfNotDestroyedFAQHandlerExecutor!
var faqRequestLoopMock: FAQRequestLoopMock!
var sut: FAQActions!
Expand All @@ -42,8 +42,8 @@ class FAQActionsTests: XCTestCase {
override func setUp() {
super.setUp()
completionHandlerExecutor = ExecIfNotDestroyedFAQHandlerExecutor(faqDestroyer: faqDestroyer, queue: queue)
faqRequestLoopMock = FAQRequestLoopMock(completionHandlerExecutor: completionHandlerExecutor)
sut = FAQActions(baseURL: baseURL, faqRequestLoop: faqRequestLoopMock)
faqRequestLoopMock = FAQRequestLoopMock(completionHandlerExecutor: completionHandlerExecutor, baseURL: baseURL)
sut = FAQActions(faqRequestLoop: faqRequestLoopMock)
}

override func tearDown() {
Expand Down
4 changes: 2 additions & 2 deletions Example/Tests/FAQClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class FAQClientTests: XCTestCase {
let queue = DispatchQueue.global()
let completionHandlerExecutor = ExecIfNotDestroyedFAQHandlerExecutor(faqDestroyer: destroyer, queue: queue)
baseURL = "https://wmtest6.webim.ru/"
faqRequestLoop = FAQRequestLoopMock(completionHandlerExecutor: completionHandlerExecutor)
faqActions = FAQActions(baseURL: baseURL, faqRequestLoop: faqRequestLoop)
faqRequestLoop = FAQRequestLoopMock(completionHandlerExecutor: completionHandlerExecutor, baseURL: baseURL)
faqActions = FAQActions(faqRequestLoop: faqRequestLoop)


sut = FAQClient(withFAQRequestLoop: faqRequestLoop,
Expand Down
16 changes: 7 additions & 9 deletions Example/Tests/FileUrlCreatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FileUrlCreatorTests: XCTestCase {
globalQueue = DispatchQueue.global()
execIfNotDestroyedHandlerExecutor = ExecIfNotDestroyedHandlerExecutor(sessionDestroyer: sessionDestroyer, queue: globalQueue)
internalErrorListener = InternalErrorListenerForTests()
actionRequestLoop = ActionRequestLoopForTests(completionHandlerExecutor: execIfNotDestroyedHandlerExecutor, internalErrorListener: internalErrorListener)
actionRequestLoop = ActionRequestLoopForTests(completionHandlerExecutor: execIfNotDestroyedHandlerExecutor, internalErrorListener: internalErrorListener, requestHeader: nil, baseURL: MessageImplMockData.serverURLString.rawValue)
authData = AuthorizationData(pageID: expectedPageID, authorizationToken: expectedAuthorizationToken)

deltaRequestLoop = DeltaRequestLoop(
Expand All @@ -77,14 +77,13 @@ class FileUrlCreatorTests: XCTestCase {
visitorJSONString: nil,
sessionID: nil,
prechat: nil,
authorizationData: authData)
authorizationData: authData,
requestHeader: nil)

webimClient = WebimClient(
withActionRequestLoop: actionRequestLoop,
deltaRequestLoop: deltaRequestLoop,
webimActions: WebimActionsImpl(
baseURL: urlString,
actionRequestLoop: actionRequestLoop))
webimActions: WebimActionsImpl(actionRequestLoop: actionRequestLoop))
}

override func tearDown() {
Expand Down Expand Up @@ -157,14 +156,13 @@ class FileUrlCreatorTests: XCTestCase {
visitorJSONString: nil,
sessionID: nil,
prechat: nil,
authorizationData: nil)
authorizationData: nil,
requestHeader: nil)

webimClient = WebimClient(
withActionRequestLoop: actionRequestLoop,
deltaRequestLoop: deltaRequestLoop,
webimActions: WebimActionsImpl(
baseURL: urlString,
actionRequestLoop: actionRequestLoop))
webimActions: WebimActionsImpl(actionRequestLoop: actionRequestLoop))

let sut = FileUrlCreator(webimClient: webimClient, serverURL: urlString)

Expand Down
4 changes: 2 additions & 2 deletions Example/Tests/FullUpdateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class FullUpdateTests: XCTestCase {
],
"offline" : false,
"visitorMessageDraft" : null,
"id" : "5123124",
"id" : 5123124,
"unreadByVisitorSinceTs" : null,
"operatorIdToRate" : { },
"creationTs" : 1519040829.056129,
Expand Down Expand Up @@ -198,7 +198,7 @@ class FullUpdateTests: XCTestCase {
func testInitChat() {
let chatItemJson = """
{
"id" : "5123124",
"id" : 5123124,
"clientSideId" : "0134e9d90e0eb95884d880860382c8ab"
}
Expand Down
7 changes: 4 additions & 3 deletions Example/Tests/HistoryPollerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ class HistoryPollerTests: XCTestCase {
let executor = ExecIfNotDestroyedHandlerExecutor(sessionDestroyer: sessionDestroyer, queue: queue)
let internalErrorListener = InternalErrorListenerForTests()
actionRequestLoop = ActionRequestLoopForTests(completionHandlerExecutor: executor,
internalErrorListener: internalErrorListener)
internalErrorListener: internalErrorListener,
requestHeader: nil,
baseURL: MessageImplMockData.serverURLString.rawValue)
let accessChecker = AccessChecker(thread: Thread.current, sessionDestroyer: sessionDestroyer)

let webimActions = WebimActionsImpl(baseURL: serverURLString,
actionRequestLoop: actionRequestLoop)
let webimActions = WebimActionsImpl(actionRequestLoop: actionRequestLoop)
let remoteHistoryProvider = RemoteHistoryProviderMock(withWebimActions: webimActions,
historyMessageMapper: HistoryMessageMapper(withServerURLString: MessageImplMockData.serverURLString.rawValue),
historyMetaInformation: MemoryHistoryMetaInformationStorage(),
Expand Down
2 changes: 1 addition & 1 deletion Example/Tests/InternalUtilsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class InternalUtilsTests: XCTestCase {
func test_GetCurrentTimeInMicrosecond() {
let expectedTime = Int64(Date().timeIntervalSince1970 * 1_000_000)

XCTAssertEqual(InternalUtils.getCurrentTimeInMicrosecond(), expectedTime, accuracy: 10)
XCTAssertEqual(InternalUtils.getCurrentTimeInMicrosecond(), expectedTime, accuracy: 100)
}

func test_ParseRemoteNotification_EmptyValue() {
Expand Down
16 changes: 8 additions & 8 deletions Example/Tests/KeyboardItemTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ class ConfigurationItemTests: XCTestCase {

let sut = ConfigurationItem(jsonDictionary: convertToDict(nullIsActiveJson))

XCTAssertNil(sut)
XCTAssertNil(sut.isActive())
}

func test_Init_DataLink() {
Expand All @@ -497,8 +497,8 @@ class ConfigurationItemTests: XCTestCase {

let sut = ConfigurationItem(jsonDictionary: convertToDict(nullDataJson))

XCTAssertEqual(sut?.getData(), expectedData)
XCTAssertEqual(sut?.getButtonType(), expectedType)
XCTAssertEqual(sut.getData(), expectedData)
XCTAssertEqual(sut.getButtonType(), expectedType)
}

func test_Init_DataNullLinkValue() {
Expand All @@ -512,7 +512,7 @@ class ConfigurationItemTests: XCTestCase {

let sut = ConfigurationItem(jsonDictionary: convertToDict(nullIsDataJson))

XCTAssertNil(sut)
XCTAssertNil(sut.getButtonType())
}

func test_Init_DataNullTextValue() {
Expand All @@ -526,7 +526,7 @@ class ConfigurationItemTests: XCTestCase {

let sut = ConfigurationItem(jsonDictionary: convertToDict(nullDataJson))

XCTAssertNil(sut)
XCTAssertNil(sut.getButtonType())
}

func test_Init_StateShowing() {
Expand All @@ -547,7 +547,7 @@ class ConfigurationItemTests: XCTestCase {

let sut = ConfigurationItem(jsonDictionary: convertToDict(showingSelectedStateJson))

XCTAssertEqual(sut?.getState(), expectedValue)
XCTAssertEqual(sut.getState(), expectedValue)
}

func test_Init_StateWrongValue() {
Expand All @@ -562,7 +562,7 @@ class ConfigurationItemTests: XCTestCase {

let sut = ConfigurationItem(jsonDictionary: convertToDict(wrongStateJson))

XCTAssertEqual(sut?.getState(), expectedValue)
XCTAssertEqual(sut.getState(), expectedValue)
}

func test_Init_StateNullValue() {
Expand All @@ -576,7 +576,7 @@ class ConfigurationItemTests: XCTestCase {

let sut = ConfigurationItem(jsonDictionary: convertToDict(nullStateJson))

XCTAssertNil(sut)
XCTAssertNil(sut.getState())
}
}

Expand Down
Loading

0 comments on commit e75ceda

Please sign in to comment.