From 8efa4fe2599f4e16220bfcc6e6c9a550f70509c6 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 17:26:06 +0800 Subject: [PATCH 01/20] feat: swift action --- .github/workflows/swift.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 0000000..94f7306 --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,31 @@ +name: Swift + +on: + push: + branches: [develop] + + pull_request: + branches: [develop] + +env: + DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer + +jobs: + build: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Setup Xcode + run: bundle exec fastlane setup + + - name: SwiftLint + run: bundle exec fastlane lint + + - name: CocoaPods Lint + run: bundle exec pod lib lint --allow-warnings From 14218897e9e01191a21cf7d9f261224414f28eb1 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 17:26:16 +0800 Subject: [PATCH 02/20] feat: add .ruby-version file --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..37c2961 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.7.2 From 51c388c0a86b714192b0810b1b88808dea9aaba4 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 17:27:13 +0800 Subject: [PATCH 03/20] feat: update .swiftlint.yml --- .swiftlint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index 1e6db25..27df809 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -10,6 +10,10 @@ identifier_name: excluded: - qq +included: + - Example + - NBus + line_length: ignores_comments: true ignores_interpolated_strings: true From a284db7a401d46b975f7740ad0b5f2a6aceac82d Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 18:40:38 +0800 Subject: [PATCH 04/20] fix: donot use Dir.glob --- NBus.podspec | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/NBus.podspec b/NBus.podspec index a15d1a3..11af038 100644 --- a/NBus.podspec +++ b/NBus.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| end s.subspec "Core" do |ss| - ss.source_files = Dir.glob("NBus/Classes/Core/**/*.swift") + ss.source_files = ["NBus/Classes/Core/**/*.swift"] end s.subspec "QQSDKHandler" do |ss| @@ -64,31 +64,30 @@ Pod::Spec.new do |s| end s.subspec "QQSDK" do |ss| - ss.vendored_frameworks = Dir.glob("NBus/Vendor/QQ_SDK/**/*.framework") + ss.vendored_frameworks = ["NBus/Vendor/QQ_SDK/**/*.framework"] ss.frameworks = ["SystemConfiguration", "WebKit"] - ss.source_files = Dir.glob("NBus/Vendor/QQ_SDK/**/*.h") - .reject { |name| name.include?("TencentOpenApiUmbrellaHeader.h") } + ss.source_files = ["NBus/Vendor/QQ_SDK/**/*.h"] - ss.resources = Dir.glob("NBus/Vendor/QQ_SDK/**/*.bundle") + ss.resources = ["NBus/Vendor/QQ_SDK/**/*.bundle"] end s.subspec "WechatSDK" do |ss| - ss.vendored_libraries = Dir.glob("NBus/Vendor/Wechat_SDK/**/*.a") + ss.vendored_libraries = ["NBus/Vendor/Wechat_SDK/**/*.a"] ss.frameworks = ["WebKit"] ss.libraries = ["c++"] - ss.source_files = Dir.glob("NBus/Vendor/Wechat_SDK/**/*.h") + ss.source_files = ["NBus/Vendor/Wechat_SDK/**/*.h"] ss.pod_target_xcconfig = { "OTHER_LDFLAGS" => "-ObjC -all_load" } end s.subspec "WeiboSDK" do |ss| - ss.vendored_libraries = Dir.glob("NBus/Vendor/Weibo_SDK/**/*.a") + ss.vendored_libraries = ["NBus/Vendor/Weibo_SDK/**/*.a"] - ss.source_files = Dir.glob("NBus/Vendor/Weibo_SDK/**/*.h") + ss.source_files = ["NBus/Vendor/Weibo_SDK/**/*.h"] - ss.resources = Dir.glob("NBus/Vendor/Weibo_SDK/**/*.bundle") + ss.resources = ["NBus/Vendor/Weibo_SDK/**/*.bundle"] end s.prepare_command = <<-CMD From cbf156dcc8d923faed7ca29141814760ac240e4f Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 23:34:03 +0800 Subject: [PATCH 05/20] fix: typo --- NBus.podspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NBus.podspec b/NBus.podspec index 11af038..b7dfd78 100644 --- a/NBus.podspec +++ b/NBus.podspec @@ -127,6 +127,8 @@ Pod::Spec.new do |s| QQ_SEARCH="Lite/TencentOpenApi(Lite)_3" download_sdk ${QQ} ${QQ_VER} ${QQ_URL} ${QQ_SHA1} ${QQ_SEARCH} + sed -i "" "s/imoort/import/g" "QQ_SDK/TencentOpenAPI.framework/Headers/TencentOpenApiUmbrellaHeader.h" + WECHAT="Wechat" WECHAT_VER="1.8.7.1" WECHAT_URL="https://res.wx.qq.com/op_res/DHI055JVxYur-5c7ss5McQZj2Y9KZQlp24xwD7FYnF88x8LA8rWCzSfdStN5tiCD" From 37169a438ec1c7239b1f7d0aa8e14e0d43e6fe60 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 23:34:31 +0800 Subject: [PATCH 06/20] refactor: CustomStringConvertible --- Example/NBus/Model/AppState.swift | 12 ++++++++++++ Example/NBus/View/PlatformViewController.swift | 9 +-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Example/NBus/Model/AppState.swift b/Example/NBus/Model/AppState.swift index 701e486..68acb22 100644 --- a/Example/NBus/Model/AppState.swift +++ b/Example/NBus/Model/AppState.swift @@ -37,6 +37,18 @@ extension AppState.PlatformItem { } } +extension AppState.PlatformItem.Category: CustomStringConvertible { + + var description: String { + switch self { + case .bus: + return "开源" + case .sdk: + return "官方" + } + } +} + extension AppState { func setup() { diff --git a/Example/NBus/View/PlatformViewController.swift b/Example/NBus/View/PlatformViewController.swift index b56a453..99be64a 100644 --- a/Example/NBus/View/PlatformViewController.swift +++ b/Example/NBus/View/PlatformViewController.swift @@ -105,14 +105,7 @@ extension PlatformViewController { .disposed(by: disposeBag) viewModel.currentCategory - .map { - switch $0 { - case .bus: - return "开源" - case .sdk: - return "闭源" - } - } + .map { category in "\(category)" } .bind(to: handlerBarButtonItem.rx.title) .disposed(by: disposeBag) From 173c4f542ad2e24b0b9fac24f8d6f151f3c139a1 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 23:37:42 +0800 Subject: [PATCH 07/20] refactor: toggle --- Example/NBus/Model/AppState.swift | 18 ++++++++++++++++++ Example/NBus/View/PlatformViewController.swift | 9 +-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Example/NBus/Model/AppState.swift b/Example/NBus/Model/AppState.swift index 68acb22..a7f0390 100644 --- a/Example/NBus/Model/AppState.swift +++ b/Example/NBus/Model/AppState.swift @@ -49,6 +49,24 @@ extension AppState.PlatformItem.Category: CustomStringConvertible { } } +extension AppState.PlatformItem.Category { + + mutating func toggle() { + switch self { + case .bus: + self = .sdk + case .sdk: + self = .bus + } + } + + func toggled() -> Self { + var copy = self + copy.toggle() + return copy + } +} + extension AppState { func setup() { diff --git a/Example/NBus/View/PlatformViewController.swift b/Example/NBus/View/PlatformViewController.swift index 99be64a..56a904d 100644 --- a/Example/NBus/View/PlatformViewController.swift +++ b/Example/NBus/View/PlatformViewController.swift @@ -118,14 +118,7 @@ extension PlatformViewController { handlerBarButtonItem.rx .tap .withLatestFrom(viewModel.currentCategory) - .map { - switch $0 { - case .bus: - return .sdk - case .sdk: - return .bus - } - } + .map { category in category.toggled() } .bind(to: viewModel.currentCategory) .disposed(by: disposeBag) From 20091b3382e74bf3a55958d373fc5c422d1aab70 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 23:41:21 +0800 Subject: [PATCH 08/20] refactor: remove set --- NBus/Classes/Core/Bus+Wrapper.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/NBus/Classes/Core/Bus+Wrapper.swift b/NBus/Classes/Core/Bus+Wrapper.swift index 6837278..6fe43dc 100644 --- a/NBus/Classes/Core/Bus+Wrapper.swift +++ b/NBus/Classes/Core/Bus+Wrapper.swift @@ -21,14 +21,13 @@ public protocol BusCompatible { associatedtype BusBase - var bus: BusWrapper { get set } + var bus: BusWrapper { get } } extension BusCompatible { public var bus: BusWrapper { - get { BusWrapper(self) } - set {} + BusWrapper(self) } } From 286368529c365a9ac7a4ed20d27eb973e2bdb498 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Sun, 17 Jan 2021 23:45:06 +0800 Subject: [PATCH 09/20] fix: disable swiftlint rule --- NBus/Classes/Handler/QQHandler.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 953ba00..7c85ba7 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -8,6 +8,8 @@ import Foundation +// swiftlint:disable file_length + public class QQHandler { public let endpoints: [Endpoint] = [ @@ -43,6 +45,8 @@ public class QQHandler { extension QQHandler: ShareHandlerType { + // swiftlint:disable cyclomatic_complexity function_body_length + public func share( message: MessageType, to endpoint: Endpoint, @@ -247,6 +251,8 @@ extension QQHandler: ShareHandlerType { } } + // swiftlint:enable cyclomatic_complexity function_body_length + private func canShare(message: Message, to endpoint: Endpoint) -> Bool { switch endpoint { case Endpoints.QQ.friend: @@ -347,6 +353,8 @@ extension QQHandler: ShareHandlerType { extension QQHandler: OauthHandlerType { + // swiftlint:disable function_body_length + public func oauth( options: [Bus.OauthOptionKey: Any], completionHandler: @escaping Bus.OauthCompletionHandler @@ -420,6 +428,8 @@ extension QQHandler: OauthHandlerType { } } + // swiftlint:enable function_body_length + private var statusMachine: String { UIDevice.current.bus.machine } From 3a4ec3bb81300e67070bbdb375d41cb22a984b71 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Mon, 18 Jan 2021 23:21:50 +0800 Subject: [PATCH 10/20] fix: use directly --- NBus/Classes/Handler/QQHandler.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 7c85ba7..102de4a 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -174,7 +174,7 @@ extension QQHandler: ShareHandlerType { case let message as FileMessage: urlItems["file_type"] = "localFile" - if let fileName = message.fullName?.bus.base64EncodedString { + if let fileName = message.fullName { urlItems["fileName"] = fileName } From aa306dc248703544d9491e18acfdc187d8760bc2 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Mon, 18 Jan 2021 23:24:04 +0800 Subject: [PATCH 11/20] refactor: unnecessary --- NBus/Classes/Handler/QQHandler.swift | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 102de4a..292e3b1 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -239,11 +239,6 @@ extension QQHandler: ShareHandlerType { return } - guard UIApplication.shared.canOpenURL(url) else { - completionHandler(.failure(.unknown)) - return - } - UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { result in if !result { completionHandler(.failure(.unknown)) @@ -416,11 +411,6 @@ extension QQHandler: OauthHandlerType { return } - guard UIApplication.shared.canOpenURL(url) else { - completionHandler(.failure(.unknown)) - return - } - UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { result in if !result { completionHandler(.failure(.unknown)) @@ -518,11 +508,6 @@ extension QQHandler { return } - guard UIApplication.shared.canOpenURL(url) else { - shareCompletionHandler?(.failure(.unknown)) - return - } - UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { [weak self] result in if !result { self?.shareCompletionHandler?(.failure(.unknown)) From 4329387314d89e355aa25de7aa35b2983a630f26 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Mon, 18 Jan 2021 23:27:32 +0800 Subject: [PATCH 12/20] fix: get infos from pasteboard --- NBus/Classes/Handler/QQHandler.swift | 42 ++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 292e3b1..bdfcc88 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -473,13 +473,8 @@ extension QQHandler: OpenUserActivityHandlerType { extension QQHandler { private func handleSignToken(with components: URLComponents) { - let decoder = JSONDecoder() - decoder.dataDecodingStrategy = .base64 - guard - let item = components.queryItems?.first(where: { $0.name == "appsign_extrainfo" }), - let itemData = item.value.flatMap({ Data(base64Encoded: $0) }), - let infos = try? decoder.decode([String: String].self, from: itemData), + let infos = getSignTokenInfos(from: components) ?? getSignTokenInfos(from: .general), let appSignRedirect = infos["appsign_redirect"], let appSignToken = infos["appsign_token"], var components = URLComponents(string: appSignRedirect) @@ -515,6 +510,41 @@ extension QQHandler { } } + private func getSignTokenInfos(from components: URLComponents) -> [String: String]? { + let decoder = JSONDecoder() + decoder.dataDecodingStrategy = .base64 + + guard + let item = components.queryItems?.first(where: { $0.name == "appsign_extrainfo" }), + let itemData = item.value.flatMap({ Data(base64Encoded: $0) }), + let infos = try? decoder.decode([String: String].self, from: itemData) + else { + return nil + } + + return infos + } + + private func getSignTokenInfos(from pasteboard: UIPasteboard) -> [String: String]? { + guard + let itemData = pasteboard.data(forPasteboardType: "com.tencent.\(appID)"), + let infos = NSKeyedUnarchiver.unarchiveObject(with: itemData) as? [String: Any] + else { + return nil + } + + if let pbItems = infos["appsign_redirect_pasteboard"] { + let pbData = NSKeyedArchiver.archivedData(withRootObject: pbItems) + + UIPasteboard.general.setData( + pbData, + forPasteboardType: "com.tencent.mqq.api.apiLargeData" + ) + } + + return infos.compactMapValues { $0 as? String } + } + private func handleActionInfo(with components: URLComponents) { let decoder = JSONDecoder() decoder.dataDecodingStrategy = .base64 From 59be4bf96588b4394d20b0915ae20baf1908218e Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Mon, 18 Jan 2021 23:28:41 +0800 Subject: [PATCH 13/20] feat: assign again --- Example/NBus/AppDelegate.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Example/NBus/AppDelegate.swift b/Example/NBus/AppDelegate.swift index be2b092..b3ff754 100644 --- a/Example/NBus/AppDelegate.swift +++ b/Example/NBus/AppDelegate.swift @@ -49,6 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:] ) -> Bool { + UIPasteboard.general.items = UIPasteboard.general.items logger.debug("\(url)") return Bus.shared.openURL(url) } @@ -58,6 +59,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void ) -> Bool { + UIPasteboard.general.items = UIPasteboard.general.items logger.debug("\(userActivity.webpageURL!)") return Bus.shared.openUserActivity(userActivity) } From 7a428cb1bb4ddc746cb79b6aa7697db717d4382b Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Mon, 18 Jan 2021 23:39:23 +0800 Subject: [PATCH 14/20] refactor: getJSON --- NBus/Classes/Handler/QQHandler.swift | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index bdfcc88..24b4288 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -511,18 +511,7 @@ extension QQHandler { } private func getSignTokenInfos(from components: URLComponents) -> [String: String]? { - let decoder = JSONDecoder() - decoder.dataDecodingStrategy = .base64 - - guard - let item = components.queryItems?.first(where: { $0.name == "appsign_extrainfo" }), - let itemData = item.value.flatMap({ Data(base64Encoded: $0) }), - let infos = try? decoder.decode([String: String].self, from: itemData) - else { - return nil - } - - return infos + getJSON(from: components, with: "appsign_extrainfo") } private func getSignTokenInfos(from pasteboard: UIPasteboard) -> [String: String]? { @@ -545,14 +534,24 @@ extension QQHandler { return infos.compactMapValues { $0 as? String } } - private func handleActionInfo(with components: URLComponents) { + private func getJSON(from components: URLComponents, with name: String) -> [String: String]? { let decoder = JSONDecoder() decoder.dataDecodingStrategy = .base64 guard - let item = components.queryItems?.first(where: { $0.name == "sdkactioninfo" }), + let item = components.queryItems?.first(where: { $0.name == name }), let itemData = item.value.flatMap({ Data(base64Encoded: $0) }), let infos = try? decoder.decode([String: String].self, from: itemData) + else { + return nil + } + + return infos + } + + private func handleActionInfo(with components: URLComponents) { + guard + let infos = getJSON(from: components, with: "sdkactioninfo") else { assertionFailure() return From 1ba74c9a09a3ab9e39486bd136f3b627f19f6bc5 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Mon, 18 Jan 2021 23:44:03 +0800 Subject: [PATCH 15/20] refactor: getPlist --- NBus/Classes/Handler/QQHandler.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 24b4288..654a79e 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -549,6 +549,18 @@ extension QQHandler { return infos } + private func getPlist(from components: URLComponents, with name: String) -> [String: Any]? { + guard + let item = components.queryItems?.first(where: { $0.name == name }), + let itemData = item.value.flatMap({ Data(base64Encoded: $0) }), + let infos = NSKeyedUnarchiver.unarchiveObject(with: itemData) as? [String: Any] + else { + return nil + } + + return infos + } + private func handleActionInfo(with components: URLComponents) { guard let infos = getJSON(from: components, with: "sdkactioninfo") @@ -601,9 +613,7 @@ extension QQHandler { private func handleOauth(with components: URLComponents) { guard - let item = components.queryItems?.first(where: { $0.name == "pasteboard" }), - let itemData = item.value.flatMap({ Data(base64Encoded: $0) }), - let infos = NSKeyedUnarchiver.unarchiveObject(with: itemData) as? [String: Any] + let infos = getPlist(from: components, with: "pasteboard") else { assertionFailure() return From 8c3ac6bc3d2b78a4fcf20881f029d715e14bfd91 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Wed, 20 Jan 2021 11:42:17 +0800 Subject: [PATCH 16/20] fix: MiniProgramMessage --- NBus/Classes/Handler/QQHandler.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 654a79e..8ddedff 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -191,6 +191,7 @@ extension QQHandler: ShareHandlerType { urlItems["file_type"] = "news" + urlItems["title"] = url urlItems["url"] = url if let thumbnail = message.thumbnail { @@ -222,6 +223,8 @@ extension QQHandler: ShareHandlerType { if pbItems.contains(where: { $0.key == "file_data" }) { urlItems["objectlocation"] = "pasteboard" + } else if message is MiniProgramMessage { + urlItems["objectlocation"] = "url" } var components = URLComponents() From 4b7c255c922f7f538201371394989bbc867cdab3 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Wed, 20 Jan 2021 11:42:46 +0800 Subject: [PATCH 17/20] refactor: remove delay --- Example/NBus/AppDelegate.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Example/NBus/AppDelegate.swift b/Example/NBus/AppDelegate.swift index b3ff754..6f6323c 100644 --- a/Example/NBus/AppDelegate.swift +++ b/Example/NBus/AppDelegate.swift @@ -130,7 +130,6 @@ extension AppDelegate { private func observeSDK() { pasteboardItems() - .delay(.seconds(1), scheduler: MainScheduler.instance) .bind(onNext: { items in logger.debug("\(items)") }) From 7ee2701fc23e2de561b381d21efb7788e1b781d8 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Wed, 20 Jan 2021 16:44:50 +0800 Subject: [PATCH 18/20] refactor: assertionFailure --- NBus/Classes/Handler/QQHandler.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 8ddedff..7798d63 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -118,6 +118,7 @@ extension QQHandler: ShareHandlerType { guard let text = message.text.bus.base64EncodedString else { + assertionFailure() completionHandler(.failure(.invalidParameter)) return } @@ -135,6 +136,7 @@ extension QQHandler: ShareHandlerType { guard let url = message.link.absoluteString.bus.base64EncodedString else { + assertionFailure() completionHandler(.failure(.invalidParameter)) return } @@ -151,6 +153,7 @@ extension QQHandler: ShareHandlerType { guard let url = message.link.absoluteString.bus.base64EncodedString else { + assertionFailure() completionHandler(.failure(.invalidParameter)) return } @@ -163,6 +166,7 @@ extension QQHandler: ShareHandlerType { guard let url = message.link.absoluteString.bus.base64EncodedString else { + assertionFailure() completionHandler(.failure(.invalidParameter)) return } @@ -185,6 +189,7 @@ extension QQHandler: ShareHandlerType { let path = message.path.bus.base64EncodedString, let url = message.link.absoluteString.bus.base64EncodedString else { + assertionFailure() completionHandler(.failure(.invalidParameter)) return } @@ -238,6 +243,7 @@ extension QQHandler: ShareHandlerType { } guard let url = components.url else { + assertionFailure() completionHandler(.failure(.invalidParameter)) return } @@ -410,6 +416,7 @@ extension QQHandler: OauthHandlerType { } guard let url = components.url else { + assertionFailure() completionHandler(.failure(.invalidParameter)) return } @@ -502,6 +509,7 @@ extension QQHandler { }) guard let url = components.url else { + assertionFailure() shareCompletionHandler?(.failure(.invalidParameter)) return } From c839311818f67a7dde781feec239907475ce6a27 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Wed, 20 Jan 2021 16:45:03 +0800 Subject: [PATCH 19/20] fix: shareCompletionHandler --- NBus/Classes/Handler/QQHandler.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/NBus/Classes/Handler/QQHandler.swift b/NBus/Classes/Handler/QQHandler.swift index 7798d63..7203e91 100644 --- a/NBus/Classes/Handler/QQHandler.swift +++ b/NBus/Classes/Handler/QQHandler.swift @@ -490,6 +490,7 @@ extension QQHandler { var components = URLComponents(string: appSignRedirect) else { assertionFailure() + shareCompletionHandler?(.failure(.invalidParameter)) return } From 719efc4987977093f1fb323d1eb5e3874804b196 Mon Sep 17 00:00:00 2001 From: nuomi1 Date: Wed, 20 Jan 2021 19:35:40 +0800 Subject: [PATCH 20/20] bump to 0.8.1 --- NBus.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NBus.podspec b/NBus.podspec index b7dfd78..5e4a71b 100644 --- a/NBus.podspec +++ b/NBus.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "NBus" - s.version = "0.8.0" + s.version = "0.8.1" s.summary = "A short description of NBus." s.homepage = "https://github.com/nuomi1/NBus"