Skip to content

Commit

Permalink
Merge branch 'release/0.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
nuomi1 committed Jan 20, 2021
2 parents 2968de5 + 719efc4 commit be933b0
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 58 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.2
4 changes: 4 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ identifier_name:
excluded:
- qq

included:
- Example
- NBus

line_length:
ignores_comments: true
ignores_interpolated_strings: true
Expand Down
3 changes: 2 additions & 1 deletion Example/NBus/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -128,7 +130,6 @@ extension AppDelegate {

private func observeSDK() {
pasteboardItems()
.delay(.seconds(1), scheduler: MainScheduler.instance)
.bind(onNext: { items in
logger.debug("\(items)")
})
Expand Down
30 changes: 30 additions & 0 deletions Example/NBus/Model/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@ extension AppState.PlatformItem {
}
}

extension AppState.PlatformItem.Category: CustomStringConvertible {

var description: String {
switch self {
case .bus:
return "开源"
case .sdk:
return "官方"
}
}
}

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() {
Expand Down
18 changes: 2 additions & 16 deletions Example/NBus/View/PlatformViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -125,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)

Expand Down
23 changes: 12 additions & 11 deletions NBus.podspec
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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|
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -128,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"
Expand Down
5 changes: 2 additions & 3 deletions NBus/Classes/Core/Bus+Wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ public protocol BusCompatible {

associatedtype BusBase

var bus: BusWrapper<BusBase> { get set }
var bus: BusWrapper<BusBase> { get }
}

extension BusCompatible {

public var bus: BusWrapper<Self> {
get { BusWrapper(self) }
set {}
BusWrapper(self)
}
}

Expand Down
Loading

0 comments on commit be933b0

Please sign in to comment.