Compare commits
350 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43dda4a2f0 | |||
| 2f0978ccc4 | |||
| 71c5eda4a1 | |||
| 4b241374ea | |||
| dd07b545c7 | |||
| af4ba6623c | |||
| 435607d170 | |||
| 8094bd2c6c | |||
| d8d22f6083 | |||
| 6fcfe2fda4 | |||
| 6ccce1875b | |||
| 433fc1a8ff | |||
| 4f64c952b8 | |||
| 139b25a7f0 | |||
| 3ee4e0fd1d | |||
| f013840cae | |||
| 79457aa13d | |||
| ac2657b7e1 | |||
| 82130f2e67 | |||
| b9573c4e8b | |||
| 6481620e7a | |||
| 35e7ead8d1 | |||
| 0f896fdaee | |||
| 8a4fceaa00 | |||
| 6007f790db | |||
| 05e7f2baa3 | |||
| 39871172e9 | |||
| 491f80741b | |||
| 0eb9ea31e1 | |||
| 8865376c3c | |||
| d86d0108ff | |||
| b45b7085ce | |||
| 91193c6b2e | |||
| 9720b1c05c | |||
| 9766a5ad6c | |||
| 1e181e7580 | |||
| f6d6c779ae | |||
| 11bb50f8d2 | |||
| d721e0ba1a | |||
| ba6066875c | |||
| 0f1a1a9de5 | |||
| a81cebf5c8 | |||
| 007ec7ab69 | |||
| b93d411f63 | |||
| 741a23809d | |||
| a92fd36c17 | |||
| e122610c04 | |||
| 0539e0bac2 | |||
| 3416161818 | |||
| 32a4aa13ea | |||
| cf188ffb6a | |||
| f1a1963ac8 | |||
| 645797b72e | |||
| b9f808f70e | |||
| 74ef3979f5 | |||
| 992879f54f | |||
| ccdf9d5d3c | |||
| 0336b5a9b6 | |||
| aefbeafd28 | |||
| bc6c07f045 | |||
| db24e66d33 | |||
| ef70f935c1 | |||
| afbf8ab6fe | |||
| d39296f496 | |||
| eafceb4645 | |||
| 83cf85a27a | |||
| 06e250a954 | |||
| 5b6622a961 | |||
| a58e291d2e | |||
| a0e1f9844e | |||
| 7d524ddeac | |||
| 94c9f7fe5a | |||
| be8a5879f3 | |||
| c657919704 | |||
| abeef21d7a | |||
| 79e3b14593 | |||
| d9a4cda9b0 | |||
| 12b316da0b | |||
| 13cade5c00 | |||
| 051e8dd6c8 | |||
| 1adea1c54e | |||
| aa51cfb2fd | |||
| 6b8885bd29 | |||
| e0fbf1ab4e | |||
| 366c6e7b77 | |||
| 378c116d9b | |||
| 58bade8ec9 | |||
| 7d7f5c40d6 | |||
| c9fd54d106 | |||
| 2f1ce799ad | |||
| 7f02f4cf99 | |||
| a9066c0d0a | |||
| 29739dba74 | |||
| d60a7094a4 | |||
| 7edd4210f6 | |||
| 2abaecbd14 | |||
| 346499e03b | |||
| bc72a52bf5 | |||
| 0ebd3cb0e7 | |||
| 5d7064ee13 | |||
| d02768ddad | |||
| dbc7b361c8 | |||
| a0de46e3c7 | |||
| 2d6e19baee | |||
| 21ec3cb2a1 | |||
| cb542da068 | |||
| 788b4e4f7a | |||
| 24b2292cba | |||
| 72866262d2 | |||
| acabbb6c03 | |||
| fff0f0befc | |||
| cf0675dac2 | |||
| 1cffa0ba74 | |||
| 9ebd8182a6 | |||
| 63a8ae7f08 | |||
| 992f94e870 | |||
| 1c476c77ad | |||
| 28bd612ca0 | |||
| 45cf2a7ac0 | |||
| f7c986c65c | |||
| ca43df4475 | |||
| ef71b6abf0 | |||
| 3ff922a2c0 | |||
| 646c371bd3 | |||
| 36401009f8 | |||
| b837554dcf | |||
| 0ba0e019ae | |||
| 8771ef3f0a | |||
| 71e7238483 | |||
| b75c10fca6 | |||
| 50f85ac103 | |||
| a7cbb84b34 | |||
| ed6789c9a5 | |||
| ca444930a4 | |||
| 21051864ec | |||
| 36d1553072 | |||
| eb14758846 | |||
| bf3a5c2422 | |||
| 98fd1342e7 | |||
| 183ed91cb8 | |||
| c241dcf1df | |||
| 8007fa6f0f | |||
| 7ab973a03b | |||
| 1889ffeeee | |||
| 987be40c91 | |||
| 2e71ac6876 | |||
| df661762a9 | |||
| c428cac537 | |||
| 18c6516df9 | |||
| fe450a7db2 | |||
| bb57f59553 | |||
| e5a4a67bdb | |||
| 1e304f1f6d | |||
| 81ebf86abd | |||
| afa16e98b3 | |||
| 6596bb2861 | |||
| fd12ab0600 | |||
| 31508e44dc | |||
| b980f371f6 | |||
| 9526d739e1 | |||
| c3af5c33be | |||
| c6258c57a0 | |||
| 45e075aca2 | |||
| 5ebe40a389 | |||
| 0a5a8f83f7 | |||
| 8f4a287ad0 | |||
| deadc8855a | |||
| 98155f00b7 | |||
| a55d3be65b | |||
| 3b8f1834f0 | |||
| 34972eb8af | |||
| f21179f567 | |||
| e1bf5a160f | |||
| c66a5fe0db | |||
| f03908bcc7 | |||
| 591b0d9d55 | |||
| 6e83fb93d8 | |||
| c1d202f433 | |||
| c7db8ac578 | |||
| d2e430e5bf | |||
| ebe169bf2a | |||
| ca36653dc4 | |||
| 94895edfac | |||
| 3ea13ac6c4 | |||
| e94adfc019 | |||
| 1291323c5a | |||
| 4ceb452e6b | |||
| 457504e786 | |||
| 6d9a939575 | |||
| efc3847a20 | |||
| 3ed139b503 | |||
| a4d9083f72 | |||
| 67b2fa95b3 | |||
| e031f85447 | |||
| 0b1dc6068e | |||
| b027b5b779 | |||
| e507c85ca2 | |||
| 145dfccfae | |||
| b4ca2bcc07 | |||
| 85b2d920ad | |||
| 6415a113ed | |||
| 3a2324b279 | |||
| d647a6b0c9 | |||
| 4230d7841c | |||
| 8995a54d15 | |||
| ba43a123ea | |||
| d00419dc18 | |||
| 15f3a30ba9 | |||
| befa53e3a9 | |||
| 35dfa840e8 | |||
| edf56e1678 | |||
| 3eab323564 | |||
| 0b2ee1d10e | |||
| 5444948940 | |||
| 13335b5de1 | |||
| c8d8e18db6 | |||
| c11321c116 | |||
| 0041a118a7 | |||
| 6cb5280cf5 | |||
| 9cad043957 | |||
| fa15ed8751 | |||
| 0c9c146d58 | |||
| 109a20fac2 | |||
| a6cf1e3cb6 | |||
| d3c16bed5f | |||
| 797d95ab75 | |||
| efb7bc9458 | |||
| 79e59f23fb | |||
| 01e199659e | |||
| 851b2f5e14 | |||
| c506512800 | |||
| 20fa05605b | |||
| 30baf1f76c | |||
| 1c3f01f861 | |||
| 47dc9b3d9f | |||
| b9e828ef3d | |||
| b2be8d0170 | |||
| 45be1b7a3f | |||
| 09aa72d43e | |||
| bf4b55bbd6 | |||
| a82279fad1 | |||
| 500e489d5d | |||
| 874f4f51e1 | |||
| 654f419f4e | |||
| a7c25fe33b | |||
| d2037f4cc5 | |||
| b87232dfb5 | |||
| 9e5678739f | |||
| 5cc8582d65 | |||
| aa078934c0 | |||
| 5c157caea3 | |||
| b567113b5f | |||
| 5b08fb6031 | |||
| b48f33fb72 | |||
| deccb727a1 | |||
| 8f1df8d138 | |||
| 0048710e24 | |||
| f6da0ddd32 | |||
| 513485e704 | |||
| fb3719c29d | |||
| 76fdc55f9e | |||
| 687b57fc1f | |||
| 319dc9a095 | |||
| 64440b5c5b | |||
| 3efe5752cb | |||
| 31f69e3afd | |||
| 72b29562e5 | |||
| 2b26eb35d7 | |||
| c4c8e99c0b | |||
| 5efe222196 | |||
| e56ff971b2 | |||
| 18b8a31d85 | |||
| d386730c75 | |||
| bc6e94d99a | |||
| 89f5e3786e | |||
| 0665ea0270 | |||
| 4ebc33b59a | |||
| 9e93806437 | |||
| 572e363717 | |||
| d8c8c3cb57 | |||
| 02eff541b1 | |||
| 92d6d833ea | |||
| 78b73c4c99 | |||
| dee376e1b9 | |||
| 5550658d83 | |||
| 82978bb963 | |||
| 0a203bbc68 | |||
| 38a762c60b | |||
| 96543932af | |||
| 39fa80904f | |||
| e4f0429ffb | |||
| ab41c148cd | |||
| a74aba3c5e | |||
| 9f266fff64 | |||
| 78d31af3f7 | |||
| 1a787019ec | |||
| f2f25763e7 | |||
| de3cf52687 | |||
| 49b151cd98 | |||
| e9fc66a68f | |||
| 0e25584191 | |||
| 074be89825 | |||
| 12dcb791a8 | |||
| de7dbfb9df | |||
| fe49ca7b25 | |||
| 7888b0bbba | |||
| 02791a4ea0 | |||
| 64a0b0e8dc | |||
| 6653d934f6 | |||
| 27f49dfc07 | |||
| ce02093e20 | |||
| e625acbb52 | |||
| 6d34ea0dab | |||
| 8c90da220e | |||
| d1c4282203 | |||
| d0d2cbdc40 | |||
| 2ce1a3edde | |||
| a33b2d08de | |||
| bb7271c7b3 | |||
| 3d9711ab32 | |||
| a424760f34 | |||
| a452bd2526 | |||
| f4e28af783 | |||
| 95f39c4f5d | |||
| f000e8152e | |||
| 62f203ba20 | |||
| 3c48d19b86 | |||
| ffb05ca19f | |||
| ac8780dfc2 | |||
| 9bc4da8d77 | |||
| 0f9fc0c98d | |||
| 4ddee594ab | |||
| 02179975ec | |||
| dccc9f86bd | |||
| c41126923d | |||
| 36b746f8a6 | |||
| 794cf83d7c | |||
| ea1e947e1a | |||
| f1cd8e9961 | |||
| 73bbde9486 | |||
| f73b1a44d5 | |||
| 5ce0a2d32a | |||
| 51c9fe61fd | |||
| 71ff3da8f9 | |||
| f81d4bc7b9 | |||
| 7d7a31a243 | |||
| 200ba1fe2a | |||
| fab220aae5 | |||
| 1c36bae33a | |||
| d5c03d34b2 |
+7
-2
@@ -16,6 +16,11 @@ DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
*.DS_Store
|
||||
|
||||
# SwiftPM
|
||||
Packages/
|
||||
.build
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
@@ -24,10 +29,10 @@ DerivedData
|
||||
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
|
||||
#
|
||||
Pods/
|
||||
SlackKit.xcworkspace
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Checkouts
|
||||
Carthage/Build
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
3.1.1
|
||||
@@ -0,0 +1,7 @@
|
||||
disabled_rules:
|
||||
- identifier_name
|
||||
- function_parameter_count
|
||||
line_length: 140
|
||||
excluded: # paths to ignore during linting. Takes precedence over `included`.
|
||||
- Carthage
|
||||
- Pods
|
||||
@@ -0,0 +1,4 @@
|
||||
github "SlackKit/SKCore" >= 4.0.0
|
||||
github "SlackKit/SKClient" >= 4.0.0
|
||||
github "SlackKit/SKRTMAPI" >= 4.0.0
|
||||
github "SlackKit/SKServer" >= 4.0.0
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Peter Zignego
|
||||
Copyright (c) 2017 Peter Zignego
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SlackKit",
|
||||
targets: [
|
||||
Target(name: "SlackKit")
|
||||
],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/SlackKit/SKCore", majorVersion: 4),
|
||||
.Package(url: "https://github.com/SlackKit/SKClient", majorVersion: 4),
|
||||
.Package(url: "https://github.com/SlackKit/SKRTMAPI", majorVersion: 4),
|
||||
.Package(url: "https://github.com/SlackKit/SKServer", majorVersion: 4)
|
||||
]
|
||||
)
|
||||
@@ -1,7 +1,28 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
target 'SlackKit' do
|
||||
pod 'Starscream'
|
||||
target 'SlackKit macOS' do
|
||||
platform :osx, '10.11'
|
||||
pod 'SKCore'
|
||||
pod 'SKClient'
|
||||
pod 'SKWebAPI'
|
||||
pod 'SKRTMAPI'
|
||||
pod 'SKServer'
|
||||
end
|
||||
|
||||
target 'SlackKit iOS' do
|
||||
platform :ios, '9.0'
|
||||
pod 'SKCore'
|
||||
pod 'SKClient'
|
||||
pod 'SKWebAPI'
|
||||
pod 'SKRTMAPI'
|
||||
pod 'SKServer'
|
||||
end
|
||||
|
||||
target 'SlackKit tvOS' do
|
||||
platform :tvos, '9.0'
|
||||
pod 'SKCore'
|
||||
pod 'SKClient'
|
||||
pod 'SKWebAPI'
|
||||
pod 'SKRTMAPI'
|
||||
pod 'SKServer'
|
||||
end
|
||||
@@ -1,10 +0,0 @@
|
||||
PODS:
|
||||
- Starscream (1.0.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Starscream
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Starscream: 24012f5dc21c634b66e2270b1bb95771b5316d5b
|
||||
|
||||
COCOAPODS: 0.38.2
|
||||
@@ -1,50 +1,206 @@
|
||||

|
||||
##iOS/OS X Slack Client Library
|
||||
###Description
|
||||
This is a Slack client library for iOS and OS X written in Swift. It's intended to expose all of the functionality of Slack's [Real Time Messaging API](https://api.slack.com/rtm).
|
||||
<p align="center"><img src="https://cloud.githubusercontent.com/assets/8311605/24083714/e921a0d4-0cb2-11e7-8384-d42113ef5056.png" alt="SlackKit" width="500"/></p>
|
||||
|
||||

|
||||

|
||||

|
||||
[](https://github.com/apple/swift-package-manager)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](https://cocoapods.org)
|
||||
|
||||
## SlackKit: Slack Apps in Swift
|
||||
### Description
|
||||
|
||||
SlackKit makes it easy to build Slack apps in Swift.
|
||||
|
||||
It's intended to expose all of the functionality of Slack's [Real Time Messaging API](https://api.slack.com/rtm) as well as the [web APIs](https://api.slack.com/web) that are accessible to [bot users](https://api.slack.com/bot-users). SlackKit also supports Slack’s [OAuth 2.0](https://api.slack.com/docs/oauth) flow including the [Add to Slack](https://api.slack.com/docs/slack-button) and [Sign in with Slack](https://api.slack.com/docs/sign-in-with-slack) buttons, [incoming webhooks](https://api.slack.com/incoming-webhooks), [slash commands](https://api.slack.com/slash-commands), and [message buttons](https://api.slack.com/docs/message-buttons).
|
||||
|
||||
### Installation
|
||||
|
||||
#### Swift Package Manager
|
||||
|
||||
Add `SlackKit` to your `Package.swift`
|
||||
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/SlackKit/SlackKit.git", majorVersion: 4)
|
||||
]
|
||||
)
|
||||
```
|
||||
#### Carthage
|
||||
|
||||
Add `SlackKit` to your `Cartfile`:
|
||||
|
||||
```
|
||||
github "SlackKit/SlackKit"
|
||||
```
|
||||
|
||||
#### CocoaPods
|
||||
Add `SlackKit` to your `Podfile`:
|
||||
|
||||
###Installation
|
||||
####CocoaPods
|
||||
Add the pod to your podfile:
|
||||
```
|
||||
pod 'SlackKit'
|
||||
```
|
||||
and run
|
||||
```
|
||||
pod install
|
||||
```
|
||||
|
||||
To use the library in your project import it:
|
||||
```
|
||||
### Usage
|
||||
#### The Basics
|
||||
Create a bot user with an API token:
|
||||
|
||||
```swift
|
||||
import SlackKit
|
||||
|
||||
let bot = SlackKit()
|
||||
bot.addRTMBotWithAPIToken("xoxb-SLACK-BOT-TOKEN")
|
||||
// Register for event notifications
|
||||
bot.notificationForEvent(.message) { (event, _) in
|
||||
// Your bot logic here
|
||||
print(event.message)
|
||||
}
|
||||
```
|
||||
|
||||
###Usage
|
||||
To use SlackKit you'll need a bearer token which identifies a single user. You can generate a [full access token or create one using OAuth 2](https://api.slack.com/web).
|
||||
or create a ready-to-launch Slack app with your [application’s `Client ID` and `Client Secret`](https://api.slack.com/apps):
|
||||
|
||||
Once you have a token, give it to the Client:
|
||||
```swift
|
||||
Client.sharedInstance.setAuthToken("YOUR_SLACK_AUTH_TOKEN")
|
||||
import SlackKit
|
||||
|
||||
let bot = SlackKit()
|
||||
let oauthConfig = OAuthConfig(clientID: "CLIENT_ID", clientSecret: "CLIENT_SECRET")
|
||||
bot.addServer(oauth: oauthConfig)
|
||||
```
|
||||
and connect:
|
||||
|
||||
or just make calls to the Slack Web API:
|
||||
|
||||
```swift
|
||||
Client.sharedInstance.connect()
|
||||
```
|
||||
Once connected, the client will begin to consume any messages sent by the Slack RTM API.
|
||||
import SlackKit
|
||||
|
||||
let bot = SlackKit()
|
||||
bot.addWebAPIAccessWithToken("xoxb-SLACK-BOT-TOKEN")
|
||||
bot.webAPI?.authenticationTest(success: { (success) in
|
||||
print(success)
|
||||
}, failure: nil)
|
||||
|
||||
```
|
||||
|
||||
#### Slash Commands
|
||||
After [configuring your slash command in Slack](https://my.slack.com/services/new/slash-commands) (you can also provide slash commands as part of a [Slack App](https://api.slack.com/slack-apps)), create a route, response middleware for that route, and add it to a responder:
|
||||
|
||||
###Examples
|
||||
####Sending a Message:
|
||||
```swift
|
||||
Client.sharedInstance.sendMessage(message: "Hello, world!", channelID: "CHANNEL_ID")
|
||||
let slackkit = SlackKit()
|
||||
let middleware = ResponseMiddleware(token: "SLASH_COMMAND_TOKEN", response: SKResponse(text: "👋"))
|
||||
let route = RequestRoute(path: "/hello", middleware: middleware)
|
||||
let responder = SlackKitResponder(routes: [route])
|
||||
slackkit.addServer(responder: responder)
|
||||
```
|
||||
When a user enters that slash command, it will hit your configured route and return the response you specified.
|
||||
|
||||
#### Message Buttons
|
||||
Add [message buttons](https://api.slack.com/docs/message-buttons) to your responses for additional interactivity.
|
||||
|
||||
To send messages with actions, add them to an attachment and send them using the Web API:
|
||||
|
||||
####Print a List of Users in a Channel:
|
||||
```swift
|
||||
let users = Client.sharedInstance.channels?["CHANNEL_ID"]?.members
|
||||
print(users)
|
||||
let helloAction = Action(name: "hello", text: "🌎")
|
||||
let attachment = Attachment(fallback: "Hello World", title: "Welcome to SlackKit", callbackID: "hello_world", actions: [helloAction])
|
||||
slackkit.webAPI?.sendMessage(channel: "CXXXXXX", text: "", attachments: [attachment], success: nil, failure: nil)
|
||||
```
|
||||
|
||||
###Get In Touch
|
||||
[@pvzig](https://twitter.com/pvzig)
|
||||
To respond to message actions, add a `RequestRoute` with `MessageActionMiddleware` using your app’s verification token to your `SlackKitResponder`:
|
||||
|
||||
<peter@launchsoft.co>
|
||||
```swift
|
||||
let response = ResponseMiddleware(token: "SLACK_APP_VERIFICATION_TOKEN", response: SKResponse(text: "Hello, world!"))
|
||||
let actionRoute = MessageActionRoute(action: helloAction, middleware: response)
|
||||
let actionMiddleware = MessageActionMiddleware(token: "SLACK_APP_VERIFICATION_TOKEN", routes:[actionRoute])
|
||||
let actions = RequestRoute(path: "/actions", middleware: actionMiddleware)
|
||||
let responder = SlackKitResponder(routes: [actions])
|
||||
slackkit.addServer(responder: responder)
|
||||
```
|
||||
|
||||
#### OAuth
|
||||
Slack has [many different oauth scopes](https://api.slack.com/docs/oauth-scopes) that can be combined in different ways. If your application does not request the proper OAuth scopes, your API calls will fail.
|
||||
|
||||
If you authenticate using OAuth and the Add to Slack or Sign in with Slack buttons this is handled for you.
|
||||
|
||||
For local development of things like OAuth, slash commands, and message buttons, you may want to use a tool like [ngrok](https://ngrok.com).
|
||||
|
||||
#### Web API Methods
|
||||
SlackKit currently supports the a subset of the Slack Web APIs that are available to bot users:
|
||||
|
||||
| Web APIs |
|
||||
| ------------- |
|
||||
| `api.test`|
|
||||
| `api.revoke`|
|
||||
| `auth.test`|
|
||||
| `channels.history`|
|
||||
| `channels.info`|
|
||||
| `channels.list`|
|
||||
| `channels.mark`|
|
||||
| `channels.setPurpose`|
|
||||
| `channels.setTopic`|
|
||||
| `chat.delete`|
|
||||
| `chat.meMessage`|
|
||||
| `chat.postMessage`|
|
||||
| `chat.update`|
|
||||
| `emoji.list`|
|
||||
| `files.comments.add`|
|
||||
| `files.comments.edit`|
|
||||
| `files.comments.delete`|
|
||||
| `files.delete`|
|
||||
| `files.info`|
|
||||
| `files.upload`|
|
||||
| `groups.close`|
|
||||
| `groups.history`|
|
||||
| `groups.info`|
|
||||
| `groups.list`|
|
||||
| `groups.mark`|
|
||||
| `groups.open`|
|
||||
| `groups.setPurpose`|
|
||||
| `groups.setTopic`|
|
||||
| `im.close`|
|
||||
| `im.history`|
|
||||
| `im.list`|
|
||||
| `im.mark`|
|
||||
| `im.open`|
|
||||
| `mpim.close`|
|
||||
| `mpim.history`|
|
||||
| `mpim.list`|
|
||||
| `mpim.mark`|
|
||||
| `mpim.open`|
|
||||
| `oauth.access`|
|
||||
| `pins.add`|
|
||||
| `pins.list`|
|
||||
| `pins.remove`|
|
||||
| `reactions.add`|
|
||||
| `reactions.get`|
|
||||
| `reactions.list`|
|
||||
| `reactions.remove`|
|
||||
| `rtm.start`|
|
||||
| `stars.add`|
|
||||
| `stars.remove`|
|
||||
| `team.info`|
|
||||
| `users.getPresence`|
|
||||
| `users.info`|
|
||||
| `users.list`|
|
||||
| `users.setActive`|
|
||||
| `users.setPresence`|
|
||||
|
||||
Don’t need the whole banana? Want more control over the low-level implementation details? Use the extensible modules SlackKit is built on:
|
||||
|
||||
| Module | Slack Service |
|
||||
| ------------- |------------- |
|
||||
| **[SKClient](https://github.com/SlackKit/SKClient)** | Write your own client implementation|
|
||||
| **[SKRTMAPI](https://github.com/SlackKit/SKRTMAPI)** | Connect to the Slack RTM API|
|
||||
| **[SKServer](https://github.com/SlackKit/SKServer)** | Spin up a server|
|
||||
| **[SKWebAPI](https://github.com/SlackKit/SKWebAPI)** | Access the Slack Web API|
|
||||
|
||||
### Examples
|
||||
You can find the source code for several example applications [here](https://github.com/SlackKit/Examples).
|
||||
|
||||
### Tutorials
|
||||
- [Build a Slack Bot and Deploy to Heroku](https://medium.com/@pvzig/building-slack-bots-in-swift-b99e243e444c)
|
||||
|
||||
### Get In Touch
|
||||
Twitter: [@pvzig](https://twitter.com/pvzig)
|
||||
|
||||
Email: <peter@launchsoft.co>
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// SlackKit.h
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for SlackKit.
|
||||
FOUNDATION_EXPORT double SlackKitVersionNumber;
|
||||
|
||||
//! Project version string for SlackKit.
|
||||
FOUNDATION_EXPORT const unsigned char SlackKitVersionString[];
|
||||
+12
-8
@@ -1,16 +1,20 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SlackKit"
|
||||
s.version = "0.9.0"
|
||||
s.summary = "a Slack client library for iOS and OS X written in Swift"
|
||||
s.version = "4.0.0"
|
||||
s.summary = "Write Slack apps in Swift"
|
||||
s.homepage = "https://github.com/pvzig/SlackKit"
|
||||
s.license = 'MIT'
|
||||
s.author = { "Peter Zignego" => "peter@launchsoft.co" }
|
||||
s.source = { :git => "https://github.com/pvzig/SlackKit.git", :tag => s.version.to_s }
|
||||
s.source = { :git => "https://github.com/SlackKit/SlackKit.git", :tag => s.version.to_s }
|
||||
s.social_media_url = 'https://twitter.com/pvzig'
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.9'
|
||||
s.ios.deployment_target = '9.0'
|
||||
s.osx.deployment_target = '10.11'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.requires_arc = true
|
||||
s.source_files = 'SlackKit/*.swift'
|
||||
s.source_files = 'Sources/*.swift'
|
||||
s.frameworks = 'Foundation'
|
||||
s.dependency 'Starscream', '~> 1.0.1'
|
||||
end
|
||||
s.dependency 'SKCore'
|
||||
s.dependency 'SKClient'
|
||||
s.dependency 'SKRTMAPI'
|
||||
s.dependency 'SKServer'
|
||||
end
|
||||
+440
-123
@@ -7,103 +7,176 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2661A68F1BBF60E60026F67B /* Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A6821BBF60E60026F67B /* Bot.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6901BBF60E60026F67B /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A6831BBF60E60026F67B /* Channel.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6911BBF60E60026F67B /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A6841BBF60E60026F67B /* Client.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6921BBF60E60026F67B /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A6851BBF60E60026F67B /* Event.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6931BBF60E60026F67B /* EventDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A6861BBF60E60026F67B /* EventDispatcher.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6941BBF60E60026F67B /* EventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A6871BBF60E60026F67B /* EventHandler.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6951BBF60E60026F67B /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A6881BBF60E60026F67B /* File.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6971BBF60E60026F67B /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A68A1BBF60E60026F67B /* Message.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A6991BBF60E60026F67B /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A68C1BBF60E60026F67B /* Team.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A69A1BBF60E60026F67B /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A68D1BBF60E60026F67B /* Types.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
2661A69B1BBF60E60026F67B /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2661A68E1BBF60E60026F67B /* User.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
FFE3AC870D1C42EF276CCA2D /* Pods_SlackKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 407A2ABFC0611867E2BE34D0 /* Pods_SlackKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
266687051E95CB9F00777D94 /* SlackKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 266687041E95CB9F00777D94 /* SlackKit.swift */; };
|
||||
266687061E95CB9F00777D94 /* SlackKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 266687041E95CB9F00777D94 /* SlackKit.swift */; };
|
||||
266687071E95CB9F00777D94 /* SlackKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 266687041E95CB9F00777D94 /* SlackKit.swift */; };
|
||||
26D1C4FE1EE476C600C95954 /* SKClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C4F71EE476C600C95954 /* SKClient.framework */; };
|
||||
26D1C4FF1EE476C600C95954 /* SKCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C4F81EE476C600C95954 /* SKCore.framework */; };
|
||||
26D1C5001EE476C600C95954 /* SKRTMAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C4F91EE476C600C95954 /* SKRTMAPI.framework */; };
|
||||
26D1C5011EE476C600C95954 /* SKServer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C4FA1EE476C600C95954 /* SKServer.framework */; };
|
||||
26D1C5021EE476C600C95954 /* SKWebAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C4FB1EE476C600C95954 /* SKWebAPI.framework */; };
|
||||
26D1C5031EE476C600C95954 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C4FC1EE476C600C95954 /* Starscream.framework */; };
|
||||
26D1C5041EE476C600C95954 /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C4FD1EE476C600C95954 /* Swifter.framework */; };
|
||||
26D1C50C1EE476D200C95954 /* SKClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5051EE476D200C95954 /* SKClient.framework */; };
|
||||
26D1C50D1EE476D200C95954 /* SKCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5061EE476D200C95954 /* SKCore.framework */; };
|
||||
26D1C50E1EE476D200C95954 /* SKRTMAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5071EE476D200C95954 /* SKRTMAPI.framework */; };
|
||||
26D1C50F1EE476D200C95954 /* SKServer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5081EE476D200C95954 /* SKServer.framework */; };
|
||||
26D1C5101EE476D200C95954 /* SKWebAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5091EE476D200C95954 /* SKWebAPI.framework */; };
|
||||
26D1C5111EE476D200C95954 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C50A1EE476D200C95954 /* Starscream.framework */; };
|
||||
26D1C5121EE476D200C95954 /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C50B1EE476D200C95954 /* Swifter.framework */; };
|
||||
26D1C51A1EE476DD00C95954 /* SKClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5131EE476DD00C95954 /* SKClient.framework */; };
|
||||
26D1C51B1EE476DD00C95954 /* SKCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5141EE476DD00C95954 /* SKCore.framework */; };
|
||||
26D1C51C1EE476DD00C95954 /* SKRTMAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5151EE476DD00C95954 /* SKRTMAPI.framework */; };
|
||||
26D1C51D1EE476DD00C95954 /* SKServer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5161EE476DD00C95954 /* SKServer.framework */; };
|
||||
26D1C51E1EE476DD00C95954 /* SKWebAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5171EE476DD00C95954 /* SKWebAPI.framework */; };
|
||||
26D1C51F1EE476DD00C95954 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5181EE476DD00C95954 /* Starscream.framework */; };
|
||||
26D1C5201EE476DD00C95954 /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D1C5191EE476DD00C95954 /* Swifter.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
26072A341BB48B3A00CD650C /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2661A6821BBF60E60026F67B /* Bot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bot.swift; sourceTree = "<group>"; };
|
||||
2661A6831BBF60E60026F67B /* Channel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
|
||||
2661A6841BBF60E60026F67B /* Client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = "<group>"; };
|
||||
2661A6851BBF60E60026F67B /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = "<group>"; };
|
||||
2661A6861BBF60E60026F67B /* EventDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventDispatcher.swift; sourceTree = "<group>"; };
|
||||
2661A6871BBF60E60026F67B /* EventHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventHandler.swift; sourceTree = "<group>"; };
|
||||
2661A6881BBF60E60026F67B /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
|
||||
2661A68A1BBF60E60026F67B /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
|
||||
2661A68C1BBF60E60026F67B /* Team.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Team.swift; sourceTree = "<group>"; };
|
||||
2661A68D1BBF60E60026F67B /* Types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = "<group>"; };
|
||||
2661A68E1BBF60E60026F67B /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = "<group>"; };
|
||||
2661A6A41BBF62FF0026F67B /* SlackKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlackKit.h; sourceTree = "<group>"; };
|
||||
266E05F01BBF780C00840D76 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
407A2ABFC0611867E2BE34D0 /* Pods_SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4347F92F3932C96C23B10B2A /* Pods-SlackKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SlackKit.release.xcconfig"; path = "Pods/Target Support Files/Pods-SlackKit/Pods-SlackKit.release.xcconfig"; sourceTree = "<group>"; };
|
||||
F59B6A12F1C4C4E24C58E1BF /* Pods-SlackKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SlackKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SlackKit/Pods-SlackKit.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
266687041E95CB9F00777D94 /* SlackKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SlackKit.swift; sourceTree = "<group>"; };
|
||||
2684F17D1E95AA6900536DCC /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2684F1E41E95ABD400536DCC /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2684F2081E95ABD600536DCC /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2684F20D1E95AF8C00536DCC /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
26D1C4F71EE476C600C95954 /* SKClient.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKClient.framework; path = Carthage/Build/Mac/SKClient.framework; sourceTree = "<group>"; };
|
||||
26D1C4F81EE476C600C95954 /* SKCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKCore.framework; path = Carthage/Build/Mac/SKCore.framework; sourceTree = "<group>"; };
|
||||
26D1C4F91EE476C600C95954 /* SKRTMAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKRTMAPI.framework; path = Carthage/Build/Mac/SKRTMAPI.framework; sourceTree = "<group>"; };
|
||||
26D1C4FA1EE476C600C95954 /* SKServer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKServer.framework; path = Carthage/Build/Mac/SKServer.framework; sourceTree = "<group>"; };
|
||||
26D1C4FB1EE476C600C95954 /* SKWebAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKWebAPI.framework; path = Carthage/Build/Mac/SKWebAPI.framework; sourceTree = "<group>"; };
|
||||
26D1C4FC1EE476C600C95954 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/Mac/Starscream.framework; sourceTree = "<group>"; };
|
||||
26D1C4FD1EE476C600C95954 /* Swifter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swifter.framework; path = Carthage/Build/Mac/Swifter.framework; sourceTree = "<group>"; };
|
||||
26D1C5051EE476D200C95954 /* SKClient.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKClient.framework; path = Carthage/Build/iOS/SKClient.framework; sourceTree = "<group>"; };
|
||||
26D1C5061EE476D200C95954 /* SKCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKCore.framework; path = Carthage/Build/iOS/SKCore.framework; sourceTree = "<group>"; };
|
||||
26D1C5071EE476D200C95954 /* SKRTMAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKRTMAPI.framework; path = Carthage/Build/iOS/SKRTMAPI.framework; sourceTree = "<group>"; };
|
||||
26D1C5081EE476D200C95954 /* SKServer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKServer.framework; path = Carthage/Build/iOS/SKServer.framework; sourceTree = "<group>"; };
|
||||
26D1C5091EE476D200C95954 /* SKWebAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKWebAPI.framework; path = Carthage/Build/iOS/SKWebAPI.framework; sourceTree = "<group>"; };
|
||||
26D1C50A1EE476D200C95954 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/iOS/Starscream.framework; sourceTree = "<group>"; };
|
||||
26D1C50B1EE476D200C95954 /* Swifter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swifter.framework; path = Carthage/Build/iOS/Swifter.framework; sourceTree = "<group>"; };
|
||||
26D1C5131EE476DD00C95954 /* SKClient.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKClient.framework; path = Carthage/Build/tvOS/SKClient.framework; sourceTree = "<group>"; };
|
||||
26D1C5141EE476DD00C95954 /* SKCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKCore.framework; path = Carthage/Build/tvOS/SKCore.framework; sourceTree = "<group>"; };
|
||||
26D1C5151EE476DD00C95954 /* SKRTMAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKRTMAPI.framework; path = Carthage/Build/tvOS/SKRTMAPI.framework; sourceTree = "<group>"; };
|
||||
26D1C5161EE476DD00C95954 /* SKServer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKServer.framework; path = Carthage/Build/tvOS/SKServer.framework; sourceTree = "<group>"; };
|
||||
26D1C5171EE476DD00C95954 /* SKWebAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SKWebAPI.framework; path = Carthage/Build/tvOS/SKWebAPI.framework; sourceTree = "<group>"; };
|
||||
26D1C5181EE476DD00C95954 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/tvOS/Starscream.framework; sourceTree = "<group>"; };
|
||||
26D1C5191EE476DD00C95954 /* Swifter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swifter.framework; path = Carthage/Build/tvOS/Swifter.framework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
26072A301BB48B3A00CD650C /* Frameworks */ = {
|
||||
2684F1791E95AA6900536DCC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FFE3AC870D1C42EF276CCA2D /* Pods_SlackKit.framework in Frameworks */,
|
||||
26D1C4FE1EE476C600C95954 /* SKClient.framework in Frameworks */,
|
||||
26D1C4FF1EE476C600C95954 /* SKCore.framework in Frameworks */,
|
||||
26D1C5001EE476C600C95954 /* SKRTMAPI.framework in Frameworks */,
|
||||
26D1C5011EE476C600C95954 /* SKServer.framework in Frameworks */,
|
||||
26D1C5021EE476C600C95954 /* SKWebAPI.framework in Frameworks */,
|
||||
26D1C5031EE476C600C95954 /* Starscream.framework in Frameworks */,
|
||||
26D1C5041EE476C600C95954 /* Swifter.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F1DE1E95ABD400536DCC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26D1C50C1EE476D200C95954 /* SKClient.framework in Frameworks */,
|
||||
26D1C50D1EE476D200C95954 /* SKCore.framework in Frameworks */,
|
||||
26D1C50E1EE476D200C95954 /* SKRTMAPI.framework in Frameworks */,
|
||||
26D1C50F1EE476D200C95954 /* SKServer.framework in Frameworks */,
|
||||
26D1C5101EE476D200C95954 /* SKWebAPI.framework in Frameworks */,
|
||||
26D1C5111EE476D200C95954 /* Starscream.framework in Frameworks */,
|
||||
26D1C5121EE476D200C95954 /* Swifter.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F2021E95ABD600536DCC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26D1C51A1EE476DD00C95954 /* SKClient.framework in Frameworks */,
|
||||
26D1C51B1EE476DD00C95954 /* SKCore.framework in Frameworks */,
|
||||
26D1C51C1EE476DD00C95954 /* SKRTMAPI.framework in Frameworks */,
|
||||
26D1C51D1EE476DD00C95954 /* SKServer.framework in Frameworks */,
|
||||
26D1C51E1EE476DD00C95954 /* SKWebAPI.framework in Frameworks */,
|
||||
26D1C51F1EE476DD00C95954 /* Starscream.framework in Frameworks */,
|
||||
26D1C5201EE476DD00C95954 /* Swifter.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
0C2928E508A686B69F9F0117 /* Pods */ = {
|
||||
266687031E95CB9F00777D94 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F59B6A12F1C4C4E24C58E1BF /* Pods-SlackKit.debug.xcconfig */,
|
||||
4347F92F3932C96C23B10B2A /* Pods-SlackKit.release.xcconfig */,
|
||||
266687041E95CB9F00777D94 /* SlackKit.swift */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
path = Sources;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
26072A2A1BB48B3A00CD650C = {
|
||||
2684F1731E95AA6900536DCC = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2661A6811BBF60E60026F67B /* SlackKit */,
|
||||
26072A351BB48B3A00CD650C /* Products */,
|
||||
0C2928E508A686B69F9F0117 /* Pods */,
|
||||
CA70A3A1A9A1A259960DFBCF /* Frameworks */,
|
||||
2684F17F1E95AA6900536DCC /* SlackKit */,
|
||||
2684F17E1E95AA6900536DCC /* Products */,
|
||||
26D1C4F61EE476C600C95954 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
26072A351BB48B3A00CD650C /* Products */ = {
|
||||
2684F17E1E95AA6900536DCC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26072A341BB48B3A00CD650C /* SlackKit.framework */,
|
||||
2684F17D1E95AA6900536DCC /* SlackKit.framework */,
|
||||
2684F1E41E95ABD400536DCC /* SlackKit.framework */,
|
||||
2684F2081E95ABD600536DCC /* SlackKit.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2661A6811BBF60E60026F67B /* SlackKit */ = {
|
||||
2684F17F1E95AA6900536DCC /* SlackKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2661A6821BBF60E60026F67B /* Bot.swift */,
|
||||
2661A6831BBF60E60026F67B /* Channel.swift */,
|
||||
2661A6841BBF60E60026F67B /* Client.swift */,
|
||||
2661A6851BBF60E60026F67B /* Event.swift */,
|
||||
2661A6861BBF60E60026F67B /* EventDispatcher.swift */,
|
||||
2661A6871BBF60E60026F67B /* EventHandler.swift */,
|
||||
2661A6881BBF60E60026F67B /* File.swift */,
|
||||
2661A68A1BBF60E60026F67B /* Message.swift */,
|
||||
2661A68C1BBF60E60026F67B /* Team.swift */,
|
||||
2661A68D1BBF60E60026F67B /* Types.swift */,
|
||||
2661A68E1BBF60E60026F67B /* User.swift */,
|
||||
2661A6A41BBF62FF0026F67B /* SlackKit.h */,
|
||||
266E05F01BBF780C00840D76 /* Info.plist */,
|
||||
266687031E95CB9F00777D94 /* Sources */,
|
||||
2684F20C1E95AF8C00536DCC /* Supporting Files */,
|
||||
);
|
||||
path = SlackKit;
|
||||
name = SlackKit;
|
||||
path = SKCore;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA70A3A1A9A1A259960DFBCF /* Frameworks */ = {
|
||||
2684F20C1E95AF8C00536DCC /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
407A2ABFC0611867E2BE34D0 /* Pods_SlackKit.framework */,
|
||||
2684F20D1E95AF8C00536DCC /* Info.plist */,
|
||||
);
|
||||
path = "Supporting Files";
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
26D1C4F61EE476C600C95954 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26D1C5131EE476DD00C95954 /* SKClient.framework */,
|
||||
26D1C5141EE476DD00C95954 /* SKCore.framework */,
|
||||
26D1C5151EE476DD00C95954 /* SKRTMAPI.framework */,
|
||||
26D1C5161EE476DD00C95954 /* SKServer.framework */,
|
||||
26D1C5171EE476DD00C95954 /* SKWebAPI.framework */,
|
||||
26D1C5181EE476DD00C95954 /* Starscream.framework */,
|
||||
26D1C5191EE476DD00C95954 /* Swifter.framework */,
|
||||
26D1C5051EE476D200C95954 /* SKClient.framework */,
|
||||
26D1C5061EE476D200C95954 /* SKCore.framework */,
|
||||
26D1C5071EE476D200C95954 /* SKRTMAPI.framework */,
|
||||
26D1C5081EE476D200C95954 /* SKServer.framework */,
|
||||
26D1C5091EE476D200C95954 /* SKWebAPI.framework */,
|
||||
26D1C50A1EE476D200C95954 /* Starscream.framework */,
|
||||
26D1C50B1EE476D200C95954 /* Swifter.framework */,
|
||||
26D1C4F71EE476C600C95954 /* SKClient.framework */,
|
||||
26D1C4F81EE476C600C95954 /* SKCore.framework */,
|
||||
26D1C4F91EE476C600C95954 /* SKRTMAPI.framework */,
|
||||
26D1C4FA1EE476C600C95954 /* SKServer.framework */,
|
||||
26D1C4FB1EE476C600C95954 /* SKWebAPI.framework */,
|
||||
26D1C4FC1EE476C600C95954 /* Starscream.framework */,
|
||||
26D1C4FD1EE476C600C95954 /* Swifter.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@@ -111,7 +184,21 @@
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
26072A311BB48B3A00CD650C /* Headers */ = {
|
||||
2684F17A1E95AA6900536DCC /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F1DF1E95ABD400536DCC /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F2031E95ABD600536DCC /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -121,60 +208,119 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
26072A331BB48B3A00CD650C /* SlackKit */ = {
|
||||
2684F17C1E95AA6900536DCC /* SlackKit macOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit" */;
|
||||
buildConfigurationList = 2684F1851E95AA6900536DCC /* Build configuration list for PBXNativeTarget "SlackKit macOS" */;
|
||||
buildPhases = (
|
||||
EBD7A091EB278C5BA34791C5 /* Check Pods Manifest.lock */,
|
||||
26072A2F1BB48B3A00CD650C /* Sources */,
|
||||
26072A301BB48B3A00CD650C /* Frameworks */,
|
||||
26072A311BB48B3A00CD650C /* Headers */,
|
||||
26072A321BB48B3A00CD650C /* Resources */,
|
||||
AC19A945F408269E4B4132CC /* Copy Pods Resources */,
|
||||
2684F1781E95AA6900536DCC /* Sources */,
|
||||
2684F1791E95AA6900536DCC /* Frameworks */,
|
||||
2684F17A1E95AA6900536DCC /* Headers */,
|
||||
2684F17B1E95AA6900536DCC /* Resources */,
|
||||
2668B5151EEB3FC40082DE33 /* SwiftLint */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SlackKit;
|
||||
productName = SlackRTMKit;
|
||||
productReference = 26072A341BB48B3A00CD650C /* SlackKit.framework */;
|
||||
name = "SlackKit macOS";
|
||||
productName = SKCore;
|
||||
productReference = 2684F17D1E95AA6900536DCC /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
2684F1C21E95ABD400536DCC /* SlackKit iOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2684F1E11E95ABD400536DCC /* Build configuration list for PBXNativeTarget "SlackKit iOS" */;
|
||||
buildPhases = (
|
||||
2684F1C31E95ABD400536DCC /* Sources */,
|
||||
2684F1DE1E95ABD400536DCC /* Frameworks */,
|
||||
2684F1DF1E95ABD400536DCC /* Headers */,
|
||||
2684F1E01E95ABD400536DCC /* Resources */,
|
||||
2668B5161EEB3FCF0082DE33 /* SwiftLint */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit iOS";
|
||||
productName = SKCore;
|
||||
productReference = 2684F1E41E95ABD400536DCC /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
2684F1E61E95ABD600536DCC /* SlackKit tvOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2684F2051E95ABD600536DCC /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */;
|
||||
buildPhases = (
|
||||
2684F1E71E95ABD600536DCC /* Sources */,
|
||||
2684F2021E95ABD600536DCC /* Frameworks */,
|
||||
2684F2031E95ABD600536DCC /* Headers */,
|
||||
2684F2041E95ABD600536DCC /* Resources */,
|
||||
2668B5171EEB3FD90082DE33 /* SwiftLint */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit tvOS";
|
||||
productName = SKCore;
|
||||
productReference = 2684F2081E95ABD600536DCC /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
26072A2B1BB48B3A00CD650C /* Project object */ = {
|
||||
2684F1741E95AA6900536DCC /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Launch Software LLC";
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = "Peter Zignego";
|
||||
TargetAttributes = {
|
||||
26072A331BB48B3A00CD650C = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
2684F17C1E95AA6900536DCC = {
|
||||
CreatedOnToolsVersion = 8.3;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
2684F1C21E95ABD400536DCC = {
|
||||
DevelopmentTeam = U63DWZL52M;
|
||||
};
|
||||
2684F1E61E95ABD600536DCC = {
|
||||
DevelopmentTeam = U63DWZL52M;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 26072A2E1BB48B3A00CD650C /* Build configuration list for PBXProject "SlackKit" */;
|
||||
buildConfigurationList = 2684F1771E95AA6900536DCC /* Build configuration list for PBXProject "SlackKit" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 26072A2A1BB48B3A00CD650C;
|
||||
productRefGroup = 26072A351BB48B3A00CD650C /* Products */;
|
||||
mainGroup = 2684F1731E95AA6900536DCC;
|
||||
productRefGroup = 2684F17E1E95AA6900536DCC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
26072A331BB48B3A00CD650C /* SlackKit */,
|
||||
2684F17C1E95AA6900536DCC /* SlackKit macOS */,
|
||||
2684F1C21E95ABD400536DCC /* SlackKit iOS */,
|
||||
2684F1E61E95ABD600536DCC /* SlackKit tvOS */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
26072A321BB48B3A00CD650C /* Resources */ = {
|
||||
2684F17B1E95AA6900536DCC /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F1E01E95ABD400536DCC /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F2041E95ABD600536DCC /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -184,64 +330,84 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
AC19A945F408269E4B4132CC /* Copy Pods Resources */ = {
|
||||
2668B5151EEB3FC40082DE33 /* SwiftLint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Copy Pods Resources";
|
||||
name = SwiftLint;
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SlackKit/Pods-SlackKit-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
|
||||
};
|
||||
EBD7A091EB278C5BA34791C5 /* Check Pods Manifest.lock */ = {
|
||||
2668B5161EEB3FCF0082DE33 /* SwiftLint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Check Pods Manifest.lock";
|
||||
name = SwiftLint;
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
|
||||
};
|
||||
2668B5171EEB3FD90082DE33 /* SwiftLint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = SwiftLint;
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
26072A2F1BB48B3A00CD650C /* Sources */ = {
|
||||
2684F1781E95AA6900536DCC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2661A69A1BBF60E60026F67B /* Types.swift in Sources */,
|
||||
2661A6901BBF60E60026F67B /* Channel.swift in Sources */,
|
||||
2661A6921BBF60E60026F67B /* Event.swift in Sources */,
|
||||
2661A6971BBF60E60026F67B /* Message.swift in Sources */,
|
||||
2661A6991BBF60E60026F67B /* Team.swift in Sources */,
|
||||
2661A69B1BBF60E60026F67B /* User.swift in Sources */,
|
||||
2661A6951BBF60E60026F67B /* File.swift in Sources */,
|
||||
2661A6931BBF60E60026F67B /* EventDispatcher.swift in Sources */,
|
||||
2661A6911BBF60E60026F67B /* Client.swift in Sources */,
|
||||
2661A6941BBF60E60026F67B /* EventHandler.swift in Sources */,
|
||||
2661A68F1BBF60E60026F67B /* Bot.swift in Sources */,
|
||||
266687051E95CB9F00777D94 /* SlackKit.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F1C31E95ABD400536DCC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
266687061E95CB9F00777D94 /* SlackKit.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2684F1E71E95ABD600536DCC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
266687071E95CB9F00777D94 /* SlackKit.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
26072A3A1BB48B3B00CD650C /* Debug */ = {
|
||||
2684F1831E95AA6900536DCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
@@ -249,12 +415,16 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
@@ -274,20 +444,23 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
26072A3B1BB48B3B00CD650C /* Release */ = {
|
||||
2684F1841E95AA6900536DCC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
@@ -295,12 +468,16 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
@@ -314,77 +491,217 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
26072A3D1BB48B3B00CD650C /* Debug */ = {
|
||||
2684F1861E95AA6900536DCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = F59B6A12F1C4C4E24C58E1BF /* Pods-SlackKit.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = SlackKit/Info.plist;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
26072A3E1BB48B3B00CD650C /* Release */ = {
|
||||
2684F1871E95AA6900536DCC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 4347F92F3932C96C23B10B2A /* Pods-SlackKit.release.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = SlackKit/Info.plist;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
2684F1E21E95ABD400536DCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = U63DWZL52M;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2684F1E31E95ABD400536DCC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = U63DWZL52M;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
2684F2061E95ABD600536DCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = U63DWZL52M;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/tvOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2684F2071E95ABD600536DCC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = U63DWZL52M;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/tvOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
26072A2E1BB48B3A00CD650C /* Build configuration list for PBXProject "SlackKit" */ = {
|
||||
2684F1771E95AA6900536DCC /* Build configuration list for PBXProject "SlackKit" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
26072A3A1BB48B3B00CD650C /* Debug */,
|
||||
26072A3B1BB48B3B00CD650C /* Release */,
|
||||
2684F1831E95AA6900536DCC /* Debug */,
|
||||
2684F1841E95AA6900536DCC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit" */ = {
|
||||
2684F1851E95AA6900536DCC /* Build configuration list for PBXNativeTarget "SlackKit macOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
26072A3D1BB48B3B00CD650C /* Debug */,
|
||||
26072A3E1BB48B3B00CD650C /* Release */,
|
||||
2684F1861E95AA6900536DCC /* Debug */,
|
||||
2684F1871E95AA6900536DCC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
2684F1E11E95ABD400536DCC /* Build configuration list for PBXNativeTarget "SlackKit iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2684F1E21E95ABD400536DCC /* Debug */,
|
||||
2684F1E31E95ABD400536DCC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
2684F2051E95ABD600536DCC /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2684F2061E95ABD600536DCC /* Debug */,
|
||||
2684F2071E95ABD600536DCC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 26072A2B1BB48B3A00CD650C /* Project object */;
|
||||
rootObject = 2684F1741E95AA6900536DCC /* Project object */;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SlackRTMKit.xcodeproj">
|
||||
location = "self:SKCore.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F1C21E95ABD400536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit iOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F1C21E95ABD400536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit iOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F1C21E95ABD400536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit iOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F17C1E95AA6900536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit macOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F17C1E95AA6900536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit macOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F17C1E95AA6900536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit macOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F1E61E95ABD600536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit tvOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F1E61E95ABD600536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit tvOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2684F1E61E95ABD600536DCC"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit tvOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:SlackKit.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,36 +0,0 @@
|
||||
//
|
||||
// Bot.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct Bot {
|
||||
|
||||
let id: String?
|
||||
internal(set) public var name: String?
|
||||
internal(set) public var icons: Dictionary<String, AnyObject>?
|
||||
|
||||
internal init?(bot:Dictionary<String, AnyObject>?) {
|
||||
id = bot?["id"] as? String
|
||||
name = bot?["name"] as? String
|
||||
icons = bot?["icons"] as? Dictionary<String, AnyObject>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
//
|
||||
// Channel.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct Channel {
|
||||
|
||||
public let id: String?
|
||||
public let created: String?
|
||||
public let creator: String?
|
||||
internal(set) public var name: String?
|
||||
internal(set) public var isArchived: Bool?
|
||||
internal(set) public var isGeneral: Bool?
|
||||
public let isGroup: Bool?
|
||||
public let isDM: Bool?
|
||||
internal(set) public var user: String?
|
||||
internal(set) public var isUserDeleted: Bool?
|
||||
internal(set) public var isOpen: Bool?
|
||||
internal(set) public var topic: Topic?
|
||||
internal(set) public var purpose: Topic?
|
||||
internal(set) public var isMember: Bool?
|
||||
internal(set) public var lastRead: String?
|
||||
internal(set) public var latest: Message?
|
||||
internal(set) public var unread: Int?
|
||||
internal(set) public var unreadCountDisplay: Int?
|
||||
internal(set) public var hasPins: Bool?
|
||||
internal(set) public lazy var members = [String]()
|
||||
// Client use
|
||||
internal(set) public lazy var pinnedItems = [Item]()
|
||||
internal(set) public lazy var usersTyping = [String]()
|
||||
internal(set) public lazy var messages = Dictionary<String, Message>()
|
||||
|
||||
internal init?(channel:Dictionary<String, AnyObject>?) {
|
||||
id = channel?["id"] as? String
|
||||
name = channel?["name"] as? String
|
||||
created = channel?["created"] as? String
|
||||
creator = channel?["creator"] as? String
|
||||
isArchived = channel?["is_archived"] as? Bool
|
||||
isGeneral = channel?["is_general"] as? Bool
|
||||
isGroup = channel?["is_group"] as? Bool
|
||||
isDM = channel?["is_im"] as? Bool
|
||||
isUserDeleted = channel?["is_user_deleted"] as? Bool
|
||||
user = channel?["user"] as? String
|
||||
isOpen = channel?["is_open"] as? Bool
|
||||
topic = Topic(topic: channel?["topic"] as? Dictionary<String, AnyObject>)
|
||||
purpose = Topic(topic: channel?["purpose"] as? Dictionary<String, AnyObject>)
|
||||
isMember = channel?["is_member"] as? Bool
|
||||
lastRead = channel?["last_read"] as? String
|
||||
latest = Message(message: channel?["message"] as? Dictionary<String, AnyObject>)
|
||||
unread = channel?["unread_count"] as? Int
|
||||
unreadCountDisplay = channel?["unread_count_display"] as? Int
|
||||
hasPins = channel?["has_pins"] as? Bool
|
||||
|
||||
if let members = channel?["members"] as? [String] {
|
||||
self.members = members
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal init?(id:String?) {
|
||||
self.id = id
|
||||
created = nil
|
||||
creator = nil
|
||||
isGroup = false
|
||||
isDM = false
|
||||
}
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
//
|
||||
// Client.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Starscream
|
||||
|
||||
public class Client: WebSocketDelegate {
|
||||
|
||||
public var connected = false
|
||||
public var authenticated = false
|
||||
public var authenticatedUser: User?
|
||||
public var team: Team?
|
||||
|
||||
public var channels: [String: Channel]?
|
||||
public var users: [String: User]?
|
||||
public var bots: [String: Bot]?
|
||||
public var files: [String: File]?
|
||||
|
||||
internal lazy var sentMessages = [String: Message]()
|
||||
|
||||
private var token = "SLACK_AUTH_TOKEN"
|
||||
public func setAuthToken(token: String) {
|
||||
self.token = token
|
||||
}
|
||||
|
||||
private var webSocket: WebSocket?
|
||||
|
||||
required public init() {
|
||||
|
||||
}
|
||||
|
||||
public static let sharedInstance = Client()
|
||||
|
||||
//MARK: - Connection
|
||||
public func connect() {
|
||||
let request = NSURLRequest(URL: NSURL(string:"https://slack.com/api/rtm.start?token="+token)!)
|
||||
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.currentQueue()!) {
|
||||
(response, data, error) -> Void in
|
||||
guard let data = data else {
|
||||
return
|
||||
}
|
||||
do {
|
||||
let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as! Dictionary<String, AnyObject>
|
||||
if (result["ok"] as! Bool == true) {
|
||||
self.initialSetup(result)
|
||||
let socketURL = NSURL(string: result["url"] as! String)
|
||||
self.webSocket = WebSocket(url: socketURL!)
|
||||
self.webSocket?.delegate = self
|
||||
self.webSocket?.connect()
|
||||
}
|
||||
} catch _ {
|
||||
print(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Message send
|
||||
public func sendMessage(message: String, channelID: String) {
|
||||
if (connected) {
|
||||
if let data = formatMessageToSlackJsonString(msg: message, channel: channelID) {
|
||||
let string = NSString(data: data, encoding: NSUTF8StringEncoding)
|
||||
self.webSocket?.writeString(string as! String)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func formatMessageToSlackJsonString(message: (msg: String, channel: String)) -> NSData? {
|
||||
let json: Dictionary<String, AnyObject> = [
|
||||
"id": NSDate().timeIntervalSince1970,
|
||||
"type": "message",
|
||||
"channel": message.channel,
|
||||
"text": slackFormatEscaping(message.msg)
|
||||
]
|
||||
addSentMessage(json)
|
||||
do {
|
||||
let data = try NSJSONSerialization.dataWithJSONObject(json, options: NSJSONWritingOptions.PrettyPrinted)
|
||||
return data
|
||||
}
|
||||
catch _ {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
private func addSentMessage(dictionary:Dictionary<String, AnyObject>) {
|
||||
var message = dictionary
|
||||
let ts = message["id"] as? NSNumber
|
||||
message.removeValueForKey("id")
|
||||
message["ts"] = ts?.stringValue
|
||||
message["user"] = self.authenticatedUser?.id
|
||||
sentMessages[ts!.stringValue] = Message(message: message)
|
||||
}
|
||||
|
||||
private func slackFormatEscaping(string: String) -> String {
|
||||
var escapedString = string.stringByReplacingOccurrencesOfString("&", withString: "&")
|
||||
escapedString = escapedString.stringByReplacingOccurrencesOfString("<", withString: "<")
|
||||
escapedString = escapedString.stringByReplacingOccurrencesOfString(">", withString: ">")
|
||||
return escapedString
|
||||
}
|
||||
|
||||
//MARK: - Client setup
|
||||
private func initialSetup(json: Dictionary<String, AnyObject>) {
|
||||
team = Team(team: json["team"] as? Dictionary<String, AnyObject>)
|
||||
authenticatedUser = User(user: json["self"] as? Dictionary<String, AnyObject>)
|
||||
enumerateUsers(json["users"] as? Array)
|
||||
enumerateChannels(json["channels"] as? Array)
|
||||
enumerateGroups(json["groups"] as? Array)
|
||||
enumerateDMs(json["ims"] as? Array)
|
||||
enumerateBots(json["bots"] as? Array)
|
||||
}
|
||||
|
||||
private func enumerateUsers(users: Array<AnyObject>?) {
|
||||
self.users = [String: User]()
|
||||
for (var i=0; i < users!.count; i++) {
|
||||
let user = User(user: users?[i] as? Dictionary<String, AnyObject>)
|
||||
self.users?[user!.id!] = user
|
||||
}
|
||||
}
|
||||
|
||||
private func enumerateChannels(channels: Array<AnyObject>?) {
|
||||
self.channels = [String: Channel]()
|
||||
for (var i=0; i < channels!.count; i++) {
|
||||
let channel = Channel(channel: channels?[i] as? Dictionary<String, AnyObject>)
|
||||
self.channels?[channel!.id!] = channel
|
||||
}
|
||||
}
|
||||
|
||||
private func enumerateGroups(groups: Array<AnyObject>?) {
|
||||
for (var i=0; i < groups!.count; i++) {
|
||||
let group = Channel(channel: groups?[i] as? Dictionary<String, AnyObject>)
|
||||
self.channels?[group!.id!] = group
|
||||
}
|
||||
}
|
||||
|
||||
private func enumerateDMs(dms: Array<AnyObject>?) {
|
||||
for (var i=0; i < dms!.count; i++) {
|
||||
let dm = Channel(channel: dms?[i] as? Dictionary<String, AnyObject>)
|
||||
self.channels?[dm!.id!] = dm
|
||||
}
|
||||
}
|
||||
|
||||
private func enumerateBots(bots: Array<AnyObject>?) {
|
||||
self.bots = [String: Bot]()
|
||||
for (var i=0; i < bots?.count; i++) {
|
||||
let bot = Bot(bot: bots?[i] as? Dictionary<String, AnyObject>)
|
||||
self.bots?[bot!.id!] = bot
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Convenience methods
|
||||
|
||||
public func IDForChannelName(name: String) -> String? {
|
||||
for channel in channels! {
|
||||
if (channel.1.name == name) {
|
||||
return channel.1.id!
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// MARK: - WebSocketDelegate
|
||||
public func websocketDidConnect(socket: WebSocket) {
|
||||
print("Connected.")
|
||||
}
|
||||
|
||||
public func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
|
||||
connected = false
|
||||
authenticated = false
|
||||
webSocket = nil
|
||||
print("Disconnected: \(error)")
|
||||
}
|
||||
|
||||
public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
|
||||
guard let data = text.dataUsingEncoding(NSUTF8StringEncoding) else {
|
||||
return
|
||||
}
|
||||
do {
|
||||
try EventDispatcher.eventDispatcher(NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments) as! Dictionary<String, AnyObject>)
|
||||
print(try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments) as! NSDictionary)
|
||||
}
|
||||
catch _ {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public func websocketDidReceiveData(socket: WebSocket, data: NSData) {
|
||||
print("Data: \(data)")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
//
|
||||
// Message.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal enum EventType: String {
|
||||
case Hello = "hello"
|
||||
case Message = "message"
|
||||
case UserTyping = "user_typing"
|
||||
case ChannelMarked = "channel_marked"
|
||||
case ChannelCreated = "channel_created"
|
||||
case ChannelJoined = "channel_joined"
|
||||
case ChannelLeft = "channel_left"
|
||||
case ChannelDeleted = "channel_deleted"
|
||||
case ChannelRenamed = "channel_rename"
|
||||
case ChannelArchive = "channel_archive"
|
||||
case ChannelUnarchive = "channel_unarchive"
|
||||
case ChannelHistoryChanged = "channel_history_changed"
|
||||
case DMCreated = "im_created"
|
||||
case DMOpen = "im_open"
|
||||
case DMClose = "im_close"
|
||||
case DMMarked = "im_marked"
|
||||
case DMHistoryChanged = "im_history_changed"
|
||||
case GroupJoined = "group_joined"
|
||||
case GroupLeft = "group_left"
|
||||
case GroupOpen = "group_open"
|
||||
case GroupClose = "group_close"
|
||||
case GroupArchive = "group_archive"
|
||||
case GroupUnarchive = "group_unarchive"
|
||||
case GroupRename = "group_rename"
|
||||
case GroupMarked = "group_marked"
|
||||
case GroupHistoryChanged = "group_history_changed"
|
||||
case FileCreated = "file_created"
|
||||
case FileShared = "file_shared"
|
||||
case FileUnshared = "file_unshared"
|
||||
case FilePublic = "file_public"
|
||||
case FilePrivate = "file_private"
|
||||
case FileChanged = "file_change"
|
||||
case FileDeleted = "file_deleted"
|
||||
case FileCommentAdded = "file_comment_added"
|
||||
case FileCommentEdited = "file_comment_edited"
|
||||
case FileCommentDeleted = "file_comment_deleted"
|
||||
case PinAdded = "pin_added"
|
||||
case PinRemoved = "pin_removed"
|
||||
case PresenceChange = "presence_change"
|
||||
case ManualPresenceChange = "manual_presence_change"
|
||||
case PrefChange = "pref_change"
|
||||
case UserChange = "user_change"
|
||||
case TeamJoin = "team_join"
|
||||
case StarAdded = "star_added"
|
||||
case StarRemoved = "star_removed"
|
||||
case ReactionAdded = "reaction_added"
|
||||
case ReactionRemoved = "reaction_removed"
|
||||
case EmojiChanged = "emoji_changed"
|
||||
case CommandsChanged = "commands_changed"
|
||||
case TeamPlanChange = "team_plan_change"
|
||||
case TeamPrefChange = "team_pref_change"
|
||||
case TeamRename = "team_rename"
|
||||
case TeamDomainChange = "team_domain_change"
|
||||
case EmailDomainChange = "email_domain_change"
|
||||
case BotAdded = "bot_added"
|
||||
case BotChanged = "bot_changed"
|
||||
case AccountsChanged = "accounts_changed"
|
||||
case TeamMigrationStarted = "team_migration_started"
|
||||
case Ok = "ok"
|
||||
case Error = "error"
|
||||
}
|
||||
|
||||
internal enum MessageSubtype: String {
|
||||
case BotMessage = "bot_message"
|
||||
case MeMessage = "me_message"
|
||||
case MessageChanged = "message_changed"
|
||||
case MessageDeleted = "message_deleted"
|
||||
case ChannelJoin = "channel_join"
|
||||
case ChannelLeave = "channel_leave"
|
||||
case ChannelTopic = "channel_topic"
|
||||
case ChannelPurpose = "channel_purpose"
|
||||
case ChannelName = "channel_name"
|
||||
case ChannelArchive = "channel_archive"
|
||||
case ChannelUnarchive = "channel_unarchive"
|
||||
case GroupJoin = "group_join"
|
||||
case GroupLeave = "group_leave"
|
||||
case GroupTopic = "group_topic"
|
||||
case GroupPurpose = "group_purpose"
|
||||
case GroupName = "group_name"
|
||||
case GroupArchive = "group_archive"
|
||||
case GroupUnarchive = "group_unarchive"
|
||||
case FileShare = "file_share"
|
||||
case FileComment = "file_comment"
|
||||
case FileMention = "file_mention"
|
||||
case PinnedItem = "pinned_item"
|
||||
case UnpinnedItem = "unpinned_item"
|
||||
}
|
||||
|
||||
internal struct Event {
|
||||
|
||||
let type: EventType
|
||||
let ts: String?
|
||||
let subtype: String?
|
||||
let channelID: String?
|
||||
let text: String?
|
||||
let eventTs: String?
|
||||
let latest: String?
|
||||
let hidden: Bool?
|
||||
let isStarred: Bool?
|
||||
let hasPins: Bool?
|
||||
let pinnedTo: [String]?
|
||||
let fileID: String?
|
||||
let presence: String?
|
||||
let name: String?
|
||||
let value: String?
|
||||
let plan: String?
|
||||
let url: String?
|
||||
let domain: String?
|
||||
let emailDomain: String?
|
||||
let reaction: String?
|
||||
let replyTo: String?
|
||||
let reactions: [Dictionary<String, AnyObject>]?
|
||||
let edited: Edited?
|
||||
let bot: Bot?
|
||||
let channel: Channel?
|
||||
let comment: Comment?
|
||||
let user: User?
|
||||
let file: File?
|
||||
let message: Message?
|
||||
let nestedMessage: Message?
|
||||
let item: Item?
|
||||
|
||||
init(event:Dictionary<String, AnyObject>) {
|
||||
if let eventType = event["type"] as? String {
|
||||
type = EventType(rawValue:eventType)!
|
||||
} else {
|
||||
type = EventType(rawValue: "ok")!
|
||||
}
|
||||
ts = event["ts"] as? String
|
||||
subtype = event["subtype"] as? String
|
||||
channelID = event["channel_id"] as? String
|
||||
text = event["text"] as? String
|
||||
eventTs = event["event_ts"] as? String
|
||||
latest = event["latest"] as? String
|
||||
hidden = event["hidden"] as? Bool
|
||||
isStarred = event["is_starred"] as? Bool
|
||||
hasPins = event["has_pins"] as? Bool
|
||||
pinnedTo = event["pinned_top"] as? [String]
|
||||
fileID = event["file_id"] as? String
|
||||
presence = event["presence"] as? String
|
||||
name = event["name"] as? String
|
||||
value = event["value"] as? String
|
||||
plan = event["plan"] as? String
|
||||
url = event["url"] as? String
|
||||
domain = event["domain"] as? String
|
||||
emailDomain = event["email_domain"] as? String
|
||||
reaction = event["reaction"] as? String
|
||||
replyTo = event["reply_to"] as? String
|
||||
reactions = event["reactions"] as? [Dictionary<String, AnyObject>]
|
||||
bot = Bot(bot: event["bot"] as? Dictionary<String, AnyObject>)
|
||||
edited = Edited(edited:event["edited"] as? Dictionary<String, AnyObject>)
|
||||
item = Item(item: event["item"] as? Dictionary<String, AnyObject>)
|
||||
message = Message(message: event)
|
||||
nestedMessage = Message(message: event["message"] as? Dictionary<String, AnyObject>)
|
||||
|
||||
// Comment, Channel, User, and File can come across as Strings or Dictionaries
|
||||
if (Comment(comment: event["comment"] as? Dictionary<String, AnyObject>) == nil) {
|
||||
comment = Comment(id: event["comment"] as? String)
|
||||
} else {
|
||||
comment = Comment(comment: event["comment"] as? Dictionary<String, AnyObject>)
|
||||
}
|
||||
|
||||
if (User(user: event["user"] as? Dictionary<String, AnyObject>)?.id == nil) {
|
||||
user = User(id: event["user"] as? String)
|
||||
} else {
|
||||
user = User(user: event["user"] as? Dictionary<String, AnyObject>)
|
||||
}
|
||||
|
||||
if (File(file: event["file"] as? Dictionary<String, AnyObject>)?.id == nil) {
|
||||
file = File(id: event["file"] as? String)
|
||||
} else {
|
||||
file = File(file: event["file"] as? Dictionary<String, AnyObject>)
|
||||
}
|
||||
|
||||
if (Channel(channel: event["channel"] as? Dictionary<String, AnyObject>)?.id == nil) {
|
||||
channel = Channel(id: event["channel"] as? String)
|
||||
} else {
|
||||
channel = Channel(channel: event["channel"] as? Dictionary<String, AnyObject>)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
//
|
||||
// EventDispatcher.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal struct EventDispatcher {
|
||||
|
||||
static func eventDispatcher(event:Dictionary<String, AnyObject>) {
|
||||
let event = Event(event: event)
|
||||
switch event.type {
|
||||
case .Hello:
|
||||
EventHandler.connected()
|
||||
break
|
||||
case .Ok:
|
||||
EventHandler.messageSent(event)
|
||||
break
|
||||
case .Message:
|
||||
if (event.subtype != nil) {
|
||||
messageDispatcher(event)
|
||||
} else {
|
||||
EventHandler.messageReceived(event)
|
||||
}
|
||||
break
|
||||
case .UserTyping:
|
||||
EventHandler.userTyping(event)
|
||||
break
|
||||
case .ChannelMarked, .DMMarked, .GroupMarked:
|
||||
EventHandler.channelMarked(event)
|
||||
break
|
||||
case .ChannelCreated, .DMCreated:
|
||||
EventHandler.channelCreated(event)
|
||||
break
|
||||
case .ChannelJoined, .GroupJoined:
|
||||
EventHandler.channelJoined(event)
|
||||
break
|
||||
case .ChannelLeft, .GroupLeft:
|
||||
EventHandler.channelLeft(event)
|
||||
break
|
||||
case .ChannelDeleted:
|
||||
EventHandler.channelDeleted(event)
|
||||
break
|
||||
case .ChannelRenamed, .GroupRename:
|
||||
EventHandler.channelRenamed(event)
|
||||
break
|
||||
case .ChannelArchive, .GroupArchive:
|
||||
EventHandler.channelArchived(event, archived: true)
|
||||
break
|
||||
case .ChannelUnarchive, .GroupUnarchive:
|
||||
EventHandler.channelArchived(event, archived: false)
|
||||
break
|
||||
case .ChannelHistoryChanged, .DMHistoryChanged, .GroupHistoryChanged:
|
||||
EventHandler.channelHistoryChanged(event)
|
||||
break
|
||||
case .DMOpen, .GroupOpen:
|
||||
EventHandler.open(event, open: true)
|
||||
break
|
||||
case .DMClose, .GroupClose:
|
||||
EventHandler.open(event, open: false)
|
||||
break
|
||||
case .FileCreated:
|
||||
EventHandler.processFile(event)
|
||||
break
|
||||
case .FileShared:
|
||||
EventHandler.processFile(event)
|
||||
break
|
||||
case .FileUnshared:
|
||||
EventHandler.processFile(event)
|
||||
break
|
||||
case .FilePublic:
|
||||
EventHandler.processFile(event)
|
||||
break
|
||||
case .FilePrivate:
|
||||
EventHandler.filePrivate(event)
|
||||
break
|
||||
case .FileChanged:
|
||||
EventHandler.processFile(event)
|
||||
break
|
||||
case .FileDeleted:
|
||||
EventHandler.deleteFile(event)
|
||||
break
|
||||
case .FileCommentAdded:
|
||||
EventHandler.fileCommentAdded(event)
|
||||
break
|
||||
case .FileCommentEdited:
|
||||
EventHandler.fileCommentEdited(event)
|
||||
break
|
||||
case .FileCommentDeleted:
|
||||
EventHandler.fileCommentDeleted(event)
|
||||
break
|
||||
case .PinAdded:
|
||||
EventHandler.pinAdded(event)
|
||||
break
|
||||
case .PinRemoved:
|
||||
EventHandler.pinRemoved(event)
|
||||
break
|
||||
case .PresenceChange:
|
||||
EventHandler.presenceChange(event)
|
||||
break
|
||||
case .ManualPresenceChange:
|
||||
EventHandler.manualPresenceChange(event)
|
||||
break
|
||||
case .PrefChange:
|
||||
EventHandler.changePreference(event)
|
||||
break
|
||||
case .UserChange:
|
||||
EventHandler.userChange(event)
|
||||
break
|
||||
case .TeamJoin:
|
||||
EventHandler.teamJoin(event)
|
||||
break
|
||||
case .StarAdded:
|
||||
EventHandler.messageStarred(event, star: true)
|
||||
break
|
||||
case .StarRemoved:
|
||||
EventHandler.messageStarred(event, star: false)
|
||||
break
|
||||
case .ReactionAdded:
|
||||
EventHandler.addedReaction(event)
|
||||
break
|
||||
case .ReactionRemoved:
|
||||
EventHandler.removedReaction(event)
|
||||
break
|
||||
case .EmojiChanged:
|
||||
EventHandler.emojiChanged(event)
|
||||
break
|
||||
case .CommandsChanged:
|
||||
// Not implemented per Slack documentation.
|
||||
break
|
||||
case .TeamPlanChange:
|
||||
EventHandler.teamPlanChange(event)
|
||||
break
|
||||
case .TeamPrefChange:
|
||||
EventHandler.teamPreferenceChange(event)
|
||||
break
|
||||
case .TeamRename:
|
||||
EventHandler.teamNameChange(event)
|
||||
break
|
||||
case .TeamDomainChange:
|
||||
EventHandler.teamDomainChange(event)
|
||||
break
|
||||
case .EmailDomainChange:
|
||||
EventHandler.emailDomainChange(event)
|
||||
break
|
||||
case .BotAdded:
|
||||
EventHandler.bot(event)
|
||||
break
|
||||
case .BotChanged:
|
||||
EventHandler.bot(event)
|
||||
break
|
||||
case .AccountsChanged:
|
||||
// Not implemented per Slack documentation.
|
||||
break
|
||||
case .TeamMigrationStarted:
|
||||
Client.sharedInstance.connect()
|
||||
break
|
||||
case .Error:
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
static func messageDispatcher(event:Event) {
|
||||
let subtype = MessageSubtype(rawValue: event.subtype!)!
|
||||
switch subtype {
|
||||
case .MessageChanged:
|
||||
EventHandler.messageChanged(event)
|
||||
break
|
||||
case .MessageDeleted:
|
||||
EventHandler.messageDeleted(event)
|
||||
break
|
||||
default:
|
||||
EventHandler.messageReceived(event)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,315 +0,0 @@
|
||||
//
|
||||
// EventHandler.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
internal struct EventHandler {
|
||||
|
||||
//MARK: - Initial connection
|
||||
static func connected() {
|
||||
Client.sharedInstance.connected = true
|
||||
}
|
||||
|
||||
//MARK: - Messages
|
||||
|
||||
static func messageSent(event: Event) {
|
||||
if let reply = event.replyTo {
|
||||
if let message = Client.sharedInstance.sentMessages[reply] {
|
||||
message.ts = event.ts
|
||||
message.text = event.text
|
||||
Client.sharedInstance.channels?[message.channel!]?.messages[message.ts!] = message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func messageReceived(event: Event) {
|
||||
if let channel = event.channel,
|
||||
message = event.message
|
||||
{
|
||||
Client.sharedInstance.channels?[channel.id!]?.messages[message.ts!] = message
|
||||
}
|
||||
}
|
||||
|
||||
static func messageChanged(event: Event) {
|
||||
if let id = event.channel?.id {
|
||||
if let nested = event.nestedMessage {
|
||||
Client.sharedInstance.channels?[id]?.messages[nested.ts!] = nested
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func messageDeleted(event: Event) {
|
||||
if let id = event.channel?.id {
|
||||
if let key = event.message?.deletedTs {
|
||||
Client.sharedInstance.channels?[id]?.messages.removeValueForKey(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Channels
|
||||
static func userTyping(event: Event) {
|
||||
if (!Client.sharedInstance.channels![event.channel!.id!]!.usersTyping.contains(event.user!.id!)) {
|
||||
Client.sharedInstance.channels?[event.channel!.id!]?.usersTyping.append(event.user!.id!)
|
||||
}
|
||||
|
||||
let timeout = dispatch_time(DISPATCH_TIME_NOW, Int64(5.0 * Double(NSEC_PER_SEC)))
|
||||
dispatch_after(timeout, dispatch_get_main_queue()) {
|
||||
if let index = Client.sharedInstance.channels?[event.channel!.id!]?.usersTyping.indexOf(event.user!.id!) {
|
||||
Client.sharedInstance.channels?[event.channel!.id!]?.usersTyping.removeAtIndex(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func channelMarked(event: Event) {
|
||||
if let channel = event.channel {
|
||||
Client.sharedInstance.channels?[channel.id!]?.lastRead = event.ts
|
||||
}
|
||||
//TO-DO: Recalculate unreads
|
||||
}
|
||||
|
||||
static func channelCreated(event: Event) {
|
||||
if let channel = event.channel {
|
||||
Client.sharedInstance.channels?[channel.id!] = channel
|
||||
}
|
||||
}
|
||||
|
||||
static func channelDeleted(event: Event) {
|
||||
if let channel = event.channel {
|
||||
Client.sharedInstance.channels?.removeValueForKey(channel.id!)
|
||||
}
|
||||
}
|
||||
|
||||
static func channelJoined(event: Event) {
|
||||
if let channel = event.channel {
|
||||
Client.sharedInstance.channels?[channel.id!]?.members.append(Client.sharedInstance.authenticatedUser!.id!)
|
||||
}
|
||||
}
|
||||
|
||||
static func channelLeft(event: Event) {
|
||||
if let channel = event.channel {
|
||||
if let index = Client.sharedInstance.channels?[channel.id!]?.members.indexOf(Client.sharedInstance.authenticatedUser!.id!) {
|
||||
Client.sharedInstance.channels?[channel.id!]?.members.removeAtIndex(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func channelRenamed(event: Event) {
|
||||
if let channel = event.channel {
|
||||
Client.sharedInstance.channels?[channel.id!]?.name = channel.name
|
||||
}
|
||||
}
|
||||
|
||||
static func channelArchived(event: Event, archived: Bool) {
|
||||
if let channel = event.channel {
|
||||
Client.sharedInstance.channels?[channel.id!]?.isArchived = archived
|
||||
}
|
||||
}
|
||||
|
||||
static func channelHistoryChanged(event: Event) {
|
||||
//TO-DO: Reload chat history if there are any cached messages before latest
|
||||
}
|
||||
|
||||
//MARK: - DM & Group Open/Close
|
||||
static func open(event: Event, open: Bool) {
|
||||
if let channel = event.channel {
|
||||
Client.sharedInstance.channels?[channel.id!]?.isOpen = open
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Files
|
||||
static func processFile(event: Event) {
|
||||
if let file = event.file {
|
||||
Client.sharedInstance.files?[file.id!] = file
|
||||
}
|
||||
}
|
||||
|
||||
static func filePrivate(event: Event) {
|
||||
if let file = event.file {
|
||||
Client.sharedInstance.files?[file.id!]?.isPublic = false
|
||||
}
|
||||
}
|
||||
|
||||
static func deleteFile(event: Event) {
|
||||
if let file = event.file {
|
||||
Client.sharedInstance.files?.removeValueForKey(file.id!)
|
||||
}
|
||||
}
|
||||
|
||||
static func fileCommentAdded(event: Event) {
|
||||
if let file = event.file {
|
||||
if let comment = event.comment {
|
||||
Client.sharedInstance.files?[file.id!]?.comments?.append(comment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func fileCommentEdited(event: Event) {
|
||||
if let file = event.file {
|
||||
if let commentEdit = event.comment {
|
||||
if let comments = Client.sharedInstance.files?[file.id!]?.comments?.filter({$0.id == commentEdit.id}) {
|
||||
if var comment = comments.first {
|
||||
comment.comment = commentEdit.comment
|
||||
comment.timestamp = commentEdit.timestamp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func fileCommentDeleted(event: Event) {
|
||||
if let file = event.file {
|
||||
if let comment = event.comment {
|
||||
if let comments = Client.sharedInstance.files?[file.id!]?.comments?.filter({$0.id != comment.id}) {
|
||||
Client.sharedInstance.files?[file.id!]?.comments = comments
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Pins
|
||||
static func pinAdded(event: Event) {
|
||||
if let id = event.channelID {
|
||||
Client.sharedInstance.channels?[id]?.pinnedItems.append(event.item!)
|
||||
}
|
||||
}
|
||||
|
||||
static func pinRemoved(event: Event) {
|
||||
if let id = event.channelID {
|
||||
if let pins = Client.sharedInstance.channels?[id]?.pinnedItems.filter({$0 != event.item}) {
|
||||
Client.sharedInstance.channels?[id]?.pinnedItems = pins
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Stars
|
||||
static func messageStarred(event: Event, star: Bool) {
|
||||
if let item = event.item {
|
||||
if let message = Client.sharedInstance.channels?[item.channel!]?.messages[item.message!.ts!] {
|
||||
message.isStarred = star
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Reactions
|
||||
static func addedReaction(event: Event) {
|
||||
if let channel = event.item?.channel {
|
||||
if let message = Client.sharedInstance.channels?[channel]?.messages[event.item!.ts!] {
|
||||
if (message.reactions[event.reaction!]) == nil {
|
||||
message.reactions[event.reaction!] = Reaction(name: event.reaction, user: event.user!.id!)
|
||||
} else {
|
||||
message.reactions[event.reaction!]?.users[event.user!.id!] = event.user!.id!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func removedReaction(event: Event) {
|
||||
if let channel = event.item?.channel {
|
||||
if let message = Client.sharedInstance.channels?[channel]?.messages[event.item!.ts!] {
|
||||
if (message.reactions[event.reaction!]) != nil {
|
||||
message.reactions[event.reaction!]?.users.removeValueForKey(event.user!.id!)
|
||||
}
|
||||
if (message.reactions[event.reaction!]?.users.count == 0) {
|
||||
message.reactions.removeValueForKey(event.reaction!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Preferences
|
||||
static func changePreference(event: Event) {
|
||||
if let name = event.name {
|
||||
Client.sharedInstance.authenticatedUser?.preferences?[name] = event.value
|
||||
}
|
||||
}
|
||||
|
||||
//Mark: - User Change
|
||||
static func userChange(event: Event) {
|
||||
if var user = event.user {
|
||||
user.preferences = Client.sharedInstance.users?[user.id!]?.preferences
|
||||
Client.sharedInstance.users?[user.id!] = user
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - User Presence
|
||||
static func presenceChange(event: Event) {
|
||||
if let user = event.user {
|
||||
Client.sharedInstance.users?[user.id!]?.presence = event.presence
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Team
|
||||
static func teamJoin(event: Event) {
|
||||
if let user = event.user {
|
||||
Client.sharedInstance.users?[user.id!] = user
|
||||
}
|
||||
}
|
||||
|
||||
static func teamPlanChange(event: Event) {
|
||||
if let plan = event.plan {
|
||||
Client.sharedInstance.team?.plan = plan
|
||||
}
|
||||
}
|
||||
|
||||
static func teamPreferenceChange(event: Event) {
|
||||
if let name = event.name {
|
||||
Client.sharedInstance.team?.prefs?[name] = event.value
|
||||
}
|
||||
}
|
||||
|
||||
static func teamNameChange(event: Event) {
|
||||
if let name = event.name {
|
||||
Client.sharedInstance.team?.name = name
|
||||
}
|
||||
}
|
||||
|
||||
static func teamDomainChange(event: Event) {
|
||||
if let domain = event.domain {
|
||||
Client.sharedInstance.team?.domain = domain
|
||||
}
|
||||
}
|
||||
|
||||
static func emailDomainChange(event: Event) {
|
||||
if let domain = event.emailDomain {
|
||||
Client.sharedInstance.team?.emailDomain = domain
|
||||
}
|
||||
}
|
||||
|
||||
//Mark: - Changed
|
||||
static func emojiChanged(event: Event) {
|
||||
//TODO: Call emoji.list here
|
||||
}
|
||||
|
||||
//Mark: - Bots
|
||||
static func bot(event: Event) {
|
||||
if let bot = event.bot {
|
||||
Client.sharedInstance.bots?[bot.id!] = bot
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Authenticated User
|
||||
static func manualPresenceChange(event: Event) {
|
||||
Client.sharedInstance.authenticatedUser?.presence = event.presence
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct File {
|
||||
|
||||
let id: String?
|
||||
let created: String?
|
||||
let timeStamp: String?
|
||||
let name: String?
|
||||
let title: String?
|
||||
let mimeType: String?
|
||||
let fileType: String?
|
||||
let prettyType: String?
|
||||
let user: String?
|
||||
let mode: String?
|
||||
let editable: Bool?
|
||||
let isExternal: Bool?
|
||||
let externalType: String?
|
||||
let size: Int?
|
||||
let url: String?
|
||||
let urlDownload: String?
|
||||
let urlPrivate: String?
|
||||
let urlPrivateDownload: String?
|
||||
let thumb64: String?
|
||||
let thumb80: String?
|
||||
let thumb360: String?
|
||||
let thumb360gif: String?
|
||||
let thumb360w: String?
|
||||
let thumb360h: String?
|
||||
let permalink: String?
|
||||
let editLink: String?
|
||||
let preview: String?
|
||||
let previewHighlight: String?
|
||||
let lines: Int?
|
||||
let linesMore: Int?
|
||||
internal(set) public var isPublic: Bool?
|
||||
let publicSharedURL: Bool?
|
||||
let channels: [String]?
|
||||
let groups: [String]?
|
||||
let dms: [String]?
|
||||
let initialComment: Comment?
|
||||
let stars: Int?
|
||||
let isStarred: Bool?
|
||||
let pinnedTo: [String]?
|
||||
internal(set) public lazy var comments = [Comment]?()
|
||||
|
||||
init?(file:Dictionary<String, AnyObject>?) {
|
||||
id = file?["id"] as? String
|
||||
created = file?["created"] as? String
|
||||
timeStamp = file?["timestamp"] as? String
|
||||
name = file?["name"] as? String
|
||||
title = file?["title"] as? String
|
||||
mimeType = file?["mimetype"] as? String
|
||||
fileType = file?["filetype"] as? String
|
||||
prettyType = file?["pretty_type"] as? String
|
||||
user = file?["user"] as? String
|
||||
mode = file?["mode"] as? String
|
||||
editable = file?["editable"] as? Bool
|
||||
isExternal = file?["is_external"] as? Bool
|
||||
externalType = file?["external_type"] as? String
|
||||
size = file?["size"] as? Int
|
||||
url = file?["url"] as? String
|
||||
urlDownload = file?["url_download"] as? String
|
||||
urlPrivate = file?["url_private"] as? String
|
||||
urlPrivateDownload = file?["url_private_download"] as? String
|
||||
thumb64 = file?["thumb_64"] as? String
|
||||
thumb80 = file?["thumb_80"] as? String
|
||||
thumb360 = file?["thumb_360"] as? String
|
||||
thumb360gif = file?["thumb_360_gif"] as? String
|
||||
thumb360w = file?["thumb_360_w"] as? String
|
||||
thumb360h = file?["thumb_360_h"] as? String
|
||||
permalink = file?["permalink"] as? String
|
||||
editLink = file?["edit_link"] as? String
|
||||
preview = file?["preview"] as? String
|
||||
previewHighlight = file?["preview_highlight"] as? String
|
||||
lines = file?["lines"] as? Int
|
||||
linesMore = file?["lines_more"] as? Int
|
||||
isPublic = file?["is_public"] as? Bool
|
||||
publicSharedURL = file?["public_url_shared"] as? Bool
|
||||
channels = file?["channels"] as? [String]
|
||||
groups = file?["groups"] as? [String]
|
||||
dms = file?["ims"] as? [String]
|
||||
initialComment = Comment(comment: file?["initial_comment"] as? Dictionary<String, AnyObject>)
|
||||
stars = file?["stars"] as? Int
|
||||
isStarred = file?["is_starred"] as? Bool
|
||||
pinnedTo = file?["pinned_to"] as? [String]
|
||||
}
|
||||
|
||||
init?(id:String?) {
|
||||
self.id = id
|
||||
created = nil
|
||||
timeStamp = nil
|
||||
name = nil
|
||||
title = nil
|
||||
mimeType = nil
|
||||
fileType = nil
|
||||
prettyType = nil
|
||||
user = nil
|
||||
mode = nil
|
||||
editable = nil
|
||||
isExternal = nil
|
||||
externalType = nil
|
||||
size = nil
|
||||
url = nil
|
||||
urlDownload = nil
|
||||
urlPrivate = nil
|
||||
urlPrivateDownload = nil
|
||||
thumb64 = nil
|
||||
thumb80 = nil
|
||||
thumb360 = nil
|
||||
thumb360gif = nil
|
||||
thumb360w = nil
|
||||
thumb360h = nil
|
||||
permalink = nil
|
||||
editLink = nil
|
||||
preview = nil
|
||||
previewHighlight = nil
|
||||
lines = nil
|
||||
linesMore = nil
|
||||
publicSharedURL = nil
|
||||
channels = nil
|
||||
groups = nil
|
||||
dms = nil
|
||||
initialComment = nil
|
||||
stars = nil
|
||||
isStarred = nil
|
||||
pinnedTo = nil
|
||||
}
|
||||
}
|
||||
|
||||
extension File: Equatable {}
|
||||
|
||||
public func ==(lhs: File, rhs: File) -> Bool {
|
||||
return lhs.id == rhs.id
|
||||
}
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
//
|
||||
// Message.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public enum ItemType: String {
|
||||
case ChannelMessage = "C"
|
||||
case PrivateGroupMessage = "G"
|
||||
case File = "F"
|
||||
case FileComments = "Fc"
|
||||
}
|
||||
|
||||
public class Message {
|
||||
|
||||
let type = "message"
|
||||
let subtype: String?
|
||||
var ts: String?
|
||||
let user: String?
|
||||
let channel: String?
|
||||
let hidden: Bool?
|
||||
internal(set) public var text: String?
|
||||
let botID: String?
|
||||
let username: String?
|
||||
let icons: Dictionary<String, AnyObject>?
|
||||
let deletedTs: String?
|
||||
let purpose: String?
|
||||
let topic: String?
|
||||
let name: String?
|
||||
let members: [String]?
|
||||
let oldName: String?
|
||||
let upload: Bool?
|
||||
let itemType: String?
|
||||
internal(set) public var isStarred: Bool?
|
||||
let pinnedTo: [String]?
|
||||
let comment: Comment?
|
||||
let file: File?
|
||||
internal(set) public lazy var reactions = Dictionary<String, Reaction>()
|
||||
|
||||
init?(message: Dictionary<String, AnyObject>?) {
|
||||
subtype = message?["subtype"] as? String
|
||||
ts = message?["ts"] as? String
|
||||
user = message?["user"] as? String
|
||||
channel = message?["channel"] as? String
|
||||
hidden = message?["hidden"] as? Bool
|
||||
text = message?["text"] as? String
|
||||
botID = message?["bot_id"] as? String
|
||||
username = message?["username"] as? String
|
||||
icons = message?["icons"] as? Dictionary<String, AnyObject>
|
||||
deletedTs = message?["deleted_ts"] as? String
|
||||
purpose = message?["purpose"] as? String
|
||||
topic = message?["topic"] as? String
|
||||
name = message?["name"] as? String
|
||||
members = message?["members"] as? [String]
|
||||
oldName = message?["old_name"] as? String
|
||||
upload = message?["upload"] as? Bool
|
||||
itemType = message?["item_type"] as? String
|
||||
isStarred = message?["is_starred"] as? Bool
|
||||
pinnedTo = message?["pinned_to"] as? [String]
|
||||
comment = Comment(comment: message?["comment"] as? Dictionary<String, AnyObject>)
|
||||
file = File(file: message?["file"] as? Dictionary<String, AnyObject>)
|
||||
if let messageReactions = message?["reactions"] as? [Dictionary<String, AnyObject>] {
|
||||
for react in messageReactions {
|
||||
let reaction = Reaction(reaction: react)
|
||||
self.reactions[reaction!.name!] = reaction
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Message: Equatable {}
|
||||
|
||||
public func ==(lhs: Message, rhs: Message) -> Bool {
|
||||
return lhs.ts == rhs.ts && lhs.user == rhs.user && lhs.text == rhs.text
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// SlackKit.h
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for SlackKit.
|
||||
FOUNDATION_EXPORT double SlackKitVersionNumber;
|
||||
|
||||
//! Project version string for SlackKit.
|
||||
FOUNDATION_EXPORT const unsigned char SlackKitVersionString[];
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// Team.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct Team {
|
||||
|
||||
let id: String
|
||||
internal(set) public var name: String?
|
||||
internal(set) public var emailDomain: String?
|
||||
internal(set) public var domain: String?
|
||||
internal(set) public var messageEditWindowMinutes: Int?
|
||||
internal(set) public var overStorageLimit: Bool?
|
||||
internal(set) public var prefs: Dictionary<String, AnyObject>?
|
||||
internal(set) public var plan: String?
|
||||
|
||||
internal init?(team: Dictionary<String, AnyObject>?) {
|
||||
id = team?["id"] as! String
|
||||
name = team?["id"] as? String
|
||||
emailDomain = team?["email_domain"] as? String
|
||||
domain = team?["domain"] as? String
|
||||
messageEditWindowMinutes = team?["mesg_edit_window_mins"] as? Int
|
||||
overStorageLimit = team?["over_storage_limit"] as? Bool
|
||||
prefs = team?["prefs"] as? Dictionary<String, AnyObject>
|
||||
plan = team?["plan"] as? String
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
//
|
||||
// Types.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
// MARK: - Edited
|
||||
public struct Edited {
|
||||
let user: String?
|
||||
let ts: String?
|
||||
|
||||
internal init?(edited:Dictionary<String, AnyObject>?) {
|
||||
user = edited?["user"] as? String
|
||||
ts = edited?["ts"] as? String
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Reaction
|
||||
public struct Reaction {
|
||||
let name: String?
|
||||
internal(set) public lazy var users = Dictionary<String, String>()
|
||||
|
||||
internal init?(reaction:Dictionary<String, AnyObject>?) {
|
||||
name = reaction?["name"] as? String
|
||||
}
|
||||
|
||||
internal init?(name: String?, user: String) {
|
||||
self.name = name
|
||||
users[user] = user
|
||||
}
|
||||
}
|
||||
|
||||
extension Reaction: Equatable {}
|
||||
|
||||
public func ==(lhs: Reaction, rhs: Reaction) -> Bool {
|
||||
return lhs.name == rhs.name
|
||||
}
|
||||
|
||||
// MARK: - Comment
|
||||
public struct Comment {
|
||||
let id: String?
|
||||
let user: String?
|
||||
internal(set) public var timestamp: String?
|
||||
internal(set) public var comment: String?
|
||||
|
||||
internal init?(comment:Dictionary<String, AnyObject>?) {
|
||||
id = comment?["id"] as? String
|
||||
timestamp = comment?["timestamp"] as? String
|
||||
user = comment?["user"] as? String
|
||||
self.comment = comment?["comment"] as? String
|
||||
}
|
||||
|
||||
internal init?(id: String?) {
|
||||
self.id = id
|
||||
self.comment = nil
|
||||
self.timestamp = nil
|
||||
self.user = nil
|
||||
}
|
||||
}
|
||||
|
||||
extension Comment: Equatable {}
|
||||
|
||||
public func ==(lhs: Comment, rhs: Comment) -> Bool {
|
||||
return lhs.id == rhs.id
|
||||
}
|
||||
|
||||
// MARK: - Item
|
||||
public struct Item {
|
||||
let type: String?
|
||||
let ts: String?
|
||||
let channel: String?
|
||||
let message: Message?
|
||||
let file: File?
|
||||
let comment: Comment?
|
||||
|
||||
internal init?(item:Dictionary<String, AnyObject>?) {
|
||||
type = item?["type"] as? String
|
||||
ts = item?["ts"] as? String
|
||||
channel = item?["channel"] as? String
|
||||
message = Message(message: item?["message"] as? Dictionary<String, AnyObject>)
|
||||
file = File(file: item?["file"] as? Dictionary<String, AnyObject>)
|
||||
comment = Comment(comment: item?["comment"] as? Dictionary<String, AnyObject>)
|
||||
}
|
||||
}
|
||||
|
||||
extension Item: Equatable {}
|
||||
|
||||
public func ==(lhs: Item, rhs: Item) -> Bool {
|
||||
return lhs.type == rhs.type && lhs.channel == rhs.channel && lhs.file == rhs.file && lhs.comment == rhs.comment && lhs.message == rhs.message
|
||||
}
|
||||
|
||||
// MARK: - Topic
|
||||
public struct Topic {
|
||||
let value: String?
|
||||
let creator: String?
|
||||
let lastSet: String?
|
||||
|
||||
internal init?(topic: Dictionary<String, AnyObject>?) {
|
||||
value = topic?["value"] as? String
|
||||
creator = topic?["creator"] as? String
|
||||
lastSet = topic?["last_set"] as? String
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
//
|
||||
// User.swift
|
||||
//
|
||||
// Copyright © 2015 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct User {
|
||||
|
||||
public struct Profile {
|
||||
internal(set) public var firstName: String?
|
||||
internal(set) public var lastName: String?
|
||||
internal(set) public var realName: String?
|
||||
internal(set) public var email: String?
|
||||
internal(set) public var skype: String?
|
||||
internal(set) public var phone: String?
|
||||
internal(set) public var image24: String?
|
||||
internal(set) public var image32: String?
|
||||
internal(set) public var image48: String?
|
||||
internal(set) public var image72: String?
|
||||
internal(set) public var image192: String?
|
||||
|
||||
internal init?(profile: Dictionary<String, AnyObject>?) {
|
||||
firstName = profile?["first_name"] as? String
|
||||
lastName = profile?["last_name"] as? String
|
||||
realName = profile?["real_name"] as? String
|
||||
email = profile?["email"] as? String
|
||||
skype = profile?["skype"] as? String
|
||||
phone = profile?["phone"] as? String
|
||||
image24 = profile?["image_24"] as? String
|
||||
image32 = profile?["image_32"] as? String
|
||||
image48 = profile?["image_48"] as? String
|
||||
image72 = profile?["image_72"] as? String
|
||||
image192 = profile?["image_192"] as? String
|
||||
}
|
||||
}
|
||||
|
||||
let id: String?
|
||||
internal(set) public var name: String?
|
||||
internal(set) public var deleted: Bool?
|
||||
internal(set) public var profile: Profile?
|
||||
internal(set) public var presence: String?
|
||||
internal(set) public var color: String?
|
||||
let isBot: Bool?
|
||||
internal(set) public var isAdmin: Bool?
|
||||
internal(set) public var isOwner: Bool?
|
||||
internal(set) public var isPrimaryOwner: Bool?
|
||||
internal(set) public var isRestricted: Bool?
|
||||
internal(set) public var isUltraRestricted: Bool?
|
||||
internal(set) public var has2fa: Bool?
|
||||
internal(set) public var hasFiles: Bool?
|
||||
internal(set) public var status: String?
|
||||
internal(set) public var timeZone: String?
|
||||
internal(set) public var timeZoneLabel: String?
|
||||
internal(set) public var timeZoneOffSet: Int?
|
||||
internal(set) public var preferences: Dictionary<String, AnyObject>?
|
||||
|
||||
internal init?(user: Dictionary<String, AnyObject>?) {
|
||||
id = user?["id"] as? String
|
||||
name = user?["name"] as? String
|
||||
deleted = user?["deleted"] as? Bool
|
||||
profile = Profile(profile: user?["profile"] as? Dictionary<String, AnyObject>)
|
||||
color = user?["color"] as? String
|
||||
isAdmin = user?["is_admin"] as? Bool
|
||||
isOwner = user?["is_owner"] as? Bool
|
||||
isPrimaryOwner = user?["is_primary_owner"] as? Bool
|
||||
isRestricted = user?["is_restricted"] as? Bool
|
||||
isUltraRestricted = user?["is_ultra_restricted"] as? Bool
|
||||
has2fa = user?["has_2fa"] as? Bool
|
||||
hasFiles = user?["has_files"] as? Bool
|
||||
isBot = user?["is_bot"] as? Bool
|
||||
presence = user?["presence"] as? String
|
||||
status = user?["status"] as? String
|
||||
timeZone = user?["tz"] as? String
|
||||
timeZoneLabel = user?["tz_label"] as? String
|
||||
timeZoneOffSet = user?["tz_offset"] as? Int
|
||||
preferences = user?["prefs"] as? Dictionary<String, AnyObject>
|
||||
}
|
||||
|
||||
internal init?(id: String?) {
|
||||
self.id = id
|
||||
self.isBot = nil
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// SlackKit.swift
|
||||
//
|
||||
// Copyright © 2017 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
@_exported import SKClient
|
||||
@_exported import SKCore
|
||||
@_exported import SKRTMAPI
|
||||
@_exported import SKServer
|
||||
@_exported import SKWebAPI
|
||||
|
||||
public final class SlackKit: RTMAdapter {
|
||||
|
||||
public typealias EventClosure = (Event, Client?) -> Void
|
||||
internal typealias TypedEvent = (EventType, EventClosure)
|
||||
internal var callbacks = [TypedEvent]()
|
||||
internal(set) public var rtm: SKRTMAPI?
|
||||
internal(set) public var server: SKServer?
|
||||
internal(set) public var webAPI: WebAPI?
|
||||
internal(set) public var clients: [String: Client] = [:]
|
||||
|
||||
public init() {}
|
||||
|
||||
public func addWebAPIAccessWithToken(_ token: String) {
|
||||
self.webAPI = WebAPI(token: token)
|
||||
}
|
||||
|
||||
public func addRTMBotWithAPIToken(
|
||||
_ token: String,
|
||||
client: Client? = Client(),
|
||||
options: RTMOptions = RTMOptions(),
|
||||
rtm: RTMWebSocket? = nil
|
||||
) {
|
||||
self.rtm = SKRTMAPI(withAPIToken: token, options: options, rtm: rtm)
|
||||
self.rtm?.adapter = self
|
||||
clients[token] = client
|
||||
self.rtm?.connect()
|
||||
}
|
||||
|
||||
public func addServer(_ server: SlackKitServer? = nil, responder: SlackKitResponder? = nil, oauth: OAuthConfig? = nil) {
|
||||
var responder: SlackKitResponder = responder ?? SlackKitResponder(routes: [])
|
||||
if let oauth = oauth {
|
||||
responder.routes.append(oauthRequestRoute(config: oauth))
|
||||
}
|
||||
self.server = SKServer(server: server, responder: responder)
|
||||
self.server?.start()
|
||||
}
|
||||
|
||||
private func oauthRequestRoute(config: OAuthConfig) -> RequestRoute {
|
||||
let oauth = OAuthMiddleware(config: config) { authorization in
|
||||
// User
|
||||
if let token = authorization.accessToken {
|
||||
self.webAPI = WebAPI(token: token)
|
||||
}
|
||||
// Bot User
|
||||
if let token = authorization.bot?.botToken {
|
||||
self.webAPI = WebAPI(token: token)
|
||||
self.rtm = SKRTMAPI(withAPIToken: token, options: RTMOptions(), rtm: nil)
|
||||
self.rtm?.adapter = self
|
||||
self.clients[token] = Client()
|
||||
self.rtm?.connect()
|
||||
}
|
||||
}
|
||||
return RequestRoute(path: "/oauth", middleware: oauth)
|
||||
}
|
||||
|
||||
// MARK: - RTM Adapter
|
||||
public func initialSetup(json: [String: Any], instance: SKRTMAPI) {
|
||||
clients[instance.token]?.initialSetup(JSON: json)
|
||||
}
|
||||
|
||||
public func notificationForEvent(_ event: Event, type: EventType, instance: SKRTMAPI) {
|
||||
let client = clients[instance.token]
|
||||
client?.notificationForEvent(event, type: type)
|
||||
executeCallbackForEvent(event, type: type, client: client)
|
||||
}
|
||||
|
||||
// MARK: - Callbacks
|
||||
public func notificationForEvent(_ type: EventType, event: @escaping EventClosure) {
|
||||
callbacks.append((type, event))
|
||||
}
|
||||
|
||||
private func executeCallbackForEvent(_ event: Event, type: EventType, client: Client?) {
|
||||
let cbs = callbacks.filter {$0.0 == type}
|
||||
for callback in cbs {
|
||||
callback.1(event, client)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<string>4.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2015 Peter Zignego. All rights reserved.</string>
|
||||
<string>Copyright © 2017 Peter Zignego. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
Reference in New Issue
Block a user