Skip to content

Commit be933b0

Browse files
committed
Merge branch 'release/0.8.1'
2 parents 2968de5 + 719efc4 commit be933b0

File tree

9 files changed

+157
-58
lines changed

9 files changed

+157
-58
lines changed

.github/workflows/swift.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Swift
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
7+
pull_request:
8+
branches: [develop]
9+
10+
env:
11+
DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer
12+
13+
jobs:
14+
build:
15+
runs-on: macos-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- uses: ruby/setup-ruby@v1
21+
with:
22+
bundler-cache: true
23+
24+
- name: Setup Xcode
25+
run: bundle exec fastlane setup
26+
27+
- name: SwiftLint
28+
run: bundle exec fastlane lint
29+
30+
- name: CocoaPods Lint
31+
run: bundle exec pod lib lint --allow-warnings

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.2

.swiftlint.yml

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ identifier_name:
1010
excluded:
1111
- qq
1212

13+
included:
14+
- Example
15+
- NBus
16+
1317
line_length:
1418
ignores_comments: true
1519
ignores_interpolated_strings: true

Example/NBus/AppDelegate.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4949
open url: URL,
5050
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
5151
) -> Bool {
52+
UIPasteboard.general.items = UIPasteboard.general.items
5253
logger.debug("\(url)")
5354
return Bus.shared.openURL(url)
5455
}
@@ -58,6 +59,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5859
continue userActivity: NSUserActivity,
5960
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
6061
) -> Bool {
62+
UIPasteboard.general.items = UIPasteboard.general.items
6163
logger.debug("\(userActivity.webpageURL!)")
6264
return Bus.shared.openUserActivity(userActivity)
6365
}
@@ -128,7 +130,6 @@ extension AppDelegate {
128130

129131
private func observeSDK() {
130132
pasteboardItems()
131-
.delay(.seconds(1), scheduler: MainScheduler.instance)
132133
.bind(onNext: { items in
133134
logger.debug("\(items)")
134135
})

Example/NBus/Model/AppState.swift

+30
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,36 @@ extension AppState.PlatformItem {
3737
}
3838
}
3939

40+
extension AppState.PlatformItem.Category: CustomStringConvertible {
41+
42+
var description: String {
43+
switch self {
44+
case .bus:
45+
return "开源"
46+
case .sdk:
47+
return "官方"
48+
}
49+
}
50+
}
51+
52+
extension AppState.PlatformItem.Category {
53+
54+
mutating func toggle() {
55+
switch self {
56+
case .bus:
57+
self = .sdk
58+
case .sdk:
59+
self = .bus
60+
}
61+
}
62+
63+
func toggled() -> Self {
64+
var copy = self
65+
copy.toggle()
66+
return copy
67+
}
68+
}
69+
4070
extension AppState {
4171

4272
func setup() {

Example/NBus/View/PlatformViewController.swift

+2-16
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,7 @@ extension PlatformViewController {
105105
.disposed(by: disposeBag)
106106

107107
viewModel.currentCategory
108-
.map {
109-
switch $0 {
110-
case .bus:
111-
return "开源"
112-
case .sdk:
113-
return "闭源"
114-
}
115-
}
108+
.map { category in "\(category)" }
116109
.bind(to: handlerBarButtonItem.rx.title)
117110
.disposed(by: disposeBag)
118111

@@ -125,14 +118,7 @@ extension PlatformViewController {
125118
handlerBarButtonItem.rx
126119
.tap
127120
.withLatestFrom(viewModel.currentCategory)
128-
.map {
129-
switch $0 {
130-
case .bus:
131-
return .sdk
132-
case .sdk:
133-
return .bus
134-
}
135-
}
121+
.map { category in category.toggled() }
136122
.bind(to: viewModel.currentCategory)
137123
.disposed(by: disposeBag)
138124

NBus.podspec

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "NBus"
3-
s.version = "0.8.0"
3+
s.version = "0.8.1"
44
s.summary = "A short description of NBus."
55

66
s.homepage = "https://github.com/nuomi1/NBus"
@@ -27,7 +27,7 @@ Pod::Spec.new do |s|
2727
end
2828

2929
s.subspec "Core" do |ss|
30-
ss.source_files = Dir.glob("NBus/Classes/Core/**/*.swift")
30+
ss.source_files = ["NBus/Classes/Core/**/*.swift"]
3131
end
3232

3333
s.subspec "QQSDKHandler" do |ss|
@@ -64,31 +64,30 @@ Pod::Spec.new do |s|
6464
end
6565

6666
s.subspec "QQSDK" do |ss|
67-
ss.vendored_frameworks = Dir.glob("NBus/Vendor/QQ_SDK/**/*.framework")
67+
ss.vendored_frameworks = ["NBus/Vendor/QQ_SDK/**/*.framework"]
6868
ss.frameworks = ["SystemConfiguration", "WebKit"]
6969

70-
ss.source_files = Dir.glob("NBus/Vendor/QQ_SDK/**/*.h")
71-
.reject { |name| name.include?("TencentOpenApiUmbrellaHeader.h") }
70+
ss.source_files = ["NBus/Vendor/QQ_SDK/**/*.h"]
7271

73-
ss.resources = Dir.glob("NBus/Vendor/QQ_SDK/**/*.bundle")
72+
ss.resources = ["NBus/Vendor/QQ_SDK/**/*.bundle"]
7473
end
7574

7675
s.subspec "WechatSDK" do |ss|
77-
ss.vendored_libraries = Dir.glob("NBus/Vendor/Wechat_SDK/**/*.a")
76+
ss.vendored_libraries = ["NBus/Vendor/Wechat_SDK/**/*.a"]
7877
ss.frameworks = ["WebKit"]
7978
ss.libraries = ["c++"]
8079

81-
ss.source_files = Dir.glob("NBus/Vendor/Wechat_SDK/**/*.h")
80+
ss.source_files = ["NBus/Vendor/Wechat_SDK/**/*.h"]
8281

8382
ss.pod_target_xcconfig = { "OTHER_LDFLAGS" => "-ObjC -all_load" }
8483
end
8584

8685
s.subspec "WeiboSDK" do |ss|
87-
ss.vendored_libraries = Dir.glob("NBus/Vendor/Weibo_SDK/**/*.a")
86+
ss.vendored_libraries = ["NBus/Vendor/Weibo_SDK/**/*.a"]
8887

89-
ss.source_files = Dir.glob("NBus/Vendor/Weibo_SDK/**/*.h")
88+
ss.source_files = ["NBus/Vendor/Weibo_SDK/**/*.h"]
9089

91-
ss.resources = Dir.glob("NBus/Vendor/Weibo_SDK/**/*.bundle")
90+
ss.resources = ["NBus/Vendor/Weibo_SDK/**/*.bundle"]
9291
end
9392

9493
s.prepare_command = <<-CMD
@@ -128,6 +127,8 @@ Pod::Spec.new do |s|
128127
QQ_SEARCH="Lite/TencentOpenApi(Lite)_3"
129128
download_sdk ${QQ} ${QQ_VER} ${QQ_URL} ${QQ_SHA1} ${QQ_SEARCH}
130129
130+
sed -i "" "s/imoort/import/g" "QQ_SDK/TencentOpenAPI.framework/Headers/TencentOpenApiUmbrellaHeader.h"
131+
131132
WECHAT="Wechat"
132133
WECHAT_VER="1.8.7.1"
133134
WECHAT_URL="https://res.wx.qq.com/op_res/DHI055JVxYur-5c7ss5McQZj2Y9KZQlp24xwD7FYnF88x8LA8rWCzSfdStN5tiCD"

NBus/Classes/Core/Bus+Wrapper.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ public protocol BusCompatible {
2121

2222
associatedtype BusBase
2323

24-
var bus: BusWrapper<BusBase> { get set }
24+
var bus: BusWrapper<BusBase> { get }
2525
}
2626

2727
extension BusCompatible {
2828

2929
public var bus: BusWrapper<Self> {
30-
get { BusWrapper(self) }
31-
set {}
30+
BusWrapper(self)
3231
}
3332
}
3433

0 commit comments

Comments
 (0)