diff --git a/Core/UDValidationManager.swift b/Core/UDValidationManager.swift index a1b8e47..9988edc 100644 --- a/Core/UDValidationManager.swift +++ b/Core/UDValidationManager.swift @@ -76,12 +76,16 @@ public class UDValidationManager { errorBlock(.urlError, UDError.urlError.description) return } - model.urlWithoutPort = url! + var urlValue = url! + if urlValue.last == "/" && urlValue.count > 2 { + urlValue.removeLast() + } + model.urlWithoutPort = urlValue - if isExistProtocol(url: url!) { - model.url = "\(url!):\(model.port)" + if isExistProtocol(url: urlValue) { + model.url = "\(urlValue):\(model.port)" } else { - model.url = "https://" + "\(url!):\(model.port)" + model.url = "https://" + "\(urlValue):\(model.port)" } } @@ -96,31 +100,38 @@ public class UDValidationManager { } } - if urlToSendFile != nil { - if urlToSendFile != "" { - guard urlToSendFile!.udIsValidUrl() else { + if let url = urlToSendFile { + if url != "" { + var urlValue = url + guard urlValue.udIsValidUrl() else { errorBlock(.urlToSendFileError, UDError.urlToSendFileError.description) return } - if isExistProtocol(url: urlToSendFile!) { - model.urlToSendFile = urlToSendFile! + if urlValue.last == "/" && urlValue.count > 2 { + urlValue.removeLast() + } + if isExistProtocol(url: urlValue) { + model.urlToSendFile = urlValue } else { - model.urlToSendFile = "https://" + urlToSendFile! + model.urlToSendFile = "https://" + urlValue } } } - if urlAPI != nil { - if urlAPI != "" { - var urlAPIValue = urlAPI! - if !isExistProtocol(url: urlAPIValue) { - urlAPIValue = "https://" + urlAPIValue + if let url = urlAPI { + if url != "" { + var urlValue = url + if !isExistProtocol(url: urlValue) { + urlValue = "https://" + urlValue } - guard urlAPIValue.udIsValidUrl() else { + guard urlValue.udIsValidUrl() else { errorBlock(.urlAPIError, UDError.urlAPIError.description) return } - model.urlAPI = urlAPIValue + if urlValue.last == "/" && urlValue.count > 2 { + urlValue.removeLast() + } + model.urlAPI = urlValue } } diff --git a/Core/UseDeskSDKHelp.swift b/Core/UseDeskSDKHelp.swift index 8b470a4..9216917 100755 --- a/Core/UseDeskSDKHelp.swift +++ b/Core/UseDeskSDKHelp.swift @@ -10,7 +10,7 @@ class UseDeskSDKHelp { let payload: [String : Any] = [ "sdk" : "iOS", "type" : "sdk", - "version" : "3.4.4", + "version" : "3.4.5", "message_limit" : countMessagesOnInit, "userData" : getUserParameters() ] diff --git a/Example/UseDesk.xcodeproj/project.pbxproj b/Example/UseDesk.xcodeproj/project.pbxproj index c81d01a..d43b838 100644 --- a/Example/UseDesk.xcodeproj/project.pbxproj +++ b/Example/UseDesk.xcodeproj/project.pbxproj @@ -589,7 +589,7 @@ INFOPLIST_FILE = "UseDesk/UseDesk-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 3.4.4; + MARKETING_VERSION = 3.4.5; MODULE_NAME = ExampleApp; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = UseDeskExampleSDK.ru; @@ -622,7 +622,7 @@ INFOPLIST_FILE = "UseDesk/UseDesk-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 3.4.4; + MARKETING_VERSION = 3.4.5; MODULE_NAME = ExampleApp; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = UseDeskExampleSDK.ru; diff --git a/UseDesk_SDK_Swift.podspec b/UseDesk_SDK_Swift.podspec index 53bd65f..06d573b 100755 --- a/UseDesk_SDK_Swift.podspec +++ b/UseDesk_SDK_Swift.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'UseDesk_SDK_Swift' - s.version = '3.4.4' + s.version = '3.4.5' s.summary = 'A short description of UseDesk.' s.homepage = 'https://github.com/usedesk/UseDeskSwift'