From c496d4b0ccfe505e72c67601f79a60c61486bbfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D1=80=D0=BE=D1=82=D0=BA=D0=B8=D0=BD=20=D0=9D?= =?UTF-8?q?=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Tue, 18 May 2021 12:21:15 +0300 Subject: [PATCH] update native webim --- README.md | 2 +- ios/Department.swift | 10 +- ios/FatalErrorHandler.swift | 0 ios/Message.swift | 49 ++--- ios/MessageListener.swift | 0 ios/MessageStream.swift | 168 ++++++++++-------- ios/MessageTracker.swift | 4 +- ios/ObjectiveCExample-Bridging-Header.h | 4 + ios/Operator.swift | 0 ...videdAuthorizationTokenStateListener.swift | 0 ios/RNWebim.m | 4 +- ios/Webim.swift | 19 +- ios/WebimError.swift | 10 +- ios/WebimLogger.swift | 0 ios/WebimRemoteNotification.swift | 14 +- ios/WebimSession.swift | 26 +-- 16 files changed, 165 insertions(+), 145 deletions(-) mode change 100755 => 100644 ios/Department.swift mode change 100755 => 100644 ios/FatalErrorHandler.swift mode change 100755 => 100644 ios/Message.swift mode change 100755 => 100644 ios/MessageListener.swift mode change 100755 => 100644 ios/MessageStream.swift mode change 100755 => 100644 ios/MessageTracker.swift create mode 100644 ios/ObjectiveCExample-Bridging-Header.h mode change 100755 => 100644 ios/Operator.swift mode change 100755 => 100644 ios/ProvidedAuthorizationTokenStateListener.swift mode change 100755 => 100644 ios/Webim.swift mode change 100755 => 100644 ios/WebimError.swift mode change 100755 => 100644 ios/WebimLogger.swift mode change 100755 => 100644 ios/WebimRemoteNotification.swift mode change 100755 => 100644 ios/WebimSession.swift diff --git a/README.md b/README.md index 8a7151f..3552c31 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ iOS - add to PodFile ``` use_frameworks! - pod 'WebimClientLibrary', :git => 'https://github.com/webim/webim-client-sdk-ios.git', :tag => '3.29.0' + pod 'WebimClientLibrary', :git => 'https://github.com/webim/webim-client-sdk-ios.git', :tag => '3.34.4' ``` - pod install diff --git a/ios/Department.swift b/ios/Department.swift old mode 100755 new mode 100644 index 5c4edfb..7783a61 --- a/ios/Department.swift +++ b/ios/Department.swift @@ -57,15 +57,15 @@ public final class _ObjCDepartment: NSObject { @objc(getDepartmentOnlineStatus) func getDepartmentOnlineStatus() -> _ObjCDepartmentOnlineStatus { switch department.getDepartmentOnlineStatus() { - case .BUSY_OFFLINE: + case .busyOffline: return .BUSY_OFFLINE - case .BUSY_ONLINE: + case .busyOnline: return .BUSY_ONLINE - case .OFFLINE: + case .offline: return .OFFLINE - case .ONLINE: + case .online: return .ONLINE - case .UNKNOWN: + case .unknown: return .UNKNOWN } } diff --git a/ios/FatalErrorHandler.swift b/ios/FatalErrorHandler.swift old mode 100755 new mode 100644 diff --git a/ios/Message.swift b/ios/Message.swift old mode 100755 new mode 100644 index 8b1884e..54a6024 --- a/ios/Message.swift +++ b/ios/Message.swift @@ -46,7 +46,7 @@ public final class _ObjCMessage: NSObject { @objc(getAttachment) public func getAttachment() -> _ObjCMessageAttachment? { - if let attachment = message.getAttachment() { + if let attachment = message.getData()?.getAttachment() { return _ObjCMessageAttachment(messageAttachment: attachment) } @@ -55,7 +55,7 @@ public final class _ObjCMessage: NSObject { @objc(getData) public func getData() -> [String: Any]? { - if let data = message.getData() { + if let data = message.getRawData() { var objCData = [String: Any]() for key in data.keys { if let value = data[key] { @@ -92,9 +92,9 @@ public final class _ObjCMessage: NSObject { @objc(getSendStatus) public func getSendStatus() -> _ObjCMessageSendStatus { switch message.getSendStatus() { - case .SENDING: + case .sending: return .SENDING - case .SENT: + case .sent: return .SENT } } @@ -112,26 +112,28 @@ public final class _ObjCMessage: NSObject { @objc(getType) public func getType() -> _ObjCMessageType { switch message.getType() { - case .ACTION_REQUEST: + case .actionRequest: return .ACTION_REQUEST - case .CONTACTS_REQUEST: + case .contactInformationRequest: return .CONTACTS_REQUEST - case .FILE_FROM_OPERATOR: + case .fileFromOperator: return .FILE_FROM_OPERATOR - case .FILE_FROM_VISITOR: + case .fileFromVisitor: return .FILE_FROM_VISITOR - case .INFO: + case .info: return .INFO - case .OPERATOR: + case .operatorMessage: return .OPERATOR - case .OPERATOR_BUSY: + case .operatorBusy: return .OPERATOR_BUSY - case .VISITOR: + case .visitorMessage: return .VISITOR - case .KEYBOARD: + case .keyboard: return .KEYBOARD - case .KEYBOARD_RESPONSE: + case .keyboardResponse: return .KEYBOARD_RESPONSE + case .stickerVisitor: + return .STICKER_VISITOR } } @@ -169,18 +171,18 @@ public final class _ObjCMessageAttachment: NSObject { // MARK: - Methods @objc(getContentType) - public func getContentType() -> String { - return messageAttachment.getContentType() + public func getContentType() -> String? { + return messageAttachment.getFileInfo().getContentType() } @objc(getFileName) public func getFileName() -> String { - return messageAttachment.getFileName() + return messageAttachment.getFileInfo().getFileName() } @objc(getImageInfo) public func getImageInfo() -> _ObjCImageInfo? { - if let imageInfo = messageAttachment.getImageInfo() { + if let imageInfo = messageAttachment.getFileInfo().getImageInfo() { return _ObjCImageInfo(imageInfo: imageInfo) } @@ -189,12 +191,12 @@ public final class _ObjCMessageAttachment: NSObject { @objc(getSize) public func getSize() -> NSNumber? { - return messageAttachment.getSize() as NSNumber? + return messageAttachment.getFileInfo().getSize() as NSNumber? } @objc(getURL) - public func getURL() -> URL { - return messageAttachment.getURL() + public func getURL() -> URL? { + return messageAttachment.getFileInfo().getURL() } } @@ -241,11 +243,12 @@ public enum _ObjCMessageType: Int { case FILE_FROM_OPERATOR case FILE_FROM_VISITOR case INFO + case KEYBOARD + case KEYBOARD_RESPONSE case OPERATOR case OPERATOR_BUSY case VISITOR - case KEYBOARD - case KEYBOARD_RESPONSE + case STICKER_VISITOR } // MARK: - MessageSendStatus diff --git a/ios/MessageListener.swift b/ios/MessageListener.swift old mode 100755 new mode 100644 diff --git a/ios/MessageStream.swift b/ios/MessageStream.swift old mode 100755 new mode 100644 index 4380790..03bf5ff --- a/ios/MessageStream.swift +++ b/ios/MessageStream.swift @@ -63,17 +63,17 @@ public final class _ObjCMessageStream: NSObject { @objc(getVisitSessionState) public func getVisitSessionState() -> _ObjCVisitSessionState { switch messageStream.getVisitSessionState() { - case .CHAT: + case .chat: return .CHAT - case .DEPARTMENT_SELECTION: + case .departmentSelection: return .DEPARTMENT_SELECTION - case .IDLE: + case .idle: return .IDLE - case .IDLE_AFTER_CHAT: + case .idleAfterChat: return .IDLE_AFTER_CHAT - case .OFFLINE_MESSAGE: + case .offlineMessage: return .OFFLINE_MESSAGE - case .UNKNOWN: + case .unknown: return .UNKNOWN } } @@ -81,19 +81,19 @@ public final class _ObjCMessageStream: NSObject { @objc(getChatState) public func getChatState() -> _ObjCChatState { switch messageStream.getChatState() { - case .CHATTING: + case .chatting: return .CHATTING - case .CHATTING_WITH_ROBOT: + case .chattingWithRobot: return .CHATTING_WITH_ROBOT - case .CLOSED_BY_OPERATOR: + case .closedByOperator: return .CLOSED_BY_OPERATOR - case .CLOSED_BY_VISITOR: + case .closedByVisitor: return .CLOSED_BY_VISITOR - case .INVITATION: + case .invitation: return .INVITATION - case .NONE: - return .NONE - case .QUEUE: + case .closed: + return .CLOSED + case .queue: return .QUEUE default: return .UNKNOWN @@ -555,7 +555,7 @@ public enum _ObjCChatState: Int { case CLOSED_BY_OPERATOR case CLOSED_BY_VISITOR case INVITATION - case NONE + case CLOSED case QUEUE case UNKNOWN } @@ -619,6 +619,9 @@ public enum _ObjCSendFileError: Int, Error { case FILE_TYPE_NOT_ALLOWED case UPLOADED_FILE_NOT_FOUND case UNKNOWN + case FILE_SIZE_TOO_SMALL + case MAX_FILES_COUNT_PER_CHAT_EXCEEDED + case UNATHORIZED } // MARK: - RateOperatorError @@ -626,6 +629,7 @@ public enum _ObjCSendFileError: Int, Error { public enum _ObjCRateOperatorError: Int, Error { case NO_CHAT case WRONG_OPERATOR_ID + case NOTE_IS_TOO_LONG } @@ -654,17 +658,17 @@ fileprivate final class DataMessageCompletionHandlerWrapper: DataMessageCompleti func onFailure(messageID: String, error: DataMessageError) { var objCError: _ObjCDataMessageError? switch error { - case .QUOTED_MESSAGE_CANNOT_BE_REPLIED: + case .quotedMessageCanNotBeReplied: objCError = .QUOTED_MESSAGE_CANNOT_BE_REPLIED - case .QUOTED_MESSAGE_FROM_ANOTHER_VISITOR: + case .quotedMessageFromAnotherVisitor: objCError = .QUOTED_MESSAGE_FROM_ANOTHER_VISITOR - case .QUOTED_MESSAGE_MULTIPLE_IDS: + case .quotedMessageMultipleIds: objCError = .QUOTED_MESSAGE_MULTIPLE_IDS - case .QUOTED_MESSAGE_REQUIRED_ARGUMENTS_MISSING: + case .quotedMessageRequiredArgumentsMissing: objCError = .QUOTED_MESSAGE_REQUIRED_ARGUMENTS_MISSING - case .QUOTED_MESSAGE_WRONG_ID: + case .quotedMessageWrongId: objCError = .QUOTED_MESSAGE_WRONG_ID - case .UNKNOWN: + case .unknown: objCError = .UNKNOWN } @@ -697,17 +701,17 @@ fileprivate final class EditMessageCompletionHandlerWrapper: EditMessageCompleti func onFailure(messageID: String, error: EditMessageError) { var objCError: _ObjCEditMessageError? switch error { - case .NOT_ALLOWED: + case .notAllowed: objCError = .NOT_ALLOWED - case .MESSAGE_EMPTY: + case .messageEmpty: objCError = .MESSAGE_EMPTY - case .MESSAGE_NOT_OWNED: + case .messageNotOwned: objCError = .MESSAGE_NOT_OWNED - case .MAX_LENGTH_EXCEEDED: + case .maxLengthExceeded: objCError = .MAX_LENGTH_EXCEEDED - case .WRONG_MESSAGE_KIND: + case .wrongMesageKind: objCError = .WRONG_MESSAGE_KIND - case .UNKNOWN: + case .unknown: objCError = .UNKNOWN } @@ -740,13 +744,13 @@ fileprivate final class DeleteMessageCompletionHandlerWrapper: DeleteMessageComp func onFailure(messageID: String, error: DeleteMessageError) { var objCError: _ObjCDeleteMessageError? switch error { - case .UNKNOWN: + case .unknown: objCError = .UNKNOWN - case .NOT_ALLOWED: + case .notAllowed: objCError = .NOT_ALLOWED - case .MESSAGE_NOT_OWNED: + case .messageNotOwned: objCError = .MESSAGE_NOT_OWNED - case .MESSAGE_NOT_FOUND: + case .messageNotFound: objCError = .MESSAGE_NOT_FOUND } @@ -760,7 +764,7 @@ fileprivate final class DeleteMessageCompletionHandlerWrapper: DeleteMessageComp fileprivate final class SendFileCompletionHandlerWrapper: SendFileCompletionHandler { // MARK: - Properties - private var sendFileCompletionHandler: _ObjCSendFileCompletionHandler? + private weak var sendFileCompletionHandler: _ObjCSendFileCompletionHandler? // MARK: - Initialization @@ -780,14 +784,20 @@ fileprivate final class SendFileCompletionHandlerWrapper: SendFileCompletionHand error: SendFileError) { var objCError: _ObjCSendFileError? switch error { - case .FILE_SIZE_EXCEEDED: + case .fileSizeExceeded: objCError = .FILE_SIZE_EXCEEDED - case .FILE_TYPE_NOT_ALLOWED: + case .fileTypeNotAllowed: objCError = .FILE_TYPE_NOT_ALLOWED - case .UPLOADED_FILE_NOT_FOUND: + case .uploadedFileNotFound: objCError = .UPLOADED_FILE_NOT_FOUND - case .UNKNOWN: + case .unknown: objCError = .UNKNOWN + case .fileSizeTooSmall: + objCError = .FILE_SIZE_TOO_SMALL + case .maxFilesCountPerChatExceeded: + objCError = .MAX_FILES_COUNT_PER_CHAT_EXCEEDED + case .unauthorized: + objCError = .UNATHORIZED } sendFileCompletionHandler?.onFailure(messageID: messageID, @@ -819,10 +829,12 @@ fileprivate final class RateOperatorCompletionHandlerWrapper: RateOperatorComple func onFailure(error: RateOperatorError) { var objCError: _ObjCRateOperatorError? switch error { - case .NO_CHAT: + case .noChat: objCError = .NO_CHAT - case .WRONG_OPERATOR_ID: + case .wrongOperatorId: objCError = .WRONG_OPERATOR_ID + case .noteIsTooLong: + objCError = .NOTE_IS_TOO_LONG } rateOperatorCompletionHandler?.onFailure(error: objCError!) @@ -847,33 +859,33 @@ fileprivate final class VisitSessionStateListenerWrapper: VisitSessionStateListe to newState: VisitSessionState) { var previousObjCVisitSessionState: _ObjCVisitSessionState? switch previousState { - case .CHAT: + case .chat: previousObjCVisitSessionState = .CHAT - case .DEPARTMENT_SELECTION: + case .departmentSelection: previousObjCVisitSessionState = .DEPARTMENT_SELECTION - case .IDLE: + case .idle: previousObjCVisitSessionState = .IDLE - case .IDLE_AFTER_CHAT: + case .idleAfterChat: previousObjCVisitSessionState = .IDLE_AFTER_CHAT - case .OFFLINE_MESSAGE: + case .offlineMessage: previousObjCVisitSessionState = .OFFLINE_MESSAGE - case .UNKNOWN: + case .unknown: previousObjCVisitSessionState = .UNKNOWN } var newObjCVisitSessionState: _ObjCVisitSessionState? switch previousState { - case .CHAT: + case .chat: newObjCVisitSessionState = .CHAT - case .DEPARTMENT_SELECTION: + case .departmentSelection: newObjCVisitSessionState = .DEPARTMENT_SELECTION - case .IDLE: + case .idle: newObjCVisitSessionState = .IDLE - case .IDLE_AFTER_CHAT: + case .idleAfterChat: newObjCVisitSessionState = .IDLE_AFTER_CHAT - case .OFFLINE_MESSAGE: + case .offlineMessage: newObjCVisitSessionState = .OFFLINE_MESSAGE - case .UNKNOWN: + case .unknown: newObjCVisitSessionState = .UNKNOWN } @@ -900,42 +912,42 @@ fileprivate final class ChatStateListenerWrapper: ChatStateListener { to newState: ChatState) { var previousObjCChatState: _ObjCChatState? switch previousState { - case .CHATTING: + case .chatting: previousObjCChatState = .CHATTING - case .CHATTING_WITH_ROBOT: + case .chattingWithRobot: previousObjCChatState = .CHATTING_WITH_ROBOT - case .CLOSED_BY_OPERATOR: + case .closedByOperator: previousObjCChatState = .CLOSED_BY_OPERATOR - case .CLOSED_BY_VISITOR: + case .closedByVisitor: previousObjCChatState = .CLOSED_BY_VISITOR - case .INVITATION: + case .invitation: previousObjCChatState = .INVITATION - case .NONE: - previousObjCChatState = .NONE - case .QUEUE: + case .closed: + previousObjCChatState = .CLOSED + case .queue: previousObjCChatState = .QUEUE - case .UNKNOWN: + case .unknown: previousObjCChatState = .UNKNOWN } var newObjCChatState: _ObjCChatState? switch newState { - case .CHATTING: + case .chatting: newObjCChatState = .CHATTING - case .CHATTING_WITH_ROBOT: + case .chattingWithRobot: newObjCChatState = .CHATTING_WITH_ROBOT - case .CLOSED_BY_OPERATOR: + case .closedByOperator: newObjCChatState = .CLOSED_BY_OPERATOR - case .CLOSED_BY_VISITOR: + case .closedByVisitor: newObjCChatState = .CLOSED_BY_VISITOR - case .INVITATION: + case .invitation: newObjCChatState = .INVITATION - case .NONE: - newObjCChatState = .NONE - case .QUEUE: + case .queue: newObjCChatState = .QUEUE - case .UNKNOWN: + case .unknown: newObjCChatState = .UNKNOWN + case .closed: + newObjCChatState = .CLOSED } chatStateListener.changed(state: previousObjCChatState!, @@ -1047,29 +1059,29 @@ fileprivate final class OnlineStatusChangeListenerWrapper: OnlineStatusChangeLis to newOnlineStatus: OnlineStatus) { var previousObjCOnlineStatus: _ObjCOnlineStatus? switch previousOnlineStatus { - case .BUSY_OFFLINE: + case .busyOffline: previousObjCOnlineStatus = .BUSY_OFFLINE - case .BUSY_ONLINE: + case .busyOnline: previousObjCOnlineStatus = .BUSY_ONLINE - case .OFFLINE: + case .offline: previousObjCOnlineStatus = .OFFLINE - case .ONLINE: + case .online: previousObjCOnlineStatus = .ONLINE - case .UNKNOWN: + case .unknown: previousObjCOnlineStatus = .UNKNOWN } var newObjCOnlineStatus: _ObjCOnlineStatus? switch newOnlineStatus { - case .BUSY_OFFLINE: + case .busyOffline: newObjCOnlineStatus = .BUSY_OFFLINE - case .BUSY_ONLINE: + case .busyOnline: newObjCOnlineStatus = .BUSY_ONLINE - case .OFFLINE: + case .offline: newObjCOnlineStatus = .OFFLINE - case .ONLINE: + case .online: newObjCOnlineStatus = .ONLINE - case .UNKNOWN: + case .unknown: newObjCOnlineStatus = .UNKNOWN } diff --git a/ios/MessageTracker.swift b/ios/MessageTracker.swift old mode 100755 new mode 100644 index 98a945b..1101d0b --- a/ios/MessageTracker.swift +++ b/ios/MessageTracker.swift @@ -81,12 +81,12 @@ public final class _ObjCMessageTracker: NSObject { } @objc(resetToMessage:error:) - public func resetTo(message: _ObjCMessage) throws { + func resetTo(message: _ObjCMessage) throws { try messageTracker.resetTo(message: message.message) } @objc(destroy:) - public func destroy() throws { + func destroy() throws { try messageTracker.destroy() } diff --git a/ios/ObjectiveCExample-Bridging-Header.h b/ios/ObjectiveCExample-Bridging-Header.h new file mode 100644 index 0000000..1b2cb5d --- /dev/null +++ b/ios/ObjectiveCExample-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/ios/Operator.swift b/ios/Operator.swift old mode 100755 new mode 100644 diff --git a/ios/ProvidedAuthorizationTokenStateListener.swift b/ios/ProvidedAuthorizationTokenStateListener.swift old mode 100755 new mode 100644 diff --git a/ios/RNWebim.m b/ios/RNWebim.m index 3aa5c11..39bdace 100644 --- a/ios/RNWebim.m +++ b/ios/RNWebim.m @@ -389,8 +389,8 @@ - (NSDictionary*)messageToJson: (Message*) msg { -(NSMutableArray*)messagesToJsonArray: (NSArray* _Nonnull) arr { NSMutableArray* messages = [[NSMutableArray alloc] init]; for (int i = 0; i < [arr count]; ++i) { - Message* msg = [arr objectAtIndex:i]; - [messages addObject:[self messageToJson: msg]]; + Message* message = [arr objectAtIndex:i]; + [messages addObject:[self messageToJson: message]]; } return messages; } diff --git a/ios/Webim.swift b/ios/Webim.swift old mode 100755 new mode 100644 index c195e4a..b667c49 --- a/ios/Webim.swift +++ b/ios/Webim.swift @@ -28,14 +28,15 @@ import Foundation import WebimClientLibrary + // MARK: - Webim @objc(Webim) public final class _ObjCWebim: NSObject { // MARK: - Methods - @objc - public static func newSessionBuilder() -> _ObjCSessionBuilder { + @objc + public static func newSessionBuilder() -> _ObjCSessionBuilder { return _ObjCSessionBuilder(sessionBuilder: Webim.newSessionBuilder()) } @@ -159,9 +160,9 @@ public final class _ObjCSessionBuilder: NSObject { var webimRemoteNotificationSystem: Webim.RemoteNotificationSystem? switch remoteNotificationSystem { case .APNS: - webimRemoteNotificationSystem = .APNS + webimRemoteNotificationSystem = .apns default: - webimRemoteNotificationSystem = .NONE + webimRemoteNotificationSystem = Webim.RemoteNotificationSystem.none } sessionBuilder = sessionBuilder.set(remoteNotificationSystem: webimRemoteNotificationSystem!) @@ -195,15 +196,15 @@ public final class _ObjCSessionBuilder: NSObject { var internalVerbosityLevel: SessionBuilder.WebimLoggerVerbosityLevel? switch verbosityLevel { case .VERBOSE: - internalVerbosityLevel = .VERBOSE + internalVerbosityLevel = .verbose case .DEBUG: - internalVerbosityLevel = .DEBUG + internalVerbosityLevel = .debug case .INFO: - internalVerbosityLevel = .INFO + internalVerbosityLevel = .info case .WARNING: - internalVerbosityLevel = .WARNING + internalVerbosityLevel = .warning case .ERROR: - internalVerbosityLevel = .ERROR + internalVerbosityLevel = .error } let wrapper = WebimLoggerWrapper(webimLogger: webimLogger) webimLoggerWrapper = wrapper diff --git a/ios/WebimError.swift b/ios/WebimError.swift old mode 100755 new mode 100644 index ddf22ff..663b8e9 --- a/ios/WebimError.swift +++ b/ios/WebimError.swift @@ -48,15 +48,15 @@ public final class _ObjCWebimError: NSObject { @objc(getErrorType) func getErrorType() -> _ObjCFatalErrorType { switch webimError.getErrorType() { - case .ACCOUNT_BLOCKED: + case .accountBlocked: return .ACCOUNT_BLOCKED - case .PROVIDED_VISITOR_FIELDS_EXPIRED: + case .providedVisitorFieldsExpired: return .PROVIDED_VISITOR_FIELDS_EXPIRED - case .UNKNOWN: + case .unknown: return .UNKNOWN - case .VISITOR_BANNED: + case .visitorBanned: return .VISITOR_BANNED - case .WRONG_PROVIDED_VISITOR_HASH: + case .wrongProvidedVisitorHash: return .WRONG_PROVIDED_VISITOR_HASH } } diff --git a/ios/WebimLogger.swift b/ios/WebimLogger.swift old mode 100755 new mode 100644 diff --git a/ios/WebimRemoteNotification.swift b/ios/WebimRemoteNotification.swift old mode 100755 new mode 100644 index b276425..0e5519d --- a/ios/WebimRemoteNotification.swift +++ b/ios/WebimRemoteNotification.swift @@ -46,15 +46,15 @@ public final class _ObjCWebimRemoteNotification: NSObject { @objc(getType) public func getType() -> _ObjCNotificationType { switch webimRemoteNotification.getType() { - case .CONTACT_INFORMATION_REQUEST: + case .contactInformationRequest: return .CONTACT_INFORMATION_REQUEST - case .OPERATOR_ACCEPTED: + case .operatorAccepted: return .OPERATOR_ACCEPTED - case .OPERATOR_FILE: + case .operatorFile: return .OPERATOR_FILE - case .OPERATOR_MESSAGE: + case .operatorMessage: return .OPERATOR_MESSAGE - case .WIDGET: + case .widget: return .WIDGET case .none: return .NONE @@ -65,9 +65,9 @@ public final class _ObjCWebimRemoteNotification: NSObject { public func getEvent() -> _ObjCNotificationEvent { if let event = webimRemoteNotification.getEvent() { switch event { - case .ADD: + case .add: return .ADD - case .DELETE: + case .delete: return .DELETE } } diff --git a/ios/WebimSession.swift b/ios/WebimSession.swift old mode 100755 new mode 100644 index 5fcaf26..08173f3 --- a/ios/WebimSession.swift +++ b/ios/WebimSession.swift @@ -32,52 +32,52 @@ import WebimClientLibrary // MARK: - WebimSession @objc(WebimSession) public final class _ObjCWebimSession: NSObject { - + // MARK: - Properties private let webimSession: WebimSession - - + + // MARK: - Initializers public init(webimSession: WebimSession) { self.webimSession = webimSession } - - + + // MARK: - Methods - + @objc(resume:) public func resume() throws { try webimSession.resume() } - + @objc(pause:) public func pause() throws { try webimSession.pause() } - + @objc(destroy:) public func destroy() throws { try webimSession.destroy() } - + @objc(destroyWithClearVisitorData:) public func destroyWithClearVisitorData() throws { try webimSession.destroyWithClearVisitorData() } - + @objc(getStream) public func getStream() -> _ObjCMessageStream { return _ObjCMessageStream(messageStream: webimSession.getStream()) } - + @objc(changeLocation:error:) public func change(location: String) throws { try webimSession.change(location: location) } - + @objc(setDeviceToken:error:) public func set(deviceToken: String) throws { try webimSession.set(deviceToken: deviceToken) } - + }