Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d60b8bf88a | |||
| f2f95b7a26 | |||
| c4b38dbc14 | |||
| 7fffbc8dba | |||
| ab39fda0f5 | |||
| 11e9f2e9ab | |||
| a93b4b7966 | |||
| b639fff78e | |||
| 6075577ec5 | |||
| 7a967b8f7d | |||
| 5f53f89693 | |||
| 30d701f6de | |||
| 82e200f4cc | |||
| 6cca5c3956 | |||
| 43f184a8ed | |||
| c5ce209e54 | |||
| fc336cd2ee | |||
| 7138cf3f4f | |||
| 00b2605a37 | |||
| 2561e8ba48 | |||
| 00b0823dbd | |||
| b88ef3638c | |||
| 1675aa82fb | |||
| 01be45e979 | |||
| dc3336a807 | |||
| 5962ce5115 | |||
| db6bf52eaa | |||
| 32ae1ed7a2 | |||
| 2e4b4390b3 | |||
| 07861887f1 | |||
| 1c9b7bb011 | |||
| 59e1e8856d | |||
| 76b33dba0e | |||
| 6040d8deaa |
+4
-5
@@ -16,10 +16,9 @@ DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
|
||||
# SwiftPM
|
||||
Packages/
|
||||
.build
|
||||
Packages/
|
||||
*.xcodeproj/
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
@@ -28,10 +27,10 @@ Packages/
|
||||
# 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
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
github "daltoniam/Starscream" "1.1.3"
|
||||
@@ -0,0 +1,8 @@
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "leaderboard",
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 0, minor: 0),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,167 @@
|
||||
//
|
||||
// main.swift
|
||||
//
|
||||
// Copyright © 2016 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 String
|
||||
import SlackKit
|
||||
|
||||
class Leaderboard: MessageEventsDelegate {
|
||||
|
||||
var leaderboard: [String: Int] = [String: Int]()
|
||||
let atSet = CharacterSet(characters: ["@"])
|
||||
|
||||
let client: SlackClient
|
||||
|
||||
init(token: String) {
|
||||
client = SlackClient(apiToken: token)
|
||||
client.messageEventsDelegate = self
|
||||
}
|
||||
|
||||
enum Command: String {
|
||||
case Leaderboard = "leaderboard"
|
||||
}
|
||||
|
||||
enum Trigger: String {
|
||||
case PlusPlus = "++"
|
||||
case MinusMinus = "--"
|
||||
}
|
||||
|
||||
// MARK: MessageEventsDelegate
|
||||
func messageReceived(message: Message) {
|
||||
listen(message: message)
|
||||
}
|
||||
|
||||
func messageSent(message: Message){}
|
||||
func messageChanged(message: Message){}
|
||||
func messageDeleted(message: Message?){}
|
||||
|
||||
// MARK: Leaderboard Internal Logic
|
||||
private func listen(message: Message) {
|
||||
if let id = client.authenticatedUser?.id, text = message.text {
|
||||
if text.lowercased().contains(query: Command.Leaderboard.rawValue) && text.contains(query: id) {
|
||||
handleCommand(command: .Leaderboard, channel: message.channel)
|
||||
}
|
||||
}
|
||||
if message.text?.contains(query: Trigger.PlusPlus.rawValue) == true {
|
||||
handleMessageWithTrigger(message: message, trigger: .PlusPlus)
|
||||
}
|
||||
if message.text?.contains(query: Trigger.MinusMinus.rawValue) == true {
|
||||
handleMessageWithTrigger(message: message, trigger: .MinusMinus)
|
||||
}
|
||||
}
|
||||
|
||||
private func handleMessageWithTrigger(message: Message, trigger: Trigger) {
|
||||
if let text = message.text,
|
||||
start = text.index(of: "@"),
|
||||
end = text.index(of: trigger.rawValue) {
|
||||
let string = String(text.characters[start...end].dropLast().dropFirst())
|
||||
let users = client.users.values.filter{$0.id == self.userID(string: string)}
|
||||
if users.count > 0 {
|
||||
let idString = userID(string: string)
|
||||
initalizationForValue(dictionary: &leaderboard, value: idString)
|
||||
scoringForValue(dictionary: &leaderboard, value: idString, trigger: trigger)
|
||||
} else {
|
||||
initalizationForValue(dictionary: &leaderboard, value: string)
|
||||
scoringForValue(dictionary: &leaderboard, value: string, trigger: trigger)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleCommand(command: Command, channel:String?) {
|
||||
switch command {
|
||||
case .Leaderboard:
|
||||
if let id = channel {
|
||||
client.webAPI.sendMessage(channel:id, text: "Leaderboard", linkNames: true, attachments: [constructLeaderboardAttachment()], success: {(response) in
|
||||
|
||||
}, failure: { (error) in
|
||||
print("Leaderboard failed to post due to error:\(error)")
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func initalizationForValue( dictionary: inout [String: Int], value: String) {
|
||||
if dictionary[value] == nil {
|
||||
dictionary[value] = 0
|
||||
}
|
||||
}
|
||||
|
||||
private func scoringForValue( dictionary: inout [String: Int], value: String, trigger: Trigger) {
|
||||
switch trigger {
|
||||
case .PlusPlus:
|
||||
dictionary[value]?+=1
|
||||
case .MinusMinus:
|
||||
dictionary[value]?-=1
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Leaderboard Interface
|
||||
private func constructLeaderboardAttachment() -> Attachment? {
|
||||
let 💯 = AttachmentField(title: "💯", value: swapIDsForNames(string: topItems(dictionary: &leaderboard)), short: true)
|
||||
let 💩 = AttachmentField(title: "💩", value: swapIDsForNames(string: bottomItems(dictionary: &leaderboard)), short: true)
|
||||
return Attachment(fallback: "Leaderboard", title: "Leaderboard", colorHex: AttachmentColor.Good.rawValue, text: "", fields: [💯, 💩])
|
||||
}
|
||||
|
||||
private func topItems(dictionary: inout [String: Int]) -> String {
|
||||
let sortedKeys = dictionary.keys.sorted(isOrderedBefore: ({dictionary[$0] > dictionary[$1]})).filter({dictionary[$0] > 0})
|
||||
let sortedValues = dictionary.values.sorted(isOrderedBefore: {$0 > $1}).filter({$0 > 0})
|
||||
return leaderboardString(keys: sortedKeys, values: sortedValues)
|
||||
}
|
||||
|
||||
private func bottomItems( dictionary: inout [String: Int]) -> String {
|
||||
let sortedKeys = dictionary.keys.sorted(isOrderedBefore: ({dictionary[$0] < dictionary[$1]})).filter({dictionary[$0] < 0})
|
||||
let sortedValues = dictionary.values.sorted(isOrderedBefore: {$0 < $1}).filter({$0 < 0})
|
||||
return leaderboardString(keys: sortedKeys, values: sortedValues)
|
||||
}
|
||||
|
||||
private func leaderboardString(keys: [String], values: [Int]) -> String {
|
||||
var returnValue = ""
|
||||
for i in 0..<values.count {
|
||||
returnValue += keys[i] + " (" + "\(values[i])" + ")\n"
|
||||
}
|
||||
return returnValue
|
||||
}
|
||||
|
||||
// MARK: - Utilities
|
||||
private func swapIDsForNames(string: String) -> String {
|
||||
var returnString = string
|
||||
for key in client.users.keys {
|
||||
if let name = client.users[key]?.name {
|
||||
if returnString.contains(query: key) {
|
||||
returnString.replace(string: key, with: "@"+name)
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnString
|
||||
}
|
||||
|
||||
private func userID(string: String) -> String {
|
||||
let alphanumericSet = CharacterSet(characters:
|
||||
["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
|
||||
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
|
||||
"0","1","2","3","4","5","6","7","8","9"])
|
||||
return string.trim(alphanumericSet.inverted)
|
||||
}
|
||||
}
|
||||
|
||||
let leaderboard = Leaderboard(token: "xoxb-SLACK_API_TOKEN")
|
||||
leaderboard.client.connect()
|
||||
@@ -0,0 +1,9 @@
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "robot-or-not-bot",
|
||||
targets: [],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 0, minor: 0),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,139 @@
|
||||
//
|
||||
// main.swift
|
||||
//
|
||||
// Copyright © 2016 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 SlackKit
|
||||
|
||||
class RobotOrNotBot: MessageEventsDelegate {
|
||||
|
||||
let verdicts: [String:Bool] = [
|
||||
"Mr. Roboto" : false,
|
||||
"Service Kiosks": false,
|
||||
"Darth Vader": false,
|
||||
"K-9": true,
|
||||
"Emotions": false,
|
||||
"Self-Driving Cars": false,
|
||||
"Telepresence Robots": false,
|
||||
"Roomba": true,
|
||||
"Assembly-Line Robot": false,
|
||||
"ASIMO": false,
|
||||
"KITT": false,
|
||||
"USS Enterprise": false,
|
||||
"Transformers": true,
|
||||
"Jaegers": false,
|
||||
"The Major": false,
|
||||
"Siri": false,
|
||||
"The Terminator": true,
|
||||
"Commander Data": false,
|
||||
"Marvin the Paranoid Android": true,
|
||||
"Pinocchio": false,
|
||||
"Droids": true,
|
||||
"Hitchbot": false,
|
||||
"Mars Rovers": false,
|
||||
"Space Probes": false,
|
||||
"Sasquatch": false,
|
||||
"Toaster": false,
|
||||
"Toaster Oven": false,
|
||||
"Cylons": false,
|
||||
"V'ger": true,
|
||||
"Ilia Robot": false,
|
||||
"The TARDIS": false,
|
||||
"Johnny 5": true,
|
||||
"Twiki": true,
|
||||
"Dr. Theopolis": false,
|
||||
"robots.txt": false,
|
||||
"Lobot": false,
|
||||
"Vicki": true,
|
||||
"GlaDOS": false,
|
||||
"Turrets": true,
|
||||
"Wheatley": true,
|
||||
"Herbie the Love Bug": false,
|
||||
"Iron Man": false,
|
||||
"Ultron": false,
|
||||
"The Vision": false,
|
||||
"Clockwork Droids": false,
|
||||
"Podcasts": false,
|
||||
"Cars": false,
|
||||
"Swimming Pool Cleaners": false,
|
||||
"Burritos": false,
|
||||
"Prince Robot IV": false,
|
||||
"Daleks": false,
|
||||
"Cybermen": false,
|
||||
"The Internet of Things": false,
|
||||
"Nanobots": true,
|
||||
"Two Intermeshed Gears": false,
|
||||
"Crow T. Robot": true,
|
||||
"Tom Servo": true,
|
||||
"Thomas and Friends": false,
|
||||
"Replicants": false,
|
||||
"Chatbots": false,
|
||||
"Agents": false,
|
||||
"Lego Simulated Worm Toy": true,
|
||||
"Ghosts": false,
|
||||
"Exos": true,
|
||||
"Rasputin": false,
|
||||
"Tamagotchi": false,
|
||||
"T-1000": true,
|
||||
"The Tin Woodman": false,
|
||||
"Mic N. The Robot": true,
|
||||
"Robot Or Not Bot": false
|
||||
]
|
||||
let client: SlackClient
|
||||
|
||||
init(token: String) {
|
||||
client = SlackClient(apiToken: token)
|
||||
client.messageEventsDelegate = self
|
||||
}
|
||||
|
||||
// MARK: MessageEventsDelegate
|
||||
func messageReceived(message: Message) {
|
||||
if let id = client.authenticatedUser?.id {
|
||||
if message.text?.contains(query: id) == true {
|
||||
handleMessage(message: message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func messageSent(message: Message){}
|
||||
func messageChanged(message: Message){}
|
||||
func messageDeleted(message: Message?){}
|
||||
|
||||
private func handleMessage(message: Message) {
|
||||
if let text = message.text?.lowercased(), channel = message.channel {
|
||||
for (robot, verdict) in verdicts {
|
||||
let lowerbot = robot.lowercased()
|
||||
if text.contains(query: lowerbot) {
|
||||
if verdict == true {
|
||||
client.webAPI.addReaction(name: "robot_face", timestamp: message.ts, channel: channel, success: nil, failure: nil)
|
||||
} else {
|
||||
client.webAPI.addReaction(name: "no_entry_sign", timestamp: message.ts, channel: channel, success: nil, failure: nil)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
client.webAPI.addReaction(name: "question", timestamp: message.ts, channel: channel, success: nil, failure: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let slackbot = RobotOrNotBot(token: "xoxb-SLACK_API_TOKEN")
|
||||
slackbot.client.connect()
|
||||
+5
-3
@@ -27,7 +27,9 @@ let package = Package(
|
||||
name: "SlackKit",
|
||||
targets: [],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/daltoniam/Starscream",
|
||||
majorVersion: 1),
|
||||
]
|
||||
.Package(url: "https://github.com/open-swift/C7.git", majorVersion: 0, minor: 7),
|
||||
.Package(url: "https://github.com/czechboy0/Jay.git", majorVersion: 0, minor: 6),
|
||||
.Package(url: "https://github.com/Zewo/WebSocket", majorVersion: 0, minor: 6),
|
||||
],
|
||||
exclude: ["Examples"]
|
||||
)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
target 'SlackKit' do
|
||||
pod 'Starscream'
|
||||
end
|
||||
|
||||
target 'SlackKit_iOS' do
|
||||
pod 'Starscream'
|
||||
end
|
||||
|
||||
target 'SlackKit_tvOS' do
|
||||
pod 'Starscream'
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
PODS:
|
||||
- Starscream (1.1.3)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Starscream
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Starscream: d662732354b40dd19ed1ece3e3c44c80b536b83c
|
||||
|
||||
PODFILE CHECKSUM: d22778f772dbbded8b17fbebf5fa1c879d785aee
|
||||
|
||||
COCOAPODS: 1.0.0
|
||||
@@ -1,38 +1,11 @@
|
||||

|
||||
##iOS, OS X, and tvOS Slack Client Library
|
||||
##Alpha Linux Slack Client Library
|
||||
###Description
|
||||
This is a Slack client library for OS X, iOS, and tvOS written 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 by [bot users](https://api.slack.com/bot-users).
|
||||
This is a Slack client library for Linux written 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 by [bot users](https://api.slack.com/bot-users).
|
||||
|
||||
####Building the SlackKit Framework
|
||||
To build the SlackKit project directly, first build the dependencies using Carthage or CocoaPods. To use the framework in your application, install it in one of the following ways:
|
||||
###Disclaimer: The linux version of SlackKit is a pre-release alpha. Feel free to report issues you come across.
|
||||
|
||||
###Installation
|
||||
####CocoaPods
|
||||
Add the pod to your podfile:
|
||||
```
|
||||
pod 'SlackKit'
|
||||
```
|
||||
and run
|
||||
```
|
||||
pod install
|
||||
```
|
||||
|
||||
####Carthage
|
||||
|
||||
Add SlackKit to your Cartfile:
|
||||
```
|
||||
github "pvzig/SlackKit" ~> 1.0
|
||||
```
|
||||
and run
|
||||
```
|
||||
carthage bootstrap
|
||||
```
|
||||
**Note:** SlackKit currently takes a _long_ time for the compiler to compile with optimizations turned on. I'm currently exploring a potential fix for this issue. In the meantime, you may want to skip the waiting and build it in the debug configuration instead:
|
||||
```
|
||||
carthage bootstrap --configuration "Debug"
|
||||
```
|
||||
|
||||
Drag the built `SlackKit.framework` into your Xcode project.
|
||||
|
||||
####Swift Package Manager
|
||||
Add SlackKit to your Package.swift
|
||||
@@ -42,18 +15,37 @@ import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 1)
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 0, minor: 0)
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
Run `swift build` on your application’s main directory.
|
||||
####Development
|
||||
1. Install Homebrew: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
|
||||
2. Install `swiftenv`: `brew install kylef/formulae/swiftenv`
|
||||
3. Configure your shell: `echo 'if which swiftenv > /dev/null; then eval "$(swiftenv init -)"; fi' >> ~/.bash_profile`
|
||||
4. Download and install the latest Zewo compatible snapshot:
|
||||
```
|
||||
swiftenv install DEVELOPMENT-SNAPSHOT-2016-05-03-a
|
||||
swiftenv local DEVELOPMENT-SNAPSHOT-2016-05-03-a
|
||||
```
|
||||
5. Install and Link OpenSSL: `brew install openssl`, `brew link openssl --force`
|
||||
|
||||
To build an application that uses SlackKit in Xcode, simply use SwiftPM. (For the 05-03 snapshot you must run `swift build` before generating an Xcode project:
|
||||
```
|
||||
swift build
|
||||
swift build -Xlinker -L$(pwd)/.build/debug/ -Xswiftc -I/usr/local/include -Xlinker -L/usr/local/lib -X
|
||||
```
|
||||
|
||||
|
||||
To use the library in your project import it:
|
||||
```
|
||||
import SlackKit
|
||||
```
|
||||
|
||||
####Deployment
|
||||
Deploy your application to Heroku using [this buildpack](https://github.com/pvzig/heroku-buildpack-swift). For more detailed instructions please see [this post](https://medium.com/@pvzig/building-slack-bots-in-swift-b99e243e444c).
|
||||
|
||||
###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).
|
||||
|
||||
@@ -67,11 +59,6 @@ If you want to receive messages from the Slack RTM API, connect to it.
|
||||
client.connect()
|
||||
```
|
||||
|
||||
You can also set options for a ping/pong interval, timeout interval, and automatic reconnection:
|
||||
```swift
|
||||
client.connect(pingInterval: 2, timeout: 10, reconnect: false)
|
||||
```
|
||||
|
||||
Once connected, the client will begin to consume any messages sent by the Slack RTM API.
|
||||
|
||||
####Web API Methods
|
||||
@@ -93,7 +80,6 @@ SlackKit currently supports the a subset of the Slack Web APIs that are availabl
|
||||
- files.comments.edit
|
||||
- files.comments.delete
|
||||
- files.delete
|
||||
- files.info
|
||||
- files.upload
|
||||
- groups.close
|
||||
- groups.history
|
||||
@@ -151,7 +137,6 @@ There are a number of delegates that you can set to receive callbacks for certai
|
||||
|
||||
#####SlackEventsDelegate
|
||||
```swift
|
||||
func clientConnectionFailed(error: SlackError)
|
||||
func clientConnected()
|
||||
func clientDisconnected()
|
||||
func preferenceChanged(preference: String, value: AnyObject)
|
||||
@@ -238,9 +223,6 @@ func subteamSelfAdded(subteamID: String)
|
||||
func subteamSelfRemoved(subteamID: String)
|
||||
```
|
||||
|
||||
###Examples
|
||||
[Check out example applications here.](https://github.com/pvzig/SlackKit-examples)
|
||||
|
||||
###Get In Touch
|
||||
[@pvzig](https://twitter.com/pvzig)
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SlackKit"
|
||||
s.version = "1.1.1"
|
||||
s.summary = "a Slack client library for OS X, iOS, and tvOS written in Swift"
|
||||
s.homepage = "https://github.com/pvzig/SlackKit"
|
||||
s.license = 'MIT'
|
||||
s.author = { "Peter Zignego" => "peter@launchsoft.co" }
|
||||
s.source = { :git => "https://github.com/pvzig/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.10'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.requires_arc = true
|
||||
s.source_files = 'SlackKit/Sources/*.swift'
|
||||
s.frameworks = 'Foundation'
|
||||
s.dependency 'Starscream', '~> 1.1.3'
|
||||
end
|
||||
|
||||
@@ -1,710 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2601D61B1C7646B80012BF22 /* SlackWebAPIErrorDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2601D61A1C7646B80012BF22 /* SlackWebAPIErrorDispatcher.swift */; };
|
||||
260EC2331C4DC61D0093B253 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2301C4DC61D0093B253 /* Extensions.swift */; };
|
||||
260EC2341C4DC61D0093B253 /* NetworkInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2311C4DC61D0093B253 /* NetworkInterface.swift */; };
|
||||
260EC2351C4DC61D0093B253 /* SlackWebAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2321C4DC61D0093B253 /* SlackWebAPI.swift */; };
|
||||
263993901CE90C87004A6E93 /* SlackKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 2661A6A41BBF62FF0026F67B /* SlackKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
263993971CE90EE0004A6E93 /* Client+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C16C98791CE7D3DD00692776 /* Client+Utilities.swift */; };
|
||||
263993981CE90EE0004A6E93 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1881C398E3C00BF7225 /* Channel.swift */; };
|
||||
263993991CE90EE0004A6E93 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1921C398E3C00BF7225 /* User.swift */; };
|
||||
2639939A1CE90EE0004A6E93 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1911C398E3C00BF7225 /* Types.swift */; };
|
||||
2639939B1CE90EE0004A6E93 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1891C398E3C00BF7225 /* Client.swift */; };
|
||||
2639939C1CE90EE0004A6E93 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18A1C398E3C00BF7225 /* Event.swift */; };
|
||||
2639939D1CE90EE0004A6E93 /* Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1871C398E3C00BF7225 /* Bot.swift */; };
|
||||
2639939E1CE90EE0004A6E93 /* Client+EventDispatching.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A85FF71CE3BCEF00756C40 /* Client+EventDispatching.swift */; };
|
||||
2639939F1CE90EE0004A6E93 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18E1C398E3C00BF7225 /* File.swift */; };
|
||||
263993A01CE90EE0004A6E93 /* SlackWebAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2321C4DC61D0093B253 /* SlackWebAPI.swift */; };
|
||||
263993A11CE90EE0004A6E93 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DF40341C7A0FA300E19241 /* Attachment.swift */; };
|
||||
263993A21CE90EE0004A6E93 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18F1C398E3C00BF7225 /* Message.swift */; };
|
||||
263993A31CE90EE0004A6E93 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1901C398E3C00BF7225 /* Team.swift */; };
|
||||
263993A41CE90EE0004A6E93 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2301C4DC61D0093B253 /* Extensions.swift */; };
|
||||
263993A51CE90EE0004A6E93 /* UserGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1931C398E3C00BF7225 /* UserGroup.swift */; };
|
||||
263993A61CE90EE0004A6E93 /* SlackWebAPIErrorDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2601D61A1C7646B80012BF22 /* SlackWebAPIErrorDispatcher.swift */; };
|
||||
263993A71CE90EE0004A6E93 /* Client+EventHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A85FF81CE3BCEF00756C40 /* Client+EventHandling.swift */; };
|
||||
263993A81CE90EE0004A6E93 /* NetworkInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2311C4DC61D0093B253 /* NetworkInterface.swift */; };
|
||||
263993A91CE90EE0004A6E93 /* EventDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18B1C398E3C00BF7225 /* EventDelegate.swift */; };
|
||||
263993AB1CE90EE0004A6E93 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4307A07F1CC6D0910011D5DE /* Starscream.framework */; };
|
||||
263993AD1CE90EE0004A6E93 /* SlackKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 2661A6A41BBF62FF0026F67B /* SlackKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
263993B61CE90EED004A6E93 /* Client+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C16C98791CE7D3DD00692776 /* Client+Utilities.swift */; };
|
||||
263993B71CE90EED004A6E93 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1881C398E3C00BF7225 /* Channel.swift */; };
|
||||
263993B81CE90EED004A6E93 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1921C398E3C00BF7225 /* User.swift */; };
|
||||
263993B91CE90EED004A6E93 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1911C398E3C00BF7225 /* Types.swift */; };
|
||||
263993BA1CE90EED004A6E93 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1891C398E3C00BF7225 /* Client.swift */; };
|
||||
263993BB1CE90EED004A6E93 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18A1C398E3C00BF7225 /* Event.swift */; };
|
||||
263993BC1CE90EED004A6E93 /* Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1871C398E3C00BF7225 /* Bot.swift */; };
|
||||
263993BD1CE90EED004A6E93 /* Client+EventDispatching.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A85FF71CE3BCEF00756C40 /* Client+EventDispatching.swift */; };
|
||||
263993BE1CE90EED004A6E93 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18E1C398E3C00BF7225 /* File.swift */; };
|
||||
263993BF1CE90EED004A6E93 /* SlackWebAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2321C4DC61D0093B253 /* SlackWebAPI.swift */; };
|
||||
263993C01CE90EED004A6E93 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DF40341C7A0FA300E19241 /* Attachment.swift */; };
|
||||
263993C11CE90EED004A6E93 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18F1C398E3C00BF7225 /* Message.swift */; };
|
||||
263993C21CE90EED004A6E93 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1901C398E3C00BF7225 /* Team.swift */; };
|
||||
263993C31CE90EED004A6E93 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2301C4DC61D0093B253 /* Extensions.swift */; };
|
||||
263993C41CE90EED004A6E93 /* UserGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1931C398E3C00BF7225 /* UserGroup.swift */; };
|
||||
263993C51CE90EED004A6E93 /* SlackWebAPIErrorDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2601D61A1C7646B80012BF22 /* SlackWebAPIErrorDispatcher.swift */; };
|
||||
263993C61CE90EED004A6E93 /* Client+EventHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A85FF81CE3BCEF00756C40 /* Client+EventHandling.swift */; };
|
||||
263993C71CE90EED004A6E93 /* NetworkInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260EC2311C4DC61D0093B253 /* NetworkInterface.swift */; };
|
||||
263993C81CE90EED004A6E93 /* EventDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18B1C398E3C00BF7225 /* EventDelegate.swift */; };
|
||||
263993CA1CE90EED004A6E93 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4307A07F1CC6D0910011D5DE /* Starscream.framework */; };
|
||||
263993CC1CE90EED004A6E93 /* SlackKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 2661A6A41BBF62FF0026F67B /* SlackKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
26BBA1941C398E3C00BF7225 /* Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1871C398E3C00BF7225 /* Bot.swift */; };
|
||||
26BBA1951C398E3C00BF7225 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1881C398E3C00BF7225 /* Channel.swift */; };
|
||||
26BBA1961C398E3C00BF7225 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1891C398E3C00BF7225 /* Client.swift */; };
|
||||
26BBA1971C398E3C00BF7225 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18A1C398E3C00BF7225 /* Event.swift */; };
|
||||
26BBA1981C398E3C00BF7225 /* EventDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18B1C398E3C00BF7225 /* EventDelegate.swift */; };
|
||||
26BBA19B1C398E3C00BF7225 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18E1C398E3C00BF7225 /* File.swift */; };
|
||||
26BBA19C1C398E3C00BF7225 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA18F1C398E3C00BF7225 /* Message.swift */; };
|
||||
26BBA19D1C398E3C00BF7225 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1901C398E3C00BF7225 /* Team.swift */; };
|
||||
26BBA19E1C398E3C00BF7225 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1911C398E3C00BF7225 /* Types.swift */; };
|
||||
26BBA19F1C398E3C00BF7225 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1921C398E3C00BF7225 /* User.swift */; };
|
||||
26BBA1A01C398E3C00BF7225 /* UserGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BBA1931C398E3C00BF7225 /* UserGroup.swift */; };
|
||||
26DF40351C7A0FA300E19241 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DF40341C7A0FA300E19241 /* Attachment.swift */; };
|
||||
4307A0801CC6D0910011D5DE /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4307A07F1CC6D0910011D5DE /* Starscream.framework */; };
|
||||
C16C987A1CE7D3DD00692776 /* Client+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C16C98791CE7D3DD00692776 /* Client+Utilities.swift */; };
|
||||
C1A85FF91CE3BCEF00756C40 /* Client+EventDispatching.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A85FF71CE3BCEF00756C40 /* Client+EventDispatching.swift */; };
|
||||
C1A85FFA1CE3BCEF00756C40 /* Client+EventHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A85FF81CE3BCEF00756C40 /* Client+EventHandling.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2601D61A1C7646B80012BF22 /* SlackWebAPIErrorDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackWebAPIErrorDispatcher.swift; path = Sources/SlackWebAPIErrorDispatcher.swift; sourceTree = "<group>"; };
|
||||
26072A341BB48B3A00CD650C /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
260EC2301C4DC61D0093B253 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = Sources/Extensions.swift; sourceTree = "<group>"; };
|
||||
260EC2311C4DC61D0093B253 /* NetworkInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NetworkInterface.swift; path = Sources/NetworkInterface.swift; sourceTree = "<group>"; };
|
||||
260EC2321C4DC61D0093B253 /* SlackWebAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackWebAPI.swift; path = Sources/SlackWebAPI.swift; sourceTree = "<group>"; };
|
||||
263993B21CE90EE0004A6E93 /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
263993D11CE90EED004A6E93 /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2661A6A41BBF62FF0026F67B /* SlackKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlackKit.h; sourceTree = "<group>"; };
|
||||
268E46131CE8F79D009F19CC /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-iOS.plist"; path = "Supporting Files/Info-iOS.plist"; sourceTree = "<group>"; };
|
||||
268E46141CE8F79D009F19CC /* Info-tvOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-tvOS.plist"; path = "Supporting Files/Info-tvOS.plist"; sourceTree = "<group>"; };
|
||||
268E46151CE8F79D009F19CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Supporting Files/Info.plist"; sourceTree = "<group>"; };
|
||||
26BBA1871C398E3C00BF7225 /* Bot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Bot.swift; path = Sources/Bot.swift; sourceTree = "<group>"; };
|
||||
26BBA1881C398E3C00BF7225 /* Channel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Channel.swift; path = Sources/Channel.swift; sourceTree = "<group>"; };
|
||||
26BBA1891C398E3C00BF7225 /* Client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Client.swift; path = Sources/Client.swift; sourceTree = "<group>"; };
|
||||
26BBA18A1C398E3C00BF7225 /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Event.swift; path = Sources/Event.swift; sourceTree = "<group>"; };
|
||||
26BBA18B1C398E3C00BF7225 /* EventDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EventDelegate.swift; path = Sources/EventDelegate.swift; sourceTree = "<group>"; };
|
||||
26BBA18E1C398E3C00BF7225 /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = File.swift; path = Sources/File.swift; sourceTree = "<group>"; };
|
||||
26BBA18F1C398E3C00BF7225 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Message.swift; path = Sources/Message.swift; sourceTree = "<group>"; };
|
||||
26BBA1901C398E3C00BF7225 /* Team.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Team.swift; path = Sources/Team.swift; sourceTree = "<group>"; };
|
||||
26BBA1911C398E3C00BF7225 /* Types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Types.swift; path = Sources/Types.swift; sourceTree = "<group>"; };
|
||||
26BBA1921C398E3C00BF7225 /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = User.swift; path = Sources/User.swift; sourceTree = "<group>"; };
|
||||
26BBA1931C398E3C00BF7225 /* UserGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserGroup.swift; path = Sources/UserGroup.swift; sourceTree = "<group>"; };
|
||||
26DF40341C7A0FA300E19241 /* Attachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Attachment.swift; path = Sources/Attachment.swift; sourceTree = "<group>"; };
|
||||
4307A07F1CC6D0910011D5DE /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/Mac/Starscream.framework; sourceTree = "<group>"; };
|
||||
C16C98791CE7D3DD00692776 /* Client+Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Client+Utilities.swift"; path = "Sources/Client+Utilities.swift"; sourceTree = "<group>"; };
|
||||
C1A85FF71CE3BCEF00756C40 /* Client+EventDispatching.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Client+EventDispatching.swift"; path = "Sources/Client+EventDispatching.swift"; sourceTree = "<group>"; };
|
||||
C1A85FF81CE3BCEF00756C40 /* Client+EventHandling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Client+EventHandling.swift"; path = "Sources/Client+EventHandling.swift"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
26072A301BB48B3A00CD650C /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4307A0801CC6D0910011D5DE /* Starscream.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993AA1CE90EE0004A6E93 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
263993AB1CE90EE0004A6E93 /* Starscream.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993C91CE90EED004A6E93 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
263993CA1CE90EED004A6E93 /* Starscream.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
26072A2A1BB48B3A00CD650C = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2661A6811BBF60E60026F67B /* SlackKit */,
|
||||
26072A351BB48B3A00CD650C /* Products */,
|
||||
CA70A3A1A9A1A259960DFBCF /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
26072A351BB48B3A00CD650C /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26072A341BB48B3A00CD650C /* SlackKit.framework */,
|
||||
263993B21CE90EE0004A6E93 /* SlackKit.framework */,
|
||||
263993D11CE90EED004A6E93 /* SlackKit.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2661A6811BBF60E60026F67B /* SlackKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26DF40341C7A0FA300E19241 /* Attachment.swift */,
|
||||
26BBA1871C398E3C00BF7225 /* Bot.swift */,
|
||||
26BBA1881C398E3C00BF7225 /* Channel.swift */,
|
||||
26BBA1891C398E3C00BF7225 /* Client.swift */,
|
||||
C1A85FF71CE3BCEF00756C40 /* Client+EventDispatching.swift */,
|
||||
C1A85FF81CE3BCEF00756C40 /* Client+EventHandling.swift */,
|
||||
C16C98791CE7D3DD00692776 /* Client+Utilities.swift */,
|
||||
26BBA18A1C398E3C00BF7225 /* Event.swift */,
|
||||
26BBA18B1C398E3C00BF7225 /* EventDelegate.swift */,
|
||||
260EC2301C4DC61D0093B253 /* Extensions.swift */,
|
||||
26BBA18E1C398E3C00BF7225 /* File.swift */,
|
||||
26BBA18F1C398E3C00BF7225 /* Message.swift */,
|
||||
260EC2311C4DC61D0093B253 /* NetworkInterface.swift */,
|
||||
260EC2321C4DC61D0093B253 /* SlackWebAPI.swift */,
|
||||
2601D61A1C7646B80012BF22 /* SlackWebAPIErrorDispatcher.swift */,
|
||||
26BBA1901C398E3C00BF7225 /* Team.swift */,
|
||||
26BBA1911C398E3C00BF7225 /* Types.swift */,
|
||||
26BBA1921C398E3C00BF7225 /* User.swift */,
|
||||
26BBA1931C398E3C00BF7225 /* UserGroup.swift */,
|
||||
268E46161CE8F7A2009F19CC /* Supporting Files */,
|
||||
);
|
||||
path = SlackKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
268E46161CE8F7A2009F19CC /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2661A6A41BBF62FF0026F67B /* SlackKit.h */,
|
||||
268E46151CE8F79D009F19CC /* Info.plist */,
|
||||
268E46131CE8F79D009F19CC /* Info-iOS.plist */,
|
||||
268E46141CE8F79D009F19CC /* Info-tvOS.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA70A3A1A9A1A259960DFBCF /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4307A07F1CC6D0910011D5DE /* Starscream.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
26072A311BB48B3A00CD650C /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
263993901CE90C87004A6E93 /* SlackKit.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993AC1CE90EE0004A6E93 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
263993AD1CE90EE0004A6E93 /* SlackKit.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993CB1CE90EED004A6E93 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
263993CC1CE90EED004A6E93 /* SlackKit.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
26072A331BB48B3A00CD650C /* SlackKit OS X */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit OS X" */;
|
||||
buildPhases = (
|
||||
26072A2F1BB48B3A00CD650C /* Sources */,
|
||||
26072A301BB48B3A00CD650C /* Frameworks */,
|
||||
26072A311BB48B3A00CD650C /* Headers */,
|
||||
26072A321BB48B3A00CD650C /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit OS X";
|
||||
productName = SlackRTMKit;
|
||||
productReference = 26072A341BB48B3A00CD650C /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
263993951CE90EE0004A6E93 /* SlackKit iOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit iOS" */;
|
||||
buildPhases = (
|
||||
263993961CE90EE0004A6E93 /* Sources */,
|
||||
263993AA1CE90EE0004A6E93 /* Frameworks */,
|
||||
263993AC1CE90EE0004A6E93 /* Headers */,
|
||||
263993AE1CE90EE0004A6E93 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit iOS";
|
||||
productName = SlackRTMKit;
|
||||
productReference = 263993B21CE90EE0004A6E93 /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
263993B41CE90EED004A6E93 /* SlackKit tvOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */;
|
||||
buildPhases = (
|
||||
263993B51CE90EED004A6E93 /* Sources */,
|
||||
263993C91CE90EED004A6E93 /* Frameworks */,
|
||||
263993CB1CE90EED004A6E93 /* Headers */,
|
||||
263993CD1CE90EED004A6E93 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit tvOS";
|
||||
productName = SlackRTMKit;
|
||||
productReference = 263993D11CE90EED004A6E93 /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
26072A2B1BB48B3A00CD650C /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Launch Software LLC";
|
||||
TargetAttributes = {
|
||||
26072A331BB48B3A00CD650C = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 26072A2E1BB48B3A00CD650C /* Build configuration list for PBXProject "SlackKit" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 26072A2A1BB48B3A00CD650C;
|
||||
productRefGroup = 26072A351BB48B3A00CD650C /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
26072A331BB48B3A00CD650C /* SlackKit OS X */,
|
||||
263993951CE90EE0004A6E93 /* SlackKit iOS */,
|
||||
263993B41CE90EED004A6E93 /* SlackKit tvOS */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
26072A321BB48B3A00CD650C /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993AE1CE90EE0004A6E93 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993CD1CE90EED004A6E93 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
26072A2F1BB48B3A00CD650C /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C16C987A1CE7D3DD00692776 /* Client+Utilities.swift in Sources */,
|
||||
26BBA1951C398E3C00BF7225 /* Channel.swift in Sources */,
|
||||
26BBA19F1C398E3C00BF7225 /* User.swift in Sources */,
|
||||
26BBA19E1C398E3C00BF7225 /* Types.swift in Sources */,
|
||||
26BBA1961C398E3C00BF7225 /* Client.swift in Sources */,
|
||||
26BBA1971C398E3C00BF7225 /* Event.swift in Sources */,
|
||||
26BBA1941C398E3C00BF7225 /* Bot.swift in Sources */,
|
||||
C1A85FF91CE3BCEF00756C40 /* Client+EventDispatching.swift in Sources */,
|
||||
26BBA19B1C398E3C00BF7225 /* File.swift in Sources */,
|
||||
260EC2351C4DC61D0093B253 /* SlackWebAPI.swift in Sources */,
|
||||
26DF40351C7A0FA300E19241 /* Attachment.swift in Sources */,
|
||||
26BBA19C1C398E3C00BF7225 /* Message.swift in Sources */,
|
||||
26BBA19D1C398E3C00BF7225 /* Team.swift in Sources */,
|
||||
260EC2331C4DC61D0093B253 /* Extensions.swift in Sources */,
|
||||
26BBA1A01C398E3C00BF7225 /* UserGroup.swift in Sources */,
|
||||
2601D61B1C7646B80012BF22 /* SlackWebAPIErrorDispatcher.swift in Sources */,
|
||||
C1A85FFA1CE3BCEF00756C40 /* Client+EventHandling.swift in Sources */,
|
||||
260EC2341C4DC61D0093B253 /* NetworkInterface.swift in Sources */,
|
||||
26BBA1981C398E3C00BF7225 /* EventDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993961CE90EE0004A6E93 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
263993971CE90EE0004A6E93 /* Client+Utilities.swift in Sources */,
|
||||
263993981CE90EE0004A6E93 /* Channel.swift in Sources */,
|
||||
263993991CE90EE0004A6E93 /* User.swift in Sources */,
|
||||
2639939A1CE90EE0004A6E93 /* Types.swift in Sources */,
|
||||
2639939B1CE90EE0004A6E93 /* Client.swift in Sources */,
|
||||
2639939C1CE90EE0004A6E93 /* Event.swift in Sources */,
|
||||
2639939D1CE90EE0004A6E93 /* Bot.swift in Sources */,
|
||||
2639939E1CE90EE0004A6E93 /* Client+EventDispatching.swift in Sources */,
|
||||
2639939F1CE90EE0004A6E93 /* File.swift in Sources */,
|
||||
263993A01CE90EE0004A6E93 /* SlackWebAPI.swift in Sources */,
|
||||
263993A11CE90EE0004A6E93 /* Attachment.swift in Sources */,
|
||||
263993A21CE90EE0004A6E93 /* Message.swift in Sources */,
|
||||
263993A31CE90EE0004A6E93 /* Team.swift in Sources */,
|
||||
263993A41CE90EE0004A6E93 /* Extensions.swift in Sources */,
|
||||
263993A51CE90EE0004A6E93 /* UserGroup.swift in Sources */,
|
||||
263993A61CE90EE0004A6E93 /* SlackWebAPIErrorDispatcher.swift in Sources */,
|
||||
263993A71CE90EE0004A6E93 /* Client+EventHandling.swift in Sources */,
|
||||
263993A81CE90EE0004A6E93 /* NetworkInterface.swift in Sources */,
|
||||
263993A91CE90EE0004A6E93 /* EventDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993B51CE90EED004A6E93 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
263993B61CE90EED004A6E93 /* Client+Utilities.swift in Sources */,
|
||||
263993B71CE90EED004A6E93 /* Channel.swift in Sources */,
|
||||
263993B81CE90EED004A6E93 /* User.swift in Sources */,
|
||||
263993B91CE90EED004A6E93 /* Types.swift in Sources */,
|
||||
263993BA1CE90EED004A6E93 /* Client.swift in Sources */,
|
||||
263993BB1CE90EED004A6E93 /* Event.swift in Sources */,
|
||||
263993BC1CE90EED004A6E93 /* Bot.swift in Sources */,
|
||||
263993BD1CE90EED004A6E93 /* Client+EventDispatching.swift in Sources */,
|
||||
263993BE1CE90EED004A6E93 /* File.swift in Sources */,
|
||||
263993BF1CE90EED004A6E93 /* SlackWebAPI.swift in Sources */,
|
||||
263993C01CE90EED004A6E93 /* Attachment.swift in Sources */,
|
||||
263993C11CE90EED004A6E93 /* Message.swift in Sources */,
|
||||
263993C21CE90EED004A6E93 /* Team.swift in Sources */,
|
||||
263993C31CE90EED004A6E93 /* Extensions.swift in Sources */,
|
||||
263993C41CE90EED004A6E93 /* UserGroup.swift in Sources */,
|
||||
263993C51CE90EED004A6E93 /* SlackWebAPIErrorDispatcher.swift in Sources */,
|
||||
263993C61CE90EED004A6E93 /* Client+EventHandling.swift in Sources */,
|
||||
263993C71CE90EED004A6E93 /* NetworkInterface.swift in Sources */,
|
||||
263993C81CE90EED004A6E93 /* EventDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
26072A3A1BB48B3B00CD650C /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
26072A3B1BB48B3B00CD650C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
26072A3D1BB48B3B00CD650C /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
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 = "$(SRCROOT)/SlackKit/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.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
26072A3E1BB48B3B00CD650C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
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 = "$(SRCROOT)/SlackKit/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.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
263993B01CE90EE0004A6E93 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
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)/SlackKit/Supporting Files/Info-iOS.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
263993B11CE90EE0004A6E93 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
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)/SlackKit/Supporting Files/Info-iOS.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
263993CF1CE90EED004A6E93 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
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)/SlackKit/Supporting Files/Info-tvOS.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
263993D01CE90EED004A6E93 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
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)/SlackKit/Supporting Files/Info-tvOS.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
26072A2E1BB48B3A00CD650C /* Build configuration list for PBXProject "SlackKit" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
26072A3A1BB48B3B00CD650C /* Debug */,
|
||||
26072A3B1BB48B3B00CD650C /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit OS X" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
26072A3D1BB48B3B00CD650C /* Debug */,
|
||||
26072A3E1BB48B3B00CD650C /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
263993B01CE90EE0004A6E93 /* Debug */,
|
||||
263993B11CE90EE0004A6E93 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
263993CF1CE90EED004A6E93 /* Debug */,
|
||||
263993D01CE90EED004A6E93 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 26072A2B1BB48B3A00CD650C /* Project object */;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SlackRTMKit.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit OS X"
|
||||
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 = "26072A331BB48B3A00CD650C"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit OS X"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit OS X"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993951CE90EE0004A6E93"
|
||||
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 = "263993951CE90EE0004A6E93"
|
||||
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 = "263993951CE90EE0004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit iOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993B41CE90EED004A6E93"
|
||||
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 = "263993B41CE90EED004A6E93"
|
||||
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 = "263993B41CE90EED004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit tvOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.1.1</string>
|
||||
<string>1.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// SlackKit.h
|
||||
//
|
||||
// Copyright © 2016 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[];
|
||||
@@ -21,8 +21,6 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Attachment {
|
||||
|
||||
public let fallback: String?
|
||||
@@ -37,11 +35,8 @@ public struct Attachment {
|
||||
public let fields: [AttachmentField]?
|
||||
public let imageURL: String?
|
||||
public let thumbURL: String?
|
||||
public let footer: String?
|
||||
public let footerIcon: String?
|
||||
public let ts: Int?
|
||||
|
||||
internal init(attachment: [String: AnyObject]?) {
|
||||
internal init?(attachment: [String: Any]?) {
|
||||
fallback = attachment?["fallback"] as? String
|
||||
color = attachment?["color"] as? String
|
||||
pretext = attachment?["pretext"] as? String
|
||||
@@ -53,13 +48,12 @@ public struct Attachment {
|
||||
text = attachment?["text"] as? String
|
||||
imageURL = attachment?["image_url"] as? String
|
||||
thumbURL = attachment?["thumb_url"] as? String
|
||||
footer = attachment?["footer"] as? String
|
||||
footerIcon = attachment?["footer_icon"] as? String
|
||||
ts = attachment?["ts"] as? Int
|
||||
fields = (attachment?["fields"] as? [[String: AnyObject]])?.map { AttachmentField(field: $0) }
|
||||
fields = (attachment?["fields"] as? [Any])?.objectArrayFromDictionaryArray(intializer: {(field) -> AttachmentField? in
|
||||
return AttachmentField(field: field)
|
||||
})
|
||||
}
|
||||
|
||||
public init(fallback: String, title:String, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, imageURL: String? = nil, thumbURL: String? = nil, footer: String? = nil, footerIcon:String? = nil, ts:Int? = nil) {
|
||||
public init?(fallback: String, title:String, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, imageURL: String? = nil, thumbURL: String? = nil) {
|
||||
self.fallback = fallback
|
||||
self.color = colorHex
|
||||
self.pretext = pretext
|
||||
@@ -72,13 +66,10 @@ public struct Attachment {
|
||||
self.fields = fields
|
||||
self.imageURL = imageURL
|
||||
self.thumbURL = thumbURL
|
||||
self.footer = footer
|
||||
self.footerIcon = footerIcon
|
||||
self.ts = ts
|
||||
}
|
||||
|
||||
internal func dictionary() -> [String: AnyObject] {
|
||||
var attachment = [String: AnyObject]()
|
||||
internal func dictionary() -> [String: Any] {
|
||||
var attachment = [String: Any]()
|
||||
attachment["fallback"] = fallback
|
||||
attachment["color"] = color
|
||||
attachment["pretext"] = pretext
|
||||
@@ -88,17 +79,14 @@ public struct Attachment {
|
||||
attachment["title"] = title
|
||||
attachment["title_link"] = titleLink
|
||||
attachment["text"] = text
|
||||
attachment["fields"] = fieldJSONArray(fields)
|
||||
attachment["fields"] = fieldJSONArray(fields: fields)
|
||||
attachment["image_url"] = imageURL
|
||||
attachment["thumb_url"] = thumbURL
|
||||
attachment["footer"] = footer
|
||||
attachment["footer_icon"] = footerIcon
|
||||
attachment["ts"] = ts
|
||||
return attachment
|
||||
}
|
||||
|
||||
private func fieldJSONArray(fields: [AttachmentField]?) -> [[String: AnyObject]] {
|
||||
var returnValue = [[String: AnyObject]]()
|
||||
private func fieldJSONArray(fields: [AttachmentField]?) -> [Any] {
|
||||
var returnValue = [Any]()
|
||||
if let f = fields {
|
||||
for field in f {
|
||||
returnValue.append(field.dictionary())
|
||||
@@ -115,7 +103,7 @@ public struct AttachmentField {
|
||||
public let value: String?
|
||||
public let short: Bool?
|
||||
|
||||
internal init(field: [String: AnyObject]?) {
|
||||
internal init?(field: [String: Any]?) {
|
||||
title = field?["title"] as? String
|
||||
value = field?["value"] as? String
|
||||
short = field?["short"] as? Bool
|
||||
@@ -127,8 +115,8 @@ public struct AttachmentField {
|
||||
self.short = short
|
||||
}
|
||||
|
||||
internal func dictionary() -> [String: AnyObject] {
|
||||
var field = [String: AnyObject]()
|
||||
internal func dictionary() -> [String: Any] {
|
||||
var field = [String: Any]()
|
||||
field["title"] = title
|
||||
field["value"] = value
|
||||
field["short"] = short
|
||||
|
||||
@@ -25,12 +25,12 @@ public struct Bot {
|
||||
|
||||
public let id: String?
|
||||
internal(set) public var name: String?
|
||||
internal(set) public var icons: [String: AnyObject]?
|
||||
internal(set) public var icons: [String: Any]?
|
||||
|
||||
internal init(bot: [String: AnyObject]?) {
|
||||
internal init?(bot: [String: Any]?) {
|
||||
id = bot?["id"] as? String
|
||||
name = bot?["name"] as? String
|
||||
icons = bot?["icons"] as? [String: AnyObject]
|
||||
icons = bot?["icons"] as? [String: Any]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ public struct Channel {
|
||||
internal(set) public var topic: Topic?
|
||||
internal(set) public var purpose: Topic?
|
||||
internal(set) public var isMember: Bool?
|
||||
public var lastRead: String?
|
||||
internal(set) public var lastRead: String?
|
||||
internal(set) public var latest: Message?
|
||||
public var unread: Int?
|
||||
public var unreadCountDisplay: Int?
|
||||
internal(set) public var unread: Int?
|
||||
internal(set) public var unreadCountDisplay: Int?
|
||||
internal(set) public var hasPins: Bool?
|
||||
internal(set) public var members: [String]?
|
||||
// Client use
|
||||
@@ -49,7 +49,7 @@ public struct Channel {
|
||||
internal(set) public var usersTyping = [String]()
|
||||
internal(set) public var messages = [String: Message]()
|
||||
|
||||
internal init(channel: [String: AnyObject]?) {
|
||||
internal init?(channel: [String: Any]?) {
|
||||
id = channel?["id"] as? String
|
||||
name = channel?["name"] as? String
|
||||
created = channel?["created"] as? Int
|
||||
@@ -62,23 +62,23 @@ public struct Channel {
|
||||
isUserDeleted = channel?["is_user_deleted"] as? Bool
|
||||
user = channel?["user"] as? String
|
||||
isOpen = channel?["is_open"] as? Bool
|
||||
topic = Topic(topic: channel?["topic"] as? [String: AnyObject])
|
||||
purpose = Topic(topic: channel?["purpose"] as? [String: AnyObject])
|
||||
topic = Topic(topic: channel?["topic"] as? [String: Any])
|
||||
purpose = Topic(topic: channel?["purpose"] as? [String: Any])
|
||||
isMember = channel?["is_member"] as? Bool
|
||||
lastRead = channel?["last_read"] as? String
|
||||
unread = channel?["unread_count"] as? Int
|
||||
unreadCountDisplay = channel?["unread_count_display"] as? Int
|
||||
hasPins = channel?["has_pins"] as? Bool
|
||||
members = channel?["members"] as? [String]
|
||||
|
||||
if let latestMsgDictionary = channel?["latest"] as? [String: AnyObject] {
|
||||
latest = Message(message: latestMsgDictionary)
|
||||
} else {
|
||||
|
||||
if (Message(message: channel?["latest"] as? [String: Any])?.ts == nil) {
|
||||
latest = Message(ts: channel?["latest"] as? String)
|
||||
} else {
|
||||
latest = Message(message: channel?["latest"] as? [String: Any])
|
||||
}
|
||||
}
|
||||
|
||||
internal init(id:String?) {
|
||||
internal init?(id:String?) {
|
||||
self.id = id
|
||||
created = nil
|
||||
creator = nil
|
||||
|
||||
@@ -21,156 +21,153 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal extension Client {
|
||||
|
||||
func dispatch(event: [String: AnyObject]) {
|
||||
internal extension SlackClient {
|
||||
|
||||
func dispatch(event: [String: Any]) {
|
||||
let event = Event(event: event)
|
||||
guard let type = event.type else {
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .Hello:
|
||||
connected = true
|
||||
slackEventsDelegate?.clientConnected()
|
||||
case .Ok:
|
||||
messageSent(event)
|
||||
case .Message:
|
||||
if (event.subtype != nil) {
|
||||
messageDispatcher(event)
|
||||
} else {
|
||||
messageReceived(event)
|
||||
if let type = event.type {
|
||||
switch type {
|
||||
case .Hello:
|
||||
connected = true
|
||||
slackEventsDelegate?.clientConnected()
|
||||
case .Ok:
|
||||
messageSent(event: event)
|
||||
case .Message:
|
||||
if (event.subtype != nil) {
|
||||
messageDispatcher(event: event)
|
||||
} else {
|
||||
messageReceived(event: event)
|
||||
}
|
||||
case .UserTyping:
|
||||
userTyping(event: event)
|
||||
case .ChannelMarked, .IMMarked, .GroupMarked:
|
||||
channelMarked(event: event)
|
||||
case .ChannelCreated, .IMCreated:
|
||||
channelCreated(event: event)
|
||||
case .ChannelJoined, .GroupJoined:
|
||||
channelJoined(event: event)
|
||||
case .ChannelLeft, .GroupLeft:
|
||||
channelLeft(event: event)
|
||||
case .ChannelDeleted:
|
||||
channelDeleted(event: event)
|
||||
case .ChannelRenamed, .GroupRename:
|
||||
channelRenamed(event: event)
|
||||
case .ChannelArchive, .GroupArchive:
|
||||
channelArchived(event: event, archived: true)
|
||||
case .ChannelUnarchive, .GroupUnarchive:
|
||||
channelArchived(event: event, archived: false)
|
||||
case .ChannelHistoryChanged, .IMHistoryChanged, .GroupHistoryChanged:
|
||||
channelHistoryChanged(event: event)
|
||||
case .DNDUpdated:
|
||||
doNotDisturbUpdated(event: event)
|
||||
case .DNDUpatedUser:
|
||||
doNotDisturbUserUpdated(event: event)
|
||||
case .IMOpen, .GroupOpen:
|
||||
open(event: event, open: true)
|
||||
case .IMClose, .GroupClose:
|
||||
open(event: event, open: false)
|
||||
case .FileCreated:
|
||||
processFile(event: event)
|
||||
case .FileShared:
|
||||
processFile(event: event)
|
||||
case .FileUnshared:
|
||||
processFile(event: event)
|
||||
case .FilePublic:
|
||||
processFile(event: event)
|
||||
case .FilePrivate:
|
||||
filePrivate(event: event)
|
||||
case .FileChanged:
|
||||
processFile(event: event)
|
||||
case .FileDeleted:
|
||||
deleteFile(event: event)
|
||||
case .FileCommentAdded:
|
||||
fileCommentAdded(event: event)
|
||||
case .FileCommentEdited:
|
||||
fileCommentEdited(event: event)
|
||||
case .FileCommentDeleted:
|
||||
fileCommentDeleted(event: event)
|
||||
case .PinAdded:
|
||||
pinAdded(event: event)
|
||||
case .PinRemoved:
|
||||
pinRemoved(event: event)
|
||||
case .Pong:
|
||||
pong(event: event)
|
||||
case .PresenceChange:
|
||||
presenceChange(event: event)
|
||||
case .ManualPresenceChange:
|
||||
manualPresenceChange(event: event)
|
||||
case .PrefChange:
|
||||
changePreference(event: event)
|
||||
case .UserChange:
|
||||
userChange(event: event)
|
||||
case .TeamJoin:
|
||||
teamJoin(event: event)
|
||||
case .StarAdded:
|
||||
itemStarred(event: event, star: true)
|
||||
case .StarRemoved:
|
||||
itemStarred(event: event, star: false)
|
||||
case .ReactionAdded:
|
||||
addedReaction(event: event)
|
||||
case .ReactionRemoved:
|
||||
removedReaction(event: event)
|
||||
case .EmojiChanged:
|
||||
emojiChanged(event: event)
|
||||
case .CommandsChanged:
|
||||
// This functionality is only used by our web client.
|
||||
// The other APIs required to support slash command metadata are currently unstable.
|
||||
// Until they are released other clients should ignore this event.
|
||||
break
|
||||
case .TeamPlanChange:
|
||||
teamPlanChange(event: event)
|
||||
case .TeamPrefChange:
|
||||
teamPreferenceChange(event: event)
|
||||
case .TeamRename:
|
||||
teamNameChange(event: event)
|
||||
case .TeamDomainChange:
|
||||
teamDomainChange(event: event)
|
||||
case .EmailDomainChange:
|
||||
emailDomainChange(event: event)
|
||||
case .TeamProfileChange:
|
||||
teamProfileChange(event: event)
|
||||
case .TeamProfileDelete:
|
||||
teamProfileDeleted(event: event)
|
||||
case .TeamProfileReorder:
|
||||
teamProfileReordered(event: event)
|
||||
case .BotAdded:
|
||||
bot(event: event)
|
||||
case .BotChanged:
|
||||
bot(event: event)
|
||||
case .AccountsChanged:
|
||||
// The accounts_changed event is used by our web client to maintain a list of logged-in accounts.
|
||||
// Other clients should ignore this event.
|
||||
break
|
||||
case .TeamMigrationStarted:
|
||||
connect(pingInterval: pingInterval, timeout: timeout, reconnect: reconnect)
|
||||
case .ReconnectURL:
|
||||
// The reconnect_url event is currently unsupported and experimental.
|
||||
break
|
||||
case .SubteamCreated, .SubteamUpdated:
|
||||
subteam(event: event)
|
||||
case .SubteamSelfAdded:
|
||||
subteamAddedSelf(event: event)
|
||||
case.SubteamSelfRemoved:
|
||||
subteamRemovedSelf(event: event)
|
||||
case .Error:
|
||||
print("Error: \(event)")
|
||||
break
|
||||
}
|
||||
case .UserTyping:
|
||||
userTyping(event)
|
||||
case .ChannelMarked, .IMMarked, .GroupMarked:
|
||||
channelMarked(event)
|
||||
case .ChannelCreated, .IMCreated:
|
||||
channelCreated(event)
|
||||
case .ChannelJoined, .GroupJoined:
|
||||
channelJoined(event)
|
||||
case .ChannelLeft, .GroupLeft:
|
||||
channelLeft(event)
|
||||
case .ChannelDeleted:
|
||||
channelDeleted(event)
|
||||
case .ChannelRenamed, .GroupRename:
|
||||
channelRenamed(event)
|
||||
case .ChannelArchive, .GroupArchive:
|
||||
channelArchived(event, archived: true)
|
||||
case .ChannelUnarchive, .GroupUnarchive:
|
||||
channelArchived(event, archived: false)
|
||||
case .ChannelHistoryChanged, .IMHistoryChanged, .GroupHistoryChanged:
|
||||
channelHistoryChanged(event)
|
||||
case .DNDUpdated:
|
||||
doNotDisturbUpdated(event)
|
||||
case .DNDUpatedUser:
|
||||
doNotDisturbUserUpdated(event)
|
||||
case .IMOpen, .GroupOpen:
|
||||
open(event, open: true)
|
||||
case .IMClose, .GroupClose:
|
||||
open(event, open: false)
|
||||
case .FileCreated:
|
||||
processFile(event)
|
||||
case .FileShared:
|
||||
processFile(event)
|
||||
case .FileUnshared:
|
||||
processFile(event)
|
||||
case .FilePublic:
|
||||
processFile(event)
|
||||
case .FilePrivate:
|
||||
filePrivate(event)
|
||||
case .FileChanged:
|
||||
processFile(event)
|
||||
case .FileDeleted:
|
||||
deleteFile(event)
|
||||
case .FileCommentAdded:
|
||||
fileCommentAdded(event)
|
||||
case .FileCommentEdited:
|
||||
fileCommentEdited(event)
|
||||
case .FileCommentDeleted:
|
||||
fileCommentDeleted(event)
|
||||
case .PinAdded:
|
||||
pinAdded(event)
|
||||
case .PinRemoved:
|
||||
pinRemoved(event)
|
||||
case .Pong:
|
||||
pong(event)
|
||||
case .PresenceChange:
|
||||
presenceChange(event)
|
||||
case .ManualPresenceChange:
|
||||
manualPresenceChange(event)
|
||||
case .PrefChange:
|
||||
changePreference(event)
|
||||
case .UserChange:
|
||||
userChange(event)
|
||||
case .TeamJoin:
|
||||
teamJoin(event)
|
||||
case .StarAdded:
|
||||
itemStarred(event, star: true)
|
||||
case .StarRemoved:
|
||||
itemStarred(event, star: false)
|
||||
case .ReactionAdded:
|
||||
addedReaction(event)
|
||||
case .ReactionRemoved:
|
||||
removedReaction(event)
|
||||
case .EmojiChanged:
|
||||
emojiChanged(event)
|
||||
case .CommandsChanged:
|
||||
// This functionality is only used by our web client.
|
||||
// The other APIs required to support slash command metadata are currently unstable.
|
||||
// Until they are released other clients should ignore this event.
|
||||
break
|
||||
case .TeamPlanChange:
|
||||
teamPlanChange(event)
|
||||
case .TeamPrefChange:
|
||||
teamPreferenceChange(event)
|
||||
case .TeamRename:
|
||||
teamNameChange(event)
|
||||
case .TeamDomainChange:
|
||||
teamDomainChange(event)
|
||||
case .EmailDomainChange:
|
||||
emailDomainChange(event)
|
||||
case .TeamProfileChange:
|
||||
teamProfileChange(event)
|
||||
case .TeamProfileDelete:
|
||||
teamProfileDeleted(event)
|
||||
case .TeamProfileReorder:
|
||||
teamProfileReordered(event)
|
||||
case .BotAdded:
|
||||
bot(event)
|
||||
case .BotChanged:
|
||||
bot(event)
|
||||
case .AccountsChanged:
|
||||
// The accounts_changed event is used by our web client to maintain a list of logged-in accounts.
|
||||
// Other clients should ignore this event.
|
||||
break
|
||||
case .TeamMigrationStarted:
|
||||
connect(pingInterval: pingInterval, timeout: timeout, reconnect: reconnect)
|
||||
case .ReconnectURL:
|
||||
// The reconnect_url event is currently unsupported and experimental.
|
||||
break
|
||||
case .SubteamCreated, .SubteamUpdated:
|
||||
subteam(event)
|
||||
case .SubteamSelfAdded:
|
||||
subteamAddedSelf(event)
|
||||
case.SubteamSelfRemoved:
|
||||
subteamRemovedSelf(event)
|
||||
case .Error:
|
||||
print("Error: \(event)")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func messageDispatcher(event:Event) {
|
||||
guard let value = event.subtype, subtype = MessageSubtype(rawValue:value) else {
|
||||
return
|
||||
}
|
||||
let subtype = MessageSubtype(rawValue: event.subtype!)!
|
||||
switch subtype {
|
||||
case .MessageChanged:
|
||||
messageChanged(event)
|
||||
messageChanged(event: event)
|
||||
case .MessageDeleted:
|
||||
messageDeleted(event)
|
||||
messageDeleted(event: event)
|
||||
default:
|
||||
messageReceived(event)
|
||||
messageReceived(event: event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
internal extension Client {
|
||||
import Venice
|
||||
|
||||
internal extension SlackClient {
|
||||
|
||||
//MARK: - Pong
|
||||
func pong(event: Event) {
|
||||
pong = event.replyTo
|
||||
@@ -32,532 +32,516 @@ internal extension Client {
|
||||
|
||||
//MARK: - Messages
|
||||
func messageSent(event: Event) {
|
||||
guard let reply = event.replyTo, message = sentMessages[NSNumber(double: reply).stringValue], channel = message.channel, ts = message.ts else {
|
||||
return
|
||||
if let reply = event.replyTo, message = sentMessages["\(reply)"], channel = message.channel, ts = message.ts {
|
||||
message.ts = event.ts
|
||||
message.text = event.text
|
||||
channels[channel]?.messages[ts] = message
|
||||
|
||||
messageEventsDelegate?.messageSent(message: message)
|
||||
}
|
||||
|
||||
message.ts = event.ts
|
||||
message.text = event.text
|
||||
channels[channel]?.messages[ts] = message
|
||||
messageEventsDelegate?.messageSent(message)
|
||||
}
|
||||
|
||||
func messageReceived(event: Event) {
|
||||
guard let channel = event.channel, message = event.message, id = channel.id, ts = message.ts else {
|
||||
return
|
||||
if let channel = event.channel, message = event.message, id = channel.id, ts = message.ts {
|
||||
channels[id]?.messages[ts] = message
|
||||
|
||||
messageEventsDelegate?.messageReceived(message: message)
|
||||
}
|
||||
|
||||
channels[id]?.messages[ts] = message
|
||||
messageEventsDelegate?.messageReceived(message)
|
||||
}
|
||||
|
||||
func messageChanged(event: Event) {
|
||||
guard let id = event.channel?.id, nested = event.nestedMessage, ts = nested.ts else {
|
||||
return
|
||||
if let id = event.channel?.id, nested = event.nestedMessage, ts = nested.ts {
|
||||
channels[id]?.messages[ts] = nested
|
||||
|
||||
messageEventsDelegate?.messageChanged(message: nested)
|
||||
}
|
||||
|
||||
channels[id]?.messages[ts] = nested
|
||||
messageEventsDelegate?.messageChanged(nested)
|
||||
}
|
||||
|
||||
func messageDeleted(event: Event) {
|
||||
guard let id = event.channel?.id, key = event.message?.deletedTs, message = channels[id]?.messages[key] else {
|
||||
return
|
||||
if let id = event.channel?.id, key = event.message?.deletedTs {
|
||||
let message = channels[id]?.messages[key]
|
||||
channels[id]?.messages.removeValue(forKey:key)
|
||||
|
||||
messageEventsDelegate?.messageDeleted(message: message)
|
||||
}
|
||||
|
||||
channels[id]?.messages.removeValueForKey(key)
|
||||
messageEventsDelegate?.messageDeleted(message)
|
||||
}
|
||||
|
||||
//MARK: - Channels
|
||||
func userTyping(event: Event) {
|
||||
guard let channel = event.channel, channelID = channel.id, user = event.user, userID = user.id where
|
||||
channels.indexForKey(channelID) != nil && !channels[channelID]!.usersTyping.contains(userID) else {
|
||||
return
|
||||
}
|
||||
|
||||
channels[channelID]?.usersTyping.append(userID)
|
||||
channelEventsDelegate?.userTyping(channel, user: user)
|
||||
|
||||
let timeout = dispatch_time(DISPATCH_TIME_NOW, Int64(5.0 * Double(NSEC_PER_SEC)))
|
||||
dispatch_after(timeout, dispatch_get_main_queue()) {
|
||||
if let index = self.channels[channelID]?.usersTyping.indexOf(userID) {
|
||||
self.channels[channelID]?.usersTyping.removeAtIndex(index)
|
||||
if let channelID = event.channel?.id, userID = event.user?.id {
|
||||
if let _ = channels[channelID] {
|
||||
if (!channels[channelID]!.usersTyping.contains(userID)) {
|
||||
channels[channelID]?.usersTyping.append(userID)
|
||||
|
||||
channelEventsDelegate?.userTyping(channel: event.channel, user: event.user)
|
||||
}
|
||||
}
|
||||
|
||||
co { [weak self] in
|
||||
let weakSelf = self
|
||||
nap(for: 5.0.seconds)
|
||||
if let index = weakSelf?.channels[channelID]?.usersTyping.index(of:userID) {
|
||||
weakSelf?.channels[channelID]?.usersTyping.remove(at: index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func channelMarked(event: Event) {
|
||||
guard let channel = event.channel, id = channel.id, timestamp = event.ts else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id {
|
||||
channels[id]?.lastRead = event.ts
|
||||
|
||||
channelEventsDelegate?.channelMarked(channel: channel, timestamp: event.ts)
|
||||
}
|
||||
|
||||
channels[id]?.lastRead = event.ts
|
||||
channelEventsDelegate?.channelMarked(channel, timestamp: timestamp)
|
||||
//TODO: Recalculate unreads
|
||||
}
|
||||
|
||||
func channelCreated(event: Event) {
|
||||
guard let channel = event.channel, id = channel.id else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id {
|
||||
channels[id] = channel
|
||||
|
||||
channelEventsDelegate?.channelCreated(channel: channel)
|
||||
}
|
||||
|
||||
channels[id] = channel
|
||||
channelEventsDelegate?.channelCreated(channel)
|
||||
}
|
||||
|
||||
func channelDeleted(event: Event) {
|
||||
guard let channel = event.channel, id = channel.id else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id {
|
||||
channels.removeValue(forKey:id)
|
||||
|
||||
channelEventsDelegate?.channelDeleted(channel: channel)
|
||||
}
|
||||
|
||||
channels.removeValueForKey(id)
|
||||
channelEventsDelegate?.channelDeleted(channel)
|
||||
}
|
||||
|
||||
func channelJoined(event: Event) {
|
||||
guard let channel = event.channel, id = channel.id else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id {
|
||||
channels[id] = event.channel
|
||||
|
||||
channelEventsDelegate?.channelJoined(channel: channel)
|
||||
}
|
||||
|
||||
channels[id] = event.channel
|
||||
channelEventsDelegate?.channelJoined(channel)
|
||||
}
|
||||
|
||||
func channelLeft(event: Event) {
|
||||
guard let channel = event.channel, id = channel.id else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id, userID = authenticatedUser?.id {
|
||||
if let index = channels[id]?.members?.index(of:userID) {
|
||||
channels[id]?.members?.remove(at: index)
|
||||
|
||||
channelEventsDelegate?.channelLeft(channel: channel)
|
||||
}
|
||||
}
|
||||
|
||||
if let userID = authenticatedUser?.id, index = channels[id]?.members?.indexOf(userID) {
|
||||
channels[id]?.members?.removeAtIndex(index)
|
||||
}
|
||||
channelEventsDelegate?.channelLeft(channel)
|
||||
}
|
||||
|
||||
func channelRenamed(event: Event) {
|
||||
guard let channel = event.channel, id = channel.id else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id {
|
||||
channels[id]?.name = channel.name
|
||||
|
||||
channelEventsDelegate?.channelRenamed(channel: channel)
|
||||
}
|
||||
|
||||
channels[id]?.name = channel.name
|
||||
channelEventsDelegate?.channelRenamed(channel)
|
||||
}
|
||||
|
||||
func channelArchived(event: Event, archived: Bool) {
|
||||
guard let channel = event.channel, id = channel.id else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id {
|
||||
channels[id]?.isArchived = archived
|
||||
|
||||
channelEventsDelegate?.channelArchived(channel: channel)
|
||||
}
|
||||
|
||||
channels[id]?.isArchived = archived
|
||||
channelEventsDelegate?.channelArchived(channel)
|
||||
}
|
||||
|
||||
func channelHistoryChanged(event: Event) {
|
||||
guard let channel = event.channel else {
|
||||
return
|
||||
if let channel = event.channel {
|
||||
//TODO: Reload chat history if there are any cached messages before latest
|
||||
|
||||
channelEventsDelegate?.channelHistoryChanged(channel: channel)
|
||||
}
|
||||
channelEventsDelegate?.channelHistoryChanged(channel)
|
||||
}
|
||||
|
||||
//MARK: - Do Not Disturb
|
||||
func doNotDisturbUpdated(event: Event) {
|
||||
guard let dndStatus = event.dndStatus else {
|
||||
return
|
||||
if let dndStatus = event.dndStatus {
|
||||
authenticatedUser?.doNotDisturbStatus = dndStatus
|
||||
|
||||
doNotDisturbEventsDelegate?.doNotDisturbUpdated(dndStatus: dndStatus)
|
||||
}
|
||||
|
||||
authenticatedUser?.doNotDisturbStatus = dndStatus
|
||||
doNotDisturbEventsDelegate?.doNotDisturbUpdated(dndStatus)
|
||||
}
|
||||
|
||||
func doNotDisturbUserUpdated(event: Event) {
|
||||
guard let dndStatus = event.dndStatus, user = event.user, id = user.id else {
|
||||
return
|
||||
if let dndStatus = event.dndStatus, user = event.user, id = user.id {
|
||||
users[id]?.doNotDisturbStatus = dndStatus
|
||||
|
||||
doNotDisturbEventsDelegate?.doNotDisturbUserUpdated(dndStatus: dndStatus, user: user)
|
||||
}
|
||||
|
||||
users[id]?.doNotDisturbStatus = dndStatus
|
||||
doNotDisturbEventsDelegate?.doNotDisturbUserUpdated(dndStatus, user: user)
|
||||
}
|
||||
|
||||
//MARK: - IM & Group Open/Close
|
||||
func open(event: Event, open: Bool) {
|
||||
guard let channel = event.channel, id = channel.id else {
|
||||
return
|
||||
if let channel = event.channel, id = channel.id {
|
||||
channels[id]?.isOpen = open
|
||||
|
||||
groupEventsDelegate?.groupOpened(group: channel)
|
||||
}
|
||||
|
||||
channels[id]?.isOpen = open
|
||||
groupEventsDelegate?.groupOpened(channel)
|
||||
}
|
||||
|
||||
//MARK: - Files
|
||||
func processFile(event: Event) {
|
||||
guard let file = event.file, id = file.id else {
|
||||
return
|
||||
}
|
||||
if let comment = file.initialComment, commentID = comment.id {
|
||||
if files[id]?.comments[commentID] == nil {
|
||||
files[id]?.comments[commentID] = comment
|
||||
if let file = event.file, id = file.id {
|
||||
if let comment = file.initialComment, commentID = comment.id {
|
||||
if files[id]?.comments[commentID] == nil {
|
||||
files[id]?.comments[commentID] = comment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
files[id] = file
|
||||
fileEventsDelegate?.fileProcessed(file)
|
||||
files[id] = file
|
||||
|
||||
fileEventsDelegate?.fileProcessed(file: file)
|
||||
}
|
||||
}
|
||||
|
||||
func filePrivate(event: Event) {
|
||||
guard let file = event.file, id = file.id else {
|
||||
return
|
||||
if let file = event.file, id = file.id {
|
||||
files[id]?.isPublic = false
|
||||
|
||||
fileEventsDelegate?.fileMadePrivate(file: file)
|
||||
}
|
||||
|
||||
files[id]?.isPublic = false
|
||||
fileEventsDelegate?.fileMadePrivate(file)
|
||||
}
|
||||
|
||||
func deleteFile(event: Event) {
|
||||
guard let file = event.file, id = file.id else {
|
||||
return
|
||||
if let file = event.file, id = file.id {
|
||||
if files[id] != nil {
|
||||
files.removeValue(forKey:id)
|
||||
}
|
||||
|
||||
fileEventsDelegate?.fileDeleted(file: file)
|
||||
}
|
||||
|
||||
if files[id] != nil {
|
||||
files.removeValueForKey(id)
|
||||
}
|
||||
fileEventsDelegate?.fileDeleted(file)
|
||||
}
|
||||
|
||||
func fileCommentAdded(event: Event) {
|
||||
guard let file = event.file, id = file.id, comment = event.comment, commentID = comment.id else {
|
||||
return
|
||||
if let file = event.file, id = file.id, comment = event.comment, commentID = comment.id {
|
||||
files[id]?.comments[commentID] = comment
|
||||
|
||||
fileEventsDelegate?.fileCommentAdded(file: file, comment: comment)
|
||||
}
|
||||
|
||||
files[id]?.comments[commentID] = comment
|
||||
fileEventsDelegate?.fileCommentAdded(file, comment: comment)
|
||||
}
|
||||
|
||||
func fileCommentEdited(event: Event) {
|
||||
guard let file = event.file, id = file.id, comment = event.comment, commentID = comment.id else {
|
||||
return
|
||||
if let file = event.file, id = file.id, comment = event.comment, commentID = comment.id {
|
||||
files[id]?.comments[commentID]?.comment = comment.comment
|
||||
|
||||
fileEventsDelegate?.fileCommentEdited(file: file, comment: comment)
|
||||
}
|
||||
|
||||
files[id]?.comments[commentID]?.comment = comment.comment
|
||||
fileEventsDelegate?.fileCommentEdited(file, comment: comment)
|
||||
}
|
||||
|
||||
func fileCommentDeleted(event: Event) {
|
||||
guard let file = event.file, id = file.id, comment = event.comment, commentID = comment.id else {
|
||||
return
|
||||
if let file = event.file, id = file.id, comment = event.comment, commentID = comment.id {
|
||||
files[id]?.comments.removeValue(forKey:commentID)
|
||||
|
||||
fileEventsDelegate?.fileCommentDeleted(file: file, comment: comment)
|
||||
}
|
||||
|
||||
files[id]?.comments.removeValueForKey(commentID)
|
||||
fileEventsDelegate?.fileCommentDeleted(file, comment: comment)
|
||||
}
|
||||
|
||||
//MARK: - Pins
|
||||
func pinAdded(event: Event) {
|
||||
guard let id = event.channelID, item = event.item else {
|
||||
return
|
||||
if let id = event.channelID, item = event.item {
|
||||
channels[id]?.pinnedItems.append(item)
|
||||
|
||||
pinEventsDelegate?.itemPinned(item: item, channel: channels[id])
|
||||
}
|
||||
|
||||
channels[id]?.pinnedItems.append(item)
|
||||
pinEventsDelegate?.itemPinned(item, channel: channels[id])
|
||||
}
|
||||
|
||||
func pinRemoved(event: Event) {
|
||||
guard let id = event.channelID, item = event.item else {
|
||||
return
|
||||
if let id = event.channelID {
|
||||
if let pins = channels[id]?.pinnedItems.filter({$0 != event.item}) {
|
||||
channels[id]?.pinnedItems = pins
|
||||
}
|
||||
|
||||
pinEventsDelegate?.itemUnpinned(item: event.item, channel: channels[id])
|
||||
}
|
||||
|
||||
if let pins = channels[id]?.pinnedItems.filter({$0 != item}) {
|
||||
channels[id]?.pinnedItems = pins
|
||||
}
|
||||
pinEventsDelegate?.itemUnpinned(item, channel: channels[id])
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Stars
|
||||
func itemStarred(event: Event, star: Bool) {
|
||||
guard let item = event.item, type = item.type else {
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case "message":
|
||||
starMessage(item, star: star)
|
||||
case "file":
|
||||
starFile(item, star: star)
|
||||
case "file_comment":
|
||||
starComment(item)
|
||||
default:
|
||||
break
|
||||
}
|
||||
if let item = event.item, type = item.type {
|
||||
switch type {
|
||||
case "message":
|
||||
starMessage(item: item, star: star)
|
||||
case "file":
|
||||
starFile(item: item, star: star)
|
||||
case "file_comment":
|
||||
starComment(item: item)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
starEventsDelegate?.itemStarred(item, star: star)
|
||||
starEventsDelegate?.itemStarred(item: item, star: star)
|
||||
}
|
||||
}
|
||||
|
||||
func starMessage(item: Item, star: Bool) {
|
||||
guard let message = item.message, ts = message.ts, channel = item.channel where channels[channel]?.messages[ts] != nil else {
|
||||
return
|
||||
if let message = item.message, ts = message.ts, channel = item.channel {
|
||||
if let _ = channels[channel]?.messages[ts] {
|
||||
channels[channel]?.messages[ts]?.isStarred = star
|
||||
}
|
||||
}
|
||||
channels[channel]?.messages[ts]?.isStarred = star
|
||||
}
|
||||
|
||||
func starFile(item: Item, star: Bool) {
|
||||
guard let file = item.file, id = file.id else {
|
||||
return
|
||||
}
|
||||
|
||||
files[id]?.isStarred = star
|
||||
if let stars = files[id]?.stars {
|
||||
if star == true {
|
||||
files[id]?.stars = stars + 1
|
||||
} else {
|
||||
if stars > 0 {
|
||||
files[id]?.stars = stars - 1
|
||||
if let file = item.file, id = file.id {
|
||||
files[id]?.isStarred = star
|
||||
if let stars = files[id]?.stars {
|
||||
if star == true {
|
||||
files[id]?.stars = stars + 1
|
||||
} else {
|
||||
if stars > 0 {
|
||||
files[id]?.stars = stars - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func starComment(item: Item) {
|
||||
guard let file = item.file, id = file.id, comment = item.comment, commentID = comment.id else {
|
||||
return
|
||||
if let file = item.file, id = file.id, comment = item.comment, commentID = comment.id {
|
||||
files[id]?.comments[commentID] = comment
|
||||
}
|
||||
files[id]?.comments[commentID] = comment
|
||||
}
|
||||
|
||||
//MARK: - Reactions
|
||||
func addedReaction(event: Event) {
|
||||
guard let item = event.item, type = item.type, reaction = event.reaction, userID = event.user?.id, itemUser = event.itemUser else {
|
||||
return
|
||||
if let item = event.item, type = item.type, key = event.reaction, userID = event.user?.id {
|
||||
switch type {
|
||||
case "message":
|
||||
if let channel = item.channel, ts = item.ts {
|
||||
if let message = channels[channel]?.messages[ts] {
|
||||
if (message.reactions[key]) == nil {
|
||||
message.reactions[key] = Reaction(name: event.reaction, user: userID)
|
||||
} else {
|
||||
message.reactions[key]?.users[userID] = userID
|
||||
}
|
||||
}
|
||||
}
|
||||
case "file":
|
||||
if let id = item.file?.id, file = files[id] {
|
||||
if file.reactions[key] == nil {
|
||||
files[id]?.reactions[key] = Reaction(name: event.reaction, user: userID)
|
||||
} else {
|
||||
files[id]?.reactions[key]?.users[userID] = userID
|
||||
}
|
||||
}
|
||||
case "file_comment":
|
||||
if let id = item.file?.id, file = files[id], commentID = item.fileCommentID {
|
||||
if file.comments[commentID]?.reactions[key] == nil {
|
||||
files[id]?.comments[commentID]?.reactions[key] = Reaction(name: event.reaction, user: userID)
|
||||
} else {
|
||||
files[id]?.comments[commentID]?.reactions[key]?.users[userID] = userID
|
||||
}
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
reactionEventsDelegate?.reactionAdded(reaction: event.reaction, item: event.item, itemUser: event.itemUser)
|
||||
}
|
||||
|
||||
switch type {
|
||||
case "message":
|
||||
guard let channel = item.channel, ts = item.ts, message = channels[channel]?.messages[ts] else {
|
||||
return
|
||||
}
|
||||
message.reactions.append(Reaction(name: reaction, user: userID))
|
||||
case "file":
|
||||
guard let id = item.file?.id else {
|
||||
return
|
||||
}
|
||||
files[id]?.reactions.append(Reaction(name: reaction, user: userID))
|
||||
case "file_comment":
|
||||
guard let id = item.file?.id, commentID = item.fileCommentID else {
|
||||
return
|
||||
}
|
||||
files[id]?.comments[commentID]?.reactions.append(Reaction(name: reaction, user: userID))
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
reactionEventsDelegate?.reactionAdded(reaction, item: item, itemUser: itemUser)
|
||||
}
|
||||
|
||||
|
||||
func removedReaction(event: Event) {
|
||||
guard let item = event.item, type = item.type, key = event.reaction, userID = event.user?.id, itemUser = event.itemUser else {
|
||||
return
|
||||
if let item = event.item, type = item.type, key = event.reaction, userID = event.user?.id {
|
||||
switch type {
|
||||
case "message":
|
||||
if let channel = item.channel, ts = item.ts {
|
||||
if let message = channels[channel]?.messages[ts] {
|
||||
if (message.reactions[key]) != nil {
|
||||
message.reactions[key]?.users.removeValue(forKey:userID)
|
||||
}
|
||||
if (message.reactions[key]?.users.count == 0) {
|
||||
message.reactions.removeValue(forKey:key)
|
||||
}
|
||||
}
|
||||
}
|
||||
case "file":
|
||||
if let itemFile = item.file, id = itemFile.id, file = files[id] {
|
||||
if file.reactions[key] != nil {
|
||||
files[id]?.reactions[key]?.users.removeValue(forKey:userID)
|
||||
}
|
||||
if files[id]?.reactions[key]?.users.count == 0 {
|
||||
files[id]?.reactions.removeValue(forKey:key)
|
||||
}
|
||||
}
|
||||
case "file_comment":
|
||||
if let id = item.file?.id, file = files[id], commentID = item.fileCommentID {
|
||||
if file.comments[commentID]?.reactions[key] != nil {
|
||||
files[id]?.comments[commentID]?.reactions[key]?.users.removeValue(forKey:userID)
|
||||
}
|
||||
if files[id]?.comments[commentID]?.reactions[key]?.users.count == 0 {
|
||||
files[id]?.comments[commentID]?.reactions.removeValue(forKey:key)
|
||||
}
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
reactionEventsDelegate?.reactionRemoved(reaction: event.reaction, item: event.item, itemUser: event.itemUser)
|
||||
}
|
||||
|
||||
switch type {
|
||||
case "message":
|
||||
guard let channel = item.channel, ts = item.ts, message = channels[channel]?.messages[ts] else {
|
||||
return
|
||||
}
|
||||
message.reactions = message.reactions.filter({$0.name != key && $0.user != userID})
|
||||
case "file":
|
||||
guard let itemFile = item.file, id = itemFile.id else {
|
||||
return
|
||||
}
|
||||
files[id]?.reactions = files[id]!.reactions.filter({$0.name != key && $0.user != userID})
|
||||
case "file_comment":
|
||||
guard let id = item.file?.id, commentID = item.fileCommentID else {
|
||||
return
|
||||
}
|
||||
files[id]?.comments[commentID]?.reactions = files[id]!.comments[commentID]!.reactions.filter({$0.name != key && $0.user != userID})
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
reactionEventsDelegate?.reactionRemoved(key, item: item, itemUser: itemUser)
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Preferences
|
||||
func changePreference(event: Event) {
|
||||
guard let name = event.name else {
|
||||
return
|
||||
if let name = event.name {
|
||||
authenticatedUser?.preferences?[name] = event.value
|
||||
|
||||
slackEventsDelegate?.preferenceChanged(preference: name, value: event.value)
|
||||
}
|
||||
|
||||
authenticatedUser?.preferences?[name] = event.value
|
||||
slackEventsDelegate?.preferenceChanged(name, value: event.value)
|
||||
}
|
||||
|
||||
//Mark: - User Change
|
||||
func userChange(event: Event) {
|
||||
guard let user = event.user, id = user.id else {
|
||||
return
|
||||
if let user = event.user, id = user.id {
|
||||
let preferences = users[id]?.preferences
|
||||
users[id] = user
|
||||
users[id]?.preferences = preferences
|
||||
|
||||
slackEventsDelegate?.userChanged(user: user)
|
||||
}
|
||||
|
||||
let preferences = users[id]?.preferences
|
||||
users[id] = user
|
||||
users[id]?.preferences = preferences
|
||||
slackEventsDelegate?.userChanged(user)
|
||||
}
|
||||
|
||||
//MARK: - User Presence
|
||||
func presenceChange(event: Event) {
|
||||
guard let user = event.user, id = user.id, presence = event.presence else {
|
||||
return
|
||||
if let user = event.user, id = user.id {
|
||||
users[id]?.presence = event.presence
|
||||
|
||||
slackEventsDelegate?.presenceChanged(user: user, presence: event.presence)
|
||||
}
|
||||
|
||||
users[id]?.presence = event.presence
|
||||
slackEventsDelegate?.presenceChanged(user, presence: presence)
|
||||
}
|
||||
|
||||
//MARK: - Team
|
||||
func teamJoin(event: Event) {
|
||||
guard let user = event.user, id = user.id else {
|
||||
return
|
||||
if let user = event.user, id = user.id {
|
||||
users[id] = user
|
||||
|
||||
teamEventsDelegate?.teamJoined(user: user)
|
||||
}
|
||||
|
||||
users[id] = user
|
||||
teamEventsDelegate?.teamJoined(user)
|
||||
}
|
||||
|
||||
func teamPlanChange(event: Event) {
|
||||
guard let plan = event.plan else {
|
||||
return
|
||||
if let plan = event.plan {
|
||||
team?.plan = plan
|
||||
|
||||
teamEventsDelegate?.teamPlanChanged(plan: plan)
|
||||
}
|
||||
|
||||
team?.plan = plan
|
||||
teamEventsDelegate?.teamPlanChanged(plan)
|
||||
}
|
||||
|
||||
func teamPreferenceChange(event: Event) {
|
||||
guard let name = event.name else {
|
||||
return
|
||||
if let name = event.name {
|
||||
team?.prefs?[name] = event.value
|
||||
|
||||
teamEventsDelegate?.teamPreferencesChanged(preference: name, value: event.value)
|
||||
}
|
||||
|
||||
team?.prefs?[name] = event.value
|
||||
teamEventsDelegate?.teamPreferencesChanged(name, value: event.value)
|
||||
}
|
||||
|
||||
func teamNameChange(event: Event) {
|
||||
guard let name = event.name else {
|
||||
return
|
||||
if let name = event.name {
|
||||
team?.name = name
|
||||
|
||||
teamEventsDelegate?.teamNameChanged(name: name)
|
||||
}
|
||||
|
||||
team?.name = name
|
||||
teamEventsDelegate?.teamNameChanged(name)
|
||||
}
|
||||
|
||||
func teamDomainChange(event: Event) {
|
||||
guard let domain = event.domain else {
|
||||
return
|
||||
if let domain = event.domain {
|
||||
team?.domain = domain
|
||||
|
||||
teamEventsDelegate?.teamDomainChanged(domain: domain)
|
||||
}
|
||||
|
||||
team?.domain = domain
|
||||
teamEventsDelegate?.teamDomainChanged(domain)
|
||||
}
|
||||
|
||||
func emailDomainChange(event: Event) {
|
||||
guard let domain = event.emailDomain else {
|
||||
return
|
||||
if let domain = event.emailDomain {
|
||||
team?.emailDomain = domain
|
||||
|
||||
teamEventsDelegate?.teamEmailDomainChanged(domain: domain)
|
||||
}
|
||||
|
||||
team?.emailDomain = domain
|
||||
teamEventsDelegate?.teamEmailDomainChanged(domain)
|
||||
}
|
||||
|
||||
func emojiChanged(event: Event) {
|
||||
//TODO: Call emoji.list here
|
||||
|
||||
teamEventsDelegate?.teamEmojiChanged()
|
||||
}
|
||||
|
||||
//MARK: - Bots
|
||||
func bot(event: Event) {
|
||||
guard let bot = event.bot, id = bot.id else {
|
||||
return
|
||||
if let bot = event.bot, id = bot.id {
|
||||
bots[id] = bot
|
||||
|
||||
slackEventsDelegate?.botEvent(bot: bot)
|
||||
}
|
||||
|
||||
bots[id] = bot
|
||||
slackEventsDelegate?.botEvent(bot)
|
||||
}
|
||||
|
||||
//MARK: - Subteams
|
||||
func subteam(event: Event) {
|
||||
guard let subteam = event.subteam, id = subteam.id else {
|
||||
return
|
||||
if let subteam = event.subteam, id = subteam.id {
|
||||
userGroups[id] = subteam
|
||||
|
||||
subteamEventsDelegate?.subteamEvent(userGroup: subteam)
|
||||
}
|
||||
|
||||
userGroups[id] = subteam
|
||||
subteamEventsDelegate?.subteamEvent(subteam)
|
||||
}
|
||||
|
||||
func subteamAddedSelf(event: Event) {
|
||||
guard let subteamID = event.subteamID, _ = authenticatedUser?.userGroups else {
|
||||
return
|
||||
if let subteamID = event.subteamID, _ = authenticatedUser?.userGroups {
|
||||
authenticatedUser?.userGroups![subteamID] = subteamID
|
||||
|
||||
subteamEventsDelegate?.subteamSelfAdded(subteamID: subteamID)
|
||||
}
|
||||
|
||||
authenticatedUser?.userGroups![subteamID] = subteamID
|
||||
subteamEventsDelegate?.subteamSelfAdded(subteamID)
|
||||
}
|
||||
|
||||
func subteamRemovedSelf(event: Event) {
|
||||
guard let subteamID = event.subteamID else {
|
||||
return
|
||||
if let subteamID = event.subteamID {
|
||||
authenticatedUser?.userGroups?.removeValue(forKey:subteamID)
|
||||
|
||||
subteamEventsDelegate?.subteamSelfRemoved(subteamID: subteamID)
|
||||
}
|
||||
|
||||
authenticatedUser?.userGroups?.removeValueForKey(subteamID)
|
||||
subteamEventsDelegate?.subteamSelfRemoved(subteamID)
|
||||
}
|
||||
|
||||
//MARK: - Team Profiles
|
||||
func teamProfileChange(event: Event) {
|
||||
guard let profile = event.profile else {
|
||||
return
|
||||
}
|
||||
|
||||
for user in users {
|
||||
for key in profile.fields.keys {
|
||||
users[user.0]?.profile?.customProfile?.fields[key]?.updateProfileField(profile.fields[key])
|
||||
if let fields = event.profile?.fields {
|
||||
for key in fields.keys {
|
||||
users[user.0]?.profile?.customProfile?.fields[key]?.updateProfileField(profile: fields[key])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
teamProfileEventsDelegate?.teamProfileChanged(profile)
|
||||
teamProfileEventsDelegate?.teamProfileChanged(profile: event.profile)
|
||||
}
|
||||
|
||||
func teamProfileDeleted(event: Event) {
|
||||
guard let profile = event.profile else {
|
||||
return
|
||||
}
|
||||
|
||||
for user in users {
|
||||
if let id = profile.fields.first?.0 {
|
||||
if let id = event.profile?.fields.first?.0 {
|
||||
users[user.0]?.profile?.customProfile?.fields[id] = nil
|
||||
}
|
||||
}
|
||||
|
||||
teamProfileEventsDelegate?.teamProfileDeleted(profile)
|
||||
teamProfileEventsDelegate?.teamProfileDeleted(profile: event.profile)
|
||||
}
|
||||
|
||||
func teamProfileReordered(event: Event) {
|
||||
guard let profile = event.profile else {
|
||||
return
|
||||
}
|
||||
|
||||
for user in users {
|
||||
for key in profile.fields.keys {
|
||||
users[user.0]?.profile?.customProfile?.fields[key]?.ordering = profile.fields[key]?.ordering
|
||||
if let keys = event.profile?.fields.keys {
|
||||
for key in keys {
|
||||
users[user.0]?.profile?.customProfile?.fields[key]?.ordering = event.profile?.fields[key]?.ordering
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
teamProfileEventsDelegate?.teamProfileReordered(profile)
|
||||
|
||||
teamProfileEventsDelegate?.teamProfileReordered(profile: event.profile)
|
||||
}
|
||||
|
||||
//MARK: - Authenticated User
|
||||
func manualPresenceChange(event: Event) {
|
||||
guard let presence = event.presence, user = authenticatedUser else {
|
||||
return
|
||||
}
|
||||
authenticatedUser?.presence = event.presence
|
||||
|
||||
authenticatedUser?.presence = presence
|
||||
slackEventsDelegate?.manualPresenceChanged(user, presence: presence)
|
||||
slackEventsDelegate?.manualPresenceChanged(user: authenticatedUser, presence: event.presence)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,45 +21,32 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum ClientError: ErrorType {
|
||||
case ChannelDoesNotExist
|
||||
case UserDoesNotExist
|
||||
}
|
||||
|
||||
public extension Client {
|
||||
extension SlackClient {
|
||||
|
||||
//MARK: - User & Channel
|
||||
public func getChannelIDByName(name: String) throws -> String {
|
||||
guard let id = channels.filter({$0.1.name == stripString(name)}).first?.0 else {
|
||||
throw ClientError.ChannelDoesNotExist
|
||||
}
|
||||
return id
|
||||
public func getChannelIDByName(name: String) -> String? {
|
||||
return channels.filter{$0.1.name == stripString(string: name)}.first?.0
|
||||
}
|
||||
|
||||
public func getUserIDByName(name: String) throws -> String {
|
||||
guard let id = users.filter({$0.1.name == stripString(name)}).first?.0 else {
|
||||
throw ClientError.UserDoesNotExist
|
||||
}
|
||||
return id
|
||||
|
||||
public func getUserIDByName(name: String) -> String? {
|
||||
return users.filter{$0.1.name == stripString(string: name)}.first?.0
|
||||
}
|
||||
|
||||
|
||||
public func getImIDForUserWithID(id: String, success: (imID: String?)->Void, failure: (error: SlackError)->Void) {
|
||||
let ims = channels.filter{$0.1.isIM == true}
|
||||
let channel = ims.filter{$0.1.user == id}.first
|
||||
if let channel = channel {
|
||||
success(imID: channel.0)
|
||||
} else {
|
||||
webAPI.openIM(id, success: success, failure: failure)
|
||||
webAPI.openIM(userID: id, success: success, failure: failure)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Utilities
|
||||
internal func stripString(string: String) -> String {
|
||||
internal func stripString(string: String) -> String? {
|
||||
var strippedString = string
|
||||
if string[string.startIndex] == "@" || string[string.startIndex] == "#" {
|
||||
strippedString = string.substringFromIndex(string.startIndex.advancedBy(1))
|
||||
strippedString.characters.remove(at: string.startIndex)
|
||||
}
|
||||
return strippedString
|
||||
}
|
||||
|
||||
+127
-109
@@ -21,12 +21,14 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Starscream
|
||||
import C7
|
||||
import Jay
|
||||
import WebSocket
|
||||
|
||||
public class Client: WebSocketDelegate {
|
||||
public class SlackClient {
|
||||
|
||||
internal(set) public var connected = false
|
||||
internal(set) public var authenticated = false
|
||||
internal(set) public var authenticatedUser: User?
|
||||
internal(set) public var team: Team?
|
||||
|
||||
@@ -51,114 +53,123 @@ public class Client: WebSocketDelegate {
|
||||
public weak var subteamEventsDelegate: SubteamEventsDelegate?
|
||||
public weak var teamProfileEventsDelegate: TeamProfileEventsDelegate?
|
||||
|
||||
public var token = "SLACK_AUTH_TOKEN"
|
||||
internal var token = "SLACK_AUTH_TOKEN"
|
||||
|
||||
public func setAuthToken(token: String) {
|
||||
self.token = token
|
||||
}
|
||||
|
||||
public var webAPI: SlackWebAPI {
|
||||
return SlackWebAPI(client: self)
|
||||
return SlackWebAPI(slackClient: self)
|
||||
}
|
||||
|
||||
internal var webSocket: WebSocket?
|
||||
internal var webSocket: WebSocket.Client?
|
||||
internal var socket: Socket?
|
||||
internal let api = NetworkInterface()
|
||||
|
||||
private let pingPongQueue = dispatch_queue_create("com.launchsoft.SlackKit", DISPATCH_QUEUE_SERIAL)
|
||||
|
||||
internal var ping: Double?
|
||||
internal var pong: Double?
|
||||
|
||||
internal var pingInterval: NSTimeInterval?
|
||||
internal var timeout: NSTimeInterval?
|
||||
internal var pingInterval: Double?
|
||||
internal var timeout: Double?
|
||||
internal var reconnect: Bool?
|
||||
|
||||
required public init(apiToken: String) {
|
||||
self.token = apiToken
|
||||
}
|
||||
|
||||
public func connect(simpleLatest simpleLatest: Bool? = nil, noUnreads: Bool? = nil, mpimAware: Bool? = nil, pingInterval: NSTimeInterval? = nil, timeout: NSTimeInterval? = nil, reconnect: Bool? = nil) {
|
||||
public func connect(simpleLatest: Bool? = nil, noUnreads: Bool? = nil, mpimAware: Bool? = nil, pingInterval: Double? = nil, timeout: Double? = nil, reconnect: Bool? = nil) {
|
||||
self.pingInterval = pingInterval
|
||||
self.timeout = timeout
|
||||
self.reconnect = reconnect
|
||||
webAPI.rtmStart(simpleLatest, noUnreads: noUnreads, mpimAware: mpimAware, success: {
|
||||
webAPI.rtmStart(simpleLatest: simpleLatest, noUnreads: noUnreads, mpimAware: mpimAware, success: {
|
||||
(response) -> Void in
|
||||
self.initialSetup(response)
|
||||
self.initialSetup(json: response)
|
||||
if let socketURL = response["url"] as? String {
|
||||
let url = NSURL(string: socketURL)
|
||||
self.webSocket = WebSocket(url: url!)
|
||||
self.webSocket?.delegate = self
|
||||
self.webSocket?.connect()
|
||||
do {
|
||||
let uri = try URI(socketURL)
|
||||
self.webSocket = try WebSocket.Client(uri: uri, onConnect: {(socket) in
|
||||
self.setupSocket(socket: socket)
|
||||
if let pingInterval = self.pingInterval {
|
||||
self.pingRTMServerAtInterval(interval: pingInterval)
|
||||
}
|
||||
})
|
||||
try self.webSocket?.connect(uri.description)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
}
|
||||
}, failure: {(error) -> Void in
|
||||
self.slackEventsDelegate?.clientConnectionFailed(error)
|
||||
})
|
||||
}, failure:nil)
|
||||
}
|
||||
|
||||
/*TO-DO: Bug in Zewo/WebSocket
|
||||
public func disconnect() {
|
||||
webSocket?.disconnect()
|
||||
}
|
||||
_ = try? socket?.close()
|
||||
}*/
|
||||
|
||||
//MARK: - RTM Message send
|
||||
public func sendMessage(message: String, channelID: String) {
|
||||
guard connected else { return }
|
||||
|
||||
if let data = try? formatMessageToSlackJsonString(msg: message, channel: channelID),
|
||||
string = NSString(data: data, encoding: NSUTF8StringEncoding) as? String {
|
||||
webSocket?.writeString(string)
|
||||
if (connected) {
|
||||
if let data = formatMessageToSlackJsonString(message: message, channel: channelID) {
|
||||
if let string = try? data.string() {
|
||||
_ = try? socket?.send(string)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func formatMessageToSlackJsonString(message: (msg: String, channel: String)) throws -> NSData {
|
||||
let json: [String: AnyObject] = [
|
||||
"id": NSDate().slackTimestamp(),
|
||||
private func formatMessageToSlackJsonString(message: String, channel: String) -> Data? {
|
||||
let json: [String: Any] = [
|
||||
"id": Time.slackTimestamp(),
|
||||
"type": "message",
|
||||
"channel": message.channel,
|
||||
"text": message.msg.slackFormatEscaping()
|
||||
"channel": channel,
|
||||
"text": message.slackFormatEscaping()
|
||||
]
|
||||
addSentMessage(json)
|
||||
return try NSJSONSerialization.dataWithJSONObject(json, options: [])
|
||||
|
||||
do {
|
||||
let bytes = try Jay().dataFromJson(json)
|
||||
return Data(bytes)
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
private func addSentMessage(dictionary: [String: AnyObject]) {
|
||||
private func addSentMessage(dictionary: [String: Any]) {
|
||||
var message = dictionary
|
||||
guard let id = message["id"] as? NSNumber else {
|
||||
return
|
||||
}
|
||||
let ts = String(id)
|
||||
message.removeValueForKey("id")
|
||||
message["ts"] = ts
|
||||
let ts = message["id"] as? Int
|
||||
message.removeValue(forKey:"id")
|
||||
message["ts"] = "\(ts)"
|
||||
message["user"] = self.authenticatedUser?.id
|
||||
sentMessages[ts] = Message(message: message)
|
||||
sentMessages["\(ts)"] = Message(message: message)
|
||||
}
|
||||
|
||||
//MARK: - RTM Ping
|
||||
private func pingRTMServerAtInterval(interval: NSTimeInterval) {
|
||||
let delay = dispatch_time(DISPATCH_TIME_NOW, Int64(interval * Double(NSEC_PER_SEC)))
|
||||
dispatch_after(delay, pingPongQueue, {
|
||||
guard self.connected && self.timeoutCheck() else {
|
||||
self.disconnect()
|
||||
return
|
||||
}
|
||||
self.sendRTMPing()
|
||||
self.pingRTMServerAtInterval(interval)
|
||||
})
|
||||
private func pingRTMServerAtInterval(interval: Double) {
|
||||
co { [weak self] in
|
||||
let weakSelf = self
|
||||
repeat {
|
||||
nap(for: interval)
|
||||
weakSelf?.sendRTMPing()
|
||||
} while weakSelf?.connected == true && weakSelf?.timeoutCheck() == true
|
||||
//weakSelf?.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
private func sendRTMPing() {
|
||||
guard connected else {
|
||||
return
|
||||
}
|
||||
let json: [String: AnyObject] = [
|
||||
"id": NSDate().slackTimestamp(),
|
||||
"type": "ping",
|
||||
]
|
||||
guard let data = try? NSJSONSerialization.dataWithJSONObject(json, options: []) else {
|
||||
return
|
||||
}
|
||||
let string = NSString(data: data, encoding: NSUTF8StringEncoding)
|
||||
if let writePing = string as? String {
|
||||
ping = json["id"] as? Double
|
||||
webSocket?.writeString(writePing)
|
||||
if connected {
|
||||
let json: [String: Any] = [
|
||||
"id": Double.slackTimestamp(),
|
||||
"type": "ping",
|
||||
]
|
||||
do {
|
||||
let data = try Jay().dataFromJson(json)
|
||||
let string = try data.string()
|
||||
ping = json["id"] as? Double
|
||||
try socket?.send(string)
|
||||
}
|
||||
catch _ {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,46 +187,43 @@ public class Client: WebSocketDelegate {
|
||||
}
|
||||
|
||||
//MARK: - Client setup
|
||||
private func initialSetup(json: [String: AnyObject]) {
|
||||
team = Team(team: json["team"] as? [String: AnyObject])
|
||||
authenticatedUser = User(user: json["self"] as? [String: AnyObject])
|
||||
authenticatedUser?.doNotDisturbStatus = DoNotDisturbStatus(status: json["dnd"] as? [String: AnyObject])
|
||||
enumerateObjects(json["users"] as? Array) { (user) in self.addUser(user) }
|
||||
enumerateObjects(json["channels"] as? Array) { (channel) in self.addChannel(channel) }
|
||||
enumerateObjects(json["groups"] as? Array) { (group) in self.addChannel(group) }
|
||||
enumerateObjects(json["mpims"] as? Array) { (mpim) in self.addChannel(mpim) }
|
||||
enumerateObjects(json["ims"] as? Array) { (ims) in self.addChannel(ims) }
|
||||
enumerateObjects(json["bots"] as? Array) { (bots) in self.addBot(bots) }
|
||||
enumerateSubteams(json["subteams"] as? [String: AnyObject])
|
||||
private func initialSetup(json: [String: Any]) {
|
||||
team = Team(team: json["team"] as? [String: Any])
|
||||
authenticatedUser = User(user: json["self"] as? [String: Any])
|
||||
authenticatedUser?.doNotDisturbStatus = DoNotDisturbStatus(status: json["dnd"] as? [String: Any])
|
||||
enumerateObjects(array: json["users"] as? Array) { (user) in self.addUser(aUser: user) }
|
||||
enumerateObjects(array: json["channels"] as? Array) { (channel) in self.addChannel(aChannel: channel) }
|
||||
enumerateObjects(array: json["groups"] as? Array) { (group) in self.addChannel(aChannel: group) }
|
||||
enumerateObjects(array: json["mpims"] as? Array) { (mpim) in self.addChannel(aChannel: mpim) }
|
||||
enumerateObjects(array: json["ims"] as? Array) { (ims) in self.addChannel(aChannel: ims) }
|
||||
enumerateObjects(array: json["bots"] as? Array) { (bots) in self.addBot(aBot: bots) }
|
||||
enumerateSubteams(subteams: json["subteams"] as? [String: Any])
|
||||
}
|
||||
|
||||
private func addUser(aUser: [String: AnyObject]) {
|
||||
let user = User(user: aUser)
|
||||
if let id = user.id {
|
||||
private func addUser(aUser: [String: Any]) {
|
||||
if let user = User(user: aUser), id = user.id {
|
||||
users[id] = user
|
||||
}
|
||||
}
|
||||
|
||||
private func addChannel(aChannel: [String: AnyObject]) {
|
||||
let channel = Channel(channel: aChannel)
|
||||
if let id = channel.id {
|
||||
private func addChannel(aChannel: [String: Any]) {
|
||||
if let channel = Channel(channel: aChannel), id = channel.id {
|
||||
channels[id] = channel
|
||||
}
|
||||
}
|
||||
|
||||
private func addBot(aBot: [String: AnyObject]) {
|
||||
let bot = Bot(bot: aBot)
|
||||
if let id = bot.id {
|
||||
private func addBot(aBot: [String: Any]) {
|
||||
if let bot = Bot(bot: aBot), id = bot.id {
|
||||
bots[id] = bot
|
||||
}
|
||||
}
|
||||
|
||||
private func enumerateSubteams(subteams: [String: AnyObject]?) {
|
||||
private func enumerateSubteams(subteams: [String: Any]?) {
|
||||
if let subteams = subteams {
|
||||
if let all = subteams["all"] as? [[String: AnyObject]] {
|
||||
if let all = subteams["all"] as? [Any] {
|
||||
for item in all {
|
||||
let u = UserGroup(userGroup: item)
|
||||
self.userGroups[u.id!] = u
|
||||
let u = UserGroup(userGroup: item as? [String: Any])
|
||||
self.userGroups[u!.id!] = u
|
||||
}
|
||||
}
|
||||
if let auth = subteams["self"] as? [String] {
|
||||
@@ -228,26 +236,48 @@ public class Client: WebSocketDelegate {
|
||||
}
|
||||
|
||||
// MARK: - Utilities
|
||||
private func enumerateObjects(array: [AnyObject]?, initalizer: ([String: AnyObject])-> Void) {
|
||||
private func enumerateObjects(array: [Any]?, initalizer: ([String: Any])-> Void) {
|
||||
if let array = array {
|
||||
for object in array {
|
||||
if let dictionary = object as? [String: AnyObject] {
|
||||
if let dictionary = object as? [String: Any] {
|
||||
initalizer(dictionary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - WebSocketDelegate
|
||||
public func websocketDidConnect(socket: WebSocket) {
|
||||
if let pingInterval = pingInterval {
|
||||
pingRTMServerAtInterval(pingInterval)
|
||||
|
||||
// MARK: - WebSocket
|
||||
private func setupSocket(socket: Socket) {
|
||||
socket.onText {(message) in
|
||||
self.websocketDidReceive(message: message)
|
||||
}
|
||||
socket.onPing { (data) in try socket.pong() }
|
||||
socket.onPong { (data) in try socket.ping() }
|
||||
socket.onClose{ (code: CloseCode?, reason: String?) in
|
||||
self.websocketDidDisconnect(closeCode: code, error: reason)
|
||||
}
|
||||
self.socket = socket
|
||||
}
|
||||
|
||||
public func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
|
||||
private func websocketDidReceive(message: String) {
|
||||
do {
|
||||
let json = try Jay().jsonFromData(message.data.bytes)
|
||||
if let event = json as? [String: Any] {
|
||||
dispatch(event:event)
|
||||
}
|
||||
}
|
||||
catch _ {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private func websocketDidDisconnect(closeCode: CloseCode?, error: String?) {
|
||||
connected = false
|
||||
authenticated = false
|
||||
webSocket = nil
|
||||
socket = nil
|
||||
authenticatedUser = nil
|
||||
slackEventsDelegate?.clientDisconnected()
|
||||
if reconnect == true {
|
||||
@@ -255,16 +285,4 @@ public class Client: WebSocketDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
|
||||
guard let data = text.dataUsingEncoding(NSUTF8StringEncoding) else {
|
||||
return
|
||||
}
|
||||
|
||||
if let json = (try? NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments)) as? [String: AnyObject] {
|
||||
dispatch(json)
|
||||
}
|
||||
}
|
||||
|
||||
public func websocketDidReceiveData(socket: WebSocket, data: NSData) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Event.swift
|
||||
// Message.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
@@ -137,14 +137,13 @@ internal struct Event {
|
||||
let fileID: String?
|
||||
let presence: String?
|
||||
let name: String?
|
||||
let value: AnyObject?
|
||||
let value: Any?
|
||||
let plan: String?
|
||||
let url: String?
|
||||
let domain: String?
|
||||
let emailDomain: String?
|
||||
let reaction: String?
|
||||
let replyTo: Double?
|
||||
let reactions: [[String: AnyObject]]?
|
||||
let edited: Edited?
|
||||
let bot: Bot?
|
||||
let channel: Channel?
|
||||
@@ -160,7 +159,7 @@ internal struct Event {
|
||||
let subteamID: String?
|
||||
var profile: CustomProfile?
|
||||
|
||||
init(event:[String: AnyObject]) {
|
||||
init(event:[String: Any]) {
|
||||
if let eventType = event["type"] as? String {
|
||||
type = EventType(rawValue:eventType)
|
||||
} else {
|
||||
@@ -186,38 +185,41 @@ internal struct Event {
|
||||
emailDomain = event["email_domain"] as? String
|
||||
reaction = event["reaction"] as? String
|
||||
replyTo = event["reply_to"] as? Double
|
||||
reactions = event["reactions"] as? [[String: AnyObject]]
|
||||
bot = Bot(bot: event["bot"] as? [String: AnyObject])
|
||||
edited = Edited(edited:event["edited"] as? [String: AnyObject])
|
||||
dndStatus = DoNotDisturbStatus(status: event["dnd_status"] as? [String: AnyObject])
|
||||
bot = Bot(bot: event["bot"] as? [String: Any])
|
||||
edited = Edited(edited:event["edited"] as? [String: Any])
|
||||
dndStatus = DoNotDisturbStatus(status: event["dnd_status"] as? [String: Any])
|
||||
itemUser = event["item_user"] as? String
|
||||
item = Item(item: event["item"] as? [String: AnyObject])
|
||||
subteam = UserGroup(userGroup: event["subteam"] as? [String: AnyObject])
|
||||
item = Item(item: event["item"] as? [String: Any])
|
||||
subteam = UserGroup(userGroup: event["subteam"] as? [String: Any])
|
||||
subteamID = event["subteam_id"] as? String
|
||||
message = Message(message: event)
|
||||
nestedMessage = Message(message: event["message"] as? [String: AnyObject])
|
||||
profile = CustomProfile(profile: event["profile"] as? [String: AnyObject])
|
||||
file = File(id: event["file"] as? String)
|
||||
|
||||
// Comment, Channel, and User can come across as Strings or Dictionaries
|
||||
if let commentDictionary = event["comment"] as? [String: AnyObject] {
|
||||
comment = Comment(comment: commentDictionary)
|
||||
} else {
|
||||
nestedMessage = Message(message: event["message"] as? [String: Any])
|
||||
profile = CustomProfile(profile: event["profile"] as? [String: Any])
|
||||
|
||||
// Comment, Channel, User, and File can come across as Strings or Dictionaries
|
||||
if (Comment(comment: event["comment"] as? [String: Any])?.id == nil) {
|
||||
comment = Comment(id: event["comment"] as? String)
|
||||
}
|
||||
|
||||
if let userDictionary = event["user"] as? [String: AnyObject] {
|
||||
user = User(user: userDictionary)
|
||||
} else {
|
||||
comment = Comment(comment: event["comment"] as? [String: Any])
|
||||
}
|
||||
|
||||
if (User(user: event["user"] as? [String: Any])?.id == nil) {
|
||||
user = User(id: event["user"] as? String)
|
||||
}
|
||||
|
||||
if let channelDictionary = event["channel"] as? [String: AnyObject] {
|
||||
channel = Channel(channel: channelDictionary)
|
||||
} else {
|
||||
channel = Channel(id: event["channel"] as? String)
|
||||
user = User(user: event["user"] as? [String: Any])
|
||||
}
|
||||
|
||||
if (File(file: event["file"] as? [String: Any])?.id == nil) {
|
||||
file = File(id: event["file"] as? String)
|
||||
} else {
|
||||
file = File(file: event["file"] as? [String: Any])
|
||||
}
|
||||
|
||||
if (Channel(channel: event["channel"] as? [String: Any])?.id == nil) {
|
||||
channel = Channel(id: event["channel"] as? String)
|
||||
} else {
|
||||
channel = Channel(channel: event["channel"] as? [String: Any])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,16 +21,13 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol SlackEventsDelegate: class {
|
||||
func clientConnectionFailed(error: SlackError)
|
||||
func clientConnected()
|
||||
func clientDisconnected()
|
||||
func preferenceChanged(preference: String, value: AnyObject?)
|
||||
func preferenceChanged(preference: String, value: Any)
|
||||
func userChanged(user: User)
|
||||
func presenceChanged(user: User, presence: String)
|
||||
func manualPresenceChanged(user: User, presence: String)
|
||||
func presenceChanged(user: User?, presence: String?)
|
||||
func manualPresenceChanged(user: User?, presence: String?)
|
||||
func botEvent(bot: Bot)
|
||||
}
|
||||
|
||||
@@ -42,8 +39,8 @@ public protocol MessageEventsDelegate: class {
|
||||
}
|
||||
|
||||
public protocol ChannelEventsDelegate: class {
|
||||
func userTyping(channel: Channel, user: User)
|
||||
func channelMarked(channel: Channel, timestamp: String)
|
||||
func userTyping(channel: Channel?, user: User?)
|
||||
func channelMarked(channel: Channel, timestamp: String?)
|
||||
func channelCreated(channel: Channel)
|
||||
func channelDeleted(channel: Channel)
|
||||
func channelRenamed(channel: Channel)
|
||||
@@ -55,7 +52,7 @@ public protocol ChannelEventsDelegate: class {
|
||||
|
||||
public protocol DoNotDisturbEventsDelegate: class {
|
||||
func doNotDisturbUpdated(dndStatus: DoNotDisturbStatus)
|
||||
func doNotDisturbUserUpdated(dndStatus: DoNotDisturbStatus, user: User)
|
||||
func doNotDisturbUserUpdated(dndStatus: DoNotDisturbStatus, user: User?)
|
||||
}
|
||||
|
||||
public protocol GroupEventsDelegate: class {
|
||||
@@ -72,8 +69,8 @@ public protocol FileEventsDelegate: class {
|
||||
}
|
||||
|
||||
public protocol PinEventsDelegate: class {
|
||||
func itemPinned(item: Item, channel: Channel?)
|
||||
func itemUnpinned(item: Item, channel: Channel?)
|
||||
func itemPinned(item: Item?, channel: Channel?)
|
||||
func itemUnpinned(item: Item?, channel: Channel?)
|
||||
}
|
||||
|
||||
public protocol StarEventsDelegate: class {
|
||||
@@ -81,14 +78,14 @@ public protocol StarEventsDelegate: class {
|
||||
}
|
||||
|
||||
public protocol ReactionEventsDelegate: class {
|
||||
func reactionAdded(reaction: String, item: Item, itemUser: String)
|
||||
func reactionRemoved(reaction: String, item: Item, itemUser: String)
|
||||
func reactionAdded(reaction: String?, item: Item?, itemUser: String?)
|
||||
func reactionRemoved(reaction: String?, item: Item?, itemUser: String?)
|
||||
}
|
||||
|
||||
public protocol TeamEventsDelegate: class {
|
||||
func teamJoined(user: User)
|
||||
func teamPlanChanged(plan: String)
|
||||
func teamPreferencesChanged(preference: String, value: AnyObject?)
|
||||
func teamPreferencesChanged(preference: String, value: Any)
|
||||
func teamNameChanged(name: String)
|
||||
func teamDomainChanged(domain: String)
|
||||
func teamEmailDomainChanged(domain: String)
|
||||
@@ -102,7 +99,7 @@ public protocol SubteamEventsDelegate: class {
|
||||
}
|
||||
|
||||
public protocol TeamProfileEventsDelegate: class {
|
||||
func teamProfileChanged(profile: CustomProfile)
|
||||
func teamProfileDeleted(profile: CustomProfile)
|
||||
func teamProfileReordered(profile: CustomProfile)
|
||||
func teamProfileChanged(profile: CustomProfile?)
|
||||
func teamProfileDeleted(profile: CustomProfile?)
|
||||
func teamProfileReordered(profile: CustomProfile?)
|
||||
}
|
||||
|
||||
@@ -21,12 +21,30 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import C7
|
||||
#if os(Linux)
|
||||
import Glibc
|
||||
#else
|
||||
import Darwin.C
|
||||
#endif
|
||||
|
||||
public extension NSDate {
|
||||
public typealias Time=Double
|
||||
|
||||
func slackTimestamp() -> Double {
|
||||
return NSNumber(double: timeIntervalSince1970).doubleValue
|
||||
public extension Double {
|
||||
|
||||
static func slackTimestamp() -> Double {
|
||||
#if os(Linux)
|
||||
return Double(time(nil))
|
||||
#else
|
||||
var clock: clock_serv_t = clock_serv_t()
|
||||
var timeSpecBuffer: mach_timespec_t = mach_timespec_t(tv_sec: 0, tv_nsec: 0)
|
||||
|
||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clock)
|
||||
clock_get_time(clock, &timeSpecBuffer)
|
||||
mach_port_deallocate(mach_task_self_, clock)
|
||||
|
||||
return Double(timeSpecBuffer.tv_sec) + Double(timeSpecBuffer.tv_nsec) * 0.000000001
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,10 +52,48 @@ public extension NSDate {
|
||||
internal extension String {
|
||||
|
||||
func slackFormatEscaping() -> String {
|
||||
var escapedString = stringByReplacingOccurrencesOfString("&", withString: "&")
|
||||
escapedString = stringByReplacingOccurrencesOfString("<", withString: "<")
|
||||
escapedString = stringByReplacingOccurrencesOfString(">", withString: ">")
|
||||
var escapedString = self
|
||||
escapedString.replace(string: "&", with: "&")
|
||||
escapedString.replace(string: "<", with: "<")
|
||||
escapedString.replace(string: ">", with: ">")
|
||||
return escapedString
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public extension String {
|
||||
|
||||
func contains(query: String, caseSensitive: Bool = false) -> Bool {
|
||||
if query.isEmpty { return true }
|
||||
let (s, q) = caseSensitive ? (self, query) : (self.lowercased(), query.lowercased())
|
||||
var chars = s.characters; let qchars = q.characters
|
||||
|
||||
while !chars.isEmpty {
|
||||
if chars.starts(with: qchars) { return true }
|
||||
chars.removeFirst()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func prefixedBy(query: String, caseSensitive: Bool = false) -> Bool {
|
||||
let (s, q) = caseSensitive ? (self, query) : (self.lowercased(), query.lowercased())
|
||||
return s.characters.starts(with: q.characters)
|
||||
}
|
||||
}
|
||||
|
||||
internal extension Array {
|
||||
|
||||
func objectArrayFromDictionaryArray<T>(intializer:([String: Any])->T?) -> [T] {
|
||||
var returnValue = [T]()
|
||||
for object in self {
|
||||
if let dictionary = object as? [String: Any] {
|
||||
if let value = intializer(dictionary) {
|
||||
returnValue.append(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,22 +44,6 @@ public struct File {
|
||||
public let thumb360gif: String?
|
||||
public let thumb360w: String?
|
||||
public let thumb360h: String?
|
||||
public let thumb480: String?
|
||||
public let thumb480gif: String?
|
||||
public let thumb480w: String?
|
||||
public let thumb480h: String?
|
||||
public let thumb720: String?
|
||||
public let thumb720gif: String?
|
||||
public let thumb720w: String?
|
||||
public let thumb720h: String?
|
||||
public let thumb960: String?
|
||||
public let thumb960gif: String?
|
||||
public let thumb960w: String?
|
||||
public let thumb960h: String?
|
||||
public let thumb1024: String?
|
||||
public let thumb1024gif: String?
|
||||
public let thumb1024w: String?
|
||||
public let thumb1024h: String?
|
||||
public let permalink: String?
|
||||
public let editLink: String?
|
||||
public let preview: String?
|
||||
@@ -76,9 +60,9 @@ public struct File {
|
||||
internal(set) public var isStarred: Bool?
|
||||
internal(set) public var pinnedTo: [String]?
|
||||
internal(set) public var comments = [String: Comment]()
|
||||
internal(set) public var reactions = [Reaction]()
|
||||
internal(set) public var reactions = [String: Reaction]()
|
||||
|
||||
public init(file:[String: AnyObject]?) {
|
||||
public init?(file:[String: Any]?) {
|
||||
id = file?["id"] as? String
|
||||
created = file?["created"] as? Int
|
||||
name = file?["name"] as? String
|
||||
@@ -100,22 +84,6 @@ public struct File {
|
||||
thumb360gif = file?["thumb_360_gif"] as? String
|
||||
thumb360w = file?["thumb_360_w"] as? String
|
||||
thumb360h = file?["thumb_360_h"] as? String
|
||||
thumb480 = file?["thumb_480"] as? String
|
||||
thumb480gif = file?["thumb_480_gif"] as? String
|
||||
thumb480w = file?["thumb_480_w"] as? String
|
||||
thumb480h = file?["thumb_480_h"] as? String
|
||||
thumb720 = file?["thumb_720"] as? String
|
||||
thumb720gif = file?["thumb_720_gif"] as? String
|
||||
thumb720w = file?["thumb_720_w"] as? String
|
||||
thumb720h = file?["thumb_720_h"] as? String
|
||||
thumb960 = file?["thumb_960"] as? String
|
||||
thumb960gif = file?["thumb_960_gif"] as? String
|
||||
thumb960w = file?["thumb_960_w"] as? String
|
||||
thumb960h = file?["thumb_960_h"] as? String
|
||||
thumb1024 = file?["thumb_1024"] as? String
|
||||
thumb1024gif = file?["thumb_1024_gif"] as? String
|
||||
thumb1024w = file?["thumb_1024_w"] as? String
|
||||
thumb1024h = file?["thumb_1024_h"] as? String
|
||||
permalink = file?["permalink"] as? String
|
||||
editLink = file?["edit_link"] as? String
|
||||
preview = file?["preview"] as? String
|
||||
@@ -127,14 +95,17 @@ public struct File {
|
||||
channels = file?["channels"] as? [String]
|
||||
groups = file?["groups"] as? [String]
|
||||
ims = file?["ims"] as? [String]
|
||||
initialComment = Comment(comment: file?["initial_comment"] as? [String: AnyObject])
|
||||
initialComment = Comment(comment: file?["initial_comment"] as? [String: Any])
|
||||
stars = file?["num_stars"] as? Int
|
||||
isStarred = file?["is_starred"] as? Bool
|
||||
pinnedTo = file?["pinned_to"] as? [String]
|
||||
reactions = Reaction.reactionsFromArray(file?["reactions"] as? [[String: AnyObject]])
|
||||
if let reactions = file?["reactions"] as? [Any] {
|
||||
self.reactions = Reaction.reactionsFromArray(array: reactions)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal init(id:String?) {
|
||||
internal init?(id:String?) {
|
||||
self.id = id
|
||||
created = nil
|
||||
name = nil
|
||||
@@ -155,22 +126,6 @@ public struct File {
|
||||
thumb360gif = nil
|
||||
thumb360w = nil
|
||||
thumb360h = nil
|
||||
thumb480 = nil
|
||||
thumb480gif = nil
|
||||
thumb480w = nil
|
||||
thumb480h = nil
|
||||
thumb720 = nil
|
||||
thumb720gif = nil
|
||||
thumb720w = nil
|
||||
thumb720h = nil
|
||||
thumb960 = nil
|
||||
thumb960gif = nil
|
||||
thumb960w = nil
|
||||
thumb960h = nil
|
||||
thumb1024 = nil
|
||||
thumb1024gif = nil
|
||||
thumb1024w = nil
|
||||
thumb1024h = nil
|
||||
permalink = nil
|
||||
editLink = nil
|
||||
preview = nil
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Message {
|
||||
internal(set) public var text: String?
|
||||
public let botID: String?
|
||||
public let username: String?
|
||||
public let icons: [String: AnyObject]?
|
||||
public let icons: [String: Any]?
|
||||
public let deletedTs: String?
|
||||
internal(set) var purpose: String?
|
||||
internal(set) var topic: String?
|
||||
@@ -45,10 +45,10 @@ public class Message {
|
||||
internal(set) var pinnedTo: [String]?
|
||||
public let comment: Comment?
|
||||
public let file: File?
|
||||
internal(set) public var reactions = [Reaction]()
|
||||
internal(set) public var reactions = [String: Reaction]()
|
||||
internal(set) public var attachments: [Attachment]?
|
||||
|
||||
public init(message: [String: AnyObject]?) {
|
||||
public init?(message: [String: Any]?) {
|
||||
subtype = message?["subtype"] as? String
|
||||
ts = message?["ts"] as? String
|
||||
user = message?["user"] as? String
|
||||
@@ -57,7 +57,7 @@ public class Message {
|
||||
text = message?["text"] as? String
|
||||
botID = message?["bot_id"] as? String
|
||||
username = message?["username"] as? String
|
||||
icons = message?["icons"] as? [String: AnyObject]
|
||||
icons = message?["icons"] as? [String: Any]
|
||||
deletedTs = message?["deleted_ts"] as? String
|
||||
purpose = message?["purpose"] as? String
|
||||
topic = message?["topic"] as? String
|
||||
@@ -68,15 +68,15 @@ public class Message {
|
||||
itemType = message?["item_type"] as? String
|
||||
isStarred = message?["is_starred"] as? Bool
|
||||
pinnedTo = message?["pinned_to"] as? [String]
|
||||
comment = Comment(comment: message?["comment"] as? [String: AnyObject])
|
||||
file = File(file: message?["file"] as? [String: AnyObject])
|
||||
reactions = Reaction.reactionsFromArray(message?["reactions"] as? [[String: AnyObject]])
|
||||
attachments = (message?["attachments"] as? [[String: AnyObject]])?.map({(attachment) -> Attachment in
|
||||
comment = Comment(comment: message?["comment"] as? [String: Any])
|
||||
file = File(file: message?["file"] as? [String: Any])
|
||||
reactions = messageReactions(reactions: message?["reactions"] as? [Any])
|
||||
attachments = (message?["attachments"] as? [Any])?.objectArrayFromDictionaryArray(intializer: {(attachment) -> Attachment? in
|
||||
return Attachment(attachment: attachment)
|
||||
})
|
||||
}
|
||||
|
||||
internal init(ts:String?) {
|
||||
internal init?(ts:String?) {
|
||||
self.ts = ts
|
||||
subtype = nil
|
||||
user = nil
|
||||
@@ -90,7 +90,18 @@ public class Message {
|
||||
comment = nil
|
||||
file = nil
|
||||
}
|
||||
|
||||
|
||||
private func messageReactions(reactions: [Any]?) -> [String: Reaction] {
|
||||
var returnValue = [String: Reaction]()
|
||||
if let r = reactions {
|
||||
for react in r {
|
||||
if let reaction = Reaction(reaction: react as? [String: Any]), reactionName = reaction.name {
|
||||
returnValue[reactionName] = reaction
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue
|
||||
}
|
||||
}
|
||||
|
||||
extension Message: Equatable {}
|
||||
|
||||
@@ -21,97 +21,47 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import C7
|
||||
import HTTPSClient
|
||||
import Jay
|
||||
|
||||
internal struct NetworkInterface {
|
||||
|
||||
private let apiUrl = "https://slack.com/api/"
|
||||
private let client: HTTPSClient.Client?
|
||||
|
||||
internal func request(endpoint: SlackAPIEndpoint, token: String, parameters: [String: AnyObject]?, successClosure: ([String: AnyObject])->Void, errorClosure: (SlackError)->Void) {
|
||||
init() {
|
||||
do {
|
||||
self.client = try Client(uri: URI("https://slack.com"))
|
||||
} catch {
|
||||
self.client = nil
|
||||
}
|
||||
}
|
||||
|
||||
internal func request(endpoint: SlackAPIEndpoint, token: String, parameters: [String: Any]?, successClosure: ([String: Any])->Void, errorClosure: (SlackError)->Void) {
|
||||
var requestString = "\(apiUrl)\(endpoint.rawValue)?token=\(token)"
|
||||
if let params = parameters {
|
||||
requestString += requestStringFromParameters(params)
|
||||
requestString += requestStringFromParameters(parameters: params)
|
||||
}
|
||||
guard let url = NSURL(string: requestString) else {
|
||||
errorClosure(SlackError.ClientNetworkError)
|
||||
return
|
||||
}
|
||||
let request = NSURLRequest(URL:url)
|
||||
NSURLSession.sharedSession().dataTaskWithRequest(request) {
|
||||
(data, response, internalError) -> Void in
|
||||
self.handleResponse(data, response: response, internalError: internalError, successClosure: {(json) in
|
||||
successClosure(json)
|
||||
}, errorClosure: {(error) in
|
||||
errorClosure(error)
|
||||
})
|
||||
}.resume()
|
||||
}
|
||||
|
||||
internal func uploadRequest(token: String, data: NSData, parameters: [String: AnyObject]?, successClosure: ([String: AnyObject])->Void, errorClosure: (SlackError)->Void) {
|
||||
var requestString = "\(apiUrl)\(SlackAPIEndpoint.FilesUpload.rawValue)?token=\(token)"
|
||||
if let params = parameters {
|
||||
requestString = requestString + requestStringFromParameters(params)
|
||||
}
|
||||
guard let url = NSURL(string: requestString) else {
|
||||
errorClosure(SlackError.ClientNetworkError)
|
||||
return
|
||||
}
|
||||
let request = NSMutableURLRequest(URL:url)
|
||||
request.HTTPMethod = "POST"
|
||||
let boundaryConstant = randomBoundary()
|
||||
let contentType = "multipart/form-data; boundary=" + boundaryConstant
|
||||
let boundaryStart = "--\(boundaryConstant)\r\n"
|
||||
let boundaryEnd = "--\(boundaryConstant)--\r\n"
|
||||
let contentDispositionString = "Content-Disposition: form-data; name=\"file\"; filename=\"\(parameters!["filename"])\"\r\n"
|
||||
let contentTypeString = "Content-Type: \(parameters!["filetype"])\r\n\r\n"
|
||||
|
||||
let requestBodyData : NSMutableData = NSMutableData()
|
||||
requestBodyData.appendData(boundaryStart.dataUsingEncoding(NSUTF8StringEncoding)!)
|
||||
requestBodyData.appendData(contentDispositionString.dataUsingEncoding(NSUTF8StringEncoding)!)
|
||||
requestBodyData.appendData(contentTypeString.dataUsingEncoding(NSUTF8StringEncoding)!)
|
||||
requestBodyData.appendData(data)
|
||||
requestBodyData.appendData("\r\n".dataUsingEncoding(NSUTF8StringEncoding)!)
|
||||
requestBodyData.appendData(boundaryEnd.dataUsingEncoding(NSUTF8StringEncoding)!)
|
||||
|
||||
request.setValue(contentType, forHTTPHeaderField: "Content-Type")
|
||||
request.HTTPBody = requestBodyData
|
||||
|
||||
NSURLSession.sharedSession().dataTaskWithRequest(request) {
|
||||
(data, response, internalError) -> Void in
|
||||
self.handleResponse(data, response: response, internalError: internalError, successClosure: {(json) in
|
||||
successClosure(json)
|
||||
}, errorClosure: {(error) in
|
||||
errorClosure(error)
|
||||
})
|
||||
}.resume()
|
||||
}
|
||||
|
||||
private func handleResponse(data: NSData?, response:NSURLResponse?, internalError:NSError?, successClosure: ([String: AnyObject])->Void, errorClosure: (SlackError)->Void) {
|
||||
guard let data = data, response = response as? NSHTTPURLResponse else {
|
||||
errorClosure(SlackError.ClientNetworkError)
|
||||
return
|
||||
}
|
||||
do {
|
||||
guard let json = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [String: AnyObject] else {
|
||||
errorClosure(SlackError.ClientJSONError)
|
||||
return
|
||||
}
|
||||
var response: Response?
|
||||
response = try client?.get(requestString)
|
||||
|
||||
switch response.statusCode {
|
||||
case 200:
|
||||
if (json["ok"] as! Bool == true) {
|
||||
successClosure(json)
|
||||
} else {
|
||||
if let errorString = json["error"] as? String {
|
||||
throw ErrorDispatcher.dispatch(errorString)
|
||||
let data = try response?.body.becomeBuffer()
|
||||
if let data = data {
|
||||
let json = try Jay().jsonFromData(data.bytes)
|
||||
if let result = json as? [String: Any] {
|
||||
if (result["ok"] as? Bool == true) {
|
||||
successClosure(result)
|
||||
} else {
|
||||
throw SlackError.UnknownError
|
||||
if let errorString = result["error"] as? String {
|
||||
throw ErrorDispatcher.dispatch(error: errorString)
|
||||
} else {
|
||||
throw SlackError.UnknownError
|
||||
}
|
||||
}
|
||||
}
|
||||
case 429:
|
||||
throw SlackError.TooManyRequests
|
||||
default:
|
||||
throw SlackError.ClientNetworkError
|
||||
}
|
||||
} catch let error {
|
||||
if let slackError = error as? SlackError {
|
||||
@@ -122,17 +72,76 @@ internal struct NetworkInterface {
|
||||
}
|
||||
}
|
||||
|
||||
private func randomBoundary() -> String {
|
||||
return String(format: "slackkit.boundary.%08x%08x", arc4random(), arc4random())
|
||||
internal func uploadRequest(token: String, data: Data, parameters: [String: Any]?, successClosure: ([String: Any])->Void, errorClosure: (SlackError)->Void) {
|
||||
var requestString = "\(apiUrl)\(SlackAPIEndpoint.FilesUpload.rawValue)?token=\(token)"
|
||||
if let params = parameters {
|
||||
requestString = requestString + requestStringFromParameters(parameters: params)
|
||||
}
|
||||
|
||||
let boundaryConstant = randomBoundary()
|
||||
let contentType:Header = ["multipart/form-data; boundary=" + boundaryConstant]
|
||||
let boundaryStart = "--\(boundaryConstant)\r\n"
|
||||
let boundaryEnd = "--\(boundaryConstant)--\r\n"
|
||||
let contentDispositionString = "Content-Disposition: form-data; name=\"file\"; filename=\"\(parameters!["filename"])\"\r\n"
|
||||
let contentTypeString = "Content-Type: \(parameters!["filetype"])\r\n\r\n"
|
||||
|
||||
var requestBodyData = Data()
|
||||
requestBodyData.append(contentsOf: boundaryStart.data.bytes)
|
||||
requestBodyData.append(contentsOf: contentDispositionString.data.bytes)
|
||||
requestBodyData.append(contentsOf: contentTypeString.data.bytes)
|
||||
requestBodyData.append(contentsOf: data)
|
||||
requestBodyData.append(contentsOf: "\r\n".data.bytes)
|
||||
requestBodyData.append(contentsOf: boundaryEnd.data.bytes)
|
||||
|
||||
let header: Headers = ["Content-Type":contentType]
|
||||
|
||||
do {
|
||||
var response: Response?
|
||||
response = try client?.post(requestString, headers: header, body: requestBodyData)
|
||||
|
||||
let data = try response?.body.becomeBuffer()
|
||||
if let data = data {
|
||||
let json = try Jay().jsonFromData(data.bytes)
|
||||
if let result = json as? [String: Any] {
|
||||
if (result["ok"] as? Bool == true) {
|
||||
successClosure(result)
|
||||
} else {
|
||||
if let errorString = result["error"] as? String {
|
||||
throw ErrorDispatcher.dispatch(error: errorString)
|
||||
} else {
|
||||
throw SlackError.UnknownError
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch let error {
|
||||
if let slackError = error as? SlackError {
|
||||
errorClosure(slackError)
|
||||
} else {
|
||||
errorClosure(SlackError.UnknownError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func requestStringFromParameters(parameters: [String: AnyObject]) -> String {
|
||||
private func randomBoundary() -> String {
|
||||
return "slackkit.boundary.\(arc4random())\(arc4random())"
|
||||
}
|
||||
|
||||
private func requestStringFromParameters(parameters: [String: Any]) -> String {
|
||||
var requestString = ""
|
||||
for key in parameters.keys {
|
||||
if let value = parameters[key] as? String, encodedValue = value.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLHostAllowedCharacterSet()) {
|
||||
requestString += "&\(key)=\(encodedValue)"
|
||||
if let value = parameters[key] as? String {
|
||||
do {
|
||||
let encodedValue = try value.percentEncoded(allowing: .uriQueryAllowed)
|
||||
requestString += "&\(key)=\(encodedValue)"
|
||||
} catch _ {
|
||||
print("Error encoding parameters.")
|
||||
}
|
||||
} else if let value = parameters[key] as? Int {
|
||||
requestString += "&\(key)=\(value)"
|
||||
} else if let value = parameters[key] as? Bool {
|
||||
requestString += "&\(key)=\(value)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+137
-157
@@ -21,7 +21,8 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import C7
|
||||
import Jay
|
||||
|
||||
internal enum SlackAPIEndpoint: String {
|
||||
case APITest = "api.test"
|
||||
@@ -42,7 +43,6 @@ internal enum SlackAPIEndpoint: String {
|
||||
case FilesCommentsEdit = "files.comments.edit"
|
||||
case FilesCommentsDelete = "files.comments.delete"
|
||||
case FilesDelete = "files.delete"
|
||||
case FilesInfo = "files.info"
|
||||
case FilesUpload = "files.upload"
|
||||
case GroupsClose = "groups.close"
|
||||
case GroupsHistory = "groups.history"
|
||||
@@ -106,20 +106,20 @@ public class SlackWebAPI {
|
||||
|
||||
private let networkInterface: NetworkInterface
|
||||
private let token: String
|
||||
|
||||
|
||||
init(networkInterface: NetworkInterface, token: String) {
|
||||
self.networkInterface = networkInterface
|
||||
self.token = token
|
||||
}
|
||||
|
||||
convenience public init(client: Client) {
|
||||
self.init(networkInterface: client.api, token: client.token)
|
||||
|
||||
convenience public init(slackClient: SlackClient) {
|
||||
self.init(networkInterface: slackClient.api, token: slackClient.token)
|
||||
}
|
||||
|
||||
//MARK: - RTM
|
||||
public func rtmStart(simpleLatest: Bool? = nil, noUnreads: Bool? = nil, mpimAware: Bool? = nil, success: ((response: [String: AnyObject])->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["simple_latest": simpleLatest, "no_unreads": noUnreads, "mpim_aware": mpimAware]
|
||||
networkInterface.request(.RTMStart, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
public func rtmStart(simpleLatest: Bool? = nil, noUnreads: Bool? = nil, mpimAware: Bool? = nil, success: ((response: [String: Any])->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["simple_latest": simpleLatest, "no_unreads": noUnreads, "mpim_aware": mpimAware]
|
||||
networkInterface.request(endpoint: .RTMStart, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?(response: response)
|
||||
}) {(error) -> Void in
|
||||
@@ -129,7 +129,7 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - Auth Test
|
||||
public func authenticationTest(success: ((authenticated: Bool)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.AuthTest, token: token, parameters: nil, successClosure: {
|
||||
networkInterface.request(endpoint: .AuthTest, token: token, parameters: nil, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(authenticated: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -138,8 +138,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
//MARK: - Channels
|
||||
public func channelHistory(id: String, latest: String = "\(NSDate().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.ChannelsHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
public func channelHistory(id: String, latest: String = "\(Time.slackTimestamp())", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History?)->Void)?, failure: FailureClosure?) {
|
||||
history(endpoint: .ChannelsHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
(history) -> Void in
|
||||
success?(history: history)
|
||||
}) {(error) -> Void in
|
||||
@@ -147,8 +147,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func channelInfo(id: String, success: ((channel: Channel)->Void)?, failure: FailureClosure?) {
|
||||
info(.ChannelsInfo, type:ChannelType.Channel, id: id, success: {
|
||||
public func channelInfo(id: String, success: ((channel: Channel?)->Void)?, failure: FailureClosure?) {
|
||||
info(endpoint: .ChannelsInfo, type:ChannelType.Channel, id: id, success: {
|
||||
(channel) -> Void in
|
||||
success?(channel: channel)
|
||||
}) { (error) -> Void in
|
||||
@@ -156,8 +156,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func channelsList(excludeArchived: Bool = false, success: ((channels: [[String: AnyObject]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.ChannelsList, type:ChannelType.Channel, excludeArchived: excludeArchived, success: {
|
||||
public func channelsList(excludeArchived: Bool = false, success: ((channels: [Any]?)->Void)?, failure: FailureClosure?) {
|
||||
list(endpoint: .ChannelsList, type:ChannelType.Channel, excludeArchived: excludeArchived, success: {
|
||||
(channels) -> Void in
|
||||
success?(channels: channels)
|
||||
}) {(error) -> Void in
|
||||
@@ -166,7 +166,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func markChannel(channel: String, timestamp: String, success: ((ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.ChannelsMark, channel: channel, timestamp: timestamp, success: {
|
||||
mark(endpoint: .ChannelsMark, channel: channel, timestamp: timestamp, success: {
|
||||
(ts) -> Void in
|
||||
success?(ts:timestamp)
|
||||
}) {(error) -> Void in
|
||||
@@ -175,7 +175,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func setChannelPurpose(channel: String, purpose: String, success: ((purposeSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.ChannelsSetPurpose, type: .Purpose, channel: channel, text: purpose, success: {
|
||||
setInfo(endpoint: .ChannelsSetPurpose, type: .Purpose, channel: channel, text: purpose, success: {
|
||||
(purposeSet) -> Void in
|
||||
success?(purposeSet: purposeSet)
|
||||
}) { (error) -> Void in
|
||||
@@ -184,7 +184,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func setChannelTopic(channel: String, topic: String, success: ((topicSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.ChannelsSetTopic, type: .Topic, channel: channel, text: topic, success: {
|
||||
setInfo(endpoint: .ChannelsSetTopic, type: .Topic, channel: channel, text: topic, success: {
|
||||
(topicSet) -> Void in
|
||||
success?(topicSet: topicSet)
|
||||
}) {(error) -> Void in
|
||||
@@ -194,8 +194,8 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - Messaging
|
||||
public func deleteMessage(channel: String, ts: String, success: ((deleted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["channel": channel, "ts": ts]
|
||||
networkInterface.request(.ChatDelete, token: token, parameters: parameters, successClosure: { (response) -> Void in
|
||||
let parameters: [String: Any] = ["channel": channel, "ts": ts]
|
||||
networkInterface.request(endpoint: .ChatDelete, token: token, parameters: parameters, successClosure: { (response) -> Void in
|
||||
success?(deleted: true)
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
@@ -203,8 +203,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func sendMessage(channel: String, text: String, username: String? = nil, asUser: Bool? = nil, parse: ParseMode? = nil, linkNames: Bool? = nil, attachments: [Attachment?]? = nil, unfurlLinks: Bool? = nil, unfurlMedia: Bool? = nil, iconURL: String? = nil, iconEmoji: String? = nil, success: (((ts: String?, channel: String?))->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["channel":channel, "text":text.slackFormatEscaping(), "as_user":asUser, "parse":parse?.rawValue, "link_names":linkNames, "unfurl_links":unfurlLinks, "unfurlMedia":unfurlMedia, "username":username, "attachments":encodeAttachments(attachments), "icon_url":iconURL, "icon_emoji":iconEmoji]
|
||||
networkInterface.request(.ChatPostMessage, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
let parameters: [String: Any?] = ["channel":channel, "text":text.slackFormatEscaping(), "as_user":asUser, "parse":parse?.rawValue, "link_names":linkNames, "unfurl_links":unfurlLinks, "unfurlMedia":unfurlMedia, "username":username, "attachments":encodeAttachments(attachments: attachments), "icon_url":iconURL, "icon_emoji":iconEmoji]
|
||||
networkInterface.request(endpoint: .ChatPostMessage, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?((ts: response["ts"] as? String, response["channel"] as? String))
|
||||
}) {(error) -> Void in
|
||||
@@ -213,8 +213,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func updateMessage(channel: String, ts: String, message: String, attachments: [Attachment?]? = nil, parse:ParseMode = .None, linkNames: Bool = false, success: ((updated: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["channel": channel, "ts": ts, "text": message.slackFormatEscaping(), "parse": parse.rawValue, "link_names": linkNames, "attachments":encodeAttachments(attachments)]
|
||||
networkInterface.request(.ChatUpdate, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
let parameters: [String: Any?] = ["channel": channel, "ts": ts, "text": message.slackFormatEscaping(), "parse": parse.rawValue, "link_names": linkNames, "attachments":encodeAttachments(attachments: attachments)]
|
||||
networkInterface.request(endpoint: .ChatUpdate, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?(updated: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -223,9 +223,9 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
//MARK: - Do Not Disturb
|
||||
public func dndInfo(user: String? = nil, success: ((status: DoNotDisturbStatus)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["user": user]
|
||||
networkInterface.request(.DNDInfo, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
public func dndInfo(user: String? = nil, success: ((status: DoNotDisturbStatus?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["user": user]
|
||||
networkInterface.request(endpoint: .DNDInfo, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?(status: DoNotDisturbStatus(status: response))
|
||||
}) {(error) -> Void in
|
||||
@@ -233,25 +233,21 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func dndTeamInfo(users: [String]? = nil, success: ((statuses: [String: DoNotDisturbStatus])->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["users":users?.joinWithSeparator(",")]
|
||||
networkInterface.request(.DNDTeamInfo, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
public func dndTeamInfo(users: [String]? = nil, success: ((statuses: [String: DoNotDisturbStatus]?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["users":users?.joined(separator: ",")]
|
||||
networkInterface.request(endpoint: .DNDTeamInfo, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
guard let usersDictionary = response["users"] as? [String: AnyObject] else {
|
||||
success?(statuses: [:])
|
||||
return
|
||||
}
|
||||
success?(statuses: self.enumerateDNDStatuses(usersDictionary))
|
||||
success?(statuses: self.enumerateDNDStauses(statuses: response["users"] as? [String: Any]))
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Emoji
|
||||
public func emojiList(success: ((emojiList: [String: AnyObject]?)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.EmojiList, token: token, parameters: nil, successClosure: {
|
||||
public func emojiList(success: ((emojiList: [String: Any]?)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(endpoint: .EmojiList, token: token, parameters: nil, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(emojiList: response["emoji"] as? [String: AnyObject])
|
||||
success?(emojiList: response["emoji"] as? [String: Any])
|
||||
}) { (error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
@@ -259,8 +255,8 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - Files
|
||||
public func deleteFile(fileID: String, success: ((deleted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["file":fileID]
|
||||
networkInterface.request(.FilesDelete, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["file":fileID]
|
||||
networkInterface.request(endpoint: .FilesDelete, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(deleted: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -268,57 +264,40 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func fileInfo(fileID: String, commentCount: Int = 100, totalPages: Int = 1, success: ((file: File)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["file":fileID, "count": commentCount, "totalPages":totalPages]
|
||||
networkInterface.request(.FilesInfo, token: token, parameters: parameters, successClosure: {
|
||||
(response) in
|
||||
var file = File(file: response["file"] as? [String: AnyObject])
|
||||
(response["comments"] as? [[String: AnyObject]])?.forEach { comment in
|
||||
let comment = Comment(comment: comment)
|
||||
if let id = comment.id {
|
||||
file.comments[id] = comment
|
||||
}
|
||||
}
|
||||
success?(file: file)
|
||||
}) {(error) in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
public func uploadFile(file: NSData, filename: String, filetype: String = "auto", title: String? = nil, initialComment: String? = nil, channels: [String]? = nil, success: ((file: File)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["file":file, "filename": filename, "filetype":filetype, "title":title, "initial_comment":initialComment, "channels":channels?.joinWithSeparator(",")]
|
||||
networkInterface.uploadRequest(token, data: file, parameters: filterNilParameters(parameters), successClosure: {
|
||||
public func uploadFile(file: Data, filename: String, filetype: String = "auto", title: String? = nil, initialComment: String? = nil, channels: [String]? = nil, success: ((file: File?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["file":file, "filename": filename, "filetype":filetype, "title":title, "initial_comment":initialComment, "channels":channels?.joined(separator: ",")]
|
||||
networkInterface.uploadRequest(token: token, data: file, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?(file: File(file: response["file"] as? [String: AnyObject]))
|
||||
success?(file: File(file: response["file"] as? [String: Any]))
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - File Comments
|
||||
public func addFileComment(fileID: String, comment: String, success: ((comment: Comment)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["file":fileID, "comment":comment.slackFormatEscaping()]
|
||||
networkInterface.request(.FilesCommentsAdd, token: token, parameters: parameters, successClosure: {
|
||||
public func addFileComment(fileID: String, comment: String, success: ((comment: Comment?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["file":fileID, "comment":comment.slackFormatEscaping()]
|
||||
networkInterface.request(endpoint: .FilesCommentsAdd, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(comment: Comment(comment: response["comment"] as? [String: AnyObject]))
|
||||
success?(comment: Comment(comment: response["comment"] as? [String: Any]))
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
public func editFileComment(fileID: String, commentID: String, comment: String, success: ((comment: Comment)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["file":fileID, "id":commentID, "comment":comment.slackFormatEscaping()]
|
||||
networkInterface.request(.FilesCommentsEdit, token: token, parameters: parameters, successClosure: {
|
||||
public func editFileComment(fileID: String, commentID: String, comment: String, success: ((comment: Comment?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["file":fileID, "id":commentID, "comment":comment.slackFormatEscaping()]
|
||||
networkInterface.request(endpoint: .FilesCommentsEdit, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(comment: Comment(comment: response["comment"] as? [String: AnyObject]))
|
||||
success?(comment: Comment(comment: response["comment"] as? [String: Any]))
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
public func deleteFileComment(fileID: String, commentID: String, success: ((deleted: Bool?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["file":fileID, "id": commentID]
|
||||
networkInterface.request(.FilesCommentsDelete, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["file":fileID, "id": commentID]
|
||||
networkInterface.request(endpoint: .FilesCommentsDelete, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(deleted: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -328,7 +307,7 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - Groups
|
||||
public func closeGroup(groupID: String, success: ((closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
close(.GroupsClose, channelID: groupID, success: {
|
||||
close(endpoint: .GroupsClose, channelID: groupID, success: {
|
||||
(closed) -> Void in
|
||||
success?(closed:closed)
|
||||
}) {(error) -> Void in
|
||||
@@ -336,8 +315,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func groupHistory(id: String, latest: String = "\(NSDate().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.GroupsHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
public func groupHistory(id: String, latest: String = "\(Time.slackTimestamp())", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History?)->Void)?, failure: FailureClosure?) {
|
||||
history(endpoint: .GroupsHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
(history) -> Void in
|
||||
success?(history: history)
|
||||
}) {(error) -> Void in
|
||||
@@ -345,8 +324,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func groupInfo(id: String, success: ((channel: Channel)->Void)?, failure: FailureClosure?) {
|
||||
info(.GroupsInfo, type:ChannelType.Group, id: id, success: {
|
||||
public func groupInfo(id: String, success: ((channel: Channel?)->Void)?, failure: FailureClosure?) {
|
||||
info(endpoint: .GroupsInfo, type:ChannelType.Group, id: id, success: {
|
||||
(channel) -> Void in
|
||||
success?(channel: channel)
|
||||
}) {(error) -> Void in
|
||||
@@ -354,8 +333,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func groupsList(excludeArchived: Bool = false, success: ((channels: [[String: AnyObject]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.GroupsList, type:ChannelType.Group, excludeArchived: excludeArchived, success: {
|
||||
public func groupsList(excludeArchived: Bool = false, success: ((channels: [Any]?)->Void)?, failure: FailureClosure?) {
|
||||
list(endpoint: .GroupsList, type:ChannelType.Group, excludeArchived: excludeArchived, success: {
|
||||
(channels) -> Void in
|
||||
success?(channels: channels)
|
||||
}) {(error) -> Void in
|
||||
@@ -364,7 +343,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func markGroup(channel: String, timestamp: String, success: ((ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.GroupsMark, channel: channel, timestamp: timestamp, success: {
|
||||
mark(endpoint: .GroupsMark, channel: channel, timestamp: timestamp, success: {
|
||||
(ts) -> Void in
|
||||
success?(ts: timestamp)
|
||||
}) {(error) -> Void in
|
||||
@@ -373,8 +352,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func openGroup(channel: String, success: ((opened: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["channel":channel]
|
||||
networkInterface.request(.GroupsOpen, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["channel":channel]
|
||||
networkInterface.request(endpoint: .GroupsOpen, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(opened: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -383,7 +362,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func setGroupPurpose(channel: String, purpose: String, success: ((purposeSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.GroupsSetPurpose, type: .Purpose, channel: channel, text: purpose, success: {
|
||||
setInfo(endpoint: .GroupsSetPurpose, type: .Purpose, channel: channel, text: purpose, success: {
|
||||
(purposeSet) -> Void in
|
||||
success?(purposeSet: purposeSet)
|
||||
}) {(error) -> Void in
|
||||
@@ -392,7 +371,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func setGroupTopic(channel: String, topic: String, success: ((topicSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.GroupsSetTopic, type: .Topic, channel: channel, text: topic, success: {
|
||||
setInfo(endpoint: .GroupsSetTopic, type: .Topic, channel: channel, text: topic, success: {
|
||||
(topicSet) -> Void in
|
||||
success?(topicSet: topicSet)
|
||||
}) {(error) -> Void in
|
||||
@@ -402,7 +381,7 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - IM
|
||||
public func closeIM(channel: String, success: ((closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
close(.IMClose, channelID: channel, success: {
|
||||
close(endpoint: .IMClose, channelID: channel, success: {
|
||||
(closed) -> Void in
|
||||
success?(closed: closed)
|
||||
}) {(error) -> Void in
|
||||
@@ -410,8 +389,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func imHistory(id: String, latest: String = "\(NSDate().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.IMHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
public func imHistory(id: String, latest: String = "\(Time.slackTimestamp())", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History?)->Void)?, failure: FailureClosure?) {
|
||||
history(endpoint: .IMHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
(history) -> Void in
|
||||
success?(history: history)
|
||||
}) {(error) -> Void in
|
||||
@@ -419,8 +398,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func imsList(excludeArchived: Bool = false, success: ((channels: [[String: AnyObject]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.IMList, type:ChannelType.IM, excludeArchived: excludeArchived, success: {
|
||||
public func imsList(excludeArchived: Bool = false, success: ((channels: [Any]?)->Void)?, failure: FailureClosure?) {
|
||||
list(endpoint: .IMList, type:ChannelType.IM, excludeArchived: excludeArchived, success: {
|
||||
(channels) -> Void in
|
||||
success?(channels: channels)
|
||||
}) {(error) -> Void in
|
||||
@@ -429,7 +408,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func markIM(channel: String, timestamp: String, success: ((ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.IMMark, channel: channel, timestamp: timestamp, success: {
|
||||
mark(endpoint: .IMMark, channel: channel, timestamp: timestamp, success: {
|
||||
(ts) -> Void in
|
||||
success?(ts: timestamp)
|
||||
}) {(error) -> Void in
|
||||
@@ -438,10 +417,10 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func openIM(userID: String, success: ((imID: String?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["user":userID]
|
||||
networkInterface.request(.IMOpen, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["user":userID]
|
||||
networkInterface.request(endpoint: .IMOpen, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
let group = response["channel"] as? [String: AnyObject]
|
||||
let group = response["channel"] as? [String: Any]
|
||||
success?(imID: group?["id"] as? String)
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
@@ -450,7 +429,7 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - MPIM
|
||||
public func closeMPIM(channel: String, success: ((closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
close(.MPIMClose, channelID: channel, success: {
|
||||
close(endpoint: .MPIMClose, channelID: channel, success: {
|
||||
(closed) -> Void in
|
||||
success?(closed: closed)
|
||||
}) {(error) -> Void in
|
||||
@@ -458,8 +437,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func mpimHistory(id: String, latest: String = "\(NSDate().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.MPIMHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
public func mpimHistory(id: String, latest: String = "\(Time.slackTimestamp())", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History?)->Void)?, failure: FailureClosure?) {
|
||||
history(endpoint: .MPIMHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {
|
||||
(history) -> Void in
|
||||
success?(history: history)
|
||||
}) {(error) -> Void in
|
||||
@@ -467,8 +446,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func mpimsList(excludeArchived: Bool = false, success: ((channels: [[String: AnyObject]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.MPIMList, type:ChannelType.Group, excludeArchived: excludeArchived, success: {
|
||||
public func mpimsList(excludeArchived: Bool = false, success: ((channels: [Any]?)->Void)?, failure: FailureClosure?) {
|
||||
list(endpoint: .MPIMList, type:ChannelType.Group, excludeArchived: excludeArchived, success: {
|
||||
(channels) -> Void in
|
||||
success?(channels: channels)
|
||||
}) {(error) -> Void in
|
||||
@@ -477,7 +456,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func markMPIM(channel: String, timestamp: String, success: ((ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.MPIMMark, channel: channel, timestamp: timestamp, success: {
|
||||
mark(endpoint: .MPIMMark, channel: channel, timestamp: timestamp, success: {
|
||||
(ts) -> Void in
|
||||
success?(ts: timestamp)
|
||||
}) {(error) -> Void in
|
||||
@@ -486,10 +465,10 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func openMPIM(userIDs: [String], success: ((mpimID: String?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["users":userIDs.joinWithSeparator(",")]
|
||||
networkInterface.request(.MPIMOpen, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["users":userIDs.joined(separator: ",")]
|
||||
networkInterface.request(endpoint: .MPIMOpen, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
let group = response["group"] as? [String: AnyObject]
|
||||
let group = response["group"] as? [String: Any]
|
||||
success?(mpimID: group?["id"] as? String)
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
@@ -498,7 +477,7 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - Pins
|
||||
public func pinItem(channel: String, file: String? = nil, fileComment: String? = nil, timestamp: String? = nil, success: ((pinned: Bool)->Void)?, failure: FailureClosure?) {
|
||||
pin(.PinsAdd, channel: channel, file: file, fileComment: fileComment, timestamp: timestamp, success: {
|
||||
pin(endpoint: .PinsAdd, channel: channel, file: file, fileComment: fileComment, timestamp: timestamp, success: {
|
||||
(ok) -> Void in
|
||||
success?(pinned: ok)
|
||||
}) {(error) -> Void in
|
||||
@@ -507,7 +486,7 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func unpinItem(channel: String, file: String? = nil, fileComment: String? = nil, timestamp: String? = nil, success: ((unpinned: Bool)->Void)?, failure: FailureClosure?) {
|
||||
pin(.PinsRemove, channel: channel, file: file, fileComment: fileComment, timestamp: timestamp, success: {
|
||||
pin(endpoint: .PinsRemove, channel: channel, file: file, fileComment: fileComment, timestamp: timestamp, success: {
|
||||
(ok) -> Void in
|
||||
success?(unpinned: ok)
|
||||
}) {(error) -> Void in
|
||||
@@ -516,8 +495,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
private func pin(endpoint: SlackAPIEndpoint, channel: String, file: String? = nil, fileComment: String? = nil, timestamp: String? = nil, success: ((ok: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["channel":channel, "file":file, "file_comment":fileComment, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
let parameters: [String: Any?] = ["channel":channel, "file":file, "file_comment":fileComment, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?(ok: true)
|
||||
}){(error) -> Void in
|
||||
@@ -528,7 +507,7 @@ public class SlackWebAPI {
|
||||
//MARK: - Reactions
|
||||
// One of file, file_comment, or the combination of channel and timestamp must be specified.
|
||||
public func addReaction(name: String, file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((reacted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
react(.ReactionsAdd, name: name, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
react(endpoint: .ReactionsAdd, name: name, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
(ok) -> Void in
|
||||
success?(reacted: ok)
|
||||
}) {(error) -> Void in
|
||||
@@ -538,7 +517,7 @@ public class SlackWebAPI {
|
||||
|
||||
// One of file, file_comment, or the combination of channel and timestamp must be specified.
|
||||
public func removeReaction(name: String, file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((unreacted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
react(.ReactionsRemove, name: name, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
react(endpoint: .ReactionsRemove, name: name, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
(ok) -> Void in
|
||||
success?(unreacted: ok)
|
||||
}) {(error) -> Void in
|
||||
@@ -547,8 +526,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
private func react(endpoint: SlackAPIEndpoint, name: String, file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((ok: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["name":name, "file":file, "file_comment":fileComment, "channel":channel, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
let parameters: [String: Any?] = ["name":name, "file":file, "file_comment":fileComment, "channel":channel, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?(ok: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -559,7 +538,7 @@ public class SlackWebAPI {
|
||||
//MARK: - Stars
|
||||
// One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
|
||||
public func addStar(file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((starred: Bool)->Void)?, failure: FailureClosure?) {
|
||||
star(.StarsAdd, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
star(endpoint: .StarsAdd, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
(ok) -> Void in
|
||||
success?(starred: ok)
|
||||
}) {(error) -> Void in
|
||||
@@ -569,7 +548,7 @@ public class SlackWebAPI {
|
||||
|
||||
// One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
|
||||
public func removeStar(file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((unstarred: Bool)->Void)?, failure: FailureClosure?) {
|
||||
star(.StarsRemove, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
star(endpoint: .StarsRemove, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {
|
||||
(ok) -> Void in
|
||||
success?(unstarred: ok)
|
||||
}) {(error) -> Void in
|
||||
@@ -578,8 +557,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
private func star(endpoint: SlackAPIEndpoint, file: String?, fileComment: String?, channel: String?, timestamp: String?, success: ((ok: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject?] = ["file":file, "file_comment":fileComment, "channel":channel, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: filterNilParameters(parameters), successClosure: {
|
||||
let parameters: [String: Any?] = ["file":file, "file_comment":fileComment, "channel":channel, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: filterNilParameters(parameters: parameters), successClosure: {
|
||||
(response) -> Void in
|
||||
success?(ok: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -589,10 +568,10 @@ public class SlackWebAPI {
|
||||
|
||||
|
||||
//MARK: - Team
|
||||
public func teamInfo(success: ((info: [String: AnyObject]?)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.TeamInfo, token: token, parameters: nil, successClosure: {
|
||||
public func teamInfo(success: ((info: [String: Any]?)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(endpoint: .TeamInfo, token: token, parameters: nil, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(info: response["team"] as? [String: AnyObject])
|
||||
success?(info: response["team"] as? [String: Any])
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
@@ -600,8 +579,8 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - Users
|
||||
public func userPresence(user: String, success: ((presence: String?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["user":user]
|
||||
networkInterface.request(.UsersGetPresence, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["user":user]
|
||||
networkInterface.request(endpoint: .UsersGetPresence, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(presence: response["presence"] as? String)
|
||||
}){(error) -> Void in
|
||||
@@ -609,28 +588,28 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func userInfo(id: String, success: ((user: User)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["user":id]
|
||||
networkInterface.request(.UsersInfo, token: token, parameters: parameters, successClosure: {
|
||||
public func userInfo(id: String, success: ((user: User?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["user":id]
|
||||
networkInterface.request(endpoint: .UsersInfo, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(user: User(user: response["user"] as? [String: AnyObject]))
|
||||
success?(user: User(user: response["user"] as? [String: Any]))
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
public func usersList(includePresence: Bool = false, success: ((userList: [[String: AnyObject]]?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["presence":includePresence]
|
||||
networkInterface.request(.UsersList, token: token, parameters: parameters, successClosure: {
|
||||
public func usersList(includePresence: Bool = false, success: ((userList: [String: Any]?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["presence":includePresence]
|
||||
networkInterface.request(endpoint: .UsersList, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(userList: response["members"] as? [[String: AnyObject]])
|
||||
success?(userList: response["members"] as? [String: Any])
|
||||
}){(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
public func setUserActive(success: ((success: Bool)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.UsersSetActive, token: token, parameters: nil, successClosure: {
|
||||
networkInterface.request(endpoint: .UsersSetActive, token: token, parameters: nil, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(success: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -639,8 +618,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func setUserPresence(presence: Presence, success: ((success: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["presence":presence.rawValue]
|
||||
networkInterface.request(.UsersSetPresence, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["presence":presence.rawValue]
|
||||
networkInterface.request(endpoint: .UsersSetPresence, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(success:true)
|
||||
}) {(error) -> Void in
|
||||
@@ -650,8 +629,8 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - Channel Utilities
|
||||
private func close(endpoint: SlackAPIEndpoint, channelID: String, success: ((closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["channel":channelID]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["channel":channelID]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(closed: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -659,9 +638,9 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
private func history(endpoint: SlackAPIEndpoint, id: String, latest: String = "\(NSDate().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["channel": id, "latest": latest, "oldest": oldest, "inclusive":inclusive, "count":count, "unreads":unreads]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {
|
||||
private func history(endpoint: SlackAPIEndpoint, id: String, latest: String = "\(Time.slackTimestamp())", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((history: History?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel": id, "latest": latest, "oldest": oldest, "inclusive":inclusive, "count":count, "unreads":unreads]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(history: History(history: response))
|
||||
}) {(error) -> Void in
|
||||
@@ -669,29 +648,29 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
private func info(endpoint: SlackAPIEndpoint, type: ChannelType, id: String, success: ((channel: Channel)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["channel": id]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {
|
||||
private func info(endpoint: SlackAPIEndpoint, type: ChannelType, id: String, success: ((channel: Channel?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel": id]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(channel: Channel(channel: response[type.rawValue] as? [String: AnyObject]))
|
||||
success?(channel: Channel(channel: response[type.rawValue] as? [String: Any]))
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
private func list(endpoint: SlackAPIEndpoint, type: ChannelType, excludeArchived: Bool = false, success: ((channels: [[String: AnyObject]]?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["exclude_archived": excludeArchived]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {
|
||||
private func list(endpoint: SlackAPIEndpoint, type: ChannelType, excludeArchived: Bool = false, success: ((channels: [Any]?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["exclude_archived": excludeArchived]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(channels: response[type.rawValue+"s"] as? [[String: AnyObject]])
|
||||
success?(channels: response[type.rawValue+"s"] as? [Any])
|
||||
}) {(error) -> Void in
|
||||
failure?(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
private func mark(endpoint: SlackAPIEndpoint, channel: String, timestamp: String, success: ((ts: String)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["channel": channel, "ts": timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["channel": channel, "ts": timestamp]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(ts: timestamp)
|
||||
}) {(error) -> Void in
|
||||
@@ -700,8 +679,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
private func setInfo(endpoint: SlackAPIEndpoint, type: InfoType, channel: String, text: String, success: ((success: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: AnyObject] = ["channel": channel, type.rawValue: text]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {
|
||||
let parameters: [String: Any] = ["channel": channel, type.rawValue: text]
|
||||
networkInterface.request(endpoint: endpoint, token: token, parameters: parameters, successClosure: {
|
||||
(response) -> Void in
|
||||
success?(success: true)
|
||||
}) {(error) -> Void in
|
||||
@@ -710,8 +689,8 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
//MARK: - Filter Nil Parameters
|
||||
private func filterNilParameters(parameters: [String: AnyObject?]) -> [String: AnyObject] {
|
||||
var finalParameters = [String: AnyObject]()
|
||||
private func filterNilParameters(parameters: [String: Any?]) -> [String: Any] {
|
||||
var finalParameters = [String: Any]()
|
||||
for key in parameters.keys {
|
||||
if parameters[key] != nil {
|
||||
finalParameters[key] = parameters[key]!
|
||||
@@ -721,17 +700,16 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
//MARK: - Encode Attachments
|
||||
private func encodeAttachments(attachments: [Attachment?]?) -> NSString? {
|
||||
private func encodeAttachments(attachments: [Attachment?]?) -> String? {
|
||||
if let attachments = attachments {
|
||||
var attachmentArray: [[String: AnyObject]] = []
|
||||
var attachmentArray: [Any] = []
|
||||
for attachment in attachments {
|
||||
if let attachment = attachment {
|
||||
attachmentArray.append(attachment.dictionary())
|
||||
}
|
||||
}
|
||||
do {
|
||||
let data = try NSJSONSerialization.dataWithJSONObject(attachmentArray, options: [])
|
||||
let string = NSString(data: data, encoding: NSUTF8StringEncoding)
|
||||
let string = try Jay().dataFromJson(attachmentArray).string()
|
||||
return string
|
||||
} catch _ {
|
||||
|
||||
@@ -740,11 +718,13 @@ public class SlackWebAPI {
|
||||
return nil
|
||||
}
|
||||
|
||||
//MARK: - Enumerate Do Not Disturb Status
|
||||
private func enumerateDNDStatuses(statuses: [String: AnyObject]) -> [String: DoNotDisturbStatus] {
|
||||
//MARK: - Enumerate Do Not Distrub Status
|
||||
private func enumerateDNDStauses(statuses: [String: Any]?) -> [String: DoNotDisturbStatus] {
|
||||
var retVal = [String: DoNotDisturbStatus]()
|
||||
for key in statuses.keys {
|
||||
retVal[key] = DoNotDisturbStatus(status: statuses[key] as? [String: AnyObject])
|
||||
if let keys = statuses?.keys {
|
||||
for key in keys {
|
||||
retVal[key] = DoNotDisturbStatus(status: statuses?[key] as? [String: Any])
|
||||
}
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// SlackWebAPIErrorDispatcher.swift
|
||||
// SlackWebAPIErrorHandling.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
@@ -21,9 +21,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum SlackError: ErrorType {
|
||||
public enum SlackError: ErrorProtocol {
|
||||
case AccountInactive
|
||||
case AlreadyArchived
|
||||
case AlreadyInChannel
|
||||
@@ -111,12 +109,6 @@ public enum SlackError: ErrorType {
|
||||
case UserListNotSupplied
|
||||
case UserNotFound
|
||||
case UserNotVisible
|
||||
// Client
|
||||
case ClientNetworkError
|
||||
case ClientJSONError
|
||||
// HTTP
|
||||
case TooManyRequests
|
||||
case UnknownHTTPError
|
||||
}
|
||||
|
||||
internal struct ErrorDispatcher {
|
||||
|
||||
@@ -29,20 +29,20 @@ public struct Team {
|
||||
internal(set) public var emailDomain: String?
|
||||
internal(set) public var messageEditWindowMinutes: Int?
|
||||
internal(set) public var overStorageLimit: Bool?
|
||||
internal(set) public var prefs: [String: AnyObject]?
|
||||
internal(set) public var prefs: [String: Any]?
|
||||
internal(set) public var plan: String?
|
||||
internal(set) public var icon: TeamIcon?
|
||||
|
||||
internal init(team: [String: AnyObject]?) {
|
||||
internal init?(team: [String: Any]?) {
|
||||
id = team?["id"] as! String
|
||||
name = team?["name"] as? String
|
||||
domain = team?["domain"] as? String
|
||||
emailDomain = team?["email_domain"] as? String
|
||||
messageEditWindowMinutes = team?["msg_edit_window_mins"] as? Int
|
||||
overStorageLimit = team?["over_storage_limit"] as? Bool
|
||||
prefs = team?["prefs"] as? [String: AnyObject]
|
||||
prefs = team?["prefs"] as? [String: Any]
|
||||
plan = team?["plan"] as? String
|
||||
icon = TeamIcon(icon: team?["icon"] as? [String: AnyObject])
|
||||
icon = TeamIcon(icon: team?["icon"] as? [String: Any])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public struct TeamIcon {
|
||||
internal(set) public var imageOriginal: String?
|
||||
internal(set) public var imageDefault: Bool?
|
||||
|
||||
internal init(icon: [String: AnyObject]?) {
|
||||
internal init?(icon: [String: Any]?) {
|
||||
image34 = icon?["image_34"] as? String
|
||||
image44 = icon?["image_44"] as? String
|
||||
image68 = icon?["image_68"] as? String
|
||||
|
||||
@@ -21,14 +21,13 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
// MARK: - Edited
|
||||
public struct Edited {
|
||||
public let user: String?
|
||||
public let ts: String?
|
||||
|
||||
internal init(edited:[String: AnyObject]?) {
|
||||
internal init?(edited:[String: Any]?) {
|
||||
user = edited?["user"] as? String
|
||||
ts = edited?["ts"] as? String
|
||||
}
|
||||
@@ -36,17 +35,19 @@ public struct Edited {
|
||||
|
||||
// MARK: - History
|
||||
public struct History {
|
||||
internal(set) public var latest: NSDate?
|
||||
internal(set) public var latest: Double?
|
||||
internal(set) public var messages = [Message]()
|
||||
public let hasMore: Bool?
|
||||
|
||||
internal init(history: [String: AnyObject]?) {
|
||||
internal init?(history: [String: Any]?) {
|
||||
if let latestStr = history?["latest"] as? String, latestDouble = Double(latestStr) {
|
||||
latest = NSDate(timeIntervalSince1970: NSTimeInterval(latestDouble))
|
||||
latest = latestDouble
|
||||
}
|
||||
if let msgs = history?["messages"] as? [[String: AnyObject]] {
|
||||
if let msgs = history?["messages"] as? [Any] {
|
||||
for message in msgs {
|
||||
messages.append(Message(message: message))
|
||||
if let message = Message(message: message as? [String: Any]) {
|
||||
messages.append(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
hasMore = history?["has_more"] as? Bool
|
||||
@@ -56,26 +57,35 @@ public struct History {
|
||||
// MARK: - Reaction
|
||||
public struct Reaction {
|
||||
public let name: String?
|
||||
internal(set) public var user: String?
|
||||
internal(set) public var users = [String: String]()
|
||||
|
||||
internal init(reaction:[String: AnyObject]?) {
|
||||
internal init?(reaction:[String: Any]?) {
|
||||
name = reaction?["name"] as? String
|
||||
}
|
||||
|
||||
internal init(name: String, user: String) {
|
||||
internal init?(name: String?, user: String) {
|
||||
self.name = name
|
||||
self.user = user
|
||||
users[user] = user
|
||||
}
|
||||
|
||||
static func reactionsFromArray(array: [[String: AnyObject]]?) -> [Reaction] {
|
||||
var reactions = [Reaction]()
|
||||
if let array = array {
|
||||
for reaction in array {
|
||||
if let users = reaction["users"] as? [String], name = reaction["name"] as? String {
|
||||
internal init?(name: String?, users: [String: String]) {
|
||||
self.name = name
|
||||
self.users = users
|
||||
}
|
||||
|
||||
static func reactionsFromArray(array: [Any]) -> [String: Reaction] {
|
||||
var reactions = [String: Reaction]()
|
||||
var userDictionary = [String: String]()
|
||||
for r in array {
|
||||
if let reaction = r as? [String: Any] {
|
||||
if let users = reaction["users"] as? [String] {
|
||||
for user in users {
|
||||
reactions.append(Reaction(name: name, user: user))
|
||||
userDictionary[user] = user
|
||||
}
|
||||
}
|
||||
if let name = reaction["name"] as? String {
|
||||
reactions[name] = Reaction(name: name, users: userDictionary)
|
||||
}
|
||||
}
|
||||
}
|
||||
return reactions
|
||||
@@ -97,9 +107,9 @@ public struct Comment {
|
||||
internal(set) public var comment: String?
|
||||
internal(set) public var starred: Bool?
|
||||
internal(set) public var stars: Int?
|
||||
internal(set) public var reactions = [Reaction]()
|
||||
internal(set) public var reactions = [String: Reaction]()
|
||||
|
||||
internal init(comment:[String: AnyObject]?) {
|
||||
internal init?(comment:[String: Any]?) {
|
||||
id = comment?["id"] as? String
|
||||
created = comment?["created"] as? Int
|
||||
user = comment?["user"] as? String
|
||||
@@ -108,7 +118,7 @@ public struct Comment {
|
||||
self.comment = comment?["comment"] as? String
|
||||
}
|
||||
|
||||
internal init(id: String?) {
|
||||
internal init?(id: String?) {
|
||||
self.id = id
|
||||
self.user = nil
|
||||
}
|
||||
@@ -130,24 +140,23 @@ public struct Item {
|
||||
public let comment: Comment?
|
||||
public let fileCommentID: String?
|
||||
|
||||
internal init(item:[String: AnyObject]?) {
|
||||
internal init?(item:[String: Any]?) {
|
||||
type = item?["type"] as? String
|
||||
ts = item?["ts"] as? String
|
||||
channel = item?["channel"] as? String
|
||||
|
||||
message = Message(message: item?["message"] as? [String: AnyObject])
|
||||
message = Message(message: item?["message"] as? [String: Any])
|
||||
|
||||
// Comment and File can come across as Strings or Dictionaries
|
||||
if let commentDictionary = item?["comment"] as? [String: AnyObject] {
|
||||
comment = Comment(comment: commentDictionary)
|
||||
} else {
|
||||
if (Comment(comment: item?["comment"] as? [String: Any])?.id == nil) {
|
||||
comment = Comment(id: item?["comment"] as? String)
|
||||
}
|
||||
|
||||
if let fileDictionary = item?["file"] as? [String: AnyObject] {
|
||||
file = File(file: fileDictionary)
|
||||
} else {
|
||||
comment = Comment(comment: item?["comment"] as? [String: Any])
|
||||
}
|
||||
if (File(file: item?["file"] as? [String: Any])?.id == nil) {
|
||||
file = File(id: item?["file"] as? String)
|
||||
} else {
|
||||
file = File(file: item?["file"] as? [String: Any])
|
||||
}
|
||||
|
||||
fileCommentID = item?["file_comment"] as? String
|
||||
@@ -166,7 +175,7 @@ public struct Topic {
|
||||
public let creator: String?
|
||||
public let lastSet: Int?
|
||||
|
||||
internal init(topic: [String: AnyObject]?) {
|
||||
internal init?(topic: [String: Any]?) {
|
||||
value = topic?["value"] as? String
|
||||
creator = topic?["creator"] as? String
|
||||
lastSet = topic?["last_set"] as? Int
|
||||
@@ -181,7 +190,7 @@ public struct DoNotDisturbStatus {
|
||||
internal(set) public var snoozeEnabled: Bool?
|
||||
internal(set) public var snoozeEndtime: Int?
|
||||
|
||||
internal init(status: [String: AnyObject]?) {
|
||||
internal init?(status: [String: Any]?) {
|
||||
enabled = status?["dnd_enabled"] as? Bool
|
||||
nextDoNotDisturbStart = status?["next_dnd_start_ts"] as? Int
|
||||
nextDoNotDisturbEnd = status?["next_dnd_end_ts"] as? Int
|
||||
@@ -195,25 +204,26 @@ public struct DoNotDisturbStatus {
|
||||
public struct CustomProfile {
|
||||
internal(set) public var fields = [String: CustomProfileField]()
|
||||
|
||||
internal init(profile: [String: AnyObject]?) {
|
||||
if let eventFields = profile?["fields"] as? [AnyObject] {
|
||||
internal init?(profile: [String: Any]?) {
|
||||
if let eventFields = profile?["fields"] as? [Any] {
|
||||
for field in eventFields {
|
||||
var cpf: CustomProfileField?
|
||||
if let fieldDictionary = field as? [String: AnyObject] {
|
||||
cpf = CustomProfileField(field: fieldDictionary)
|
||||
if let cpf = CustomProfileField(field: field as? [String: Any]), id = cpf.id {
|
||||
fields[id] = cpf
|
||||
} else {
|
||||
cpf = CustomProfileField(id: field as? String)
|
||||
if let cpf = CustomProfileField(id: field as? String), id = cpf.id {
|
||||
fields[id] = cpf
|
||||
}
|
||||
}
|
||||
if let id = cpf?.id { fields[id] = cpf }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal init(customFields: [String: AnyObject]?) {
|
||||
internal init?(customFields: [String: Any]?) {
|
||||
if let customFields = customFields {
|
||||
for key in customFields.keys {
|
||||
let cpf = CustomProfileField(field: customFields[key] as? [String: AnyObject])
|
||||
self.fields[key] = cpf
|
||||
if let cpf = CustomProfileField(field: customFields[key] as? [String: Any]) {
|
||||
self.fields[key] = cpf
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,7 +242,7 @@ public struct CustomProfileField {
|
||||
internal(set) public var possibleValues: [String]?
|
||||
internal(set) public var type: String?
|
||||
|
||||
internal init(field: [String: AnyObject]?) {
|
||||
internal init?(field: [String: Any]?) {
|
||||
id = field?["id"] as? String
|
||||
alt = field?["alt"] as? String
|
||||
value = field?["value"] as? String
|
||||
@@ -245,7 +255,7 @@ public struct CustomProfileField {
|
||||
type = field?["type"] as? String
|
||||
}
|
||||
|
||||
internal init(id: String?) {
|
||||
internal init?(id: String?) {
|
||||
self.id = id
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public struct User {
|
||||
internal(set) public var image192: String?
|
||||
internal(set) public var customProfile: CustomProfile?
|
||||
|
||||
internal init(profile: [String: AnyObject]?) {
|
||||
internal init?(profile: [String: Any]?) {
|
||||
firstName = profile?["first_name"] as? String
|
||||
lastName = profile?["last_name"] as? String
|
||||
realName = profile?["real_name"] as? String
|
||||
@@ -49,7 +49,7 @@ public struct User {
|
||||
image48 = profile?["image_48"] as? String
|
||||
image72 = profile?["image_72"] as? String
|
||||
image192 = profile?["image_192"] as? String
|
||||
customProfile = CustomProfile(customFields: profile?["fields"] as? [String: AnyObject])
|
||||
customProfile = CustomProfile(customFields: profile?["fields"] as? [String: Any])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,15 +73,15 @@ public struct User {
|
||||
internal(set) public var timeZone: String?
|
||||
internal(set) public var timeZoneLabel: String?
|
||||
internal(set) public var timeZoneOffSet: Int?
|
||||
internal(set) public var preferences: [String: AnyObject]?
|
||||
internal(set) public var preferences: [String: Any]?
|
||||
// Client properties
|
||||
internal(set) public var userGroups: [String: String]?
|
||||
|
||||
internal init(user: [String: AnyObject]?) {
|
||||
internal init?(user: [String: Any]?) {
|
||||
id = user?["id"] as? String
|
||||
name = user?["name"] as? String
|
||||
deleted = user?["deleted"] as? Bool
|
||||
profile = Profile(profile: user?["profile"] as? [String: AnyObject])
|
||||
profile = Profile(profile: user?["profile"] as? [String: Any])
|
||||
color = user?["color"] as? String
|
||||
isAdmin = user?["is_admin"] as? Bool
|
||||
isOwner = user?["is_owner"] as? Bool
|
||||
@@ -96,10 +96,10 @@ public struct User {
|
||||
timeZone = user?["tz"] as? String
|
||||
timeZoneLabel = user?["tz_label"] as? String
|
||||
timeZoneOffSet = user?["tz_offset"] as? Int
|
||||
preferences = user?["prefs"] as? [String: AnyObject]
|
||||
preferences = user?["prefs"] as? [String: Any]
|
||||
}
|
||||
|
||||
internal init(id: String?) {
|
||||
internal init?(id: String?) {
|
||||
self.id = id
|
||||
self.isBot = nil
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ public struct UserGroup {
|
||||
public let createdBy: String?
|
||||
internal(set) public var updatedBy: String?
|
||||
internal(set) public var deletedBy: String?
|
||||
internal(set) public var preferences: [String: AnyObject]?
|
||||
internal(set) public var preferences: [String: Any]?
|
||||
internal(set) public var users: [String]?
|
||||
internal(set) public var userCount: Int?
|
||||
|
||||
internal init(userGroup: [String: AnyObject]?) {
|
||||
internal init?(userGroup: [String: Any]?) {
|
||||
id = userGroup?["id"] as? String
|
||||
teamID = userGroup?["team_id"] as? String
|
||||
isUserGroup = userGroup?["is_usergroup"] as? Bool
|
||||
@@ -58,7 +58,7 @@ public struct UserGroup {
|
||||
createdBy = userGroup?["created_by"] as? String
|
||||
updatedBy = userGroup?["updated_by"] as? String
|
||||
deletedBy = userGroup?["deleted_by"] as? String
|
||||
preferences = userGroup?["prefs"] as? [String: AnyObject]
|
||||
preferences = userGroup?["prefs"] as? [String: Any]
|
||||
users = userGroup?["users"] as? [String]
|
||||
if let count = userGroup?["user_count"] as? String {
|
||||
userCount = Int(count)
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.1.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Peter Zignego. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.1.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Peter Zignego. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user