Compare commits
79 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 267cf26b2e | |||
| c3817bea15 | |||
| 492f51ce9b | |||
| dd72c619d3 | |||
| 43af10de88 | |||
| 7ba97e4893 | |||
| 0c24cb2262 | |||
| 7b76b76b94 | |||
| 565c44677b | |||
| 30dc3679c1 | |||
| 9a18cae265 | |||
| c04654a87b | |||
| bd7f67b3b0 | |||
| 833add707f | |||
| 9118a7688a | |||
| cba1eb36a2 | |||
| d15139d00d | |||
| c1cf9b47d8 | |||
| 986367be38 | |||
| 7d207136b3 | |||
| 0fa3b72a56 | |||
| 67d2bb3f62 | |||
| f2c333f57d | |||
| eccda7a525 | |||
| ac0d9977b5 | |||
| 6c1612f2bb | |||
| ead9bb9c41 | |||
| cc20c54967 | |||
| d5c2dd48f7 | |||
| f4336f1dde | |||
| 7ab91d9440 | |||
| 7e7a168806 | |||
| 9651351ec9 | |||
| c658616e0f | |||
| c8a40de44f | |||
| b212d1631a | |||
| 8adf701444 | |||
| b2f69d4b65 | |||
| 906d451200 | |||
| 80d2cab81c | |||
| c8bc22cbb9 | |||
| e9ca0365c7 | |||
| 52b0a7fd4e | |||
| 3651fc921b | |||
| ef3425e38e | |||
| 533e961c85 | |||
| c2f7632be4 | |||
| 245d709125 | |||
| 1ad14f016a | |||
| 03561eab36 | |||
| f2c98f9d86 | |||
| bde39be109 | |||
| 5d7ac480b2 | |||
| 3579579c80 | |||
| 47865cbcee | |||
| 054f8f2d87 | |||
| d7a02da74b | |||
| 1846597f04 | |||
| f94b3b247b | |||
| a96c17a3ad | |||
| 6276a09ced | |||
| ca92016ab9 | |||
| 21bca0e0e8 | |||
| dd02e9aecc | |||
| 77cc351bd6 | |||
| 6385afb34a | |||
| b880356dde | |||
| fdd2a5aa36 | |||
| 93f8da2f69 | |||
| a165f3e57f | |||
| d7f2221d77 | |||
| 02bda676a9 | |||
| e4bd44e939 | |||
| d83fbb1d7e | |||
| c2734a66c3 | |||
| 721f8964cf | |||
| 37ca701ae0 | |||
| c1a89eedda | |||
| 8aeb88cea3 |
+1
-1
@@ -1 +1 @@
|
||||
4.2
|
||||
5.0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
github "daltoniam/Starscream" == 3.0.6
|
||||
github "httpswift/swifter" == 1.4.5
|
||||
github "daltoniam/Starscream" == 3.1.0
|
||||
github "httpswift/swifter" == 1.4.6
|
||||
@@ -0,0 +1 @@
|
||||
github "pvzig/SlackKit"
|
||||
@@ -0,0 +1,275 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
262F50452259146E00A74EB1 /* Leaderbot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262F50432259146E00A74EB1 /* Leaderbot.swift */; };
|
||||
262F50462259146E00A74EB1 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262F50442259146E00A74EB1 /* main.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
262F50312259139400A74EB1 /* Leaderboard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Leaderboard.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
262F50362259139400A74EB1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
262F50432259146E00A74EB1 /* Leaderbot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Leaderbot.swift; path = Sources/Leaderbot.swift; sourceTree = "<group>"; };
|
||||
262F50442259146E00A74EB1 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = main.swift; path = Sources/main.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
262F502F2259139400A74EB1 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
262F50292259139400A74EB1 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
262F50332259139400A74EB1 /* Leaderboard */,
|
||||
262F50322259139400A74EB1 /* Products */,
|
||||
665E45E1CAEDB17C0745AD28 /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
262F50322259139400A74EB1 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
262F50312259139400A74EB1 /* Leaderboard.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
262F50332259139400A74EB1 /* Leaderboard */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
262F50432259146E00A74EB1 /* Leaderbot.swift */,
|
||||
262F50442259146E00A74EB1 /* main.swift */,
|
||||
262F50362259139400A74EB1 /* Info.plist */,
|
||||
);
|
||||
path = Leaderboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
665E45E1CAEDB17C0745AD28 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
262F50302259139400A74EB1 /* Leaderboard */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 262F50392259139400A74EB1 /* Build configuration list for PBXNativeTarget "Leaderboard" */;
|
||||
buildPhases = (
|
||||
262F502E2259139400A74EB1 /* Sources */,
|
||||
262F502F2259139400A74EB1 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Leaderboard;
|
||||
productName = Leaderboard;
|
||||
productReference = 262F50312259139400A74EB1 /* Leaderboard.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
262F502A2259139400A74EB1 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1020;
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = "Peter Zignego";
|
||||
TargetAttributes = {
|
||||
262F50302259139400A74EB1 = {
|
||||
CreatedOnToolsVersion = 10.2;
|
||||
LastSwiftMigration = 1020;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 262F502D2259139400A74EB1 /* Build configuration list for PBXProject "Leaderboard" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 262F50292259139400A74EB1;
|
||||
productRefGroup = 262F50322259139400A74EB1 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
262F50302259139400A74EB1 /* Leaderboard */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
262F502E2259139400A74EB1 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
262F50462259146E00A74EB1 /* main.swift in Sources */,
|
||||
262F50452259146E00A74EB1 /* Leaderbot.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
262F50372259139400A74EB1 /* 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;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
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;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
262F50382259139400A74EB1 /* 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;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
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;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
262F503A2259139400A74EB1 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/Carthage/Build/Mac\"";
|
||||
INFOPLIST_FILE = Leaderboard/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.Leaderboard;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
262F503B2259139400A74EB1 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/Carthage/Build/Mac\"";
|
||||
INFOPLIST_FILE = Leaderboard/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.Leaderboard;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
262F502D2259139400A74EB1 /* Build configuration list for PBXProject "Leaderboard" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
262F50372259139400A74EB1 /* Debug */,
|
||||
262F50382259139400A74EB1 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
262F50392259139400A74EB1 /* Build configuration list for PBXNativeTarget "Leaderboard" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
262F503A2259139400A74EB1 /* Debug */,
|
||||
262F503B2259139400A74EB1 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 262F502A2259139400A74EB1 /* Project object */;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:Leaderboard.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?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>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2019 Peter Zignego. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Leaderboard.swift
|
||||
//
|
||||
// Copyright © 2017 Peter Zignego. All rights reserved.
|
||||
// Copyright © 2019 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
|
||||
@@ -100,7 +100,7 @@ class Leaderbot {
|
||||
let thingRegex = try? NSRegularExpression(pattern: expression, options: [])
|
||||
let things = thingRegex?.matches(in: text, options: [], range: NSMakeRange(0, text.utf16.count)) ?? []
|
||||
for match in things {
|
||||
let value = text.substring(with: text.range(from: match.range(at: 1))!)
|
||||
let value = String(text[text.range(from: match.range(at: 1))!])
|
||||
if leaderboards[teamID]?.scores[value] == nil { leaderboards[teamID]?.scores[value] = 0 }
|
||||
switch trigger {
|
||||
case .plusPlus:
|
||||
@@ -8,11 +8,11 @@ let package = Package(
|
||||
.executable(name: "Leaderboard", targets: ["Leaderboard"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/SlackKit/SlackKit", .upToNextMajor(from: "4.0.0"))
|
||||
.package(url: "https://github.com/pvzig/SlackKit", .upToNextMinor(from: "4.3.0"))
|
||||
],
|
||||
targets: [
|
||||
.target(name: "Leaderboard",
|
||||
dependencies: ["SlackKit"],
|
||||
path: "Sources")
|
||||
dependencies: ["SlackKit"],
|
||||
path: "Leaderboard/Sources")
|
||||
]
|
||||
)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
platform :osx, '10.11'
|
||||
|
||||
target 'Leaderboard' do
|
||||
use_frameworks!
|
||||
pod 'SlackKit', '>= 4.3.0'
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
github "pvzig/SlackKit"
|
||||
@@ -8,11 +8,11 @@ let package = Package(
|
||||
.executable(name: "Robot or Not Bot", targets: ["Robot or Not Bot"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/SlackKit/SlackKit", .upToNextMajor(from: "4.0.0"))
|
||||
.package(url: "https://github.com/pvzig/SlackKit", .upToNextMinor(from: "4.3.0"))
|
||||
],
|
||||
targets: [
|
||||
.target(name: "Robot or Not Bot",
|
||||
dependencies: ["SlackKit"],
|
||||
path: "Sources")
|
||||
path: "Robot or Not Bot/Sources")
|
||||
]
|
||||
)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
platform :osx, '10.11'
|
||||
|
||||
target 'Robot Or Not Bot' do
|
||||
use_frameworks!
|
||||
pod 'SlackKit', '>= 4.3.0'
|
||||
end
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
262F505D22591A9000A74EB1 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262F505C22591A9000A74EB1 /* main.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
262F504F225919E200A74EB1 /* Robot Or Not Bot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Robot Or Not Bot.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
262F5054225919E200A74EB1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
262F505C22591A9000A74EB1 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = main.swift; path = Sources/main.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
262F504D225919E200A74EB1 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
262F5047225919E200A74EB1 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
262F5051225919E200A74EB1 /* Robot Or Not Bot */,
|
||||
262F5050225919E200A74EB1 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
262F5050225919E200A74EB1 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
262F504F225919E200A74EB1 /* Robot Or Not Bot.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
262F5051225919E200A74EB1 /* Robot Or Not Bot */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
262F505C22591A9000A74EB1 /* main.swift */,
|
||||
262F5054225919E200A74EB1 /* Info.plist */,
|
||||
);
|
||||
path = "Robot Or Not Bot";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
262F504E225919E200A74EB1 /* Robot Or Not Bot */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 262F5057225919E200A74EB1 /* Build configuration list for PBXNativeTarget "Robot Or Not Bot" */;
|
||||
buildPhases = (
|
||||
262F504C225919E200A74EB1 /* Sources */,
|
||||
262F504D225919E200A74EB1 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Robot Or Not Bot";
|
||||
productName = "Robot Or Not Bot";
|
||||
productReference = 262F504F225919E200A74EB1 /* Robot Or Not Bot.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
262F5048225919E200A74EB1 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1020;
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = "Peter Zignego";
|
||||
TargetAttributes = {
|
||||
262F504E225919E200A74EB1 = {
|
||||
CreatedOnToolsVersion = 10.2;
|
||||
LastSwiftMigration = 1020;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 262F504B225919E200A74EB1 /* Build configuration list for PBXProject "Robot Or Not Bot" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 262F5047225919E200A74EB1;
|
||||
productRefGroup = 262F5050225919E200A74EB1 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
262F504E225919E200A74EB1 /* Robot Or Not Bot */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
262F504C225919E200A74EB1 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
262F505D22591A9000A74EB1 /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
262F5055225919E200A74EB1 /* 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;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
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;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
262F5056225919E200A74EB1 /* 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;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
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;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
262F5058225919E200A74EB1 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/Carthage/Build/Mac\"";
|
||||
INFOPLIST_FILE = "Robot Or Not Bot/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.launchsoft.Robot-Or-Not-Bot";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
262F5059225919E200A74EB1 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/Carthage/Build/Mac\"";
|
||||
INFOPLIST_FILE = "Robot Or Not Bot/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.launchsoft.Robot-Or-Not-Bot";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
262F504B225919E200A74EB1 /* Build configuration list for PBXProject "Robot Or Not Bot" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
262F5055225919E200A74EB1 /* Debug */,
|
||||
262F5056225919E200A74EB1 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
262F5057225919E200A74EB1 /* Build configuration list for PBXNativeTarget "Robot Or Not Bot" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
262F5058225919E200A74EB1 /* Debug */,
|
||||
262F5059225919E200A74EB1 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 262F5048225919E200A74EB1 /* Project object */;
|
||||
}
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:Robot Or Not Bot.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?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>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2019 Peter Zignego. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,4 +1,6 @@
|
||||
// Generated by Apple Swift version 4.2.1 effective-4.1.50 (swiftlang-1000.11.42 clang-1000.11.45.1)
|
||||
#if 0
|
||||
#elif defined(__arm64__) && __arm64__
|
||||
// Generated by Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
@@ -20,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
@@ -163,6 +165,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
@import ObjectiveC;
|
||||
#endif
|
||||
@@ -195,10 +200,221 @@ SWIFT_CLASS("_TtC10Starscream16FoundationStream")
|
||||
SWIFT_CLASS("_TtC10Starscream9WebSocket")
|
||||
@interface WebSocket : NSObject <NSStreamDelegate>
|
||||
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
|
||||
+ (nonnull instancetype)new SWIFT_DEPRECATED_MSG("-init is unavailable");
|
||||
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
|
||||
@end
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma clang attribute pop
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#elif defined(__ARM_ARCH_7A__) && __ARM_ARCH_7A__
|
||||
// Generated by Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
#if !defined(__has_include)
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
#if !defined(__has_attribute)
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
#if !defined(__has_feature)
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
#if !defined(__has_warning)
|
||||
# define __has_warning(x) 0
|
||||
#endif
|
||||
|
||||
#if __has_include(<swift/objc-prologue.h>)
|
||||
# include <swift/objc-prologue.h>
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if !defined(SWIFT_TYPEDEFS)
|
||||
# define SWIFT_TYPEDEFS 1
|
||||
# if __has_include(<uchar.h>)
|
||||
# include <uchar.h>
|
||||
# elif !defined(__cplusplus)
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
# endif
|
||||
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PASTE)
|
||||
# define SWIFT_PASTE_HELPER(x, y) x##y
|
||||
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
|
||||
#endif
|
||||
#if !defined(SWIFT_METATYPE)
|
||||
# define SWIFT_METATYPE(X) Class
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_PROPERTY)
|
||||
# if __has_feature(objc_class_property)
|
||||
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
|
||||
# else
|
||||
# define SWIFT_CLASS_PROPERTY(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(objc_runtime_name)
|
||||
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
|
||||
#else
|
||||
# define SWIFT_RUNTIME_NAME(X)
|
||||
#endif
|
||||
#if __has_attribute(swift_name)
|
||||
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
|
||||
#else
|
||||
# define SWIFT_COMPILE_NAME(X)
|
||||
#endif
|
||||
#if __has_attribute(objc_method_family)
|
||||
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
|
||||
#else
|
||||
# define SWIFT_METHOD_FAMILY(X)
|
||||
#endif
|
||||
#if __has_attribute(noescape)
|
||||
# define SWIFT_NOESCAPE __attribute__((noescape))
|
||||
#else
|
||||
# define SWIFT_NOESCAPE
|
||||
#endif
|
||||
#if __has_attribute(warn_unused_result)
|
||||
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
# define SWIFT_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
#if __has_attribute(noreturn)
|
||||
# define SWIFT_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
# define SWIFT_NORETURN
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_EXTRA)
|
||||
# define SWIFT_CLASS_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_PROTOCOL_EXTRA)
|
||||
# define SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_EXTRA)
|
||||
# define SWIFT_ENUM_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS)
|
||||
# if __has_attribute(objc_subclassing_restricted)
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# else
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PROTOCOL)
|
||||
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_EXTENSION)
|
||||
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_DESIGNATED_INITIALIZER)
|
||||
# if __has_attribute(objc_designated_initializer)
|
||||
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
|
||||
# else
|
||||
# define OBJC_DESIGNATED_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_ATTR)
|
||||
# if defined(__has_attribute) && __has_attribute(enum_extensibility)
|
||||
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
|
||||
# else
|
||||
# define SWIFT_ENUM_ATTR(_extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM)
|
||||
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# if __has_feature(generalized_swift_name)
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# else
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE)
|
||||
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE_MSG)
|
||||
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
|
||||
#endif
|
||||
#if !defined(SWIFT_AVAILABILITY)
|
||||
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED)
|
||||
# define SWIFT_DEPRECATED __attribute__((deprecated))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED_MSG)
|
||||
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
|
||||
#endif
|
||||
#if __has_feature(attribute_diagnose_if_objc)
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
|
||||
#else
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
@import ObjectiveC;
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
|
||||
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
|
||||
#if __has_warning("-Wpragma-clang-attribute")
|
||||
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wnullability"
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma push_macro("any")
|
||||
# undef any
|
||||
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="Starscream",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
|
||||
# pragma pop_macro("any")
|
||||
#endif
|
||||
|
||||
@class NSStream;
|
||||
|
||||
SWIFT_CLASS("_TtC10Starscream16FoundationStream")
|
||||
@interface FoundationStream : NSObject <NSStreamDelegate>
|
||||
/// Delegate for the stream methods. Processes incoming bytes
|
||||
- (void)stream:(NSStream * _Nonnull)aStream handleEvent:(NSStreamEvent)eventCode;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC10Starscream9WebSocket")
|
||||
@interface WebSocket : NSObject <NSStreamDelegate>
|
||||
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
|
||||
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
|
||||
@end
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma clang attribute pop
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,6 @@
|
||||
// Generated by Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
|
||||
#if 0
|
||||
#elif defined(__arm64__) && __arm64__
|
||||
// Generated by Apple Swift version 5.0 effective-4.2 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
@@ -20,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
@@ -163,6 +165,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
#endif
|
||||
|
||||
@@ -189,3 +194,201 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
# pragma clang attribute pop
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#elif defined(__ARM_ARCH_7A__) && __ARM_ARCH_7A__
|
||||
// Generated by Apple Swift version 5.0 effective-4.2 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
#if !defined(__has_include)
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
#if !defined(__has_attribute)
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
#if !defined(__has_feature)
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
#if !defined(__has_warning)
|
||||
# define __has_warning(x) 0
|
||||
#endif
|
||||
|
||||
#if __has_include(<swift/objc-prologue.h>)
|
||||
# include <swift/objc-prologue.h>
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if !defined(SWIFT_TYPEDEFS)
|
||||
# define SWIFT_TYPEDEFS 1
|
||||
# if __has_include(<uchar.h>)
|
||||
# include <uchar.h>
|
||||
# elif !defined(__cplusplus)
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
# endif
|
||||
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PASTE)
|
||||
# define SWIFT_PASTE_HELPER(x, y) x##y
|
||||
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
|
||||
#endif
|
||||
#if !defined(SWIFT_METATYPE)
|
||||
# define SWIFT_METATYPE(X) Class
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_PROPERTY)
|
||||
# if __has_feature(objc_class_property)
|
||||
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
|
||||
# else
|
||||
# define SWIFT_CLASS_PROPERTY(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(objc_runtime_name)
|
||||
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
|
||||
#else
|
||||
# define SWIFT_RUNTIME_NAME(X)
|
||||
#endif
|
||||
#if __has_attribute(swift_name)
|
||||
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
|
||||
#else
|
||||
# define SWIFT_COMPILE_NAME(X)
|
||||
#endif
|
||||
#if __has_attribute(objc_method_family)
|
||||
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
|
||||
#else
|
||||
# define SWIFT_METHOD_FAMILY(X)
|
||||
#endif
|
||||
#if __has_attribute(noescape)
|
||||
# define SWIFT_NOESCAPE __attribute__((noescape))
|
||||
#else
|
||||
# define SWIFT_NOESCAPE
|
||||
#endif
|
||||
#if __has_attribute(warn_unused_result)
|
||||
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
# define SWIFT_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
#if __has_attribute(noreturn)
|
||||
# define SWIFT_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
# define SWIFT_NORETURN
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_EXTRA)
|
||||
# define SWIFT_CLASS_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_PROTOCOL_EXTRA)
|
||||
# define SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_EXTRA)
|
||||
# define SWIFT_ENUM_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS)
|
||||
# if __has_attribute(objc_subclassing_restricted)
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# else
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PROTOCOL)
|
||||
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_EXTENSION)
|
||||
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_DESIGNATED_INITIALIZER)
|
||||
# if __has_attribute(objc_designated_initializer)
|
||||
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
|
||||
# else
|
||||
# define OBJC_DESIGNATED_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_ATTR)
|
||||
# if defined(__has_attribute) && __has_attribute(enum_extensibility)
|
||||
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
|
||||
# else
|
||||
# define SWIFT_ENUM_ATTR(_extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM)
|
||||
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# if __has_feature(generalized_swift_name)
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# else
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE)
|
||||
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE_MSG)
|
||||
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
|
||||
#endif
|
||||
#if !defined(SWIFT_AVAILABILITY)
|
||||
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED)
|
||||
# define SWIFT_DEPRECATED __attribute__((deprecated))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED_MSG)
|
||||
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
|
||||
#endif
|
||||
#if __has_feature(attribute_diagnose_if_objc)
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
|
||||
#else
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
|
||||
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
|
||||
#if __has_warning("-Wpragma-clang-attribute")
|
||||
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wnullability"
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma push_macro("any")
|
||||
# undef any
|
||||
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="Swifter",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
|
||||
# pragma pop_macro("any")
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma clang attribute pop
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
// Generated by Apple Swift version 4.2.1 effective-4.1.50 (swiftlang-1000.11.42 clang-1000.11.45.1)
|
||||
// Generated by Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
@@ -163,6 +163,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
@import ObjectiveC;
|
||||
#endif
|
||||
@@ -195,7 +198,7 @@ SWIFT_CLASS("_TtC10Starscream16FoundationStream")
|
||||
SWIFT_CLASS("_TtC10Starscream9WebSocket")
|
||||
@interface WebSocket : NSObject <NSStreamDelegate>
|
||||
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
|
||||
+ (nonnull instancetype)new SWIFT_DEPRECATED_MSG("-init is unavailable");
|
||||
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
|
||||
@end
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>18C54</string>
|
||||
<string>18E226</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -29,17 +29,17 @@
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>10B61</string>
|
||||
<string>10E125</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>18B71</string>
|
||||
<string>18E219</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.14</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1010</string>
|
||||
<string>1020</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>10B61</string>
|
||||
<string>10E125</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
// Generated by Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
|
||||
// Generated by Apple Swift version 5.0 effective-4.2 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
@@ -163,6 +163,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
#endif
|
||||
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>18C54</string>
|
||||
<string>18E226</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -29,17 +29,17 @@
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>10B61</string>
|
||||
<string>10E125</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>18B71</string>
|
||||
<string>18E219</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.14</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1010</string>
|
||||
<string>1020</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>10B61</string>
|
||||
<string>10E125</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2015 Damian Kołakowski. All rights reserved.</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
// Generated by Apple Swift version 4.2.1 effective-4.1.50 (swiftlang-1000.11.42 clang-1000.11.45.1)
|
||||
// Generated by Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
@@ -163,6 +163,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
@import ObjectiveC;
|
||||
#endif
|
||||
@@ -195,7 +198,7 @@ SWIFT_CLASS("_TtC10Starscream16FoundationStream")
|
||||
SWIFT_CLASS("_TtC10Starscream9WebSocket")
|
||||
@interface WebSocket : NSObject <NSStreamDelegate>
|
||||
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
|
||||
+ (nonnull instancetype)new SWIFT_DEPRECATED_MSG("-init is unavailable");
|
||||
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
|
||||
@end
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
// Generated by Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
|
||||
// Generated by Apple Swift version 5.0 effective-4.2 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
@@ -163,6 +163,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
#endif
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
import XCTest
|
||||
|
||||
import SlackKitTests
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += SlackKitTests.__allTests()
|
||||
|
||||
XCTMain(tests)
|
||||
+14
-10
@@ -1,4 +1,4 @@
|
||||
// swift-tools-version:4.2
|
||||
// swift-tools-version:5.0
|
||||
|
||||
import PackageDescription
|
||||
|
||||
@@ -47,6 +47,9 @@ let SKWebAPI: Target = .target(name: "SKWebAPI",
|
||||
dependencies: ["SKCore"],
|
||||
path: "SKWebAPI/Sources")
|
||||
|
||||
let SlackKitTests: Target = .testTarget(name: "SlackKitTests",
|
||||
dependencies: ["SlackKit", "SKCore", "SKClient", "SKRTMAPI", "SKServer"],
|
||||
path: "SlackKitTests")
|
||||
// MARK: Package
|
||||
|
||||
let package = Package(
|
||||
@@ -55,29 +58,30 @@ let package = Package(
|
||||
.library(name: "SlackKit", targets: ["SlackKit"]),
|
||||
.library(name: "SKClient", targets: ["SKClient"]),
|
||||
.library(name: "SKCore", targets: ["SKCore"]),
|
||||
.library(name: "SKRMTAPI", targets: ["SKRTMAPI"]),
|
||||
.library(name: "SKRTMAPI", targets: ["SKRTMAPI"]),
|
||||
.library(name: "SKServer", targets: ["SKServer"]),
|
||||
.library(name: "SKWebAPI", targets: ["SKWebAPI"])
|
||||
],
|
||||
targets: [
|
||||
SlackKit, SKClient, SKCore, SKRTMAPI, SKServer, SKWebAPI
|
||||
SlackKit, SKClient, SKCore, SKRTMAPI, SKServer, SKWebAPI, SlackKitTests
|
||||
]
|
||||
)
|
||||
|
||||
#if os(macOS)
|
||||
package.dependencies = [
|
||||
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMinor(from: "1.4.5")),
|
||||
.package(url: "https://github.com/vapor/websocket", .upToNextMinor(from: "1.1.1")),
|
||||
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.0.6"))
|
||||
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMinor(from: "1.4.6")),
|
||||
.package(url: "https://github.com/vapor/websocket", .upToNextMinor(from: "1.1.2")),
|
||||
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.1.0"))
|
||||
]
|
||||
#elseif os(Linux)
|
||||
package.dependencies = [
|
||||
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMinor(from: "1.4.5")),
|
||||
.package(url: "https://github.com/vapor/websocket", .upToNextMinor(from: "1.1.1"))
|
||||
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMinor(from: "1.4.6")),
|
||||
.package(url: "https://github.com/vapor/websocket", .upToNextMinor(from: "1.1.2"))
|
||||
]
|
||||
#elseif os(iOS) || os(tvOS)
|
||||
package.dependencies = [
|
||||
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMinor(from: "1.4.5")),
|
||||
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.0.6"))
|
||||
.package(url: "https://github.com/httpswift/swifter.git", .upToNextMinor(from: "1.4.6")),
|
||||
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.1.0"))
|
||||
]
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
use_frameworks!
|
||||
|
||||
target 'SlackKit macOS' do
|
||||
platform :osx, '10.11'
|
||||
pod 'SKCore', '~> 4.1.0'
|
||||
pod 'SKClient', '~> 4.1.0'
|
||||
pod 'SKWebAPI', '~> 4.1.0'
|
||||
pod 'SKRTMAPI', '~> 4.1.0'
|
||||
pod 'SKServer', '~> 4.1.0'
|
||||
end
|
||||
|
||||
target 'SlackKit iOS' do
|
||||
platform :ios, '9.0'
|
||||
pod 'SKCore', '~> 4.1.0'
|
||||
pod 'SKClient', '~> 4.1.0'
|
||||
pod 'SKWebAPI', '~> 4.1.0'
|
||||
pod 'SKRTMAPI', '~> 4.1.0'
|
||||
pod 'SKServer', '~> 4.1.0'
|
||||
end
|
||||
|
||||
target 'SlackKit tvOS' do
|
||||
platform :tvos, '9.0'
|
||||
pod 'SKCore', '~> 4.1.0'
|
||||
pod 'SKClient', '~> 4.1.0'
|
||||
pod 'SKWebAPI', '~> 4.1.0'
|
||||
pod 'SKRTMAPI', '~> 4.1.0'
|
||||
pod 'SKServer', '~> 4.1.0'
|
||||
end
|
||||
@@ -1,7 +1,9 @@
|
||||
<p align="center"><img src="https://cloud.githubusercontent.com/assets/8311605/24083714/e921a0d4-0cb2-11e7-8384-d42113ef5056.png" alt="SlackKit" width="500"/></p>
|
||||
|
||||

|
||||

|
||||
[](https://dev.azure.com/pzignego/SlackKit/_build/latest?definitionId=2&branchName=master)
|
||||
|
||||

|
||||

|
||||

|
||||
[](https://github.com/apple/swift-package-manager)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
@@ -20,16 +22,20 @@ It's intended to expose all of the functionality of Slack's [Real Time Messaging
|
||||
|
||||
Add `SlackKit` to your `Package.swift`
|
||||
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
```swift
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/SlackKit/SlackKit.git", .upToNextMinor(from: "4.2.0"))
|
||||
.package(url: "https://github.com/pvzig/SlackKit.git", .upToNextMinor(from: "4.3.0"))
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
**When built using Swift Package Manager, SlackKit includes the [vapor websocket framework](https://github.com/vapor/websocket) by default which requires libressl.**
|
||||
|
||||
You can install it with [homebrew](https://brew.sh): `brew install libressl`
|
||||
|
||||
For additional details, see the [SKRTMAPI readme](https://github.com/pvzig/SlackKit/tree/master/SKRTMAPI#swift-package-manager).
|
||||
|
||||
#### Carthage
|
||||
|
||||
Add `SlackKit` to your `Cartfile`:
|
||||
@@ -46,6 +52,12 @@ pod 'SlackKit'
|
||||
```
|
||||
|
||||
### Usage
|
||||
To use the library in your project import it:
|
||||
|
||||
```swift
|
||||
import SlackKit
|
||||
```
|
||||
|
||||
#### The Basics
|
||||
Create a bot user with an API token:
|
||||
|
||||
@@ -124,75 +136,14 @@ Slack has [many different oauth scopes](https://api.slack.com/docs/oauth-scopes)
|
||||
If you authenticate using OAuth and the Add to Slack or Sign in with Slack buttons this is handled for you.
|
||||
|
||||
For local development of things like OAuth, slash commands, and message buttons, you may want to use a tool like [ngrok](https://ngrok.com).
|
||||
#### Advanced Usage
|
||||
Don’t need the whole banana? Want more control over the low-level implementation details? Use the extensible frameworks SlackKit is built on:
|
||||
|
||||
#### Web API Methods
|
||||
SlackKit currently supports the a subset of the Slack Web APIs that are available to bot users:
|
||||
|
||||
| Web APIs |
|
||||
| ------------- |
|
||||
| `api.test`|
|
||||
| `api.revoke`|
|
||||
| `auth.test`|
|
||||
| `channels.history`|
|
||||
| `channels.info`|
|
||||
| `channels.list`|
|
||||
| `channels.mark`|
|
||||
| `channels.setPurpose`|
|
||||
| `channels.setTopic`|
|
||||
| `chat.delete`|
|
||||
| `chat.meMessage`|
|
||||
| `chat.postMessage`|
|
||||
| `chat.update`|
|
||||
| `emoji.list`|
|
||||
| `files.comments.add`|
|
||||
| `files.comments.edit`|
|
||||
| `files.comments.delete`|
|
||||
| `files.delete`|
|
||||
| `files.info`|
|
||||
| `files.upload`|
|
||||
| `groups.close`|
|
||||
| `groups.history`|
|
||||
| `groups.info`|
|
||||
| `groups.list`|
|
||||
| `groups.mark`|
|
||||
| `groups.open`|
|
||||
| `groups.setPurpose`|
|
||||
| `groups.setTopic`|
|
||||
| `im.close`|
|
||||
| `im.history`|
|
||||
| `im.list`|
|
||||
| `im.mark`|
|
||||
| `im.open`|
|
||||
| `mpim.close`|
|
||||
| `mpim.history`|
|
||||
| `mpim.list`|
|
||||
| `mpim.mark`|
|
||||
| `mpim.open`|
|
||||
| `oauth.access`|
|
||||
| `pins.add`|
|
||||
| `pins.list`|
|
||||
| `pins.remove`|
|
||||
| `reactions.add`|
|
||||
| `reactions.get`|
|
||||
| `reactions.list`|
|
||||
| `reactions.remove`|
|
||||
| `rtm.start`|
|
||||
| `stars.add`|
|
||||
| `stars.remove`|
|
||||
| `team.info`|
|
||||
| `users.getPresence`|
|
||||
| `users.info`|
|
||||
| `users.list`|
|
||||
| `users.setActive`|
|
||||
| `users.setPresence`|
|
||||
|
||||
Don’t need the whole banana? Want more control over the low-level implementation details? Use the extensible modules SlackKit is built on:
|
||||
|
||||
| Module | Slack Service |
|
||||
| Framework | Description |
|
||||
| ------------- |------------- |
|
||||
| **[SKClient](https://github.com/pvzig/SlackKit/tree/master/SKClient)** | Write your own client implementation|
|
||||
| **[SKRTMAPI](https://github.com/pvzig/SlackKit/tree/master/SKRTMAPI)** | Connect to the Slack RTM API|
|
||||
| **[SKServer](https://github.com/pvzig/SlackKit/tree/master/SKServer)** | Spin up a server|
|
||||
| **[SKServer](https://github.com/pvzig/SlackKit/tree/master/SKServer)** | Spin up a server for a Slack app|
|
||||
| **[SKWebAPI](https://github.com/pvzig/SlackKit/tree/master/SKWebAPI)** | Access the Slack Web API|
|
||||
|
||||
### Examples
|
||||
|
||||
+49
-41
@@ -1,68 +1,76 @@
|
||||
# SKClient: SlackKit Client Module
|
||||

|
||||

|
||||

|
||||
[](https://github.com/apple/swift-package-manager)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](https://cocoapods.org)
|
||||
|
||||
# SKClient
|
||||
Create a custom SlackKit client.
|
||||
|
||||
## Installation
|
||||
|
||||
### CocoaPods
|
||||
<details>
|
||||
<summary><strong>Swift Package Manager</strong></summary>
|
||||
Add SlackKit as a dependency to your <code>Package.swift</code> and specify SKClient as a target dependency:
|
||||
|
||||
Add SKClient to your pod file:
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SampleApp",
|
||||
products: [
|
||||
.executable(
|
||||
name: "SampleApp",
|
||||
targets: ["SampleApp"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/pvzig/SlackKit.git", .upToNextMinor(from: "4.3.0")),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "SampleApp",
|
||||
dependencies: ["SKClient"])
|
||||
]
|
||||
)
|
||||
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SKClient'
|
||||
```
|
||||
and run
|
||||
</details>
|
||||
<details>
|
||||
<summary><strong>Carthage</strong></summary>
|
||||
Add SlackKit to your <code>Cartfile</code>:
|
||||
|
||||
```
|
||||
# Use CocoaPods version >= 1.4.0
|
||||
pod install
|
||||
github "pvzig/SlackKit"
|
||||
```
|
||||
|
||||
### Carthage
|
||||
|
||||
Add SKClient to your Cartfile:
|
||||
|
||||
```
|
||||
github "SlackKit/SKClient"
|
||||
```
|
||||
and run
|
||||
|
||||
```
|
||||
carthage bootstrap
|
||||
```
|
||||
|
||||
Drag the built `SKClient.framework` into your Xcode project.
|
||||
Drag the built <code>SKClient.framework</code> and it's dependency <code>SKCore.framework</code> into your Xcode project.
|
||||
</details>
|
||||
<details>
|
||||
<summary><strong>CocoaPods</strong></summary>
|
||||
Add SKClient to your <code>Podfile</code>:
|
||||
|
||||
### Swift Package Manager
|
||||
|
||||
Add SKClient to your Package.swift
|
||||
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/SlackKit/SKClient.git", .upToNextMinor(from: "4.1.0"))
|
||||
]
|
||||
)
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SlackKit/SKClient'
|
||||
```
|
||||
</details>
|
||||
|
||||
Run `swift build` on your application’s main directory.
|
||||
|
||||
## Usage
|
||||
To use the library in your project import it:
|
||||
|
||||
```
|
||||
#### Carthage & SPM
|
||||
|
||||
```swift
|
||||
import SKClient
|
||||
```
|
||||
|
||||
## Usage
|
||||
#### CocoaPods
|
||||
|
||||
```swift
|
||||
import SlackKit
|
||||
```
|
||||
|
||||
### The Basics
|
||||
Subclass `Client` to create a custom SlackKit client.
|
||||
|
||||
```
|
||||
@@ -78,7 +86,7 @@ class MyClient: Client {
|
||||
}
|
||||
```
|
||||
|
||||
Pass your custom client to [`SlackKit`](https://www.github.com/SlackKit/SlackKit) when adding an RTM bot:
|
||||
Pass your custom client to [`SlackKit`](https://www.github.com/pvzig/SlackKit) when adding an RTM bot:
|
||||
|
||||
```
|
||||
let bot = SlackKit()
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
import Dispatch
|
||||
#endif
|
||||
import Foundation
|
||||
#if !COCOAPODS
|
||||
@_exported import SKCore
|
||||
#endif
|
||||
|
||||
open class Client {
|
||||
internal(set) public var authenticatedUser: User?
|
||||
@@ -113,6 +115,10 @@ open class Client {
|
||||
manualPresenceChange(event)
|
||||
case .prefChange:
|
||||
changePreference(event)
|
||||
case .memberJoinedChannel:
|
||||
memberJoinedChannel(event)
|
||||
case .memberLeftChannel:
|
||||
memberLeftChannel(event)
|
||||
case .userChange:
|
||||
userChange(event)
|
||||
case .teamJoin:
|
||||
@@ -276,7 +282,7 @@ extension Client {
|
||||
|
||||
let timeout = DispatchTime.now() + Double(Int64(5.0 * Double(UInt64.nanosecondsPerSecond))) / Double(UInt64.nanosecondsPerSecond)
|
||||
DispatchQueue.main.asyncAfter(deadline: timeout, execute: {
|
||||
if let index = self.channels[channelID]?.usersTyping.index(of: userID) {
|
||||
if let index = self.channels[channelID]?.usersTyping.firstIndex(of: userID) {
|
||||
self.channels[channelID]?.usersTyping.remove(at: index)
|
||||
}
|
||||
})
|
||||
@@ -330,7 +336,7 @@ extension Client {
|
||||
return
|
||||
}
|
||||
|
||||
if let userID = authenticatedUser?.id, let index = channels[id]?.members?.index(of: userID) {
|
||||
if let userID = authenticatedUser?.id, let index = channels[id]?.members?.firstIndex(of: userID) {
|
||||
channels[id]?.members?.remove(at: index)
|
||||
}
|
||||
}
|
||||
@@ -358,6 +364,30 @@ extension Client {
|
||||
func channelHistoryChanged(_ event: Event) {
|
||||
|
||||
}
|
||||
|
||||
func memberJoinedChannel(_ event: Event) {
|
||||
guard
|
||||
let channel = event.channel?.id,
|
||||
let member = event.user?.id
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
channels[channel]?.members?.append(member)
|
||||
}
|
||||
|
||||
func memberLeftChannel(_ event: Event) {
|
||||
guard
|
||||
let channel = event.channel?.id,
|
||||
let member = event.user?.id
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
if let index = channels[channel]?.members?.firstIndex(of: member) {
|
||||
channels[channel]?.members?.remove(at: index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Do Not Disturb
|
||||
@@ -397,76 +427,82 @@ extension Client {
|
||||
// MARK: - Files
|
||||
extension Client {
|
||||
func processFile(_ event: Event) {
|
||||
guard
|
||||
let file = event.file,
|
||||
let id = file.id
|
||||
else {
|
||||
return
|
||||
}
|
||||
if let comment = file.initialComment, let commentID = comment.id {
|
||||
if files[id]?.comments[commentID] == nil {
|
||||
files[id]?.comments[commentID] = comment
|
||||
for file in event.files {
|
||||
guard
|
||||
let id = file.id
|
||||
else {
|
||||
continue
|
||||
}
|
||||
if let comment = file.initialComment, let commentID = comment.id {
|
||||
if files[id]?.comments[commentID] == nil {
|
||||
files[id]?.comments[commentID] = comment
|
||||
}
|
||||
}
|
||||
files[id] = file
|
||||
}
|
||||
files[id] = file
|
||||
}
|
||||
|
||||
func filePrivate(_ event: Event) {
|
||||
guard
|
||||
let file = event.file,
|
||||
let id = file.id
|
||||
else {
|
||||
return
|
||||
for file in event.files {
|
||||
guard
|
||||
let id = file.id
|
||||
else {
|
||||
continue
|
||||
}
|
||||
files[id]?.isPublic = false
|
||||
}
|
||||
files[id]?.isPublic = false
|
||||
}
|
||||
|
||||
func deleteFile(_ event: Event) {
|
||||
guard
|
||||
let file = event.file,
|
||||
let id = file.id
|
||||
else {
|
||||
return
|
||||
}
|
||||
if files[id] != nil {
|
||||
files.removeValue(forKey: id)
|
||||
for file in event.files {
|
||||
guard
|
||||
let id = file.id
|
||||
else {
|
||||
continue
|
||||
}
|
||||
if files[id] != nil {
|
||||
files.removeValue(forKey: id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fileCommentAdded(_ event: Event) {
|
||||
guard
|
||||
let file = event.file,
|
||||
let id = file.id,
|
||||
let comment = event.comment,
|
||||
let commentID = comment.id
|
||||
else {
|
||||
return
|
||||
for file in event.files {
|
||||
guard
|
||||
let id = file.id,
|
||||
let comment = event.comment,
|
||||
let commentID = comment.id
|
||||
else {
|
||||
continue
|
||||
}
|
||||
files[id]?.comments[commentID] = comment
|
||||
}
|
||||
files[id]?.comments[commentID] = comment
|
||||
}
|
||||
|
||||
func fileCommentEdited(_ event: Event) {
|
||||
guard
|
||||
let file = event.file,
|
||||
let id = file.id,
|
||||
let comment = event.comment,
|
||||
let commentID = comment.id
|
||||
else {
|
||||
return
|
||||
for file in event.files {
|
||||
guard
|
||||
let id = file.id,
|
||||
let comment = event.comment,
|
||||
let commentID = comment.id
|
||||
else {
|
||||
continue
|
||||
}
|
||||
files[id]?.comments[commentID]?.comment = comment.comment
|
||||
}
|
||||
files[id]?.comments[commentID]?.comment = comment.comment
|
||||
}
|
||||
|
||||
func fileCommentDeleted(_ event: Event) {
|
||||
guard
|
||||
let file = event.file,
|
||||
let id = file.id,
|
||||
let comment = event.comment,
|
||||
let commentID = comment.id
|
||||
else {
|
||||
return
|
||||
for file in event.files {
|
||||
guard
|
||||
let id = file.id,
|
||||
let comment = event.comment,
|
||||
let commentID = comment.id
|
||||
else {
|
||||
continue
|
||||
}
|
||||
_ = files[id]?.comments.removeValue(forKey: commentID)
|
||||
}
|
||||
_ = files[id]?.comments.removeValue(forKey: commentID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-8
@@ -1,9 +1,4 @@
|
||||
# SKCore: SlackKit Models
|
||||

|
||||

|
||||

|
||||
[](https://github.com/apple/swift-package-manager)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](https://cocoapods.org)
|
||||
# SKCore
|
||||
|
||||
The shared model objects used by [SlackKit](https://www.github.com/pvzig/SlackKit).
|
||||
|
||||
SKCore contains the shared model objects used by [SlackKit](https://www.github.com/SlackKit/SlackKit) and the other [SlackKit modules](https://www.github.com/SlackKit).
|
||||
|
||||
+126
-36
@@ -22,6 +22,18 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct Action {
|
||||
fileprivate enum CodingKeys: String {
|
||||
case name
|
||||
case text
|
||||
case type
|
||||
case value
|
||||
case url
|
||||
case style
|
||||
case confirm
|
||||
case options
|
||||
case dataSource = "data_source"
|
||||
}
|
||||
|
||||
public let name: String?
|
||||
public let text: String?
|
||||
public let type: String?
|
||||
@@ -31,17 +43,17 @@ public struct Action {
|
||||
public let confirm: Confirm?
|
||||
public let options: [Option]?
|
||||
public let dataSource: DataSource?
|
||||
|
||||
|
||||
public init(action: [String: Any]?) {
|
||||
name = action?["name"] as? String
|
||||
text = action?["text"] as? String
|
||||
type = action?["type"] as? String
|
||||
value = action?["value"] as? String
|
||||
url = action?["url"] as? String
|
||||
style = ActionStyle(rawValue: action?["style"] as? String ?? "")
|
||||
confirm = Confirm(confirm:action?["confirm"] as? [String: Any])
|
||||
options = (action?["options"] as? [[String: Any]])?.map { Option(option: $0) }
|
||||
dataSource = DataSource(rawValue: action?["data_source"] as? String ?? "")
|
||||
name = action?[CodingKeys.name.rawValue] as? String
|
||||
text = action?[CodingKeys.text.rawValue] as? String
|
||||
type = action?[CodingKeys.type.rawValue] as? String
|
||||
value = action?[CodingKeys.value.rawValue] as? String
|
||||
url = action?[CodingKeys.url.rawValue] as? String
|
||||
style = ActionStyle(rawValue: action?[CodingKeys.style.rawValue] as? String ?? "")
|
||||
confirm = Confirm(confirm:action?[CodingKeys.confirm.rawValue] as? [String: Any])
|
||||
options = (action?[CodingKeys.options.rawValue] as? [[String: Any]])?.map { Option(option: $0) }
|
||||
dataSource = DataSource(rawValue: action?[CodingKeys.dataSource.rawValue] as? String ?? "")
|
||||
}
|
||||
|
||||
public init(name: String, text: String, type: String = "button", style: ActionStyle = .defaultStyle, value: String? = nil,
|
||||
@@ -59,29 +71,36 @@ public struct Action {
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var dict = [String: Any]()
|
||||
dict["name"] = name
|
||||
dict["text"] = text
|
||||
dict["type"] = type
|
||||
dict["value"] = value
|
||||
dict["url"] = url
|
||||
dict["style"] = style?.rawValue
|
||||
dict["confirm"] = confirm?.dictionary
|
||||
dict["options"] = options?.map { $0.dictionary }
|
||||
dict["data_source"] = dataSource?.rawValue
|
||||
dict[CodingKeys.name.rawValue] = name
|
||||
dict[CodingKeys.text.rawValue] = text
|
||||
dict[CodingKeys.type.rawValue] = type
|
||||
dict[CodingKeys.value.rawValue] = value
|
||||
dict[CodingKeys.url.rawValue] = url
|
||||
dict[CodingKeys.style.rawValue] = style?.rawValue
|
||||
dict[CodingKeys.confirm.rawValue] = confirm?.dictionary
|
||||
dict[CodingKeys.options.rawValue] = options?.map { $0.dictionary }
|
||||
dict[CodingKeys.dataSource.rawValue] = dataSource?.rawValue
|
||||
return dict
|
||||
}
|
||||
|
||||
public struct Confirm {
|
||||
fileprivate enum CodingKeys: String {
|
||||
case title
|
||||
case text
|
||||
case okText = "ok_text"
|
||||
case dismissText = "dismiss_text"
|
||||
}
|
||||
|
||||
public let title: String?
|
||||
public let text: String?
|
||||
public let okText: String?
|
||||
public let dismissText: String?
|
||||
|
||||
|
||||
public init(confirm: [String: Any]?) {
|
||||
title = confirm?["title"] as? String
|
||||
text = confirm?["text"] as? String
|
||||
okText = confirm?["ok_text"] as? String
|
||||
dismissText = confirm?["dismiss_text"] as? String
|
||||
title = confirm?[CodingKeys.title.rawValue] as? String
|
||||
text = confirm?[CodingKeys.text.rawValue] as? String
|
||||
okText = confirm?[CodingKeys.okText.rawValue] as? String
|
||||
dismissText = confirm?[CodingKeys.dismissText.rawValue] as? String
|
||||
}
|
||||
|
||||
public init(text: String, title: String? = nil, okText: String? = nil, dismissText: String? = nil) {
|
||||
@@ -93,21 +112,26 @@ public struct Action {
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var dict = [String: Any]()
|
||||
dict["title"] = title
|
||||
dict["text"] = text
|
||||
dict["ok_text"] = okText
|
||||
dict["dismiss_text"] = dismissText
|
||||
dict[CodingKeys.title.rawValue] = title
|
||||
dict[CodingKeys.text.rawValue] = text
|
||||
dict[CodingKeys.okText.rawValue] = okText
|
||||
dict[CodingKeys.dismissText.rawValue] = dismissText
|
||||
return dict
|
||||
}
|
||||
}
|
||||
|
||||
public struct Option {
|
||||
fileprivate enum CodingKeys: String {
|
||||
case text
|
||||
case value
|
||||
}
|
||||
|
||||
public let text: String?
|
||||
public let value: String?
|
||||
|
||||
|
||||
public init(option: [String: Any]?) {
|
||||
text = option?["text"] as? String
|
||||
value = option?["value"] as? String
|
||||
text = option?[CodingKeys.text.rawValue] as? String
|
||||
value = option?[CodingKeys.value.rawValue] as? String
|
||||
}
|
||||
|
||||
public init(text: String, value: String) {
|
||||
@@ -117,26 +141,92 @@ public struct Action {
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var dict = [String: Any]()
|
||||
dict["text"] = text
|
||||
dict["value"] = value
|
||||
dict[CodingKeys.text.rawValue] = text
|
||||
dict[CodingKeys.value.rawValue] = value
|
||||
return dict
|
||||
}
|
||||
}
|
||||
|
||||
public enum DataSource: String {
|
||||
public enum DataSource: String, Codable {
|
||||
case users
|
||||
case channels
|
||||
case conversations
|
||||
}
|
||||
}
|
||||
|
||||
public enum ActionStyle: String {
|
||||
extension Action: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||
name = try values.decodeIfPresent(String.self, forKey: .name)
|
||||
text = try values.decodeIfPresent(String.self, forKey: .text)
|
||||
type = try values.decodeIfPresent(String.self, forKey: .type)
|
||||
value = try values.decodeIfPresent(String.self, forKey: .value)
|
||||
url = try values.decodeIfPresent(String.self, forKey: .url)
|
||||
style = try values.decodeIfPresent(ActionStyle.self, forKey: .style)
|
||||
confirm = try values.decodeIfPresent(Confirm.self, forKey: .confirm)
|
||||
options = try values.decodeIfPresent([Option].self, forKey: .options)
|
||||
dataSource = try values.decodeIfPresent(DataSource.self, forKey: .dataSource)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(name, forKey: .name)
|
||||
try container.encode(text, forKey: .text)
|
||||
try container.encode(type, forKey: .type)
|
||||
try container.encode(value, forKey: .value)
|
||||
try container.encode(url, forKey: .url)
|
||||
try container.encode(style, forKey: .style)
|
||||
try container.encode(confirm, forKey: .confirm)
|
||||
try container.encode(options, forKey: .options)
|
||||
try container.encode(dataSource, forKey: .dataSource)
|
||||
}
|
||||
}
|
||||
|
||||
extension Action.CodingKeys: CodingKey { }
|
||||
|
||||
extension Action.Confirm: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||
title = try values.decodeIfPresent(String.self, forKey: .title)
|
||||
text = try values.decodeIfPresent(String.self, forKey: .text)
|
||||
okText = try values.decodeIfPresent(String.self, forKey: .okText)
|
||||
dismissText = try values.decodeIfPresent(String.self, forKey: .dismissText)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(title, forKey: .title)
|
||||
try container.encode(text, forKey: .text)
|
||||
try container.encode(okText, forKey: .okText)
|
||||
try container.encode(dismissText, forKey: .dismissText)
|
||||
}
|
||||
}
|
||||
|
||||
extension Action.Confirm.CodingKeys: CodingKey { }
|
||||
|
||||
extension Action.Option: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||
text = try values.decodeIfPresent(String.self, forKey: .text)
|
||||
value = try values.decodeIfPresent(String.self, forKey: .value)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(text, forKey: .text)
|
||||
try container.encode(value, forKey: .value)
|
||||
}
|
||||
}
|
||||
|
||||
extension Action.Option.CodingKeys: CodingKey { }
|
||||
|
||||
public enum ActionStyle: String, Codable {
|
||||
case defaultStyle = "default"
|
||||
case primary = "primary"
|
||||
case danger = "danger"
|
||||
}
|
||||
|
||||
public enum MessageResponseType: String {
|
||||
public enum MessageResponseType: String, Codable {
|
||||
case inChannel = "in_channel"
|
||||
case ephemeral = "ephemeral"
|
||||
}
|
||||
|
||||
@@ -22,14 +22,20 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct AttachmentField {
|
||||
fileprivate enum CodingKeys: String {
|
||||
case title
|
||||
case value
|
||||
case short
|
||||
}
|
||||
|
||||
public let title: String?
|
||||
public let value: String?
|
||||
public let short: Bool?
|
||||
|
||||
|
||||
public init(field: [String: Any]?) {
|
||||
title = field?["title"] as? String
|
||||
value = field?["value"] as? String
|
||||
short = field?["short"] as? Bool
|
||||
title = field?[CodingKeys.title.rawValue] as? String
|
||||
value = field?[CodingKeys.value.rawValue] as? String
|
||||
short = field?[CodingKeys.short.rawValue] as? Bool
|
||||
}
|
||||
|
||||
public init(title: String?, value: String?, short: Bool? = nil) {
|
||||
@@ -40,9 +46,27 @@ public struct AttachmentField {
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var field = [String: Any]()
|
||||
field["title"] = title
|
||||
field["value"] = value
|
||||
field["short"] = short
|
||||
field[CodingKeys.title.rawValue] = title
|
||||
field[CodingKeys.value.rawValue] = value
|
||||
field[CodingKeys.short.rawValue] = short
|
||||
return field
|
||||
}
|
||||
}
|
||||
|
||||
extension AttachmentField: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||
title = try values.decodeIfPresent(String.self, forKey: .title)
|
||||
value = try values.decodeIfPresent(String.self, forKey: .value)
|
||||
short = try values.decodeIfPresent(Bool.self, forKey: .short)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(title, forKey: .title)
|
||||
try container.encode(value, forKey: .value)
|
||||
try container.encode(short, forKey: .short)
|
||||
}
|
||||
}
|
||||
|
||||
extension AttachmentField.CodingKeys: CodingKey { }
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/// Defined by https://api.slack.com/reference/messaging/composition-objects#text
|
||||
public struct TextComposition {
|
||||
/// The type of block. Can be one of plainText or markdown.
|
||||
public let type: BlockType
|
||||
public let text: String
|
||||
public let emoji: Bool?
|
||||
public let verbatim: Bool?
|
||||
|
||||
public init(type: BlockType,
|
||||
text: String,
|
||||
emoji: Bool? = nil,
|
||||
verbatim: Bool? = nil) {
|
||||
self.type = type
|
||||
self.text = text
|
||||
self.emoji = emoji
|
||||
self.verbatim = verbatim
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var composition = [String: Any]()
|
||||
composition["type"] = type.rawValue
|
||||
composition["text"] = text
|
||||
composition["emoji"] = emoji
|
||||
composition["verbatim"] = verbatim
|
||||
return composition
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/composition-objects#option
|
||||
public struct OptionComposition {
|
||||
public let text: TextComposition
|
||||
public let value: String
|
||||
public let url: String?
|
||||
|
||||
public init(text: TextComposition,
|
||||
value: String,
|
||||
url: String? = nil) {
|
||||
self.text = text
|
||||
self.value = value
|
||||
self.url = url
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var composition = [String: Any]()
|
||||
composition["text"] = text.dictionary
|
||||
composition["value"] = value
|
||||
composition["url"] = url
|
||||
return composition
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/composition-objects#option-group
|
||||
public struct OptionGroupComposition {
|
||||
public let label: TextComposition
|
||||
public let options: [OptionComposition]
|
||||
|
||||
public init(label: TextComposition,
|
||||
options: [OptionComposition]) {
|
||||
self.label = label
|
||||
self.options = options
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var composition = [String: Any]()
|
||||
composition["label"] = label.dictionary
|
||||
composition["options"] = options.map { $0.dictionary }
|
||||
return composition
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/composition-objects#confirm
|
||||
public struct ConfirmComposition {
|
||||
public let title: TextComposition
|
||||
public let text: TextComposition
|
||||
public let confirm: TextComposition
|
||||
public let deny: TextComposition
|
||||
|
||||
public init(title: TextComposition,
|
||||
text: TextComposition,
|
||||
confirm: TextComposition,
|
||||
deny: TextComposition) {
|
||||
self.title = title
|
||||
self.text = text
|
||||
self.confirm = confirm
|
||||
self.deny = deny
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var composition = [String: Any]()
|
||||
composition["title"] = title.dictionary
|
||||
composition["text"] = text.dictionary
|
||||
composition["confirm"] = confirm.dictionary
|
||||
composition["deny"] = deny.dictionary
|
||||
return composition
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
public protocol BlockElement {
|
||||
var dictionary: [String: Any] { get }
|
||||
}
|
||||
|
||||
public protocol SectionElement: BlockElement {}
|
||||
|
||||
public protocol ActionsElement: BlockElement {}
|
||||
|
||||
public protocol ContextElement: BlockElement {}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#image
|
||||
public struct ImageElement: BlockElement, SectionElement, ContextElement {
|
||||
/// Type will always be image.
|
||||
public let type: BlockType
|
||||
public let imageURL: String
|
||||
public let altText: String
|
||||
|
||||
public init(type: BlockType = .image,
|
||||
imageURL: String,
|
||||
altText: String) {
|
||||
self.type = type
|
||||
self.imageURL = imageURL
|
||||
self.altText = altText
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["image_url"] = imageURL
|
||||
element["alt_text"] = altText
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Custom type to better support Context PlainText
|
||||
public struct PlainTextElement: BlockElement, ContextElement {
|
||||
/// Type will always be image.
|
||||
public let type: BlockType
|
||||
public let text: String
|
||||
|
||||
public init(type: BlockType = .plainText,
|
||||
text: String) {
|
||||
self.type = type
|
||||
self.text = text
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["text"] = text
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Custom type to better support Context Markdown Text
|
||||
public struct MarkdownTextElement: BlockElement, ContextElement {
|
||||
/// Type will always be image.
|
||||
public let type: BlockType
|
||||
public let text: String
|
||||
|
||||
public init(type: BlockType = .markdown,
|
||||
text: String) {
|
||||
self.type = type
|
||||
self.text = text
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["text"] = text
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
public enum ButtonElementStyle: String, CaseIterable {
|
||||
case `default`
|
||||
case primary
|
||||
case danger
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#button
|
||||
public struct ButtonElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be button.
|
||||
public let type: BlockType
|
||||
public let text: TextComposition
|
||||
public let actionId: String
|
||||
public let url: String?
|
||||
public let value: String?
|
||||
public let style: ButtonElementStyle?
|
||||
|
||||
public init(type: BlockType = .button,
|
||||
text: TextComposition,
|
||||
actionId: String,
|
||||
url: String? = nil,
|
||||
value: String? = nil,
|
||||
style: ButtonElementStyle? = nil) {
|
||||
self.type = type
|
||||
self.text = text
|
||||
self.actionId = actionId
|
||||
self.url = url
|
||||
self.value = value
|
||||
self.style = style
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["text"] = text.dictionary
|
||||
element["action_id"] = actionId
|
||||
element["url"] = url
|
||||
element["value"] = value
|
||||
element["style"] = style
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#static-select
|
||||
public struct StaticSelectElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be static_select.
|
||||
public let type: BlockType
|
||||
public let placeholder: TextComposition
|
||||
public let actionId: String
|
||||
public let options: [OptionComposition]?
|
||||
public let optionGroups: [OptionGroupComposition]?
|
||||
public let initialOption: OptionComposition?
|
||||
public let initialOptionGroup: OptionGroupComposition?
|
||||
public let confirm: ConfirmComposition?
|
||||
|
||||
public init(type: BlockType = .staticSelect,
|
||||
placeholder: TextComposition,
|
||||
actionId: String,
|
||||
options: [OptionComposition]? = nil,
|
||||
optionGroups: [OptionGroupComposition]? = nil,
|
||||
initialOption: OptionComposition? = nil,
|
||||
initialOptionGroup: OptionGroupComposition? = nil,
|
||||
confirm: ConfirmComposition? = nil) {
|
||||
self.type = type
|
||||
self.placeholder = placeholder
|
||||
self.actionId = actionId
|
||||
self.options = options
|
||||
self.optionGroups = optionGroups
|
||||
self.initialOption = initialOption
|
||||
self.initialOptionGroup = initialOptionGroup
|
||||
self.confirm = confirm
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["placeholder"] = placeholder.dictionary
|
||||
element["action_id"] = actionId
|
||||
element["options"] = options?.map { $0.dictionary }
|
||||
element["option_groups"] = optionGroups?.map { $0.dictionary }
|
||||
element["initial_option"] = initialOption?.dictionary ?? initialOptionGroup?.dictionary
|
||||
element["confirm"] = confirm?.dictionary
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#external-select
|
||||
public struct ExternalSelectElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be externalSelect.
|
||||
public let type: BlockType
|
||||
public let placeholder: TextComposition
|
||||
public let actionId: String
|
||||
public let initialOption: OptionComposition?
|
||||
public let initialOptionGroup: OptionGroupComposition?
|
||||
public let minQueryLenght: Int?
|
||||
public let confirm: ConfirmComposition?
|
||||
|
||||
public init(type: BlockType = .externalSelect,
|
||||
placeholder: TextComposition,
|
||||
actionId: String,
|
||||
initialOption: OptionComposition? = nil,
|
||||
initialOptionGroup: OptionGroupComposition? = nil,
|
||||
minQueryLenght: Int?,
|
||||
confirm: ConfirmComposition? = nil) {
|
||||
self.type = type
|
||||
self.placeholder = placeholder
|
||||
self.actionId = actionId
|
||||
self.initialOption = initialOption
|
||||
self.initialOptionGroup = initialOptionGroup
|
||||
self.minQueryLenght = minQueryLenght
|
||||
self.confirm = confirm
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["placeholder"] = placeholder.dictionary
|
||||
element["action_id"] = actionId
|
||||
element["initial_option"] = initialOption?.dictionary ?? initialOptionGroup?.dictionary
|
||||
element["min_query_length"] = minQueryLenght
|
||||
element["confirm"] = confirm?.dictionary
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#user-select
|
||||
public struct UsersSelectElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be usersSelect.
|
||||
public let type: BlockType
|
||||
public let placeholder: TextComposition
|
||||
public let actionId: String
|
||||
public let initialUserId: String?
|
||||
public let confirm: ConfirmComposition?
|
||||
|
||||
public init(type: BlockType = .usersSelect,
|
||||
placeholder: TextComposition,
|
||||
actionId: String,
|
||||
initialUserId: String?,
|
||||
confirm: ConfirmComposition? = nil) {
|
||||
self.type = type
|
||||
self.placeholder = placeholder
|
||||
self.actionId = actionId
|
||||
self.initialUserId = initialUserId
|
||||
self.confirm = confirm
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["placeholder"] = placeholder.dictionary
|
||||
element["action_id"] = actionId
|
||||
element["initial_user"] = initialUserId
|
||||
element["confirm"] = confirm?.dictionary
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#converstation-select
|
||||
public struct ConverstationSelectElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be converstationSelect.
|
||||
public let type: BlockType
|
||||
public let placeholder: TextComposition
|
||||
public let actionId: String
|
||||
public let initialConverstationId: String?
|
||||
public let confirm: ConfirmComposition?
|
||||
|
||||
public init(type: BlockType = .converstationSelect,
|
||||
placeholder: TextComposition,
|
||||
actionId: String,
|
||||
initialConverstationId: String?,
|
||||
confirm: ConfirmComposition? = nil) {
|
||||
self.type = type
|
||||
self.placeholder = placeholder
|
||||
self.actionId = actionId
|
||||
self.initialConverstationId = initialConverstationId
|
||||
self.confirm = confirm
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["placeholder"] = placeholder.dictionary
|
||||
element["action_id"] = actionId
|
||||
element["initial_conversation"] = initialConverstationId
|
||||
element["confirm"] = confirm?.dictionary
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#channel-select
|
||||
public struct ChannelSelectElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be channelSelect.
|
||||
public let type: BlockType
|
||||
public let placeholder: TextComposition
|
||||
public let actionId: String
|
||||
public let initialChannelId: String?
|
||||
public let confirm: ConfirmComposition?
|
||||
|
||||
public init(type: BlockType = .channelSelect,
|
||||
placeholder: TextComposition,
|
||||
actionId: String,
|
||||
initialChannelId: String?,
|
||||
confirm: ConfirmComposition? = nil) {
|
||||
self.type = type
|
||||
self.placeholder = placeholder
|
||||
self.actionId = actionId
|
||||
self.initialChannelId = initialChannelId
|
||||
self.confirm = confirm
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["placeholder"] = placeholder.dictionary
|
||||
element["action_id"] = actionId
|
||||
element["initial_channel"] = initialChannelId
|
||||
element["confirm"] = confirm?.dictionary
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#overflow
|
||||
public struct OverflowElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be overflow.
|
||||
public let type: BlockType
|
||||
public let actionId: String
|
||||
public let options: [OptionComposition]
|
||||
public let confirm: ConfirmComposition?
|
||||
|
||||
public init(type: BlockType = .overflow,
|
||||
placeholder: TextComposition,
|
||||
actionId: String,
|
||||
options: [OptionComposition],
|
||||
confirm: ConfirmComposition? = nil) {
|
||||
self.type = type
|
||||
self.actionId = actionId
|
||||
self.options = options
|
||||
self.confirm = confirm
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["action_id"] = actionId
|
||||
element["options"] = options
|
||||
element["confirm"] = confirm?.dictionary
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/block-elements#overflow
|
||||
public struct DatePickerElement: BlockElement, SectionElement, ActionsElement {
|
||||
/// Type will always be datePicker.
|
||||
public let type: BlockType
|
||||
public let actionId: String
|
||||
public let placeholder: TextComposition?
|
||||
public let initialDate: String?
|
||||
public let confirm: ConfirmComposition?
|
||||
|
||||
public init(type: BlockType = .datePicker,
|
||||
actionId: String,
|
||||
placeholder: TextComposition?,
|
||||
initialDate: String? = nil,
|
||||
confirm: ConfirmComposition? = nil) {
|
||||
self.type = type
|
||||
self.actionId = actionId
|
||||
self.placeholder = placeholder
|
||||
self.initialDate = initialDate
|
||||
self.confirm = confirm
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var element = [String: Any]()
|
||||
element["type"] = type.rawValue
|
||||
element["action_id"] = actionId
|
||||
element["placeholder"] = placeholder?.dictionary
|
||||
element["initial_date"] = initialDate
|
||||
element["confirm"] = confirm?.dictionary
|
||||
return element
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
public protocol Block {
|
||||
var dictionary: [String: Any] { get }
|
||||
}
|
||||
|
||||
public enum BlockType: String, CaseIterable {
|
||||
case actions
|
||||
case button
|
||||
case context
|
||||
case datePicker = "datepicker"
|
||||
case divider
|
||||
case image
|
||||
case markdown = "mrkdwn"
|
||||
case overflow
|
||||
case plainText = "plain_text"
|
||||
case section
|
||||
|
||||
// Selects
|
||||
|
||||
case channelSelect = "channels_select"
|
||||
case converstationSelect = "conversations_select"
|
||||
case externalSelect = "external_select"
|
||||
case staticSelect = "static_select"
|
||||
case usersSelect = "users_select"
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/blocks#section
|
||||
public struct SectionBlock: Block {
|
||||
/// Type will always be section.
|
||||
public let type: BlockType
|
||||
public let text: TextComposition
|
||||
public let blockId: String?
|
||||
public let fields: [TextComposition]?
|
||||
public let accessory: SectionElement?
|
||||
|
||||
public init(type: BlockType = .section,
|
||||
text: TextComposition,
|
||||
blockId: String? = nil,
|
||||
fields: [TextComposition]? = nil,
|
||||
accessory: SectionElement? = nil) {
|
||||
self.type = type
|
||||
self.text = text
|
||||
self.blockId = blockId
|
||||
self.fields = fields
|
||||
self.accessory = accessory
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var block = [String: Any]()
|
||||
block["type"] = type.rawValue
|
||||
block["text"] = text.dictionary
|
||||
block["block_id"] = blockId
|
||||
block["fields"] = fields?.map { $0.dictionary }
|
||||
block["accessory"] = accessory?.dictionary
|
||||
return block
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/blocks#divider
|
||||
public struct DividerBlock: Block {
|
||||
/// Type will always be divider.
|
||||
public let type: BlockType
|
||||
public let blockId: String?
|
||||
|
||||
public init(type: BlockType = .divider,
|
||||
blockId: String? = nil) {
|
||||
self.type = type
|
||||
self.blockId = blockId
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var block = [String: Any]()
|
||||
block["type"] = type
|
||||
block["block_id"] = blockId
|
||||
return block
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/blocks#image
|
||||
public struct ImageBlock: Block {
|
||||
/// Type will always be image.
|
||||
public let type: BlockType
|
||||
public let imageURL: String
|
||||
public let altText: String
|
||||
public let title: String?
|
||||
public let blockId: String?
|
||||
|
||||
public init(type: BlockType = .image,
|
||||
imageURL: String,
|
||||
altText: String,
|
||||
title: String? = nil,
|
||||
blockId: String? = nil) {
|
||||
self.type = type
|
||||
self.imageURL = imageURL
|
||||
self.altText = altText
|
||||
self.title = title
|
||||
self.blockId = blockId
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var block = [String: Any]()
|
||||
block["type"] = type.rawValue
|
||||
block["image_url"] = imageURL
|
||||
block["alt_text"] = altText
|
||||
block["title"] = title
|
||||
block["block_id"] = blockId
|
||||
return block
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/blocks#actions
|
||||
public struct ActionsBlock: Block {
|
||||
/// Type will always be actions.
|
||||
public let type: BlockType
|
||||
public let elements: [ActionsElement]
|
||||
public let blockId: String?
|
||||
|
||||
public init(type: BlockType = .actions,
|
||||
elements: [ActionsElement],
|
||||
blockId: String? = nil) {
|
||||
self.type = type
|
||||
self.elements = elements
|
||||
self.blockId = blockId
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var block = [String: Any]()
|
||||
block["type"] = type.rawValue
|
||||
block["elements"] = elements.map { $0.dictionary }
|
||||
block["block_id"] = blockId
|
||||
return block
|
||||
}
|
||||
}
|
||||
|
||||
/// Defined by https://api.slack.com/reference/messaging/blocks#context
|
||||
public struct ContextBlock: Block {
|
||||
/// Type will always be actions.
|
||||
public let type: BlockType
|
||||
public let elements: [ContextElement]
|
||||
public let blockId: String?
|
||||
|
||||
public init(type: BlockType = .context,
|
||||
elements: [ContextElement],
|
||||
blockId: String? = nil) {
|
||||
self.type = type
|
||||
self.elements = elements
|
||||
self.blockId = blockId
|
||||
}
|
||||
|
||||
public var dictionary: [String: Any] {
|
||||
var block = [String: Any]()
|
||||
block["type"] = type.rawValue
|
||||
block["elements"] = elements.map { $0.dictionary }
|
||||
block["block_id"] = blockId
|
||||
return block
|
||||
}
|
||||
}
|
||||
@@ -22,11 +22,32 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct Edited {
|
||||
fileprivate enum CodingKeys: String {
|
||||
case user
|
||||
case ts
|
||||
}
|
||||
|
||||
public let user: String?
|
||||
public let ts: String?
|
||||
|
||||
public init(edited: [String: Any]?) {
|
||||
user = edited?["user"] as? String
|
||||
ts = edited?["ts"] as? String
|
||||
user = edited?[CodingKeys.user.rawValue] as? String
|
||||
ts = edited?[CodingKeys.ts.rawValue] as? String
|
||||
}
|
||||
}
|
||||
|
||||
extension Edited: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||
user = try values.decodeIfPresent(String.self, forKey: .user)
|
||||
ts = try values.decodeIfPresent(String.self, forKey: .ts)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(user, forKey: .user)
|
||||
try container.encode(ts, forKey: .ts)
|
||||
}
|
||||
}
|
||||
|
||||
extension Edited.CodingKeys: CodingKey { }
|
||||
|
||||
@@ -64,6 +64,8 @@ public enum EventType: String {
|
||||
case pinRemoved = "pin_removed"
|
||||
case pong = "pong"
|
||||
case presenceChange = "presence_change"
|
||||
case memberJoinedChannel = "member_joined_channel"
|
||||
case memberLeftChannel = "member_left_channel"
|
||||
case manualPresenceChange = "manual_presence_change"
|
||||
case prefChange = "pref_change"
|
||||
case userChange = "user_change"
|
||||
@@ -151,17 +153,20 @@ public class Event {
|
||||
public let edited: Edited?
|
||||
public let bot: Bot?
|
||||
public let channel: Channel?
|
||||
public let channelType: String?
|
||||
public let comment: Comment?
|
||||
public let user: User?
|
||||
public let file: File?
|
||||
public let files: [File]
|
||||
public let message: Message?
|
||||
public let nestedMessage: Message?
|
||||
public let itemUser: String?
|
||||
public let item: Item?
|
||||
public let teamID: String?
|
||||
public let dndStatus: DoNotDisturbStatus?
|
||||
public let subteam: UserGroup?
|
||||
public let subteamID: String?
|
||||
public var profile: CustomProfile?
|
||||
public let profile: CustomProfile?
|
||||
public let inviterID: String?
|
||||
|
||||
//swiftlint:disable function_body_length
|
||||
public init(_ event: [String: Any]) {
|
||||
@@ -197,7 +202,10 @@ public class Event {
|
||||
message = Message(dictionary: event)
|
||||
nestedMessage = Message(dictionary: event["message"] as? [String: Any])
|
||||
profile = CustomProfile(profile: event["profile"] as? [String: Any])
|
||||
file = File(id: event["file"] as? String)
|
||||
files = (event["files"] as? [Any])?.compactMap { File(file: $0 as? [String: Any]) } ?? []
|
||||
channelType = event["channel_type"] as? String
|
||||
teamID = event["team"] as? String
|
||||
inviterID = event["inviter"] as? String
|
||||
|
||||
// Comment, Channel, and User can come across as Strings or Dictionaries
|
||||
if let commentDictionary = event["comment"] as? [String: Any] {
|
||||
|
||||
@@ -47,12 +47,13 @@ public final class Message: Equatable {
|
||||
public var isStarred: Bool?
|
||||
public var pinnedTo: [String]?
|
||||
public let comment: Comment?
|
||||
public let file: File?
|
||||
public var files: [File]?
|
||||
public var reactions = [Reaction]()
|
||||
public var attachments: [Attachment]?
|
||||
public var responseType: MessageResponseType?
|
||||
public var replaceOriginal: Bool?
|
||||
public var deleteOriginal: Bool?
|
||||
public let edited: Edited?
|
||||
|
||||
public init(dictionary: [String: Any]?) {
|
||||
subtype = dictionary?["subtype"] as? String
|
||||
@@ -79,12 +80,13 @@ public final class Message: Equatable {
|
||||
isStarred = dictionary?["is_starred"] as? Bool
|
||||
pinnedTo = dictionary?["pinned_to"] as? [String]
|
||||
comment = Comment(comment: dictionary?["comment"] as? [String: Any])
|
||||
file = File(file: dictionary?["file"] as? [String: Any])
|
||||
files = (dictionary?["files"] as? [[String: Any]])?.map { File(file: $0) }
|
||||
reactions = Reaction.reactionsFromArray(dictionary?["reactions"] as? [[String: Any]])
|
||||
attachments = (dictionary?["attachments"] as? [[String: Any]])?.map { Attachment(attachment: $0) }
|
||||
responseType = MessageResponseType(rawValue: dictionary?["response_type"] as? String ?? "")
|
||||
replaceOriginal = dictionary?["replace_original"] as? Bool
|
||||
deleteOriginal = dictionary?["delete_original"] as? Bool
|
||||
edited = Edited(edited:dictionary?["edited"] as? [String: Any])
|
||||
}
|
||||
|
||||
public init(ts: String?) {
|
||||
@@ -101,7 +103,7 @@ public final class Message: Equatable {
|
||||
upload = nil
|
||||
itemType = nil
|
||||
comment = nil
|
||||
file = nil
|
||||
edited = nil
|
||||
}
|
||||
|
||||
public static func == (lhs: Message, rhs: Message) -> Bool {
|
||||
|
||||
@@ -22,11 +22,32 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct Reply {
|
||||
fileprivate enum CodingKeys: String {
|
||||
case user
|
||||
case ts
|
||||
}
|
||||
|
||||
public let user: String?
|
||||
public let ts: String?
|
||||
|
||||
|
||||
public init(reply: [String: Any]?) {
|
||||
user = reply?["user"] as? String
|
||||
ts = reply?["ts"] as? String
|
||||
user = reply?[CodingKeys.user.rawValue] as? String
|
||||
ts = reply?[CodingKeys.ts.rawValue] as? String
|
||||
}
|
||||
}
|
||||
|
||||
extension Reply: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||
user = try values.decodeIfPresent(String.self, forKey: .user)
|
||||
ts = try values.decodeIfPresent(String.self, forKey: .ts)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(user, forKey: .user)
|
||||
try container.encode(ts, forKey: .ts)
|
||||
}
|
||||
}
|
||||
|
||||
extension Reply.CodingKeys: CodingKey { }
|
||||
|
||||
@@ -34,6 +34,9 @@ public struct User {
|
||||
public var image72: String?
|
||||
public var image192: String?
|
||||
public var customProfile: CustomProfile?
|
||||
public var statusText: String?
|
||||
public var statusEmoji: String?
|
||||
public var statusExpiration: Int?
|
||||
|
||||
public init(profile: [String: Any]?) {
|
||||
firstName = profile?["first_name"] as? String
|
||||
@@ -47,6 +50,9 @@ public struct User {
|
||||
image72 = profile?["image_72"] as? String
|
||||
image192 = profile?["image_192"] as? String
|
||||
customProfile = CustomProfile(customFields: profile?["fields"] as? [String: Any])
|
||||
statusText = profile?["status_text"] as? String
|
||||
statusEmoji = profile?["status_emoji"] as? String
|
||||
statusExpiration = profile?["status_expiration"] as? Int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+66
-39
@@ -1,68 +1,95 @@
|
||||
# SKRTMAPI: SlackKit RTM Module
|
||||

|
||||

|
||||

|
||||
[](https://github.com/apple/swift-package-manager)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](https://cocoapods.org)
|
||||
# SKRTMAPI
|
||||
|
||||
A module for connecting to the [Slack Real Time Messaging API](https://api.slack.com/rtm).
|
||||
Connect to the [Slack Real Time Messaging API](https://api.slack.com/rtm) in Swift.
|
||||
|
||||
## Installation
|
||||
<details>
|
||||
<summary><strong>Swift Package Manager</strong></summary>
|
||||
Add SlackKit as a dependency to your <code>Package.swift</code> and specify SKRTMAPI as a target dependency:
|
||||
|
||||
### CocoaPods
|
||||
|
||||
Add SKRTMAPI to your pod file:
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SampleApp",
|
||||
products: [
|
||||
.executable(
|
||||
name: "SampleApp",
|
||||
targets: ["SampleApp"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/pvzig/SlackKit.git", .upToNextMinor(from: "4.3.0")),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "SampleApp",
|
||||
dependencies: ["SKRTMAPI"])
|
||||
]
|
||||
)
|
||||
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SKRTMAPI'
|
||||
|
||||
**When built using Swift Package Manager, SKRTMAPI includes the [vapor websocket framework](https://github.com/vapor/websocket) by default which requires libressl.**
|
||||
|
||||
You can install it with [homebrew](https://brew.sh): `brew install libressl`
|
||||
|
||||
If you'd like to use SPM _without vapor websocket_, you can modify the [Package.swift](https://github.com/pvzig/SlackKit/blob/master/Package.swift#L18) file to exclude it:
|
||||
|
||||
```swift
|
||||
let SKRTMAPI: Target = .target(name: "SKRTMAPI",
|
||||
path: "SKRTMAPI/Sources",
|
||||
exclude: ["Conformers/VaporEngineRTM.swift"])
|
||||
|
||||
#if os(macOS)
|
||||
SKRTMAPI.dependencies = [
|
||||
"SKCore",
|
||||
"SKWebAPI",
|
||||
"Starscream"
|
||||
]
|
||||
```
|
||||
and run
|
||||
</details>
|
||||
<details>
|
||||
<summary><strong>Carthage</strong></summary>
|
||||
Add SlackKit to your <code>Cartfile</code>:
|
||||
|
||||
```
|
||||
# Use CocoaPods version >= 1.4.0
|
||||
pod install
|
||||
github "pvzig/SlackKit"
|
||||
```
|
||||
|
||||
### Carthage
|
||||
|
||||
Add SKRTMAPI to your Cartfile:
|
||||
|
||||
```
|
||||
github "SlackKit/SKRTMAPI"
|
||||
```
|
||||
and run
|
||||
|
||||
```
|
||||
carthage bootstrap
|
||||
```
|
||||
|
||||
Drag the built `SKRTMAPI.framework` into your Xcode project.
|
||||
Drag the built <code>SKRTMAPI.framework</code> and it's dependencies <code>SKCore.framework</code>, <code>SKWebAPI.framework</code>, and <code>Starscream.framework</code> into your Xcode project.
|
||||
</details>
|
||||
<details>
|
||||
<summary><strong>CocoaPods</strong></summary>
|
||||
Add SKRTMAPI to your <code>Podfile</code>:
|
||||
|
||||
### Swift Package Manager
|
||||
|
||||
Add SKRTMAPI to your Package.swift
|
||||
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/SlackKit/SKRTMAPI.git", .upToNextMinor(from: "4.1.0"))
|
||||
]
|
||||
)
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SlackKit/SKRTMAPI'
|
||||
```
|
||||
</details>
|
||||
|
||||
Run `swift build` on your application’s main directory.
|
||||
|
||||
## Usage
|
||||
To use the library in your project import it:
|
||||
|
||||
#### Carthage & SPM
|
||||
|
||||
```swift
|
||||
import SKRTMAPI
|
||||
```
|
||||
|
||||
## Usage
|
||||
#### CocoaPods
|
||||
|
||||
```swift
|
||||
import SlackKit
|
||||
```
|
||||
|
||||
### The Basics
|
||||
Initialize an instance of `SKRTMAPI` with a Slack auth token:
|
||||
|
||||
```swift
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
|
||||
#if os(macOS) || os(iOS) || os(tvOS)
|
||||
import Foundation
|
||||
#if !COCOAPODS
|
||||
import SKCore
|
||||
#endif
|
||||
import Starscream
|
||||
|
||||
public class StarscreamRTM: RTMWebSocket, WebSocketDelegate {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if os(Linux) || os(macOS)
|
||||
#if os(Linux) || os(macOS) && !COCOAPODS
|
||||
import Foundation
|
||||
import HTTP
|
||||
import WebSocket
|
||||
@@ -29,7 +29,7 @@ import WebSocket
|
||||
// Builds with *Swift Package Manager ONLY*
|
||||
public class VaporEngineRTM: RTMWebSocket {
|
||||
|
||||
private let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
|
||||
private let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
|
||||
// Delegate
|
||||
public weak var delegate: RTMDelegate?
|
||||
// Websocket
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
import Dispatch
|
||||
#endif
|
||||
import Foundation
|
||||
#if !COCOAPODS
|
||||
import SKWebAPI
|
||||
@_exported import SKCore
|
||||
#endif
|
||||
|
||||
public protocol RTMWebSocket {
|
||||
init()
|
||||
|
||||
+46
-41
@@ -1,68 +1,73 @@
|
||||
# SKServer: SlackKit Server Module
|
||||

|
||||

|
||||

|
||||
[](https://github.com/apple/swift-package-manager)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](https://cocoapods.org)
|
||||
|
||||
A server-side Swift module for creating Slack apps.
|
||||
# SKServer
|
||||
A server-side Swift framework for creating Slack apps.
|
||||
|
||||
## Installation
|
||||
<details>
|
||||
<summary><strong>Swift Package Manager</strong></summary>
|
||||
Add SlackKit as a dependency to your <code>Package.swift</code> and specify SKServer as a target dependency:
|
||||
|
||||
### CocoaPods
|
||||
|
||||
Add SKServer to your pod file:
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SampleApp",
|
||||
products: [
|
||||
.executable(
|
||||
name: "SampleApp",
|
||||
targets: ["SampleApp"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/pvzig/SlackKit.git", .upToNextMinor(from: "4.3.0")),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "SampleApp",
|
||||
dependencies: ["SKServer"])
|
||||
]
|
||||
)
|
||||
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SKServer'
|
||||
```
|
||||
and run
|
||||
</details>
|
||||
<details>
|
||||
<summary><strong>Carthage</strong></summary>
|
||||
Add SlackKit to your <code>Cartfile</code>:
|
||||
|
||||
```
|
||||
# Use CocoaPods version >= 1.4.0
|
||||
pod install
|
||||
github "pvzig/SlackKit"
|
||||
```
|
||||
|
||||
### Carthage
|
||||
|
||||
Add SKServer to your Cartfile:
|
||||
|
||||
```
|
||||
github "SlackKit/SKServer"
|
||||
```
|
||||
and run
|
||||
|
||||
```
|
||||
carthage bootstrap
|
||||
```
|
||||
|
||||
Drag the built `SKServer.framework` into your Xcode project.
|
||||
Drag the built <code>SKServer.framework</code> and it's dependencies <code>SKCore.framework</code>, <code>SKWebAPI.framework</code>, and <code>Swifter.framework</code> into your Xcode project.
|
||||
</details>
|
||||
<details>
|
||||
<summary><strong>CocoaPods</strong></summary>
|
||||
Add SKServer to your <code>Podfile</code>:
|
||||
|
||||
### Swift Package Manager
|
||||
|
||||
Add SKServer to your Package.swift
|
||||
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/SlackKit/SKServer.git", .upToNextMinor(from: "4.1.0"))
|
||||
]
|
||||
)
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SlackKit/SKServer'
|
||||
```
|
||||
</details>
|
||||
|
||||
Run `swift build` on your application’s main directory.
|
||||
|
||||
## Usage
|
||||
To use the library in your project import it:
|
||||
|
||||
#### Carthage & SPM
|
||||
|
||||
```swift
|
||||
import SKServer
|
||||
```
|
||||
|
||||
## Usage
|
||||
#### CocoaPods
|
||||
|
||||
```swift
|
||||
import SlackKit
|
||||
```
|
||||
|
||||
### The Basics
|
||||
For local development and testing of features like OAuth, slash commands, and message buttons that require connecting over https, you may want to use a tool like [ngrok](https://ngrok.com/).
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if !COCOAPODS
|
||||
import SKCore
|
||||
import SKWebAPI
|
||||
#endif
|
||||
|
||||
public struct OAuthMiddleware: Middleware {
|
||||
private let config: OAuthConfig
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if !COCOAPODS
|
||||
import SKCore
|
||||
#endif
|
||||
|
||||
public struct MessageActionRequest {
|
||||
public let action: Action?
|
||||
@@ -41,7 +43,7 @@ public struct MessageActionRequest {
|
||||
callbackID = response?["callback_id"] as? String
|
||||
team = Team(team: response?["team"] as? [String: Any])
|
||||
channel = Channel(channel: response?["channel"] as? [String: Any])
|
||||
user = User(user: response?["channel"] as? [String: Any])
|
||||
user = User(user: response?["user"] as? [String: Any])
|
||||
actionTS = response?["action_ts"] as? String
|
||||
messageTS = response?["message_ts"] as? String
|
||||
attachmentID = response?["attachment_id"] as? String
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user