-
-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathFetchLatestBundleResult.swift
More file actions
48 lines (45 loc) · 1.66 KB
/
FetchLatestBundleResult.swift
File metadata and controls
48 lines (45 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import Foundation
import Capacitor
@objc public class FetchLatestBundleResult: NSObject, Result {
private let artifactType: ArtifactType?
private let bundleId: String?
private let channel: String?
private let checksum: String?
private let customProperties: [String: Any]?
private let downloadUrl: String?
private let signature: String?
init(artifactType: ArtifactType?, bundleId: String?, channel: String?, checksum: String?, customProperties: [String: Any]?, downloadUrl: String?, signature: String?) {
self.artifactType = artifactType
self.bundleId = bundleId
self.channel = channel
self.checksum = checksum
self.customProperties = customProperties
self.downloadUrl = downloadUrl
self.signature = signature
}
public func toJSObject() -> AnyObject {
var result = JSObject()
if artifactType == .manifest {
result["artifactType"] = "manifest"
} else if artifactType == .zip {
result["artifactType"] = "zip"
}
result["bundleId"] = bundleId == nil ? NSNull() : bundleId
if let channel = channel {
result["channel"] = channel
}
if let checksum = checksum {
result["checksum"] = checksum
}
if let customProperties = JSTypes.coerceDictionaryToJSObject(customProperties) {
result["customProperties"] = customProperties
}
if let downloadUrl = downloadUrl {
result["downloadUrl"] = downloadUrl
}
if let signature = signature {
result["signature"] = signature
}
return result as AnyObject
}
}