Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0eb9ea31e1 | |||
| 8865376c3c | |||
| d86d0108ff | |||
| b45b7085ce | |||
| 91193c6b2e | |||
| 9720b1c05c | |||
| 9766a5ad6c | |||
| 1e181e7580 | |||
| f6d6c779ae | |||
| 11bb50f8d2 | |||
| d721e0ba1a | |||
| ba6066875c | |||
| 0f1a1a9de5 | |||
| a81cebf5c8 | |||
| 94c9f7fe5a | |||
| be8a5879f3 | |||
| c657919704 | |||
| abeef21d7a | |||
| 79e3b14593 | |||
| d9a4cda9b0 | |||
| 12b316da0b | |||
| 13cade5c00 | |||
| 051e8dd6c8 | |||
| 1adea1c54e |
@@ -1,2 +1,2 @@
|
||||
github "https://github.com/daltoniam/Starscream" == 2.0.2
|
||||
github "https://github.com/pvzig/swifter.git" == 3.0.4
|
||||
github "https://github.com/daltoniam/Starscream" == 2.0.3
|
||||
github "https://github.com/httpswift/swifter" == 1.3.3
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
github "daltoniam/Starscream" "2.0.2"
|
||||
github "pvzig/swifter" "3.0.4"
|
||||
+2
-3
@@ -4,8 +4,7 @@ let package = Package(
|
||||
name: "SlackKit",
|
||||
targets: [],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/swifter.git",
|
||||
majorVersion: 3, minor: 0),
|
||||
.Package(url: "https://github.com/daltoniam/Starscream", majorVersion: 2, minor: 0)
|
||||
.Package(url: "https://github.com/httpswift/swifter", majorVersion: 1),
|
||||
.Package(url: "https://github.com/daltoniam/Starscream", majorVersion: 2)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -3,16 +3,16 @@ source 'https://github.com/CocoaPods/Specs.git'
|
||||
use_frameworks!
|
||||
|
||||
target 'SlackKit OS X' do
|
||||
pod 'Starscream', '~> 2.0.2'
|
||||
pod 'Swifter', :git => 'https://github.com/pvzig/swifter.git', :tag => '3.0.4'
|
||||
pod 'Starscream', '~> 2.0.3'
|
||||
pod 'Swifter', '~> 1.3.3'
|
||||
end
|
||||
|
||||
target 'SlackKit iOS' do
|
||||
pod 'Starscream', '~> 2.0.2'
|
||||
pod 'Swifter', :git => 'https://github.com/pvzig/swifter.git', :tag => '3.0.4'
|
||||
pod 'Starscream', '~> 2.0.3'
|
||||
pod 'Swifter', '~> 1.3.3'
|
||||
end
|
||||
|
||||
target 'SlackKit tvOS' do
|
||||
pod 'Starscream', '~> 2.0.2'
|
||||
pod 'Swifter', :git => 'https://github.com/pvzig/swifter.git', :tag => '3.0.4'
|
||||
end
|
||||
pod 'Starscream', '~> 2.0.3'
|
||||
pod 'Swifter', '~> 1.3.3'
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
PODS:
|
||||
- Starscream (2.0.2)
|
||||
- Swifter (1.3.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Starscream (~> 2.0.2)
|
||||
- Swifter (from `https://github.com/pvzig/swifter.git`, tag `3.0.4`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Swifter:
|
||||
:git: https://github.com/pvzig/swifter.git
|
||||
:tag: 3.0.4
|
||||
|
||||
CHECKOUT OPTIONS:
|
||||
Swifter:
|
||||
:git: https://github.com/pvzig/swifter.git
|
||||
:tag: 3.0.4
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Starscream: 6c135a34e0a6e60cedaa0b30db67a4c05cf7cd38
|
||||
Swifter: dd1800ba8eb3e28b22b8bd20f91a8561a0110fac
|
||||
|
||||
PODFILE CHECKSUM: cd86ea0f8422027c9d5fa3c40243ae7a816fb79a
|
||||
|
||||
COCOAPODS: 1.1.0.rc.3
|
||||
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
   [](https://cocoapods.org) [](https://github.com/Carthage/Carthage) [](https://github.com/apple/swift-package-manager)
|
||||
   [](https://cocoapods.org) [](https://github.com/Carthage/Carthage) [](https://github.com/apple/swift-package-manager)
|
||||
## SlackKit: A Swift Slack Client Library
|
||||
### Description
|
||||
|
||||
@@ -18,7 +18,7 @@ To build the SlackKit project directly, first build the dependencies using Carth
|
||||
Add SlackKit to your pod file:
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SlackKit', '~> 3.1.7'
|
||||
pod 'SlackKit', '~> 3.1.11'
|
||||
```
|
||||
and run
|
||||
```
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SlackKit"
|
||||
s.version = "3.1.8"
|
||||
s.version = "3.1.10"
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ internal struct NetworkInterface {
|
||||
}
|
||||
|
||||
internal func customRequest(_ url: String, data: Data, success: @escaping (Bool)->Void, errorClosure: @escaping (SlackError)->Void) {
|
||||
guard let url = URL(string: url.removePercentEncoding()) else {
|
||||
guard let string = url.removingPercentEncoding, let url = URL(string: string) else {
|
||||
errorClosure(SlackError.clientNetworkError)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -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.11</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.11</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
Reference in New Issue
Block a user