Skip to content

Commit

Permalink
clear code
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Jan 11, 2021
1 parent c64a92c commit 09ed379
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 49 deletions.
8 changes: 4 additions & 4 deletions China.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
07211C7D23B8D40D0068A7C0 /* MonkeyKing+Program.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07211C7C23B8D40D0068A7C0 /* MonkeyKing+Program.swift */; };
07211C7F23B8D44C0068A7C0 /* MonkeyKing+OpenURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07211C7E23B8D44C0068A7C0 /* MonkeyKing+OpenURL.swift */; };
07211C8123B8EAE80068A7C0 /* MonkeyKing+SupportedPlatformCapable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07211C8023B8EAE80068A7C0 /* MonkeyKing+SupportedPlatformCapable.swift */; };
07FBF79325A883CE0061CC37 /* MonkeyKing+WeiboUniversalLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07FBF79225A883CE0061CC37 /* MonkeyKing+WeiboUniversalLink.swift */; };
07FBF79325A883CE0061CC37 /* MonkeyKing+WeiboLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07FBF79225A883CE0061CC37 /* MonkeyKing+WeiboLinks.swift */; };
10CDDF46237A8588005E8DE7 /* MonkeyKing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10CDDF3F237A8588005E8DE7 /* MonkeyKing.swift */; };
10CDDF47237A8588005E8DE7 /* Networking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10CDDF40237A8588005E8DE7 /* Networking.swift */; };
10CDDF48237A8588005E8DE7 /* MonkeyKing+WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10CDDF41237A8588005E8DE7 /* MonkeyKing+WebView.swift */; };
Expand Down Expand Up @@ -79,7 +79,7 @@
07211C7C23B8D40D0068A7C0 /* MonkeyKing+Program.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "MonkeyKing+Program.swift"; path = "Sources/MonkeyKing/MonkeyKing+Program.swift"; sourceTree = SOURCE_ROOT; };
07211C7E23B8D44C0068A7C0 /* MonkeyKing+OpenURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "MonkeyKing+OpenURL.swift"; path = "Sources/MonkeyKing/MonkeyKing+OpenURL.swift"; sourceTree = SOURCE_ROOT; };
07211C8023B8EAE80068A7C0 /* MonkeyKing+SupportedPlatformCapable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "MonkeyKing+SupportedPlatformCapable.swift"; path = "Sources/MonkeyKing/MonkeyKing+SupportedPlatformCapable.swift"; sourceTree = SOURCE_ROOT; };
07FBF79225A883CE0061CC37 /* MonkeyKing+WeiboUniversalLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "MonkeyKing+WeiboUniversalLink.swift"; path = "Sources/MonkeyKing/MonkeyKing+WeiboUniversalLink.swift"; sourceTree = SOURCE_ROOT; };
07FBF79225A883CE0061CC37 /* MonkeyKing+WeiboLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "MonkeyKing+WeiboLinks.swift"; path = "Sources/MonkeyKing/MonkeyKing+WeiboLinks.swift"; sourceTree = SOURCE_ROOT; };
10CDDF3F237A8588005E8DE7 /* MonkeyKing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MonkeyKing.swift; path = Sources/MonkeyKing/MonkeyKing.swift; sourceTree = SOURCE_ROOT; };
10CDDF40237A8588005E8DE7 /* Networking.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Networking.swift; path = Sources/MonkeyKing/Networking.swift; sourceTree = SOURCE_ROOT; };
10CDDF41237A8588005E8DE7 /* MonkeyKing+WebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "MonkeyKing+WebView.swift"; path = "Sources/MonkeyKing/MonkeyKing+WebView.swift"; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -191,7 +191,7 @@
10CDDF44237A8588005E8DE7 /* Extensions.swift */,
10CDDF43237A8588005E8DE7 /* Helpers.swift */,
10CDDF3F237A8588005E8DE7 /* MonkeyKing.swift */,
07FBF79225A883CE0061CC37 /* MonkeyKing+WeiboUniversalLink.swift */,
07FBF79225A883CE0061CC37 /* MonkeyKing+WeiboLinks.swift */,
10CDDF45237A8588005E8DE7 /* MonkeyKing+Error.swift */,
07211C7223B8D1AA0068A7C0 /* MonkeyKing+handleOpenURL.swift */,
D71A624324D313E5002B2977 /* MonkeyKing+WeChatUniversalLink.swift */,
Expand Down Expand Up @@ -375,7 +375,7 @@
10CDDF46237A8588005E8DE7 /* MonkeyKing.swift in Sources */,
10CDDF4A237A8588005E8DE7 /* Helpers.swift in Sources */,
10CDDF47237A8588005E8DE7 /* Networking.swift in Sources */,
07FBF79325A883CE0061CC37 /* MonkeyKing+WeiboUniversalLink.swift in Sources */,
07FBF79325A883CE0061CC37 /* MonkeyKing+WeiboLinks.swift in Sources */,
07211C8123B8EAE80068A7C0 /* MonkeyKing+SupportedPlatformCapable.swift in Sources */,
07211C7B23B8D3A60068A7C0 /* MonkeyKing+OAuth.swift in Sources */,
07211C7D23B8D40D0068A7C0 /* MonkeyKing+Program.swift in Sources */,
Expand Down
37 changes: 37 additions & 0 deletions Sources/MonkeyKing/MonkeyKing+WeiboLinks.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Foundation

extension MonkeyKing {

static func weiboSchemeLink(uuidString: String) -> URL? {
var components = URLComponents(string: "weibosdk://request")

components?.queryItems = [
.init(name: "id", value: uuidString),
.init(name: "sdkversion", value: "003233000"),
.init(name: "luicode", value: "10000360"),
.init(name: "lfid", value: Bundle.main.monkeyking_bundleID ?? ""),
.init(name: "newVersion", value: "3.3"),
]

return components?.url
}

static func weiboUniversalLink(query: String?) -> URL? {
var components = URLComponents(string: "https://open.weibo.com/weibosdk/request")

components?.query = query

if let index = components?.queryItems?.firstIndex(where: { $0.name == "id" }) {
components?.queryItems?[index].name = "objId"
} else {
assertionFailure()
return nil
}

components?.queryItems?.append(
.init(name: "urltype", value: "link")
)

return components?.url
}
}
45 changes: 0 additions & 45 deletions Sources/MonkeyKing/MonkeyKing+WeiboUniversalLink.swift

This file was deleted.

0 comments on commit 09ed379

Please sign in to comment.