Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Commit

Permalink
Merge branch 'swift4'
Browse files Browse the repository at this point in the history
  • Loading branch information
pvzig committed Jan 24, 2018
2 parents fda00fa + 5f2f93d commit 1e44cd0
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Cartfile
@@ -1 +1 @@
github "SlackKit/SKCore" >= 4.0.0
github "SlackKit/SKCore" >= 4.1.0
12 changes: 9 additions & 3 deletions Package.swift
@@ -1,11 +1,17 @@
// swift-tools-version:4.0
import PackageDescription

let package = Package(
name: "SKWebAPI",
targets: [
Target(name: "SKWebAPI")
products: [
.library(name: "SKWebAPI", targets: ["SKWebAPI"])
],
dependencies: [
.Package(url: "https://github.com/SlackKit/SKCore", majorVersion: 4)
.package(url: "https://github.com/SlackKit/SKCore", .upToNextMinor(from: "4.1.0"))
],
targets: [
.target(name: "SKWebAPI",
dependencies: ["SKCore"],
path: "Sources")
]
)
6 changes: 3 additions & 3 deletions Podfile
Expand Up @@ -2,15 +2,15 @@ use_frameworks!

target 'SKWebAPI macOS' do
platform :osx, '10.11'
pod 'SKCore'
pod 'SKCore', '~> 4.1.0'
end

target 'SKWebAPI iOS' do
platform :ios, '9.0'
pod 'SKCore'
pod 'SKCore', '~> 4.1.0'
end

target 'SKWebAPI tvOS' do
platform :tvos, '9.0'
pod 'SKCore'
pod 'SKCore', '~> 4.1.0'
end
6 changes: 3 additions & 3 deletions README.md
@@ -1,5 +1,5 @@
# SKWebAPI: SlackKit Web API Module
![Swift Version](https://img.shields.io/badge/Swift-3.1.1-orange.svg)
![Swift Version](https://img.shields.io/badge/Swift-4.0.3-orange.svg)
![Plaforms](https://img.shields.io/badge/Platforms-macOS,iOS,tvOS,Linux-lightgrey.svg)
![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg)
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)
Expand All @@ -21,7 +21,7 @@ pod 'SKWebAPI'
and run

```
# Use CocoaPods version >= 1.1.0
# Use CocoaPods version >= 1.4.0
pod install
```

Expand Down Expand Up @@ -49,7 +49,7 @@ import PackageDescription

let package = Package(
dependencies: [
.Package(url: "https://github.com/SlackKit/SKWebAPI.git", majorVersion: 4)
.package(url: "https://github.com/SlackKit/SKWebAPI.git", .upToNextMinor(from: "4.1.0"))
]
)
```
Expand Down
31 changes: 16 additions & 15 deletions SKWebAPI.podspec
@@ -1,17 +1,18 @@
Pod::Spec.new do |s|
s.name = "SKWebAPI"
s.version = "4.0.7"
s.summary = "A Swift library to help make requests to the Slack Web API"
s.homepage = "https://github.com/SlackKit/SKWebAPI"
s.license = 'MIT'
s.author = { "Peter Zignego" => "peter@launchsoft.co" }
s.source = { :git => "https://github.com/SlackKit/SKWebAPI.git", :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/pvzig'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.requires_arc = true
s.source_files = 'Sources/*.swift'
s.frameworks = 'Foundation'
s.dependency 'SKCore'
s.name = "SKWebAPI"
s.version = "4.1.0"
s.summary = "A Swift library to help make requests to the Slack Web API"
s.homepage = "https://github.com/SlackKit/SKWebAPI"
s.license = 'MIT'
s.author = { "Peter Zignego" => "peter@launchsoft.co" }
s.source = { :git => "https://github.com/SlackKit/SKWebAPI.git", :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/pvzig'
s.swift_version = '4.0'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.requires_arc = true
s.source_files = 'Sources/*.swift'
s.frameworks = 'Foundation'
s.dependency 'SKCore'
end
26 changes: 19 additions & 7 deletions SKWebAPI.xcodeproj/project.pbxproj
Expand Up @@ -209,7 +209,7 @@
2684F1741E95AA6900536DCC /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = "Peter Zignego";
TargetAttributes = {
2684F17C1E95AA6900536DCC = {
Expand Down Expand Up @@ -356,15 +356,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -409,15 +415,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -467,7 +479,7 @@
PRODUCT_NAME = SKWebAPI;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -494,7 +506,7 @@
PRODUCT_NAME = SKWebAPI;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -521,7 +533,7 @@
PRODUCT_NAME = SKWebAPI;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -548,7 +560,7 @@
PRODUCT_NAME = SKWebAPI;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -574,7 +586,7 @@
PRODUCT_NAME = SKWebAPI;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
Expand All @@ -601,7 +613,7 @@
PRODUCT_NAME = SKWebAPI;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
1 change: 1 addition & 0 deletions Sources/Endpoint.swift
Expand Up @@ -65,6 +65,7 @@ public enum Endpoint: String {
case mpimMark = "mpim.mark"
case mpimOpen = "mpim.open"
case oauthAccess = "oauth.access"
case pinsList = "pins.list"
case pinsAdd = "pins.add"
case pinsRemove = "pins.remove"
case reactionsAdd = "reactions.add"
Expand Down
6 changes: 3 additions & 3 deletions Sources/NetworkInterface.swift
Expand Up @@ -169,7 +169,7 @@ public struct NetworkInterface {
if parameters.count > 0 {
components?.queryItems = filterNilParameters(parameters).map { URLQueryItem(name: $0.0, value: "\($0.1)") }
}

// As discussed http://www.openradar.me/24076063 and https://stackoverflow.com/a/37314144/407523, Apple considers
// a + and ? as valid characters in a URL query string, but Slack has recently started enforcing that they be
// encoded when included in a query string. As a result, we need to manually apply the encoding after Apple's
Expand All @@ -178,10 +178,10 @@ public struct NetworkInterface {
encodedQuery = encodedQuery?.replacingOccurrences(of: "?", with: "%3F")
encodedQuery = encodedQuery?.replacingOccurrences(of: "+", with: "%2B")
components?.percentEncodedQuery = encodedQuery

return components?.url
}

private func requestBodyData(data: Data, boundaryConstant: String, filename: String, filetype: String) -> Data? {
let boundaryStart = "--\(boundaryConstant)\r\n"
let boundaryEnd = "--\(boundaryConstant)--\r\n"
Expand Down

0 comments on commit 1e44cd0

Please sign in to comment.