Skip to content

Commit

Permalink
Merge branch 'release/0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nuomi1 committed Feb 1, 2021
2 parents 9c1d7aa + 5aa2e22 commit 8713d0e
Show file tree
Hide file tree
Showing 10 changed files with 574 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Example/NBus/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ extension AppDelegate {
let pasteboard = UIPasteboard.general

pasteboard.items = []

pasteboard.string = "NBus"
}

private func clearUserDefaults() {
Expand Down
6 changes: 6 additions & 0 deletions Example/NBus/Model/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,16 @@ extension AppState {
logger.debug("\(message)", file: file, function: function, line: line)
}

let wechatHandler = WechatHandler(
appID: AppState.getAppID(for: Platforms.wechat)!,
universalLink: AppState.getUniversalLink(for: Platforms.wechat)!
)

let wechatItem = AppState.PlatformItem(
platform: Platforms.wechat,
category: .sdk,
handlers: [
.bus: wechatHandler,
.sdk: wechatSDKHandler,
],
viewController: { PlatformViewController() }
Expand Down
7 changes: 6 additions & 1 deletion Example/NBus/Model/MediaSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,16 @@ enum MediaSource {

let miniProgramID = AppState.getMiniProgramID(for: Platforms.wechat)!

let dataAsset = NSDataAsset(name: "giphy-J1ZajKJKzD0PK")!
let data = dataAsset.data
let thumbnail = UIImage(data: data)?.jpegData(compressionQuality: 0.2)

return Messages.miniProgram(
miniProgramID: miniProgramID,
path: path,
link: url,
miniProgramType: .release
miniProgramType: .release,
thumbnail: thumbnail
)
}()
}
29 changes: 16 additions & 13 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
PODS:
- NBus/BusHandlers (0.8.1):
- NBus/BusHandlers (0.9.1):
- NBus/QQHandler
- NBus/SystemHandler
- NBus/WechatHandler
- NBus/WeiboHandler
- NBus/Core (0.8.1)
- NBus/QQHandler (0.8.1):
- NBus/Core (0.9.1)
- NBus/QQHandler (0.9.1):
- NBus/Core
- NBus/QQSDK (0.8.1)
- NBus/QQSDKHandler (0.8.1):
- NBus/QQSDK (0.9.1)
- NBus/QQSDKHandler (0.9.1):
- NBus/Core
- NBus/QQSDK
- NBus/SDKHandlers (0.8.1):
- NBus/SDKHandlers (0.9.1):
- NBus/QQSDKHandler
- NBus/SystemHandler
- NBus/WechatSDKHandler
- NBus/WeiboSDKHandler
- NBus/SystemHandler (0.8.1):
- NBus/SystemHandler (0.9.1):
- NBus/Core
- NBus/WechatSDK (0.8.1)
- NBus/WechatSDKHandler (0.8.1):
- NBus/WechatHandler (0.9.1):
- NBus/Core
- NBus/WechatSDK (0.9.1)
- NBus/WechatSDKHandler (0.9.1):
- NBus/Core
- NBus/WechatSDK
- NBus/WeiboHandler (0.8.1):
- NBus/WeiboHandler (0.9.1):
- NBus/Core
- NBus/WeiboSDK (0.8.1)
- NBus/WeiboSDKHandler (0.8.1):
- NBus/WeiboSDK (0.9.1)
- NBus/WeiboSDKHandler (0.9.1):
- NBus/Core
- NBus/WeiboSDK
- PinLayout (1.9.3)
Expand Down Expand Up @@ -59,7 +62,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
NBus: 97c14cb69f0ec19bd0752f5e25a3518849b81f8c
NBus: 8ecb3a7eb79360d65d22b5ca785164ca371f106d
PinLayout: 4d8733121f8687edcc8f00c19bf1379d12808767
RxCocoa: 3f79328fafa3645b34600f37c31e64c73ae3a80e
RxRelay: 8d593be109c06ea850df027351beba614b012ffb
Expand Down
9 changes: 8 additions & 1 deletion 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.9.1"
s.version = "0.10.0"
s.summary = "A short description of NBus."

s.homepage = "https://github.com/nuomi1/NBus"
Expand All @@ -16,6 +16,7 @@ Pod::Spec.new do |s|

s.subspec "BusHandlers" do |ss|
ss.dependency "NBus/QQHandler"
ss.dependency "NBus/WechatHandler"
ss.dependency "NBus/WeiboHandler"
ss.dependency "NBus/SystemHandler"
end
Expand Down Expand Up @@ -51,6 +52,12 @@ Pod::Spec.new do |s|
ss.source_files = ["NBus/Classes/Handler/WechatSDKHandler.swift"]
end

s.subspec "WechatHandler" do |ss|
ss.dependency "NBus/Core"

ss.source_files = ["NBus/Classes/Handler/WechatHandler.swift"]
end

s.subspec "WeiboSDKHandler" do |ss|
ss.dependency "NBus/Core"
ss.dependency "NBus/WeiboSDK"
Expand Down
13 changes: 13 additions & 0 deletions NBus/Classes/Core/Bus+Helper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2020 nuomi1. All rights reserved.
//

import CommonCrypto
import Foundation

extension Dictionary: BusCompatible {}
Expand All @@ -30,6 +31,18 @@ extension BusWrapper where Base == String {
var base64EncodedString: String? {
base.data(using: .utf8)?.base64EncodedString()
}

var sha1: String? {
let data = Data(base.utf8)

var digest = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH))
data.withUnsafeBytes { pointer in
_ = CC_SHA1(pointer.baseAddress, CC_LONG(data.count), &digest)
}

let bytes = digest.map { String(format: "%02hhx", $0) }
return bytes.joined()
}
}

extension NSObject: BusCompatible {}
Expand Down
5 changes: 5 additions & 0 deletions NBus/Classes/Core/Bus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,10 @@ extension Bus {

public static let accessToken = Bus.OauthInfoKey(rawValue: "com.nuomi1.bus.weibo.accessToken")
}

enum Wechat {

public static let code = Bus.OauthInfoKey(rawValue: "com.nuomi1.bus.wechat.code")
}
}
}
Loading

0 comments on commit 8713d0e

Please sign in to comment.