From 20308a17ecd228e8c7b0da22aeade23019a2506d Mon Sep 17 00:00:00 2001 From: onevcat Date: Fri, 7 Sep 2018 16:59:52 +0900 Subject: [PATCH 1/6] Fix incorrect escaping for return uri --- LineSDK/LineSDK/Login/LoginProcess.swift | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/LineSDK/LineSDK/Login/LoginProcess.swift b/LineSDK/LineSDK/Login/LoginProcess.swift index 3df01de2..6d512982 100644 --- a/LineSDK/LineSDK/Login/LoginProcess.swift +++ b/LineSDK/LineSDK/Login/LoginProcess.swift @@ -403,28 +403,29 @@ extension WebLoginFlow: SFSafariViewControllerDelegate { extension String { static func returnUri(_ parameter: LoginProcess.FlowParameters) -> String { - var universalLinkQuery = "" + + var parameters: [String: Any] = [ + "response_type": "code", + "sdk_ver": Constant.SDKVersion, + "client_id": parameter.channelID, + "scope": (parameter.scopes.map { $0.rawValue }).joined(separator: " "), + "otpId": parameter.otp.otpId, + "state": parameter.processID, + "redirect_uri": Constant.thirdPartyAppReturnURL, + ] + if let url = parameter.universalLinkURL { - universalLinkQuery = "&optional_redirect_uri=\(url.absoluteString)" + parameters["optional_redirect_uri"] = url.absoluteString } - - var nonceQuery = "" if let nonce = parameter.nonce { - nonceQuery = "&nonce=\(nonce)" + parameters["nonce"] = nonce } - - var botPromptQuery = "" if let botPrompt = parameter.botPrompt { - botPromptQuery = "&bot_prompt=\(botPrompt.rawValue)" + parameters["bot_prompt"] = botPrompt.rawValue } - - let result = - "/oauth2/v2.1/authorize/consent?response_type=code&sdk_ver=\(Constant.SDKVersion)" + - "&client_id=\(parameter.channelID)&scope=\((parameter.scopes.map { $0.rawValue }).joined(separator: " "))" + - "&otpId=\(parameter.otp.otpId)&state=\(parameter.processID)&redirect_uri=\(Constant.thirdPartyAppReturnURL)" + - universalLinkQuery + nonceQuery + botPromptQuery - - return result + let base = URL(string: "/oauth2/v2.1/authorize/consent")! + let encoder = URLQueryEncoder(parameters: parameters, allowed: .urlHostAllowed) + return encoder.encoded(for: base).absoluteString } } From 4316ea9fee27cfb7653f7a022f2819e643a30f0b Mon Sep 17 00:00:00 2001 From: onevcat Date: Mon, 10 Sep 2018 10:40:29 +0900 Subject: [PATCH 2/6] Fix escaping not working for double url encoding --- LineSDK/LineSDK/Login/LoginProcess.swift | 11 +++++------ .../LineSDK/Networking/Client/ParametersAdapter.swift | 10 ++++++---- .../LineSDKSample/Login/LoginViewController.swift | 11 +++++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/LineSDK/LineSDK/Login/LoginProcess.swift b/LineSDK/LineSDK/Login/LoginProcess.swift index 6d512982..3e7a7aaa 100644 --- a/LineSDK/LineSDK/Login/LoginProcess.swift +++ b/LineSDK/LineSDK/Login/LoginProcess.swift @@ -424,7 +424,7 @@ extension String { parameters["bot_prompt"] = botPrompt.rawValue } let base = URL(string: "/oauth2/v2.1/authorize/consent")! - let encoder = URLQueryEncoder(parameters: parameters, allowed: .urlHostAllowed) + let encoder = URLQueryEncoder(parameters: parameters) return encoder.encoded(for: base).absoluteString } } @@ -436,18 +436,17 @@ extension URL { "returnUri": returnUri, "loginChannelId": flowParameters.channelID ] - let encoder = URLQueryEncoder(parameters: parameters, allowed: .urlHostAllowed) + let encoder = URLQueryEncoder(parameters: parameters) return encoder.encoded(for: self) } func appendedURLSchemeQuery(_ flowParameters: LoginProcess.FlowParameters) -> URL { - let returnUri = String.returnUri(flowParameters) - let loginUrl = - "\(Constant.lineWebAuthUniversalURL)?returnUri=\(returnUri)&loginChannelId=\(flowParameters.channelID)" + let loginBase = URL(string: Constant.lineWebAuthUniversalURL)! + let loginUrl = loginBase.appendedLoginQuery(flowParameters) let parameters = [ "loginUrl": "\(loginUrl)" ] - let encoder = URLQueryEncoder(parameters: parameters, allowed: .urlHostAllowed) + let encoder = URLQueryEncoder(parameters: parameters) return encoder.encoded(for: self) } } diff --git a/LineSDK/LineSDK/Networking/Client/ParametersAdapter.swift b/LineSDK/LineSDK/Networking/Client/ParametersAdapter.swift index 22136f48..a660d031 100644 --- a/LineSDK/LineSDK/Networking/Client/ParametersAdapter.swift +++ b/LineSDK/LineSDK/Networking/Client/ParametersAdapter.swift @@ -23,11 +23,9 @@ import Foundation struct URLQueryEncoder: RequestAdapter { let parameters: Parameters - let allowed: CharacterSet - init(parameters: Parameters, allowed: CharacterSet = .urlQueryAllowed) { + init(parameters: Parameters) { self.parameters = parameters - self.allowed = allowed } func adapted(_ request: URLRequest) throws -> URLRequest { @@ -45,7 +43,11 @@ struct URLQueryEncoder: RequestAdapter { func encoded(for url: URL) -> URL { if var components = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { - let percentEncodedQuery = (components.percentEncodedQuery.map { $0 + "&" } ?? "") + query(parameters, allowed: allowed) + + var allowedCharacterSet = CharacterSet.urlQueryAllowed + allowedCharacterSet.remove(charactersIn: "!*'();:@&=+$,/?%#[]") + + let percentEncodedQuery = (components.percentEncodedQuery.map { $0 + "&" } ?? "") + query(parameters, allowed: allowedCharacterSet) components.percentEncodedQuery = percentEncodedQuery return components.url ?? url } diff --git a/LineSDKSample/LineSDKSample/Login/LoginViewController.swift b/LineSDKSample/LineSDKSample/Login/LoginViewController.swift index 18361b14..b3da0c44 100644 --- a/LineSDKSample/LineSDKSample/Login/LoginViewController.swift +++ b/LineSDKSample/LineSDKSample/Login/LoginViewController.swift @@ -26,7 +26,7 @@ extension Notification.Name { static let userDidLogin = Notification.Name("com.linecorp.linesdk_sample.userDidLogin") } -class LoginViewController: UIViewController, IndicatorDisplay, LoginButtonDelegate { +class LoginViewController: UIViewController, IndicatorDisplay { override func viewDidLoad() { super.viewDidLoad() @@ -54,21 +54,24 @@ class LoginViewController: UIViewController, IndicatorDisplay, LoginButtonDelega multiplier: 1, constant: 0).isActive = true } +} +extension LoginViewController: LoginButtonDelegate { + func loginButton(_ button: LoginButton, didSucceedLogin loginResult: LoginResult) { hideIndicator() UIAlertController.present(in: self, successResult: "\(loginResult)") { NotificationCenter.default.post(name: .userDidLogin, object: loginResult) } } - + func loginButton(_ button: LoginButton, didFailLogin error: Error) { hideIndicator() UIAlertController.present(in: self, error: error) } - + func loginButtonDidStartLogin(_ button: LoginButton) { showIndicator() } - + } From c8123fd386fb57246fa5efd67094800b9ff02b90 Mon Sep 17 00:00:00 2001 From: onevcat Date: Mon, 10 Sep 2018 10:54:03 +0900 Subject: [PATCH 3/6] Fix tests for url query encoding --- LineSDK/LineSDKTests/Login/LoginFlowTests.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/LineSDK/LineSDKTests/Login/LoginFlowTests.swift b/LineSDK/LineSDKTests/Login/LoginFlowTests.swift index 74117a37..4be9786b 100644 --- a/LineSDK/LineSDKTests/Login/LoginFlowTests.swift +++ b/LineSDK/LineSDKTests/Login/LoginFlowTests.swift @@ -35,6 +35,7 @@ class LoginFlowTests: XCTestCase, ViewControllerCompatibleTest { nonce: "kkk", botPrompt: .normal) + // Login URL has a double escaped query. func testLoginQueryURLEncode() { let baseURL = URL(string: Constant.lineWebAuthUniversalURL)! @@ -55,13 +56,18 @@ class LoginFlowTests: XCTestCase, ViewControllerCompatibleTest { } if (item.name == "returnUri") { hit += 1 + + XCTAssertNotEqual(item.value, item.value?.removingPercentEncoding) + // Should be already fully decoded (no double encoding in the url) - XCTAssertEqual(item.value, item.value?.removingPercentEncoding) + XCTAssertEqual(item.value?.removingPercentEncoding, + item.value?.removingPercentEncoding?.removingPercentEncoding) } } XCTAssertEqual(hit, 2) } + // URL Scheme has a triple escaped query. func testURLSchemeQueryEncode() { let baseURL = Constant.lineAppAuthURLv2 let result = baseURL.appendedURLSchemeQuery(parameter) @@ -77,8 +83,13 @@ class LoginFlowTests: XCTestCase, ViewControllerCompatibleTest { for item in items { if (item.name == "loginUrl") { hit += 1 + XCTAssertNotEqual(item.value, item.value?.removingPercentEncoding) + XCTAssertNotEqual(item.value?.removingPercentEncoding, + item.value?.removingPercentEncoding?.removingPercentEncoding) + // Should be already fully decoded (no double encoding in the url) - XCTAssertEqual(item.value, item.value?.removingPercentEncoding) + XCTAssertEqual(item.value?.removingPercentEncoding?.removingPercentEncoding, + item.value?.removingPercentEncoding?.removingPercentEncoding?.removingPercentEncoding) } } XCTAssertEqual(hit, 1) From 226e2cdc60b93b602eed160d6d24838fee7887c1 Mon Sep 17 00:00:00 2001 From: onevcat Date: Mon, 10 Sep 2018 11:08:53 +0900 Subject: [PATCH 4/6] Remove client response since all login result now goes as web format --- .../Login/LoginProcessURLResponse.swift | 57 +------------------ 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/LineSDK/LineSDK/Login/LoginProcessURLResponse.swift b/LineSDK/LineSDK/Login/LoginProcessURLResponse.swift index cb83d64a..fda63130 100644 --- a/LineSDK/LineSDK/Login/LoginProcessURLResponse.swift +++ b/LineSDK/LineSDK/Login/LoginProcessURLResponse.swift @@ -21,17 +21,6 @@ import Foundation -/// Result code from LINE app auth module -enum LineAppURLResultCode: String { - case success = "SUCCESS" - case disallowed = "DISALLOWED" - case cancelled = "CANCELLED" - case invalidParameter = "INVALIDPARAM" - case networkError = "NETWORKERROR" - case generalError = "GENERALERROR" - case loginFailure = "LOGINFAIL" -} - /// Result code from LINE web auth flow enum LineWebURLResultError: String { case accessDenied = "access_denied" @@ -53,52 +42,8 @@ struct LoginProcessURLResponse { guard let items = urlComponent.queryItems else { throw LineSDKError.authorizeFailed(reason: .malformedRedirectURL(url: url, message: nil)) } - - // If the items contains a "resultCode" key, we recognize it as response from LINE url scheme auth - // Maybe we could remove this, if server/LINE app side could unify the callback flow. - let isClientURLResponse = items.contains { $0.name == "resultCode" } - if isClientURLResponse { - try self.init(clientURL:url, queryItems: items) - } else { - try self.init(webURL: url, queryItems: items, validatingState: state) - } - } - - init(clientURL url: URL, queryItems items: [URLQueryItem]) throws { - var codeString = "" - var message: String? - var token: String? - for item in items { - switch item.name { - case "resultCode": codeString = item.value ?? "" - case "resultMessage": message = item.value - case "requestToken": token = item.value - default: break - } - } - - guard let code = LineAppURLResultCode(rawValue: codeString) else { - throw LineSDKError.authorizeFailed(reason: .invalidLineURLResultCode(codeString)) - } - - switch code { - case .success: - guard let token = token else { - throw LineSDKError.authorizeFailed(reason: .malformedRedirectURL(url: url, message: message)) - } - requestToken = token - case .cancelled: - throw LineSDKError.authorizeFailed(reason: .userCancelled) - case .disallowed: - // Disallowed happens when user reject the auth in the confirm screen. - // However, here we do not make `.cancelled` and `.disallowed` distinct. - throw LineSDKError.authorizeFailed(reason: .userCancelled) - default: - throw LineSDKError.authorizeFailed(reason: .lineClientError(code: code.rawValue, message: message)) - } - - friendshipStatusChanged = nil + try self.init(webURL: url, queryItems: items, validatingState: state) } init(webURL url: URL, queryItems items: [URLQueryItem], validatingState: String) throws { From eb63c3f9fa58b10d16501e87480f86122da6bcef Mon Sep 17 00:00:00 2001 From: onevcat Date: Mon, 10 Sep 2018 11:18:43 +0900 Subject: [PATCH 5/6] Remove tests for creating login process response from client --- .../Login/LoginProcessURLResponseTests.swift | 84 +------------------ 1 file changed, 1 insertion(+), 83 deletions(-) diff --git a/LineSDK/LineSDKTests/Login/LoginProcessURLResponseTests.swift b/LineSDK/LineSDKTests/Login/LoginProcessURLResponseTests.swift index 2b71b825..5f621715 100644 --- a/LineSDK/LineSDKTests/Login/LoginProcessURLResponseTests.swift +++ b/LineSDK/LineSDKTests/Login/LoginProcessURLResponseTests.swift @@ -23,89 +23,7 @@ import XCTest @testable import LineSDK class LoginProcessURLResponseTests: XCTestCase { - - func testInitFromClientResponse() { - let urlString = "\(Constant.thirdPartyAppReturnURL)?resultCode=SUCCESS&resultMessage=abc&requestToken=123" - let response = try! LoginProcessURLResponse(from: URL(string: urlString)!, validatingWith: "state") - XCTAssertEqual(response.requestToken, "123") - XCTAssertNil(response.friendshipStatusChanged) - } - - func testInitFromClientResponseWithoutToken() { - let urlString = "\(Constant.thirdPartyAppReturnURL)?resultCode=SUCCESS&resultMessage=abc" - do { - _ = try LoginProcessURLResponse(from: URL(string: urlString)!, validatingWith: "abc") - XCTFail("Should not init response") - } catch { - let e = error as! LineSDKError - guard case LineSDKError.authorizeFailed(reason: .malformedRedirectURL(let url, let message)) = e else { - XCTFail("Should be .malformedRedirectURL error") - return - } - XCTAssertEqual(url, URL(string: urlString)!) - XCTAssertEqual(message, "abc") - } - } - - func testInitFromClientUserCancel() { - let urlString = "\(Constant.thirdPartyAppReturnURL)?resultCode=CANCELLED&resultMessage=abc" - do { - _ = try LoginProcessURLResponse(from: URL(string: urlString)!, validatingWith: "abc") - XCTFail("Should not init response") - } catch { - let e = error as! LineSDKError - guard case LineSDKError.authorizeFailed(reason: .userCancelled) = e else { - XCTFail("Should be .userCancelled error") - return - } - } - } - - func testInitFromClientUserDisallow() { - let urlString = "\(Constant.thirdPartyAppReturnURL)?resultCode=DISALLOWED&resultMessage=abc" - do { - _ = try LoginProcessURLResponse(from: URL(string: urlString)!, validatingWith: "abc") - XCTFail("Should not init response") - } catch { - let e = error as! LineSDKError - guard case LineSDKError.authorizeFailed(reason: .userCancelled) = e else { - XCTFail("Should be .userCancelled error") - return - } - } - } - - func testInitFromClientOtherErrorCode() { - let urlString = "\(Constant.thirdPartyAppReturnURL)?resultCode=INVALIDPARAM&resultMessage=abc" - do { - _ = try LoginProcessURLResponse(from: URL(string: urlString)!, validatingWith: "abc") - XCTFail("Should not init response") - } catch { - let e = error as! LineSDKError - guard case LineSDKError.authorizeFailed(reason: .lineClientError(let code, let message)) = e else { - XCTFail("Should be .lineClientError error") - return - } - XCTAssertEqual(code, "INVALIDPARAM") - XCTAssertEqual(message, "abc") - } - } - - func testInitFromClientUnknownCode() { - let urlString = "\(Constant.thirdPartyAppReturnURL)?resultCode=UNKNOWN&resultMessage=abc" - do { - _ = try LoginProcessURLResponse(from: URL(string: urlString)!, validatingWith: "abc") - XCTFail("Should not init response") - } catch { - let e = error as! LineSDKError - guard case LineSDKError.authorizeFailed(reason: .invalidLineURLResultCode(let code)) = e else { - XCTFail("Should be .invalidLineURLResultCode error") - return - } - XCTAssertEqual(code, "UNKNOWN") - } - } - + func testInitFromWebResponse() { let urlString = "\(Constant.thirdPartyAppReturnURL)?code=123&state=abc&friendship_status_changed=true" let response = try! LoginProcessURLResponse(from: URL(string: urlString)!, validatingWith: "abc") From 67c4c97d47e44db62b058e1c6aaa7d902222a48f Mon Sep 17 00:00:00 2001 From: onevcat Date: Mon, 10 Sep 2018 12:44:34 +0900 Subject: [PATCH 6/6] Use subspec to define ObjC wrapper --- LineSDK/LineSDK.xcodeproj/project.pbxproj | 18 +++----- ...Error.swift => LineSDKErrorConstant.swift} | 7 +-- .../Login/LineSDKLoginManager.swift | 4 +- .../Login/LineSDKLoginManagerOptions.swift | 2 + .../Login/LineSDKLoginPermission.swift | 2 + .../Login/LineSDKLoginProcess.swift | 2 + .../Login/LineSDKLoginResult.swift | 2 + .../Login/Model/LineSDKAccessToken.swift | 2 + .../Login/Model/LineSDKAccessTokenStore.swift | 2 + .../LineSDKAccessTokenVerifyResult.swift | 2 + .../Login/Model/LineSDKUserProfile.swift | 2 + .../Actions/LineSDKMessageAction.swift | 2 + .../Component/LineSDKFlexBoxComponent.swift | 2 + .../LineSDKFlexButtonComponent.swift | 2 + .../LineSDKFlexFillerComponent.swift | 2 + .../Component/LineSDKFlexIconComponent.swift | 2 + .../Component/LineSDKFlexImageComponent.swift | 2 + .../LineSDKFlexMessageComponent.swift | 2 + .../LineSDKFlexSeparatorComponent.swift | 2 + .../Component/LineSDKFlexTextComponent.swift | 2 + .../Component/LineSDKSpacerComponent.swift | 2 + .../Flex/LineSDKFlexBubbleContainer.swift | 2 + .../Flex/LineSDKFlexCarouselContainer.swift | 2 + .../Flex/LineSDKFlexMessageContainer.swift | 2 + .../Messaging/LineSDKAudioMessage.swift | 2 + .../Messaging/LineSDKFlexMessage.swift | 2 + .../Messaging/LineSDKImageMessage.swift | 2 + .../Messaging/LineSDKLocationMessage.swift | 2 + .../Messaging/LineSDKMessage.swift | 2 + .../Messaging/LineSDKMessagingResponse.swift | 2 + .../Messaging/LineSDKTemplateMessage.swift | 2 + .../Messaging/LineSDKTextMessage.swift | 2 + .../Messaging/LineSDKVideoMessage.swift | 2 + .../LineSDKTemplateButtonsPayload.swift | 2 + .../LineSDKTemplateCarouselPayload.swift | 2 + .../LineSDKTemplateConfirmPayload.swift | 2 + .../LineSDKTemplateImageCarouselPayload.swift | 2 + .../CustomizeCoding/LineSDKHexColor.swift | 2 + .../LineSDKObjC/Networking/LineSDKAPI.swift | 2 + .../Networking/LineSDKAPIError.swift | 2 + .../Social/LineSDKGraphResponse.swift | 2 + LineSDK/LineSDKObjC/Social/LineSDKGroup.swift | 2 + LineSDK/LineSDKObjC/Social/LineSDKUser.swift | 2 + .../Utils/LinsSDKCallbackQueue.swift | 2 + LineSDK/LineSDKObjC/Utils/Log.swift | 8 ++-- .../LineSDKModelInterfaceTests.m | 10 ++++- LineSDKObjC.podspec | 26 ----------- LineSDKSwift.podspec | 45 ++++++++++++------- 48 files changed, 136 insertions(+), 64 deletions(-) rename LineSDK/LineSDKObjC/General/{LineSDKError.swift => LineSDKErrorConstant.swift} (95%) delete mode 100644 LineSDKObjC.podspec diff --git a/LineSDK/LineSDK.xcodeproj/project.pbxproj b/LineSDK/LineSDK.xcodeproj/project.pbxproj index 63da13d9..c1a19a65 100644 --- a/LineSDK/LineSDK.xcodeproj/project.pbxproj +++ b/LineSDK/LineSDK.xcodeproj/project.pbxproj @@ -16,7 +16,7 @@ 4B15EEF8211D473400866E6C /* MessageSender.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B15EEF7211D473400866E6C /* MessageSender.swift */; }; 4B15EEFB211D5BF800866E6C /* TextMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B15EEFA211D5BF800866E6C /* TextMessageTests.swift */; }; 4B15EEFD211D628000866E6C /* MessageSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B15EEFC211D628000866E6C /* MessageSample.swift */; }; - 4B2422EF2134FBE8007200C2 /* LineSDKError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2422EE2134FBE8007200C2 /* LineSDKError.swift */; }; + 4B2422EF2134FBE8007200C2 /* LineSDKErrorConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2422EE2134FBE8007200C2 /* LineSDKErrorConstant.swift */; }; 4B25A815213687A400C74B87 /* RSA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B25A814213687A400C74B87 /* RSA.swift */; }; 4B25A8172136888600C74B87 /* RSAAlgorithm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B25A8162136888600C74B87 /* RSAAlgorithm.swift */; }; 4B2D14E3212F8EDA000DD5BE /* LineSDKUserProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2D14E2212F8EDA000DD5BE /* LineSDKUserProfile.swift */; }; @@ -253,7 +253,7 @@ 4B15EEF7211D473400866E6C /* MessageSender.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSender.swift; sourceTree = ""; }; 4B15EEFA211D5BF800866E6C /* TextMessageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextMessageTests.swift; sourceTree = ""; }; 4B15EEFC211D628000866E6C /* MessageSample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSample.swift; sourceTree = ""; }; - 4B2422EE2134FBE8007200C2 /* LineSDKError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineSDKError.swift; sourceTree = ""; }; + 4B2422EE2134FBE8007200C2 /* LineSDKErrorConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineSDKErrorConstant.swift; sourceTree = ""; }; 4B25A814213687A400C74B87 /* RSA.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RSA.swift; sourceTree = ""; }; 4B25A8162136888600C74B87 /* RSAAlgorithm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RSAAlgorithm.swift; sourceTree = ""; }; 4B2D14E2212F8EDA000DD5BE /* LineSDKUserProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineSDKUserProfile.swift; sourceTree = ""; }; @@ -530,7 +530,7 @@ 4B2422ED2134FBD6007200C2 /* General */ = { isa = PBXGroup; children = ( - 4B2422EE2134FBE8007200C2 /* LineSDKError.swift */, + 4B2422EE2134FBE8007200C2 /* LineSDKErrorConstant.swift */, ); path = General; sourceTree = ""; @@ -1538,7 +1538,7 @@ 4B2D1501212FA9EE000DD5BE /* LineSDKHexColor.swift in Sources */, 4B2D14F1212F95B3000DD5BE /* LineSDKLoginResult.swift in Sources */, 4B2D14F3212F96A7000DD5BE /* LineSDKLoginProcess.swift in Sources */, - 4B2422EF2134FBE8007200C2 /* LineSDKError.swift in Sources */, + 4B2422EF2134FBE8007200C2 /* LineSDKErrorConstant.swift in Sources */, 4BBEA9B0212EB03200858627 /* LineSDKLoginPermission.swift in Sources */, 4B2D14F5212F97A6000DD5BE /* LineSDKLoginManager.swift in Sources */, ); @@ -1593,7 +1593,6 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.linecorp.TestHost; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1611,7 +1610,6 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.linecorp.TestHost; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -1675,6 +1673,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1732,6 +1731,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1759,7 +1759,6 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1784,7 +1783,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.linecorp.LineSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -1802,7 +1800,6 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.linecorp.LineSDKTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost"; }; @@ -1821,7 +1818,6 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.linecorp.LineSDKTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost"; }; @@ -1849,7 +1845,6 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1875,7 +1870,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.linecorp.LineSDKObjC; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/LineSDK/LineSDKObjC/General/LineSDKError.swift b/LineSDK/LineSDKObjC/General/LineSDKErrorConstant.swift similarity index 95% rename from LineSDK/LineSDKObjC/General/LineSDKError.swift rename to LineSDK/LineSDKObjC/General/LineSDKErrorConstant.swift index 8855c4bd..9f3f9cfb 100644 --- a/LineSDK/LineSDKObjC/General/LineSDKError.swift +++ b/LineSDK/LineSDKObjC/General/LineSDKErrorConstant.swift @@ -1,5 +1,5 @@ // -// LineSDKError.swift +// LineSDKErrorConstant.swift // // Copyright (c) 2016-present, LINE Corporation. All rights reserved. // @@ -18,11 +18,12 @@ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // - +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers -public class LineSDKError: NSObject { +public class LineSDKErrorConstant: NSObject { public static let errorDomain = LineSDK.LineSDKError.errorDomain public static let userInfoKeyUnderlyingError = LineSDKErrorUserInfoKey.underlyingError.rawValue diff --git a/LineSDK/LineSDKObjC/Login/LineSDKLoginManager.swift b/LineSDK/LineSDKObjC/Login/LineSDKLoginManager.swift index 2813a240..8de206b4 100644 --- a/LineSDK/LineSDKObjC/Login/LineSDKLoginManager.swift +++ b/LineSDK/LineSDKObjC/Login/LineSDKLoginManager.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKLoginManager: NSObject { @@ -62,7 +64,7 @@ public class LineSDKLoginManager: NSObject { public func application( _ app: UIApplication, open url: URL, - options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool + options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { return _value.application(app, open: url, options: options) } diff --git a/LineSDK/LineSDKObjC/Login/LineSDKLoginManagerOptions.swift b/LineSDK/LineSDKObjC/Login/LineSDKLoginManagerOptions.swift index 0dedef70..c8036c97 100644 --- a/LineSDK/LineSDKObjC/Login/LineSDKLoginManagerOptions.swift +++ b/LineSDK/LineSDKObjC/Login/LineSDKLoginManagerOptions.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKLoginManagerOptions: NSObject { diff --git a/LineSDK/LineSDKObjC/Login/LineSDKLoginPermission.swift b/LineSDK/LineSDKObjC/Login/LineSDKLoginPermission.swift index d37a0c82..805f51c3 100644 --- a/LineSDK/LineSDKObjC/Login/LineSDKLoginPermission.swift +++ b/LineSDK/LineSDKObjC/Login/LineSDKLoginPermission.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKLoginPermission: NSObject { diff --git a/LineSDK/LineSDKObjC/Login/LineSDKLoginProcess.swift b/LineSDK/LineSDKObjC/Login/LineSDKLoginProcess.swift index 37ff1d16..3df725a2 100644 --- a/LineSDK/LineSDKObjC/Login/LineSDKLoginProcess.swift +++ b/LineSDK/LineSDKObjC/Login/LineSDKLoginProcess.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKLoginProcess: NSObject { diff --git a/LineSDK/LineSDKObjC/Login/LineSDKLoginResult.swift b/LineSDK/LineSDKObjC/Login/LineSDKLoginResult.swift index a1379da7..0eb65d0f 100644 --- a/LineSDK/LineSDKObjC/Login/LineSDKLoginResult.swift +++ b/LineSDK/LineSDKObjC/Login/LineSDKLoginResult.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKLoginResult: NSObject { diff --git a/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessToken.swift b/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessToken.swift index ff4c7bbb..7159c9cf 100644 --- a/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessToken.swift +++ b/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessToken.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKAccessToken: NSObject { diff --git a/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenStore.swift b/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenStore.swift index 0fcc6150..c692d190 100644 --- a/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenStore.swift +++ b/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenStore.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objc extension NSNotification { public static let LineSDKAccessTokenDidUpdate = Notification.Name.LineSDKAccessTokenDidUpdate diff --git a/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenVerifyResult.swift b/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenVerifyResult.swift index 52750046..f077adc3 100644 --- a/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenVerifyResult.swift +++ b/LineSDK/LineSDKObjC/Login/Model/LineSDKAccessTokenVerifyResult.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKAccessTokenVerifyResult: NSObject { diff --git a/LineSDK/LineSDKObjC/Login/Model/LineSDKUserProfile.swift b/LineSDK/LineSDKObjC/Login/Model/LineSDKUserProfile.swift index b8d3c2db..31d31feb 100644 --- a/LineSDK/LineSDKObjC/Login/Model/LineSDKUserProfile.swift +++ b/LineSDK/LineSDKObjC/Login/Model/LineSDKUserProfile.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKUserProfile: NSObject { diff --git a/LineSDK/LineSDKObjC/Messaging/Actions/LineSDKMessageAction.swift b/LineSDK/LineSDKObjC/Messaging/Actions/LineSDKMessageAction.swift index 2d7756ad..edabb1f8 100644 --- a/LineSDK/LineSDKObjC/Messaging/Actions/LineSDKMessageAction.swift +++ b/LineSDK/LineSDKObjC/Messaging/Actions/LineSDKMessageAction.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif extension MessageAction { var wrapped: LineSDKMessageAction { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexBoxComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexBoxComponent.swift index 091653e1..413a874b 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexBoxComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexBoxComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexBoxComponent: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexButtonComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexButtonComponent.swift index 519891a5..3b699852 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexButtonComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexButtonComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objc public enum LineSDKFlexButtonComponentStyle: Int { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexFillerComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexFillerComponent.swift index deff6f0c..a48db73e 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexFillerComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexFillerComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexFillerComponent: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexIconComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexIconComponent.swift index 039ea364..c7db6f99 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexIconComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexIconComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexIconComponent: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexImageComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexImageComponent.swift index 1c371a8e..ec97d355 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexImageComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexImageComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexImageComponent: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexMessageComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexMessageComponent.swift index f9cfad31..47e08e2f 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexMessageComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexMessageComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif extension FlexMessageComponent { var wrapped: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexSeparatorComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexSeparatorComponent.swift index 4e56f7f7..afa7ca73 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexSeparatorComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexSeparatorComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexSeparatorComponent: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexTextComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexTextComponent.swift index 1ff32342..470d6ff1 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexTextComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKFlexTextComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexTextComponent: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKSpacerComponent.swift b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKSpacerComponent.swift index 2a073033..a98b9164 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKSpacerComponent.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/Component/LineSDKSpacerComponent.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexSpacerComponent: LineSDKFlexMessageComponent { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexBubbleContainer.swift b/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexBubbleContainer.swift index 1c110a1c..fc112d80 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexBubbleContainer.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexBubbleContainer.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexBubbleContainer: LineSDKFlexMessageContainer { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexCarouselContainer.swift b/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexCarouselContainer.swift index 0345baeb..ec25048d 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexCarouselContainer.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexCarouselContainer.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexCarouselContainer: LineSDKFlexMessageContainer { diff --git a/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexMessageContainer.swift b/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexMessageContainer.swift index 58d582ff..d825dffb 100644 --- a/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexMessageContainer.swift +++ b/LineSDK/LineSDKObjC/Messaging/Flex/LineSDKFlexMessageContainer.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif extension FlexMessageContainer { var wrapped: LineSDKFlexMessageContainer { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKAudioMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKAudioMessage.swift index dccba862..7ff903b0 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKAudioMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKAudioMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKAudioMessage: LineSDKMessage { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKFlexMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKFlexMessage.swift index b152af2b..c8c27c77 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKFlexMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKFlexMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKFlexMessage: LineSDKMessage { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKImageMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKImageMessage.swift index dcbdf12f..413ab81a 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKImageMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKImageMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKImageMessage: LineSDKMessage { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKLocationMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKLocationMessage.swift index 2c09d2fc..d706f46e 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKLocationMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKLocationMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKLocationMessage: LineSDKMessage { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKMessage.swift index 59f56bb5..a336d347 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKMessage: NSObject { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKMessagingResponse.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKMessagingResponse.swift index 67598ee3..87781373 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKMessagingResponse.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKMessagingResponse.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKMessageSendingStatus: NSObject { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKTemplateMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKTemplateMessage.swift index 219f48e9..ab392c44 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKTemplateMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKTemplateMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKTemplateMessage: LineSDKMessage { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKTextMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKTextMessage.swift index 3d40d911..13e436fe 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKTextMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKTextMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKTextMessage: LineSDKMessage { diff --git a/LineSDK/LineSDKObjC/Messaging/LineSDKVideoMessage.swift b/LineSDK/LineSDKObjC/Messaging/LineSDKVideoMessage.swift index 10d435ab..a7114fd3 100644 --- a/LineSDK/LineSDKObjC/Messaging/LineSDKVideoMessage.swift +++ b/LineSDK/LineSDKObjC/Messaging/LineSDKVideoMessage.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKVideoMessage: LineSDKMessage { diff --git a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateButtonsPayload.swift b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateButtonsPayload.swift index 58f10b3a..21661b33 100644 --- a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateButtonsPayload.swift +++ b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateButtonsPayload.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKTemplateButtonsPayload: LineSDKTemplateMessagePayload { diff --git a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateCarouselPayload.swift b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateCarouselPayload.swift index ecaabeba..03c32161 100644 --- a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateCarouselPayload.swift +++ b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateCarouselPayload.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKTemplateCarouselPayloadColumn: NSObject { diff --git a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateConfirmPayload.swift b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateConfirmPayload.swift index 84198ba4..2f103af9 100644 --- a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateConfirmPayload.swift +++ b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateConfirmPayload.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKTemplateConfirmPayload: LineSDKTemplateMessagePayload { diff --git a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateImageCarouselPayload.swift b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateImageCarouselPayload.swift index 444a03b0..6cb54a69 100644 --- a/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateImageCarouselPayload.swift +++ b/LineSDK/LineSDKObjC/Messaging/Template/LineSDKTemplateImageCarouselPayload.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKTemplateImageCarouselPayloadColumn: NSObject { diff --git a/LineSDK/LineSDKObjC/Networking/CustomizeCoding/LineSDKHexColor.swift b/LineSDK/LineSDKObjC/Networking/CustomizeCoding/LineSDKHexColor.swift index 5766f929..fa04c41d 100644 --- a/LineSDK/LineSDKObjC/Networking/CustomizeCoding/LineSDKHexColor.swift +++ b/LineSDK/LineSDKObjC/Networking/CustomizeCoding/LineSDKHexColor.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKHexColor: NSObject { diff --git a/LineSDK/LineSDKObjC/Networking/LineSDKAPI.swift b/LineSDK/LineSDKObjC/Networking/LineSDKAPI.swift index 5a02efe7..ab4d1c78 100644 --- a/LineSDK/LineSDKObjC/Networking/LineSDKAPI.swift +++ b/LineSDK/LineSDKObjC/Networking/LineSDKAPI.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKAPI: NSObject { diff --git a/LineSDK/LineSDKObjC/Networking/LineSDKAPIError.swift b/LineSDK/LineSDKObjC/Networking/LineSDKAPIError.swift index 7efd74d4..c6280aa5 100644 --- a/LineSDK/LineSDKObjC/Networking/LineSDKAPIError.swift +++ b/LineSDK/LineSDKObjC/Networking/LineSDKAPIError.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKAPIError: NSObject { diff --git a/LineSDK/LineSDKObjC/Social/LineSDKGraphResponse.swift b/LineSDK/LineSDKObjC/Social/LineSDKGraphResponse.swift index 07607862..92e563ce 100644 --- a/LineSDK/LineSDKObjC/Social/LineSDKGraphResponse.swift +++ b/LineSDK/LineSDKObjC/Social/LineSDKGraphResponse.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKGetFriendsResponse: NSObject { diff --git a/LineSDK/LineSDKObjC/Social/LineSDKGroup.swift b/LineSDK/LineSDKObjC/Social/LineSDKGroup.swift index 3de95015..eb196bac 100644 --- a/LineSDK/LineSDKObjC/Social/LineSDKGroup.swift +++ b/LineSDK/LineSDKObjC/Social/LineSDKGroup.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKGroup: NSObject { diff --git a/LineSDK/LineSDKObjC/Social/LineSDKUser.swift b/LineSDK/LineSDKObjC/Social/LineSDKUser.swift index 4e951aa4..4b0e33fb 100644 --- a/LineSDK/LineSDKObjC/Social/LineSDKUser.swift +++ b/LineSDK/LineSDKObjC/Social/LineSDKUser.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKUser: NSObject { diff --git a/LineSDK/LineSDKObjC/Utils/LinsSDKCallbackQueue.swift b/LineSDK/LineSDKObjC/Utils/LinsSDKCallbackQueue.swift index a1ae90f1..eb422cf4 100644 --- a/LineSDK/LineSDKObjC/Utils/LinsSDKCallbackQueue.swift +++ b/LineSDK/LineSDKObjC/Utils/LinsSDKCallbackQueue.swift @@ -19,7 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !LineSDKCocoaPods import LineSDK +#endif @objcMembers public class LineSDKCallbackQueue: NSObject { diff --git a/LineSDK/LineSDKObjC/Utils/Log.swift b/LineSDK/LineSDKObjC/Utils/Log.swift index 15d91d69..e2c87cf8 100644 --- a/LineSDK/LineSDKObjC/Utils/Log.swift +++ b/LineSDK/LineSDKObjC/Utils/Log.swift @@ -21,19 +21,21 @@ import Foundation +#if !LineSDKCocoaPods struct Log { static func assertionFailure(_ message: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) { - Swift.assertionFailure("[LineSDK][ObjC] \(message())", file: file, line: line) + Swift.assertionFailure("[LineSDK] \(message())", file: file, line: line) } static func fatalError(_ message: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Never { - Swift.fatalError("[LineSDK][ObjC] \(message())", file: file, line: line) + Swift.fatalError("[LineSDK] \(message())", file: file, line: line) } static func print(_ items: Any...) { let s = items.reduce("") { result, next in return result + String(describing: next) } - Swift.print("[LineSDK][ObjC] \(s)") + Swift.print("[LineSDK] \(s)") } } +#endif diff --git a/LineSDK/LineSDKObjCInterfaceTests/LineSDKModelInterfaceTests.m b/LineSDK/LineSDKObjCInterfaceTests/LineSDKModelInterfaceTests.m index 47e9ae73..33b6de5a 100644 --- a/LineSDK/LineSDKObjCInterfaceTests/LineSDKModelInterfaceTests.m +++ b/LineSDK/LineSDKObjCInterfaceTests/LineSDKModelInterfaceTests.m @@ -146,6 +146,12 @@ - (void)testLoginManagerInterface { [manager logoutWithCompletionHandler:^(NSError *error) { }]; + + BOOL opened = [manager application:[UIApplication sharedApplication] + open:[NSURL URLWithString:@"https://sample.com"] + options:@{}]; + XCTAssertFalse(opened); + XCTAssertNotNil([LineSDKLoginManager sharedManager]); } @@ -244,8 +250,8 @@ - (void)testPostMultisendMessagesResponseInterface { } -(void)testErrorDomain { - NSLog(@"%@", [LineSDKError errorDomain]); - XCTAssertTrue([[LineSDKError errorDomain] isEqualToString:@"LineSDKError"]); + NSLog(@"%@", [LineSDKErrorConstant errorDomain]); + XCTAssertTrue([[LineSDKErrorConstant errorDomain] isEqualToString:@"LineSDKError"]); } @end diff --git a/LineSDKObjC.podspec b/LineSDKObjC.podspec deleted file mode 100644 index c1a4f345..00000000 --- a/LineSDKObjC.podspec +++ /dev/null @@ -1,26 +0,0 @@ - -Pod::Spec.new do |s| - s.name = "LineSDKObjC" - s.version = "5.0.0" - s.summary = "Integrate LINE Login and APIs into your iOS app to create a more engaging experience for your users." - - s.description = <<-DESC - The LineSDK lets you integrate LINE into your iOS app to create a more engaging - experience for your users. This framework is written as an Objective-C wrapper - for pure Swift implmentation of LineSDK and provides an easy way to integrate - LINE login, LINE APIs and other exciting features into your app. - DESC - - s.homepage = "https://developers.line.me/" - s.license = "Apache License, Version 2.0" - - s.author = "LINE" - s.platform = :ios, "10.0" - - s.module_name = "LineSDKObjC" - s.swift_version = '4.2' - - s.source = { :git => "https://github.com/line/linesdk-ios-swift.git", :tag => "#{s.version}" } - s.source_files = ["LineSDK/LineSDKObjC/**/*.swift", "LineSDK/LineSDKObjC/LineSDKObjC.h"] - s.dependency "LineSDKSwift", "~> #{s.version}" -end diff --git a/LineSDKSwift.podspec b/LineSDKSwift.podspec index 4177aea3..35115f78 100644 --- a/LineSDKSwift.podspec +++ b/LineSDKSwift.podspec @@ -1,25 +1,36 @@ Pod::Spec.new do |s| - s.name = "LineSDKSwift" - s.version = "5.0.0" - s.summary = "Integrate LINE Login and APIs into your iOS app to create a more engaging experience for your users." + s.name = "LineSDKSwift" + s.version = "5.0.0" + s.summary = "Integrate LINE Login and APIs into your iOS app to create a more engaging experience for your users." - s.description = <<-DESC - The LineSDK lets you integrate LINE into your iOS app to create a more engaging - experience for your users. This framework is written in pure Swift and provides an easy - way to integrate LINE login, LINE APIs and other exciting features into your app. - DESC + s.description = <<-DESC + The LineSDK lets you integrate LINE into your iOS app to create a more engaging + experience for your users. This framework is written in pure Swift and provides an easy + way to integrate LINE login, LINE APIs and other exciting features into your app. + DESC - s.homepage = "https://developers.line.me/" - s.license = "Apache License, Version 2.0" + s.homepage = "https://developers.line.me/" + s.license = "Apache License, Version 2.0" - s.author = "LINE" - s.platform = :ios, "10.0" + s.author = "LINE" + s.platform = :ios, "10.0" - s.module_name = "LineSDK" - s.swift_version = '4.2' + s.module_name = "LineSDK" + s.swift_version = "4.2" + s.source = { :git => "https://github.com/line/linesdk-ios-swift.git", :tag => "#{s.version}" } - s.source = { :git => "https://github.com/line/linesdk-ios-swift.git", :tag => "#{s.version}" } - s.source_files = ["LineSDK/LineSDK/**/*.swift", "LineSDK/LineSDK/LineSDK.h"] - s.resources = ["LineSDK/LineSDK/Assets.xcassets", "LineSDK/LineSDK/Resource.bundle"] + s.default_subspecs = "Core" + s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DLineSDKCocoaPods' } + + s.subspec "Core" do |sp| + sp.source_files = ["LineSDK/LineSDK/**/*.swift", "LineSDK/LineSDK/LineSDK.h"] + sp.resources = ["LineSDK/LineSDK/Assets.xcassets", "LineSDK/LineSDK/Resource.bundle"] + end + + s.subspec "ObjC" do |sp| + sp.source_files = ["LineSDK/LineSDKObjC/**/*.swift", "LineSDK/LineSDKObjC/LineSDKObjC.h"] + sp.dependency "LineSDKSwift/Core" + end + end