Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 94c9f7fe5a | |||
| be8a5879f3 | |||
| c657919704 | |||
| abeef21d7a | |||
| 79e3b14593 | |||
| d9a4cda9b0 | |||
| 12b316da0b | |||
| 13cade5c00 | |||
| 051e8dd6c8 | |||
| 1adea1c54e |
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SlackKit"
|
||||
s.version = "3.1.8"
|
||||
s.version = "3.1.9"
|
||||
s.summary = "a Slack client library for OS X, iOS, and tvOS written in Swift"
|
||||
s.homepage = "https://github.com/pvzig/SlackKit"
|
||||
s.license = 'MIT'
|
||||
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.requires_arc = true
|
||||
s.source_files = 'SlackKit/Sources/*.swift'
|
||||
s.source_files = 'Sources/SlackKit/**/*.swift'
|
||||
s.frameworks = 'Foundation'
|
||||
s.dependency 'Starscream'
|
||||
s.dependency 'Swifter'
|
||||
|
||||
@@ -41,6 +41,8 @@ public struct Attachment {
|
||||
public let footer: String?
|
||||
public let footerIcon: String?
|
||||
public let ts: Int?
|
||||
|
||||
public let markdownEnabledFields: Set<AttachmentTextField>?
|
||||
|
||||
internal init(attachment: [String: Any]?) {
|
||||
fallback = attachment?["fallback"] as? String
|
||||
@@ -61,9 +63,11 @@ public struct Attachment {
|
||||
ts = attachment?["ts"] as? Int
|
||||
fields = (attachment?["fields"] as? [[String: Any]])?.map { AttachmentField(field: $0) }
|
||||
actions = (attachment?["actions"] as? [[String: Any]])?.map { Action(action: $0) }
|
||||
|
||||
markdownEnabledFields = (attachment?["mrkdwn_in"] as? [String]).map { Set($0.flatMap(AttachmentTextField.init)) }
|
||||
}
|
||||
|
||||
public init(fallback: String, title:String, callbackID: String? = nil, type: String? = nil, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, actions: [Action]? = nil, imageURL: String? = nil, thumbURL: String? = nil, footer: String? = nil, footerIcon:String? = nil, ts:Int? = nil) {
|
||||
public init(fallback: String, title: String?, callbackID: String? = nil, type: String? = nil, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, actions: [Action]? = nil, imageURL: String? = nil, thumbURL: String? = nil, footer: String? = nil, footerIcon:String? = nil, ts:Int? = nil, markdownFields: Set<AttachmentTextField>? = nil) {
|
||||
self.fallback = fallback
|
||||
self.callbackID = callbackID
|
||||
self.type = type
|
||||
@@ -82,6 +86,7 @@ public struct Attachment {
|
||||
self.footer = footer
|
||||
self.footerIcon = footerIcon
|
||||
self.ts = ts
|
||||
self.markdownEnabledFields = markdownFields
|
||||
}
|
||||
|
||||
internal var dictionary: [String: Any] {
|
||||
@@ -91,7 +96,7 @@ public struct Attachment {
|
||||
attachment["attachment_type"] = type
|
||||
attachment["color"] = color
|
||||
attachment["pretext"] = pretext
|
||||
attachment["authorName"] = authorName
|
||||
attachment["author_name"] = authorName
|
||||
attachment["author_link"] = authorLink
|
||||
attachment["author_icon"] = authorIcon
|
||||
attachment["title"] = title
|
||||
@@ -104,6 +109,7 @@ public struct Attachment {
|
||||
attachment["footer"] = footer
|
||||
attachment["footer_icon"] = footerIcon
|
||||
attachment["ts"] = ts
|
||||
attachment["mrkdwn_in"] = markdownEnabledFields?.map { $0.rawValue }
|
||||
return attachment
|
||||
}
|
||||
}
|
||||
@@ -113,3 +119,13 @@ public enum AttachmentColor: String {
|
||||
case warning = "warning"
|
||||
case danger = "danger"
|
||||
}
|
||||
|
||||
public enum AttachmentTextField: String {
|
||||
case fallback = "fallback"
|
||||
case pretext = "pretext"
|
||||
case authorName = "author_name"
|
||||
case title = "title"
|
||||
case text = "text"
|
||||
case fields = "fields"
|
||||
case footer = "footer"
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ public struct AttachmentField {
|
||||
short = field?["short"] as? Bool
|
||||
}
|
||||
|
||||
public init(title:String, value:String, short: Bool? = nil) {
|
||||
public init(title: String?, value: String?, short: Bool? = nil) {
|
||||
self.title = title
|
||||
self.value = value.slackFormatEscaping
|
||||
self.value = value?.slackFormatEscaping
|
||||
self.short = short
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,10 @@ public struct OAuthServer {
|
||||
|
||||
private func oauthURLRequest(_ authorize: AuthorizeRequest) -> URLRequest? {
|
||||
var components = URLComponents(string: "\(oauthURL)")
|
||||
components?.queryItems = [URLQueryItem(name: "client_id", value: "\(authorize.clientID)")]
|
||||
components?.queryItems = [
|
||||
URLQueryItem(name: "client_id", value: "\(authorize.clientID)"),
|
||||
URLQueryItem(name: "scope", value: "\(authorize.scope)"),
|
||||
]
|
||||
guard let url = components?.url else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.1.8</string>
|
||||
<string>3.1.9</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.1.8</string>
|
||||
<string>3.1.9</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
Reference in New Issue
Block a user