├── .gitignore ├── CODEOWNERS ├── Examples ├── README.md └── SnapinsSDKExample │ ├── README.md │ ├── SnapinsSDKExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── SnapinsSDKExample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── SnapinsConfig+ActionManagerDelegate.swift │ ├── SnapinsConfig+ChatDelegate.swift │ ├── SnapinsConfig+SOSDelegate.swift │ ├── SnapinsConfig.swift │ ├── SnapinsConstants.swift │ └── ViewController.swift ├── Frameworks └── README.md ├── ISSUE_TEMPLATE ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX Files 2 | build/* 3 | .DS_Store 4 | *.swp 5 | *.lock 6 | profile 7 | 8 | # Xcode Files 9 | DerivedData/ 10 | build/ 11 | Builds/ 12 | xcuserdata 13 | 14 | # App-specific Stuff 15 | *.framework 16 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Comment line immediately above ownership line is reserved for related gus information. Please be careful while editing. 2 | #ECCN:Open Source 3 | -------------------------------------------------------------------------------- /Examples/README.md: -------------------------------------------------------------------------------- 1 | # Embedded Service SDK for iOS Examples 2 | 3 | _These sample apps demonstrate Service SDK features. They do not contain production-quality code and are not meant to be used in production apps._ 4 | 5 | ## Instructions 6 | 7 | To use an example app, drop the required framework files in the [Frameworks root directory](../Frameworks/) of this repo. You can get the framework files by downloading the iOS SDK from the [Embedded Service SDK Developer Center](https://developer.salesforce.com/developer-centers/service-cloud/sdk/). 8 | 9 | ## Sample Apps 10 | 11 | * [Embedded Service SDK Hello World Example](./SnapinsSDKExample/): A simple Embedded Service SDK Hello World app that launches Knowledge, Cases, Chat, and SOS. This app uses the action button API to display a custom action button. 12 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/README.md: -------------------------------------------------------------------------------- 1 | _This sample app demonstrates Embedded Service SDK features. It doesn't contain production-quality code and is not meant to be used in a production app._ 2 | 3 | # Embedded Service SDK Hello World Example 4 | 5 | A simple Embedded Service SDK Hello World app that launches Knowledge, Cases, Chat, and SOS. This app also uses the action button API to create a custom button with a custom action. 6 | 7 | ## Instructions 8 | 9 | To use this app, clone this repository, put the required framework files in the [Frameworks root directory](../../Frameworks/), and update the `SnapinsConstants` class with your org settings. 10 | 11 | ## Code Info 12 | 13 | * [SnapinsConstants](./SnapinsSDKExample/SnapinsConstants.swift): Contains the constants used throughout this app. Update all the relevant `TO DO` items. Be sure to `ENABLE` all the features you want enabled. 14 | * [SnapinsConfig](./SnapinsSDKExample/SnapinsConfig.swift): Configures all the enabled features. 15 | * [SnapinsConfig+ActionManagerDelegate](./SnapinsSDKExample/SnapinsConfig%2BActionManagerDelegate.swift): Delegate that handles action manager events (for the action buttons). 16 | * [SnapinsConfig+ChatDelegate](./SnapinsSDKExample/SnapinsConfig%2BChatDelegate.swift): Delegate for Live Agent Chat events. 17 | * [SnapinsConfig+SOSDelegate](./SnapinsSDKExample/SnapinsConfig%2BSOSDelegate.swift): Delegate for SOS events. 18 | * [ViewController](./SnapinsSDKExample/ViewController.swift): Launches all the Snap-ins features. 19 | * [AppDelegate](./SnapinsSDKExample/AppDelegate.swift): Initializes the Snap-ins SDK. 20 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 52; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 041FFD9F29718D5D00B5DFE1 /* ServiceChat.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 041FFD9D29718D5B00B5DFE1 /* ServiceChat.xcframework */; }; 11 | 041FFDA029718D5D00B5DFE1 /* ServiceCore.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 041FFD9E29718D5C00B5DFE1 /* ServiceCore.xcframework */; }; 12 | 87C1E3AB1ECF3F52000B2299 /* SnapinsConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87C1E3AA1ECF3F52000B2299 /* SnapinsConstants.swift */; }; 13 | 87EBF7931ECDF4A100127B7B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87EBF7921ECDF4A100127B7B /* AppDelegate.swift */; }; 14 | 87EBF7951ECDF4A100127B7B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87EBF7941ECDF4A100127B7B /* ViewController.swift */; }; 15 | 87EBF7981ECDF4A100127B7B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 87EBF7961ECDF4A100127B7B /* Main.storyboard */; }; 16 | 87EBF79A1ECDF4A100127B7B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87EBF7991ECDF4A100127B7B /* Assets.xcassets */; }; 17 | 87EBF79D1ECDF4A100127B7B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 87EBF79B1ECDF4A100127B7B /* LaunchScreen.storyboard */; }; 18 | 87F348C81ECF667B00DB9066 /* SnapinsConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87F348C71ECF667B00DB9066 /* SnapinsConfig.swift */; }; 19 | 87F348CA1ECF6E6900DB9066 /* SnapinsConfig+ChatDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87F348C91ECF6E6900DB9066 /* SnapinsConfig+ChatDelegate.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXCopyFilesBuildPhase section */ 23 | 87EBF7B31ECDF4B700127B7B /* Embed Frameworks */ = { 24 | isa = PBXCopyFilesBuildPhase; 25 | buildActionMask = 2147483647; 26 | dstPath = ""; 27 | dstSubfolderSpec = 10; 28 | files = ( 29 | ); 30 | name = "Embed Frameworks"; 31 | runOnlyForDeploymentPostprocessing = 0; 32 | }; 33 | /* End PBXCopyFilesBuildPhase section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 041FFD9D29718D5B00B5DFE1 /* ServiceChat.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = ServiceChat.xcframework; sourceTree = ""; }; 37 | 041FFD9E29718D5C00B5DFE1 /* ServiceCore.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = ServiceCore.xcframework; sourceTree = ""; }; 38 | 87C1E3AA1ECF3F52000B2299 /* SnapinsConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapinsConstants.swift; sourceTree = ""; }; 39 | 87EBF78F1ECDF4A100127B7B /* SnapinsSDKExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SnapinsSDKExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 87EBF7921ECDF4A100127B7B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | 87EBF7941ECDF4A100127B7B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | 87EBF7971ECDF4A100127B7B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | 87EBF7991ECDF4A100127B7B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | 87EBF79C1ECDF4A100127B7B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | 87EBF79E1ECDF4A100127B7B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 87F348C71ECF667B00DB9066 /* SnapinsConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapinsConfig.swift; sourceTree = ""; }; 47 | 87F348C91ECF6E6900DB9066 /* SnapinsConfig+ChatDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SnapinsConfig+ChatDelegate.swift"; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 87EBF78C1ECDF4A100127B7B /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | 041FFDA029718D5D00B5DFE1 /* ServiceCore.xcframework in Frameworks */, 56 | 041FFD9F29718D5D00B5DFE1 /* ServiceChat.xcframework in Frameworks */, 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 6FCD89461EE731020034FD59 /* Frameworks */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 041FFD9D29718D5B00B5DFE1 /* ServiceChat.xcframework */, 67 | 041FFD9E29718D5C00B5DFE1 /* ServiceCore.xcframework */, 68 | ); 69 | name = Frameworks; 70 | path = ../../Frameworks; 71 | sourceTree = ""; 72 | }; 73 | 87EBF7861ECDF4A100127B7B = { 74 | isa = PBXGroup; 75 | children = ( 76 | 87EBF7911ECDF4A100127B7B /* SnapinsSDKExample */, 77 | 87EBF7901ECDF4A100127B7B /* Products */, 78 | 6FCD89461EE731020034FD59 /* Frameworks */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | 87EBF7901ECDF4A100127B7B /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 87EBF78F1ECDF4A100127B7B /* SnapinsSDKExample.app */, 86 | ); 87 | name = Products; 88 | sourceTree = ""; 89 | }; 90 | 87EBF7911ECDF4A100127B7B /* SnapinsSDKExample */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 87C1E3AA1ECF3F52000B2299 /* SnapinsConstants.swift */, 94 | 87EBF7921ECDF4A100127B7B /* AppDelegate.swift */, 95 | 87EBF7941ECDF4A100127B7B /* ViewController.swift */, 96 | 87F348C71ECF667B00DB9066 /* SnapinsConfig.swift */, 97 | 87F348C91ECF6E6900DB9066 /* SnapinsConfig+ChatDelegate.swift */, 98 | 87EBF7961ECDF4A100127B7B /* Main.storyboard */, 99 | 87EBF7991ECDF4A100127B7B /* Assets.xcassets */, 100 | 87EBF79B1ECDF4A100127B7B /* LaunchScreen.storyboard */, 101 | 87EBF79E1ECDF4A100127B7B /* Info.plist */, 102 | ); 103 | path = SnapinsSDKExample; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 87EBF78E1ECDF4A100127B7B /* SnapinsSDKExample */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 87EBF7A11ECDF4A100127B7B /* Build configuration list for PBXNativeTarget "SnapinsSDKExample" */; 112 | buildPhases = ( 113 | 87EBF78B1ECDF4A100127B7B /* Sources */, 114 | 87EBF78C1ECDF4A100127B7B /* Frameworks */, 115 | 87EBF78D1ECDF4A100127B7B /* Resources */, 116 | 87EBF7B31ECDF4B700127B7B /* Embed Frameworks */, 117 | ); 118 | buildRules = ( 119 | ); 120 | dependencies = ( 121 | ); 122 | name = SnapinsSDKExample; 123 | productName = SnapinsSDKExample; 124 | productReference = 87EBF78F1ECDF4A100127B7B /* SnapinsSDKExample.app */; 125 | productType = "com.apple.product-type.application"; 126 | }; 127 | /* End PBXNativeTarget section */ 128 | 129 | /* Begin PBXProject section */ 130 | 87EBF7871ECDF4A100127B7B /* Project object */ = { 131 | isa = PBXProject; 132 | attributes = { 133 | LastSwiftUpdateCheck = 0800; 134 | LastUpgradeCheck = 1010; 135 | ORGANIZATIONNAME = Salesforce; 136 | TargetAttributes = { 137 | 87EBF78E1ECDF4A100127B7B = { 138 | CreatedOnToolsVersion = 8.0; 139 | DevelopmentTeam = QU4DY9U89A; 140 | LastSwiftMigration = 0900; 141 | ProvisioningStyle = Automatic; 142 | SystemCapabilities = { 143 | com.apple.BackgroundModes = { 144 | enabled = 1; 145 | }; 146 | com.apple.Keychain = { 147 | enabled = 0; 148 | }; 149 | }; 150 | }; 151 | }; 152 | }; 153 | buildConfigurationList = 87EBF78A1ECDF4A100127B7B /* Build configuration list for PBXProject "SnapinsSDKExample" */; 154 | compatibilityVersion = "Xcode 3.2"; 155 | developmentRegion = English; 156 | hasScannedForEncodings = 0; 157 | knownRegions = ( 158 | English, 159 | en, 160 | Base, 161 | ); 162 | mainGroup = 87EBF7861ECDF4A100127B7B; 163 | productRefGroup = 87EBF7901ECDF4A100127B7B /* Products */; 164 | projectDirPath = ""; 165 | projectRoot = ""; 166 | targets = ( 167 | 87EBF78E1ECDF4A100127B7B /* SnapinsSDKExample */, 168 | ); 169 | }; 170 | /* End PBXProject section */ 171 | 172 | /* Begin PBXResourcesBuildPhase section */ 173 | 87EBF78D1ECDF4A100127B7B /* Resources */ = { 174 | isa = PBXResourcesBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | 87EBF79D1ECDF4A100127B7B /* LaunchScreen.storyboard in Resources */, 178 | 87EBF79A1ECDF4A100127B7B /* Assets.xcassets in Resources */, 179 | 87EBF7981ECDF4A100127B7B /* Main.storyboard in Resources */, 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | }; 183 | /* End PBXResourcesBuildPhase section */ 184 | 185 | /* Begin PBXSourcesBuildPhase section */ 186 | 87EBF78B1ECDF4A100127B7B /* Sources */ = { 187 | isa = PBXSourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 87C1E3AB1ECF3F52000B2299 /* SnapinsConstants.swift in Sources */, 191 | 87EBF7951ECDF4A100127B7B /* ViewController.swift in Sources */, 192 | 87F348C81ECF667B00DB9066 /* SnapinsConfig.swift in Sources */, 193 | 87F348CA1ECF6E6900DB9066 /* SnapinsConfig+ChatDelegate.swift in Sources */, 194 | 87EBF7931ECDF4A100127B7B /* AppDelegate.swift in Sources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXSourcesBuildPhase section */ 199 | 200 | /* Begin PBXVariantGroup section */ 201 | 87EBF7961ECDF4A100127B7B /* Main.storyboard */ = { 202 | isa = PBXVariantGroup; 203 | children = ( 204 | 87EBF7971ECDF4A100127B7B /* Base */, 205 | ); 206 | name = Main.storyboard; 207 | sourceTree = ""; 208 | }; 209 | 87EBF79B1ECDF4A100127B7B /* LaunchScreen.storyboard */ = { 210 | isa = PBXVariantGroup; 211 | children = ( 212 | 87EBF79C1ECDF4A100127B7B /* Base */, 213 | ); 214 | name = LaunchScreen.storyboard; 215 | sourceTree = ""; 216 | }; 217 | /* End PBXVariantGroup section */ 218 | 219 | /* Begin XCBuildConfiguration section */ 220 | 87EBF79F1ECDF4A100127B7B /* Debug */ = { 221 | isa = XCBuildConfiguration; 222 | buildSettings = { 223 | ALWAYS_SEARCH_USER_PATHS = NO; 224 | CLANG_ANALYZER_NONNULL = YES; 225 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 226 | CLANG_CXX_LIBRARY = "libc++"; 227 | CLANG_ENABLE_MODULES = YES; 228 | CLANG_ENABLE_OBJC_ARC = YES; 229 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 230 | CLANG_WARN_BOOL_CONVERSION = YES; 231 | CLANG_WARN_COMMA = YES; 232 | CLANG_WARN_CONSTANT_CONVERSION = YES; 233 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 234 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 235 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 236 | CLANG_WARN_EMPTY_BODY = YES; 237 | CLANG_WARN_ENUM_CONVERSION = YES; 238 | CLANG_WARN_INFINITE_RECURSION = YES; 239 | CLANG_WARN_INT_CONVERSION = YES; 240 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 241 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 242 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 243 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 244 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 245 | CLANG_WARN_STRICT_PROTOTYPES = YES; 246 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 247 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 248 | CLANG_WARN_UNREACHABLE_CODE = YES; 249 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 250 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 251 | COPY_PHASE_STRIP = NO; 252 | DEBUG_INFORMATION_FORMAT = dwarf; 253 | ENABLE_STRICT_OBJC_MSGSEND = YES; 254 | ENABLE_TESTABILITY = YES; 255 | GCC_C_LANGUAGE_STANDARD = gnu99; 256 | GCC_DYNAMIC_NO_PIC = NO; 257 | GCC_NO_COMMON_BLOCKS = YES; 258 | GCC_OPTIMIZATION_LEVEL = 0; 259 | GCC_PREPROCESSOR_DEFINITIONS = ( 260 | "DEBUG=1", 261 | "$(inherited)", 262 | ); 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 270 | MTL_ENABLE_DEBUG_INFO = YES; 271 | ONLY_ACTIVE_ARCH = YES; 272 | SDKROOT = iphoneos; 273 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 274 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 275 | TARGETED_DEVICE_FAMILY = "1,2"; 276 | }; 277 | name = Debug; 278 | }; 279 | 87EBF7A01ECDF4A100127B7B /* Release */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ALWAYS_SEARCH_USER_PATHS = NO; 283 | CLANG_ANALYZER_NONNULL = YES; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 289 | CLANG_WARN_BOOL_CONVERSION = YES; 290 | CLANG_WARN_COMMA = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 293 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 294 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 295 | CLANG_WARN_EMPTY_BODY = YES; 296 | CLANG_WARN_ENUM_CONVERSION = YES; 297 | CLANG_WARN_INFINITE_RECURSION = YES; 298 | CLANG_WARN_INT_CONVERSION = YES; 299 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 300 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 301 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 302 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 303 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 304 | CLANG_WARN_STRICT_PROTOTYPES = YES; 305 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 306 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 307 | CLANG_WARN_UNREACHABLE_CODE = YES; 308 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 309 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 310 | COPY_PHASE_STRIP = NO; 311 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 312 | ENABLE_NS_ASSERTIONS = NO; 313 | ENABLE_STRICT_OBJC_MSGSEND = YES; 314 | GCC_C_LANGUAGE_STANDARD = gnu99; 315 | GCC_NO_COMMON_BLOCKS = YES; 316 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 317 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 318 | GCC_WARN_UNDECLARED_SELECTOR = YES; 319 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 320 | GCC_WARN_UNUSED_FUNCTION = YES; 321 | GCC_WARN_UNUSED_VARIABLE = YES; 322 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 323 | MTL_ENABLE_DEBUG_INFO = NO; 324 | SDKROOT = iphoneos; 325 | SWIFT_COMPILATION_MODE = wholemodule; 326 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 327 | TARGETED_DEVICE_FAMILY = "1,2"; 328 | VALIDATE_PRODUCT = YES; 329 | }; 330 | name = Release; 331 | }; 332 | 87EBF7A21ECDF4A100127B7B /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | buildSettings = { 335 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 336 | DEVELOPMENT_TEAM = QU4DY9U89A; 337 | ENABLE_BITCODE = NO; 338 | FRAMEWORK_SEARCH_PATHS = ( 339 | "$(inherited)", 340 | "$(PROJECT_DIR)/../../Frameworks", 341 | ); 342 | INFOPLIST_FILE = SnapinsSDKExample/Info.plist; 343 | LD_RUNPATH_SEARCH_PATHS = ( 344 | "$(inherited)", 345 | "@executable_path/Frameworks", 346 | ); 347 | PRODUCT_BUNDLE_IDENTIFIER = sf.SnapinsSDKExample; 348 | PRODUCT_NAME = "$(TARGET_NAME)"; 349 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 350 | SWIFT_VERSION = 4.0; 351 | }; 352 | name = Debug; 353 | }; 354 | 87EBF7A31ECDF4A100127B7B /* Release */ = { 355 | isa = XCBuildConfiguration; 356 | buildSettings = { 357 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 358 | DEVELOPMENT_TEAM = QU4DY9U89A; 359 | ENABLE_BITCODE = NO; 360 | FRAMEWORK_SEARCH_PATHS = ( 361 | "$(inherited)", 362 | "$(PROJECT_DIR)/../../Frameworks", 363 | ); 364 | INFOPLIST_FILE = SnapinsSDKExample/Info.plist; 365 | LD_RUNPATH_SEARCH_PATHS = ( 366 | "$(inherited)", 367 | "@executable_path/Frameworks", 368 | ); 369 | PRODUCT_BUNDLE_IDENTIFIER = sf.SnapinsSDKExample; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 372 | SWIFT_VERSION = 4.0; 373 | }; 374 | name = Release; 375 | }; 376 | /* End XCBuildConfiguration section */ 377 | 378 | /* Begin XCConfigurationList section */ 379 | 87EBF78A1ECDF4A100127B7B /* Build configuration list for PBXProject "SnapinsSDKExample" */ = { 380 | isa = XCConfigurationList; 381 | buildConfigurations = ( 382 | 87EBF79F1ECDF4A100127B7B /* Debug */, 383 | 87EBF7A01ECDF4A100127B7B /* Release */, 384 | ); 385 | defaultConfigurationIsVisible = 0; 386 | defaultConfigurationName = Release; 387 | }; 388 | 87EBF7A11ECDF4A100127B7B /* Build configuration list for PBXNativeTarget "SnapinsSDKExample" */ = { 389 | isa = XCConfigurationList; 390 | buildConfigurations = ( 391 | 87EBF7A21ECDF4A100127B7B /* Debug */, 392 | 87EBF7A31ECDF4A100127B7B /* Release */, 393 | ); 394 | defaultConfigurationIsVisible = 0; 395 | defaultConfigurationName = Release; 396 | }; 397 | /* End XCConfigurationList section */ 398 | }; 399 | rootObject = 87EBF7871ECDF4A100127B7B /* Project object */; 400 | } 401 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SnapinsSDKExample 4 | // 5 | // 6 | 7 | import UIKit 8 | 9 | @UIApplicationMain 10 | class AppDelegate: UIResponder, UIApplicationDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 15 | 16 | // Run the Snapins configuration process 17 | SnapinsConfig.instance.initialize() 18 | 19 | return true 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSAppTransportSecurity 24 | 25 | NSExceptionDomains 26 | 27 | localhost 28 | 29 | NSExceptionAllowsInsecureHTTPLoads 30 | 31 | 32 | 33 | 34 | NSCameraUsageDescription 35 | $(PRODUCT_NAME) camera use 36 | NSMicrophoneUsageDescription 37 | $(PRODUCT_NAME) microphone use 38 | NSPhotoLibraryUsageDescription 39 | $(PRODUCT_NAME) photo use 40 | UIBackgroundModes 41 | 42 | audio 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIMainStoryboardFile 47 | Main 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UISupportedInterfaceOrientations~ipad 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/SnapinsConfig+ActionManagerDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController+ActionManagerDelegate.swift 3 | // SnapinsSDKExample 4 | // 5 | 6 | import Foundation 7 | import ServiceCore 8 | 9 | /** 10 | Adds an action manager delegate to `SnapinsConfig`. 11 | This delegate handles events related to the action button API. 12 | */ 13 | extension SnapinsConfig : SCSActionManagerDelegate { 14 | 15 | /** 16 | Determines which actions to show for a given controller. 17 | */ 18 | func actionManager(_ actionManager: SCSActionManager, 19 | actionsToShowFor controller: UIViewController?, 20 | withDefaultActions defaultActions: Set) 21 | -> Set? { 22 | var mySet = defaultActions 23 | 24 | // Add our custom action button. 25 | // (In this case, we're always adding the action button, but 26 | // you can inspect `controller` to determine whether you want 27 | // to add a custom button for a given view controller...) 28 | if (SnapinsConstants.ENABLE_CUSTOM_ACTION_BUTTONS) { 29 | mySet.insert(SCSAction(SnapinsConstants.CUSTOM_ACTION_NAME)) 30 | } 31 | 32 | return mySet 33 | } 34 | 35 | /** 36 | Shows the button for a given action. 37 | */ 38 | func actionManager(_ actionManager: SCSActionManager, 39 | viewForActionItemWithName name: SCSAction) 40 | -> (UIView & SCSActionItem)? { 41 | if name.rawValue == SnapinsConstants.CUSTOM_ACTION_NAME { 42 | 43 | // Create our custom action button 44 | let customActionButton = SCSActionButton() 45 | customActionButton.setTitle(SnapinsConstants.CUSTOM_ACTION_TITLE, for: .normal) 46 | customActionButton.addTarget(self, action: #selector(myCustomButtonHandler), for: .touchUpInside) 47 | 48 | return customActionButton 49 | } 50 | 51 | return nil 52 | } 53 | 54 | /** 55 | Handler for the custom action. 56 | */ 57 | @objc func myCustomButtonHandler(sender: UIButton!) { 58 | ServiceCloud.shared().knowledge.setInterfaceVisible(false, animated: true, completion: nil) 59 | 60 | let alert = UIAlertController(title: "Custom Action", 61 | message: "Here is where you can provide a custom action!", 62 | preferredStyle: .alert) 63 | let okAction = UIAlertAction(title: "OK", 64 | style: .default, 65 | handler: nil) 66 | alert.addAction(okAction) 67 | 68 | let appDelegate = UIApplication.shared.delegate as! AppDelegate 69 | appDelegate.window?.rootViewController?.present(alert, animated: true, completion: nil) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/SnapinsConfig+ChatDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController+ SCSChatDelegate.swift 3 | // SnapinsSDKExample 4 | // 5 | 6 | import Foundation 7 | import ServiceCore 8 | import ServiceChat 9 | 10 | /** 11 | Adds a chat delegate to `SnapinsConfig`. 12 | This delegate handles events related to a Live Agent Chat session. 13 | */ 14 | extension SnapinsConfig : SCSChatSessionDelegate { 15 | /** 16 | Called when a chat session ends. 17 | */ 18 | func session(_ session: SCSChatSession!, didEnd endEvent: SCSChatSessionEndEvent!) { 19 | 20 | var description = "" 21 | 22 | // Here we'll handle the situation where the agent ends the session 23 | // and when there are no agents available... 24 | switch (endEvent.reason) { 25 | case .agent: 26 | description = "The agent ended the session." 27 | case .noAgentsAvailable: 28 | description = "It looks like there are no agents available. Try again later." 29 | default: 30 | break 31 | } 32 | 33 | if (description != "") { 34 | let alert = UIAlertController(title: "Chat Session Ended", 35 | message: description, 36 | preferredStyle: .alert) 37 | let okAction = UIAlertAction(title: "OK", 38 | style: .default, 39 | handler: nil) 40 | alert.addAction(okAction) 41 | 42 | 43 | let appDelegate = UIApplication.shared.delegate as! AppDelegate 44 | appDelegate.window?.rootViewController?.present(alert, animated: true, completion: nil) 45 | } 46 | } 47 | 48 | /** 49 | Called when an error occurs. 50 | */ 51 | func session(_ session: SCSChatSession!, didError error: Error!, fatal: Bool) { 52 | // TO DO: Handle error conditions 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/SnapinsConfig+SOSDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController+SOSDelegate.swift 3 | // SnapinsSDKExample 4 | // 5 | 6 | import Foundation 7 | 8 | import ServiceCore 9 | import ServiceSOS 10 | 11 | /** 12 | Adds an SOS delegate to `SnapinsConfig`. 13 | This delegate handles events related to an SOS session. 14 | */ 15 | extension SnapinsConfig : SOSDelegate { 16 | 17 | /** 18 | Called when an SOS session ends. 19 | */ 20 | func sos(_ sos: SOSSessionManager!, didStopWith reason: SOSStopReason, 21 | error: Error!) { 22 | 23 | var title = "" 24 | var description = "" 25 | 26 | // If there's an error... 27 | if (error != nil) { 28 | 29 | switch (error as NSError).code { 30 | 31 | // No agents available 32 | case SOSErrorCode.SOSNoAgentsAvailableError.rawValue: 33 | title = "SOS Session Failed" 34 | description = "It looks like there are no agents available. Try again later." 35 | 36 | // Insufficient network error 37 | case SOSErrorCode.SOSInsufficientNetworkError.rawValue: 38 | title = "SOS Session Failed" 39 | description = "Insufficient network. Check network quality and try again." 40 | 41 | // Can't create a session 42 | case SOSErrorCode.SOSServerSessionCreationError.rawValue: 43 | title = "SOS Session Failed" 44 | description = "Unable to create a session. Check your configuration values." 45 | 46 | // TO DO: Use SOSErrorCode to check for ALL other error conditions 47 | // in order to give a more clear explanation of the error. 48 | default: 49 | title = "Session Error" 50 | description = "Unknown session error. \((error as NSError).code)" 51 | } 52 | 53 | // Else if session stopped without an error condition... 54 | } else { 55 | 56 | switch reason { 57 | 58 | // Handle the agent disconnect scenario 59 | case .agentDisconnected: 60 | title = "SOS Session Ended" 61 | description = "The agent has ended the session." 62 | 63 | // TO DO: Use SOSStopReason to check for 64 | // other reasons for session ending... 65 | default: 66 | break 67 | } 68 | } 69 | 70 | // Display dialog if we have something to say... 71 | if (title != "") { 72 | 73 | let alert = UIAlertController(title: title, 74 | message: description, 75 | preferredStyle: .alert) 76 | let okAction = UIAlertAction(title: "OK", 77 | style: .default, 78 | handler: nil) 79 | alert.addAction(okAction) 80 | 81 | let appDelegate = UIApplication.shared.delegate as! AppDelegate 82 | appDelegate.window?.rootViewController?.present(alert, animated: true, completion: nil) 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/SnapinsConfig.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapinsConfig.swift 3 | // SnapinsSDKExample 4 | // 5 | 6 | import Foundation 7 | import ServiceCore 8 | import ServiceChat 9 | 10 | /** 11 | This is a helper class that configures all the features for Snap-ins. 12 | */ 13 | class SnapinsConfig : NSObject { 14 | 15 | private static var config: SnapinsConfig? 16 | 17 | var chatConfig: SCSChatConfiguration? 18 | 19 | /** 20 | Gets the singleton SnapinsConfig instance. 21 | */ 22 | static var instance: SnapinsConfig { 23 | if (config == nil) { 24 | config = SnapinsConfig() 25 | } 26 | return config! 27 | } 28 | 29 | /** 30 | One time setup for the Snapins configuration. 31 | This is called from the AppDelegate. 32 | */ 33 | func initialize() { 34 | initializeChat() 35 | } 36 | 37 | /** 38 | One time configuration for Chat. 39 | */ 40 | func initializeChat() { 41 | let serviceCloud = ServiceCloud.shared() 42 | 43 | if SnapinsConstants.ENABLE_CHAT { 44 | 45 | // Create a configuration object for Chat 46 | chatConfig = SCSChatConfiguration(liveAgentPod: SnapinsConstants.CHAT_POD_NAME, 47 | orgId: SnapinsConstants.CHAT_ORG_ID, 48 | deploymentId: SnapinsConstants.CHAT_DEPLOYMENT_ID, 49 | buttonId: SnapinsConstants.CHAT_BUTTON_ID) 50 | 51 | // Add support for pre-chat fields 52 | if (SnapinsConstants.ENABLE_PRECHAT_FIELDS) { 53 | configurePrechat(config: chatConfig) 54 | } 55 | 56 | // Add self as a chat delegate 57 | serviceCloud.chatCore.add(delegate: self) 58 | } 59 | } 60 | 61 | /** 62 | Configures pre-chat data for Chat. 63 | */ 64 | func configurePrechat(config: SCSChatConfiguration?) { 65 | 66 | // Create some basic pre-chat fields (with user input) 67 | let firstNameField = SCSPrechatTextInputObject(label: "First Name") 68 | firstNameField!.isRequired = true 69 | let lastNameField = SCSPrechatTextInputObject(label: "Last Name") 70 | lastNameField!.isRequired = true 71 | let emailField = SCSPrechatTextInputObject(label: "Email") 72 | emailField!.isRequired = true 73 | emailField!.keyboardType = .emailAddress 74 | emailField!.autocorrectionType = .no 75 | 76 | // Create a pre-chat field without user input 77 | // (This illustrates a good way to directly send data to your org.) 78 | let subjectField = SCSPrechatObject(label: "Subject", value: "Chat case created by app") 79 | 80 | // Update config object with the pre-chat fields 81 | config?.prechatFields = 82 | [firstNameField, lastNameField, emailField, subjectField] as? [SCSPrechatObject] 83 | 84 | // Create an entity mapping for a Contact record type 85 | // (All this entity stuff is only required if you 86 | // want to map transcript fields to other Salesforce records.) 87 | let contactEntity = SCSPrechatEntity(entityName: "Contact") 88 | contactEntity.saveToTranscript = "Contact" 89 | contactEntity.linkToEntityName = "Case" 90 | contactEntity.linkToEntityField = "ContactId" 91 | 92 | // Add some field mappings to our Contact record 93 | let firstNameEntityField = SCSPrechatEntityField(fieldName: "FirstName", label: "First Name") 94 | firstNameEntityField.doFind = true 95 | firstNameEntityField.isExactMatch = true 96 | firstNameEntityField.doCreate = true 97 | contactEntity.entityFieldsMaps.add(firstNameEntityField) 98 | let lastNameEntityField = SCSPrechatEntityField(fieldName: "LastName", label: "Last Name") 99 | lastNameEntityField.doFind = true 100 | lastNameEntityField.isExactMatch = true 101 | lastNameEntityField.doCreate = true 102 | contactEntity.entityFieldsMaps.add(lastNameEntityField) 103 | let emailEntityField = SCSPrechatEntityField(fieldName: "Email", label: "Email") 104 | emailEntityField.doFind = true 105 | emailEntityField.isExactMatch = true 106 | emailEntityField.doCreate = true 107 | contactEntity.entityFieldsMaps.add(emailEntityField) 108 | 109 | // Create an entity mapping for a Case record type 110 | let caseEntity = SCSPrechatEntity(entityName: "Case") 111 | caseEntity.saveToTranscript = "Case" 112 | caseEntity.showOnCreate = true 113 | 114 | // Add one field mappings to our Case record 115 | let subjectEntityField = SCSPrechatEntityField(fieldName: "Subject", label: "Subject") 116 | subjectEntityField.doCreate = true 117 | caseEntity.entityFieldsMaps.add(subjectEntityField) 118 | 119 | // Update config object with the entity mappings 120 | // (This is only required if you want to map transcript 121 | // fields to other Salesforce records.) 122 | config?.prechatEntities = [contactEntity, caseEntity] 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/SnapinsConstants.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigurationSettings.swift 3 | // SnapinsSDKExample 4 | // 5 | 6 | import Foundation 7 | import ServiceCore 8 | 9 | /** 10 | Snap-ins constant values used throughout this app. 11 | Update these values with your org settings. 12 | Be sure to set the appropriate ENABLE_ values to true. 13 | See the Snap-ins Developer's Guide for more info: 14 | https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/servicesdk_ios_dev_guide.htm 15 | */ 16 | class SnapinsConstants { 17 | 18 | // Live Agent Chat Config 19 | // TO DO: These variables are required for Chat... 20 | static let ENABLE_CHAT = false 21 | static let ENABLE_PRECHAT_FIELDS = false 22 | static let CHAT_POD_NAME = "d.<#pod_name#>.com" 23 | static let CHAT_ORG_ID = "<#org_id#>" 24 | static let CHAT_DEPLOYMENT_ID = "<#deployment_id#>" 25 | static let CHAT_BUTTON_ID = "<#button_id#>" 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Examples/SnapinsSDKExample/SnapinsSDKExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SnapinsSDKExample 4 | // 5 | 6 | import UIKit 7 | 8 | import ServiceCore 9 | import ServiceChat 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var chatButton: UIButton! 14 | @IBOutlet weak var nothingEnabledLabel: UILabel! 15 | 16 | /** 17 | Determines whether any Snap-ins features are enabled. 18 | */ 19 | let somethingIsEnabled = SnapinsConstants.ENABLE_CHAT 20 | 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | 24 | // Enable the relevant Snap-ins buttons and labels 25 | nothingEnabledLabel.isHidden = somethingIsEnabled 26 | chatButton.isHidden = !SnapinsConstants.ENABLE_CHAT 27 | } 28 | 29 | /** 30 | Starts Live Agent Chat. 31 | */ 32 | @IBAction func startChat(_ sender: Any) { 33 | 34 | ServiceCloud.shared().chatUI.showChat(with: SnapinsConfig.instance.chatConfig!, 35 | showPrechat: SnapinsConstants.ENABLE_PRECHAT_FIELDS) 36 | 37 | // Use this command instead of above if you never need to show a pre-chat form... 38 | // ServiceCloud.shared().chatUI.showChat(with: SnapinsConfig.instance.chatConfig!) 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Frameworks/README.md: -------------------------------------------------------------------------------- 1 | ## Instructions 2 | 3 | To use the [examples](../Examples/), put the required framework files here. 4 | 5 | You can get the framework files by downloading the iOS SDK from the [Snap-ins Product Page](https://developer.salesforce.com/page/SnapinsMobile). 6 | 7 | The following framework files are included with the SDK: 8 | 9 | * `ServiceCore.framework` 10 | * `ServiceKnowledge.framework` 11 | * `ServiceCases.framework` 12 | * `ServiceChat.framework` 13 | * `ServiceSOS.framework` 14 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE: -------------------------------------------------------------------------------- 1 | Before filing an issue: 2 | ----------------------- 3 | - Attempt to reproduce the issue using 4 | [this sample application](Examples/SnapinsSDKExample/). 5 | - Search [existing issues](https://github.com/forcedotcom/ServiceSDK-iOS/issues), 6 | including issues that are closed. 7 | - Review the "Known Issues" 8 | [section of our release documentation](https://github.com/forcedotcom/ServiceSDK-iOS/releases) 9 | for your issue. 10 | - If this is an implementation-specific question, refer to the 11 | [Snap-Ins for iOS Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.noversion.service_sdk_ios.meta/service_sdk_ios/servicesdk_ios_dev_guide.htm) 12 | or the [Snap-Ins API Reference](http://forcedotcom.github.io/ServiceSDK-iOS/). 13 | 14 | **NOTE**: This issue tracker is intended for bugs and iOS Snap-ins SDK 15 | specific questions. If you're asking a general iOS development question, 16 | please do so on Stack Overflow. 17 | 18 | When reporting a bug: 19 | ----------------------- 20 | Fill out the sections below, leaving the headers but replacing the content. If 21 | you're unable to provide certain information, please explain why in the relevant 22 | section. We may close issues if they do not include sufficient information. 23 | 24 | ### Issue description 25 | Describe the issue in detail, including observed and expected behavior. 26 | 27 | ### Reproduction steps 28 | Describe how the issue can be reproduced, ideally using 29 | [this sample application](Examples/SnapinsSDKExample/). 30 | Please indicate if the issue was reproduced while the user was authenticated 31 | or unauthenticated. Include any sample code that can help us reproduce the issue. 32 | 33 | ### Version of SDK components being used 34 | Specify the absolute version number. Avoid using terms such as "latest". 35 | 36 | ### Device(s) and version(s) of iOS being used 37 | Specify the devices and versions of iOS on which the issue can be 38 | reproduced, and how easily it reproduces. If possible, please test on multiple 39 | devices and iOS versions. 40 | 41 | ### Screenshots / Videos 42 | Please provide any screenshots or videos which can be used to help clarify the issue. 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, Salesforce.com, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Next Generation Salesforce Chat Product 2 | Check out Messaging for In-App, a newer chat solution for mobile apps. 3 | 4 | * To learn more, see the [Messaging for In-App Developer Guide](https://developer.salesforce.com/docs/service/messaging-in-app/overview). 5 | * Try out an example from our [Messaging for In-App Sample App Repo](https://github.com/Salesforce-Async-Messaging/messaging-in-app-ios/tree/master/examples). 6 | 7 | # Embedded Service SDK for iOS 8 | 9 | Welcome to the Embedded Service SDK for iOS GitHub repository! 10 | 11 | ## Links 12 | 13 | * [Download the SDK](https://github.com/forcedotcom/ServiceSDK-iOS/wiki/Get-the-iOS-SDK) 14 | * [iOS Release Notes](https://github.com/forcedotcom/ServiceSDK-iOS/releases) 15 | * [iOS Developer's Guide](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/servicesdk_ios_dev_guide.htm) 16 | * [iOS Reference Documentation](http://forcedotcom.github.io/ServiceSDK-iOS/) 17 | * [iOS Examples](./Examples/) 18 | 19 | 20 | --------------------------------------------------------------------------------