Compare commits

...

5 Commits

Author SHA1 Message Date
Peter Zignego 183ed91cb8 Merge branch 'xcode8b4' into swift3 2016-08-03 22:47:16 -04:00
Peter Zignego c241dcf1df Xcode 8 beta 4 2016-08-03 22:47:03 -04:00
Peter Zignego 8007fa6f0f Include style in Action JSON dictionary 2016-08-02 23:24:12 -04:00
Peter Zignego 987be40c91 Fix callback bug when authing via a token 2016-07-26 19:07:53 -04:00
Peter Zignego 2e71ac6876 Bug fix 2016-07-23 11:12:14 -04:00
9 changed files with 14 additions and 11 deletions
+2 -2
View File
@@ -1,2 +1,2 @@
github "pvzig/Starscream" "98d7ccea30621d51a93ee5c155b3f670e37e037b"
github "pvzig/swifter" "8adfae89a6d34cfea1c20d53d8112d1d69e01bd0"
github "pvzig/Starscream" "2fde5c5eb9302439e634753c3aacc794ca2e42e8"
github "pvzig/swifter" "ddbebdde19360a2c9e4e01e5a0642dd12082cc92"
+1
View File
@@ -54,6 +54,7 @@ public struct Action {
dict["text"] = text
dict["type"] = type
dict["value"] = value
dict["style"] = style?.rawValue
dict["confirm"] = confirm?.dictionary()
return dict
}
+2 -2
View File
@@ -80,11 +80,11 @@ internal extension Client {
channelEventsDelegate?.userTyping(self, channel: channel, user: user)
let timeout = DispatchTime.now() + Double(Int64(5.0 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
DispatchQueue.main.after(when: timeout) {
DispatchQueue.main.asyncAfter(deadline: timeout, execute: {
if let index = self.channels[channelID]?.usersTyping.index(of: userID) {
self.channels[channelID]?.usersTyping.remove(at: index)
}
}
})
}
func channelMarked(_ event: Event) {
+1 -1
View File
@@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
public enum ClientError: ErrorProtocol {
public enum ClientError: Error {
case channelDoesNotExist
case userDoesNotExist
}
+2 -2
View File
@@ -44,7 +44,7 @@ public final class Client: WebSocketDelegate {
}
internal var webSocket: WebSocket?
private let pingPongQueue = DispatchQueue(label: "com.launchsoft.SlackKit", attributes: DispatchQueueAttributes.serial)
private let pingPongQueue = DispatchQueue(label: "com.launchsoft.SlackKit")
internal var ping: Double?
internal var pong: Double?
internal var options: ClientOptions?
@@ -128,7 +128,7 @@ public final class Client: WebSocketDelegate {
//MARK: - RTM Ping
private func pingRTMServerAtInterval(_ interval: TimeInterval) {
let delay = DispatchTime.now() + Double(Int64(interval * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
pingPongQueue.after(when: delay, execute: {
pingPongQueue.asyncAfter(deadline: delay, execute: {
guard self.connected && self.timeoutCheck() else {
self.disconnect()
return
+1 -1
View File
@@ -42,7 +42,7 @@ internal extension String {
}
internal extension Dictionary where Key: StringLiteralConvertible, Value: AnyObject {
internal extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject {
var requestStringFromParameters: String {
var requestString = ""
+1 -1
View File
@@ -37,7 +37,7 @@ public struct Response {
var json = [String : AnyObject]()
json["text"] = text
json["response_type"] = responseType?.rawValue
json["attachments"] = attachments?.flatMap({$0.dictionary()})
json["attachments"] = attachments?.map({$0.dictionary()})
return json
}
+1 -1
View File
@@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
public enum SlackError: String, ErrorProtocol {
public enum SlackError: String, Error {
case AccountInactive = "account_inactive"
case AlreadyArchived = "already_archived"
case AlreadyInChannel = "already_in_channel"
+3 -1
View File
@@ -35,7 +35,9 @@ public final class SlackKit: OAuthDelegate {
public init(withAPIToken token: String, clientOptions: ClientOptions = ClientOptions()) {
self.clientOptions = clientOptions
let client = Client(apiToken: token)
self.onClientInitalization?(client)
DispatchQueue.main.async(execute: {
self.onClientInitalization?(client)
})
clients[token] = client
client.connect(options: self.clientOptions)
}