Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 183ed91cb8 | |||
| c241dcf1df | |||
| 8007fa6f0f | |||
| 987be40c91 |
+2
-2
@@ -1,2 +1,2 @@
|
||||
github "pvzig/Starscream" "98d7ccea30621d51a93ee5c155b3f670e37e037b"
|
||||
github "pvzig/swifter" "8adfae89a6d34cfea1c20d53d8112d1d69e01bd0"
|
||||
github "pvzig/Starscream" "2fde5c5eb9302439e634753c3aacc794ca2e42e8"
|
||||
github "pvzig/swifter" "ddbebdde19360a2c9e4e01e5a0642dd12082cc92"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = ""
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user