diff --git a/BasicSample/BasicSample.xcodeproj/project.pbxproj b/BasicSample/BasicSample.xcodeproj/project.pbxproj index 4caacd0..0f1d3c5 100644 --- a/BasicSample/BasicSample.xcodeproj/project.pbxproj +++ b/BasicSample/BasicSample.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 117F9628027092819701291C /* Pods_BasicSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86E2E9C5B0AFCDBBF1BC6751 /* Pods_BasicSample.framework */; }; 483EA67C2369CA7100B9BBE1 /* HandOverHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 483EA67B2369CA7000B9BBE1 /* HandOverHandler.swift */; }; 4848892022EEF871000CF01E /* EmbedDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4848891F22EEF871000CF01E /* EmbedDemoViewController.swift */; }; 484F087023D5AFE30013046C /* LiveAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 484F086F23D5AFE30013046C /* LiveAccountViewController.swift */; }; @@ -42,7 +43,6 @@ 48A5A19A22761DCB0073F57B /* MainTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A5A19922761DCB0073F57B /* MainTableViewController.swift */; }; 48A5A19C227635FD0073F57B /* DemoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A5A19B227635FD0073F57B /* DemoTableViewCell.swift */; }; 48F6DBA2230C4220008EA1A0 /* AutoCompleteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48F6DBA1230C4220008EA1A0 /* AutoCompleteViewController.swift */; }; - 70C202F694A74F6E9395CD9F /* Pods_BasicSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 716BEB2BF8B887A84DE4858E /* Pods_BasicSample.framework */; }; AF12C8A321D22C90007450EF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF12C8A221D22C90007450EF /* AppDelegate.swift */; }; AF12C8A821D22C90007450EF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF12C8A621D22C90007450EF /* Main.storyboard */; }; AF12C8AA21D22C91007450EF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AF12C8A921D22C91007450EF /* Assets.xcassets */; }; @@ -50,10 +50,13 @@ AF91186C238D1583007F5D3A /* CustomFileUploadDemoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF91186B238D1583007F5D3A /* CustomFileUploadDemoVC.swift */; }; AF911888239000DB007F5D3A /* FileUploadDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF911887239000DB007F5D3A /* FileUploadDemoViewController.swift */; }; AFF9BCAB22E86CC60078DD8A /* AvailibilityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFF9BCAA22E86CC60078DD8A /* AvailibilityViewController.swift */; }; + EC4BF4DF2554602F00AF438D /* BoldFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC4BF4DE2554602F00AF438D /* BoldFormViewController.swift */; }; + ECDE8DF924EC749F00BC3152 /* ChatConfigurationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECDE8DF824EC749E00BC3152 /* ChatConfigurationHandler.swift */; }; ECE12751231BB34700A362C7 /* ContinuityDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECE12750231BB34700A362C7 /* ContinuityDemoViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 460F34D57B754A571CF96822 /* Pods-BasicSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BasicSample.release.xcconfig"; path = "Target Support Files/Pods-BasicSample/Pods-BasicSample.release.xcconfig"; sourceTree = ""; }; 483EA67B2369CA7000B9BBE1 /* HandOverHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandOverHandler.swift; sourceTree = ""; }; 4848891F22EEF871000CF01E /* EmbedDemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmbedDemoViewController.swift; sourceTree = ""; }; 484F086F23D5AFE30013046C /* LiveAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveAccountViewController.swift; sourceTree = ""; }; @@ -89,9 +92,7 @@ 48A5A19922761DCB0073F57B /* MainTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTableViewController.swift; sourceTree = ""; }; 48A5A19B227635FD0073F57B /* DemoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoTableViewCell.swift; sourceTree = ""; }; 48F6DBA1230C4220008EA1A0 /* AutoCompleteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCompleteViewController.swift; sourceTree = ""; }; - 567A596874F0DFCA554E587C /* Pods-BasicSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BasicSample.debug.xcconfig"; path = "Target Support Files/Pods-BasicSample/Pods-BasicSample.debug.xcconfig"; sourceTree = ""; }; - 716BEB2BF8B887A84DE4858E /* Pods_BasicSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BasicSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A94C83895BEB749345637473 /* Pods-BasicSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BasicSample.release.xcconfig"; path = "Target Support Files/Pods-BasicSample/Pods-BasicSample.release.xcconfig"; sourceTree = ""; }; + 86E2E9C5B0AFCDBBF1BC6751 /* Pods_BasicSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BasicSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AF12C89F21D22C90007450EF /* BasicSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BasicSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; AF12C8A221D22C90007450EF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; AF12C8A721D22C90007450EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -102,6 +103,9 @@ AF91186B238D1583007F5D3A /* CustomFileUploadDemoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomFileUploadDemoVC.swift; sourceTree = ""; }; AF911887239000DB007F5D3A /* FileUploadDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileUploadDemoViewController.swift; sourceTree = ""; }; AFF9BCAA22E86CC60078DD8A /* AvailibilityViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvailibilityViewController.swift; sourceTree = ""; }; + C10093AD161A26F8875E4BC3 /* Pods-BasicSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BasicSample.debug.xcconfig"; path = "Target Support Files/Pods-BasicSample/Pods-BasicSample.debug.xcconfig"; sourceTree = ""; }; + EC4BF4DE2554602F00AF438D /* BoldFormViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoldFormViewController.swift; sourceTree = ""; }; + ECDE8DF824EC749E00BC3152 /* ChatConfigurationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatConfigurationHandler.swift; sourceTree = ""; }; ECE12750231BB34700A362C7 /* ContinuityDemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContinuityDemoViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -110,13 +114,21 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 70C202F694A74F6E9395CD9F /* Pods_BasicSample.framework in Frameworks */, + 117F9628027092819701291C /* Pods_BasicSample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2FA818ECA61C16220CBC0169 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 86E2E9C5B0AFCDBBF1BC6751 /* Pods_BasicSample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 483EA67A2369CA5000B9BBE1 /* HandOver */ = { isa = PBXGroup; children = ( @@ -157,6 +169,7 @@ 487351CA22784A260029F295 /* ChatViewControllers */ = { isa = PBXGroup; children = ( + ECDE8DF824EC749E00BC3152 /* ChatConfigurationHandler.swift */, 4899613F22763AD500D86590 /* BotDemoViewController.swift */, 4899614122763B1800D86590 /* AgentViewController.swift */, 487351CB22784A7F0029F295 /* HistoryDemoViewController.swift */, @@ -166,6 +179,7 @@ 48F6DBA1230C4220008EA1A0 /* AutoCompleteViewController.swift */, AFF9BCAA22E86CC60078DD8A /* AvailibilityViewController.swift */, ECE12750231BB34700A362C7 /* ContinuityDemoViewController.swift */, + EC4BF4DE2554602F00AF438D /* BoldFormViewController.swift */, ); path = ChatViewControllers; sourceTree = ""; @@ -185,21 +199,13 @@ path = RestoreChat; sourceTree = ""; }; - 66BA36762FAFD6F85F90A58C /* Frameworks */ = { - isa = PBXGroup; - children = ( - 716BEB2BF8B887A84DE4858E /* Pods_BasicSample.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; AF12C89621D22C90007450EF = { isa = PBXGroup; children = ( AF12C8A121D22C90007450EF /* BasicSample */, AF12C8A021D22C90007450EF /* Products */, B7C6AE904CE1881071FF9D83 /* Pods */, - 66BA36762FAFD6F85F90A58C /* Frameworks */, + 2FA818ECA61C16220CBC0169 /* Frameworks */, ); sourceTree = ""; }; @@ -246,8 +252,8 @@ B7C6AE904CE1881071FF9D83 /* Pods */ = { isa = PBXGroup; children = ( - 567A596874F0DFCA554E587C /* Pods-BasicSample.debug.xcconfig */, - A94C83895BEB749345637473 /* Pods-BasicSample.release.xcconfig */, + C10093AD161A26F8875E4BC3 /* Pods-BasicSample.debug.xcconfig */, + 460F34D57B754A571CF96822 /* Pods-BasicSample.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -259,11 +265,11 @@ isa = PBXNativeTarget; buildConfigurationList = AF12C8B121D22C91007450EF /* Build configuration list for PBXNativeTarget "BasicSample" */; buildPhases = ( - C61500C395C2E54F8C60C0CC /* [CP] Check Pods Manifest.lock */, + ECB204F3E623BF23101324C5 /* [CP] Check Pods Manifest.lock */, AF12C89B21D22C90007450EF /* Sources */, AF12C89C21D22C90007450EF /* Frameworks */, AF12C89D21D22C90007450EF /* Resources */, - 6F16FEBC99C7BE7BB0F2E34D /* [CP] Embed Pods Frameworks */, + BBCD852A61BA3C7CED430E91 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -281,7 +287,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0940; - LastUpgradeCheck = 0940; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = bold360ai; TargetAttributes = { AF12C89E21D22C90007450EF = { @@ -334,7 +340,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 6F16FEBC99C7BE7BB0F2E34D /* [CP] Embed Pods Frameworks */ = { + BBCD852A61BA3C7CED430E91 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -351,7 +357,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-BasicSample/Pods-BasicSample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - C61500C395C2E54F8C60C0CC /* [CP] Check Pods Manifest.lock */ = { + ECB204F3E623BF23101324C5 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -385,6 +391,7 @@ 48996152227741B300D86590 /* RestoreChat.swift in Sources */, 48A5A19C227635FD0073F57B /* DemoTableViewCell.swift in Sources */, 48A5A19A22761DCB0073F57B /* MainTableViewController.swift in Sources */, + EC4BF4DF2554602F00AF438D /* BoldFormViewController.swift in Sources */, 486C0B2723D4624700544AAE /* SwitchTableViewCell.swift in Sources */, 486C0B2423D4624700544AAE /* InputTableViewCell.swift in Sources */, 486C0B3823D46C9100544AAE /* OptionButton.swift in Sources */, @@ -393,6 +400,7 @@ ECE12751231BB34700A362C7 /* ContinuityDemoViewController.swift in Sources */, AFF9BCAB22E86CC60078DD8A /* AvailibilityViewController.swift in Sources */, 483EA67C2369CA7100B9BBE1 /* HandOverHandler.swift in Sources */, + ECDE8DF924EC749F00BC3152 /* ChatConfigurationHandler.swift in Sources */, 487351CC22784A7F0029F295 /* HistoryDemoViewController.swift in Sources */, 486C0B2823D4624700544AAE /* AddContextTableViewCell.swift in Sources */, 4899614822773FD300D86590 /* RestoredChatDemo.xcdatamodeld in Sources */, @@ -463,6 +471,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -523,6 +532,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -553,7 +563,7 @@ }; AF12C8B221D22C91007450EF /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 567A596874F0DFCA554E587C /* Pods-BasicSample.debug.xcconfig */; + baseConfigurationReference = C10093AD161A26F8875E4BC3 /* Pods-BasicSample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -573,7 +583,7 @@ }; AF12C8B321D22C91007450EF /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A94C83895BEB749345637473 /* Pods-BasicSample.release.xcconfig */; + baseConfigurationReference = 460F34D57B754A571CF96822 /* Pods-BasicSample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; diff --git a/BasicSample/BasicSample.xcodeproj/xcshareddata/xcschemes/BasicSample.xcscheme b/BasicSample/BasicSample.xcodeproj/xcshareddata/xcschemes/BasicSample.xcscheme index 86864ed..492ca6f 100644 --- a/BasicSample/BasicSample.xcodeproj/xcshareddata/xcschemes/BasicSample.xcscheme +++ b/BasicSample/BasicSample.xcodeproj/xcshareddata/xcschemes/BasicSample.xcscheme @@ -1,6 +1,6 @@ Void)!) { + if (completionHandler != nil) { + DispatchQueue.main.async { + if form.form?.type == BCFormTypePostChat { + let mainStoryboard = UIStoryboard(name: "Main", bundle: nil) + let postVC = mainStoryboard.instantiateViewController(withIdentifier: "boldForm") as! BoldFormViewController + postVC.form = form + completionHandler(postVC) + } else { + completionHandler(nil) + } + } + } + } + func didFailWithError(_ error: BLDError!) { var errorMsg = String() switch error.type { @@ -87,12 +104,13 @@ extension BotDemoViewController: ChatControllerDelegate { break } - let alert = UIAlertController(title: "Error!", message: errorMsg, preferredStyle: .alert) - alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: { (action) in - self.navigationController?.popToRootViewController(animated: true) - })) - - self.navigationController?.present(alert, animated: true, completion: nil) + DispatchQueue.main.async { + let alert = UIAlertController(title: "Error!", message: errorMsg, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: { (action) in + self.navigationController?.popToRootViewController(animated: true) + })) + self.navigationController?.present(alert, animated: true, completion: nil) + } } func didUpdateState(_ event: ChatStateEvent!) { @@ -102,6 +120,7 @@ extension BotDemoViewController: ChatControllerDelegate { break case .started: print("ChatStarted") +// self.chatController.clearCache(withInvalidDays: 0) break case .accepted: print("ChatAccepted") @@ -136,7 +155,7 @@ extension BotDemoViewController: ChatControllerDelegate { // } } -extension BotDemoViewController: ContinuityProvider{ +extension BotDemoViewController: ContinuityProvider { func updateContinuityInfo(_ params: [String : String]!) { params.forEach { (key, value) in UserDefaults.standard.set(value, forKey: key) @@ -148,7 +167,9 @@ extension BotDemoViewController: ContinuityProvider{ if (key == "UserID") { handler("112233443322154534") } else { - handler(UserDefaults.standard.value(forKey: key) as? String) +// handler(UserDefaults.standard.value(forKey: key) as? String) + handler("112233443322154534") + } } } diff --git a/BasicSample/BasicSample/ChatViewControllers/ChatConfigurationHandler.swift b/BasicSample/BasicSample/ChatViewControllers/ChatConfigurationHandler.swift new file mode 100644 index 0000000..140e930 --- /dev/null +++ b/BasicSample/BasicSample/ChatViewControllers/ChatConfigurationHandler.swift @@ -0,0 +1,220 @@ +// +// ChatConfigurationHandler.swift +// BasicSample +// +// Created by Omer Rahmany on 16/08/2020. +// Copyright © 2020 bold360ai. All rights reserved. +// + +import UIKit +import Bold360AI + +class ChatConfigurationHandler: NSObject { + + private var customFont:CustomFont + + override init() { + customFont = CustomFont() + } + + var defaultConfig: Bold360AI.ChatConfiguration { + get { + return Bold360AI.ChatConfiguration() + } + } + + + var test:Bold360AI.ChatConfiguration { + get { + let config = Bold360AI.ChatConfiguration() +// config.chatViewConfig.backgroundColor = UIColor.gray +// config.chatViewConfig.backgroundImage = UIImage(named: "bold") +// config.chatViewConfig.dateStampColor = UIColor.red +// config.chatViewConfig.customFont = customFont +// // TODO:: make sure it works +// config.chatViewConfig.maxLength = 5 + + // Nisso +// config.chatViewConfig.avatarImageSize = .large + // Viktor +// config.chatViewConfig.avatarImageWidthSize = 30.0 +// config.chatViewConfig.avatarImageHightSize = 30.0 + +// config.incomingBotConfig.quickOptionConfig.avatarPosition = AvatarPosition.topLeft +// +// config.incomingBotConfig.quickOptionConfig.avatar = UIImage(named: "robot") +// +// +// config.incomingBotConfig.quickOptionConfig.textColor = UIColor.red +// let dateFormatterGet = DateFormatter() +// dateFormatterGet.dateFormat = "yyyy-MM-dd HH:mm:ss" +// config.incomingBotConfig.quickOptionConfig.dateFormatter = dateFormatterGet +// let timeFormatterGet = DateFormatter() +// timeFormatterGet.dateFormat = "HH:mm:ss" +// config.incomingBotConfig.quickOptionConfig.timeFormatter = timeFormatterGet +// +// // IncomingBotConfiguration +// +// // IncomingBotConfiguration : ChatElementConfiguration + config.incomingBotConfig.backgroundColor = UIColor.systemYellow +// config.incomingBotConfig.backgroundImage = UIImage(named: "bold") + config.incomingBotConfig.dateStampColor = UIColor.green + config.incomingBotConfig.dateStampFont = UIFont(name: "Times New Roman", size: 19.0) +// config.incomingBotConfig.customFont = customFont +// config.incomingBotConfig.maxLength = 3 + +// config.incomingBotConfig.avatarPosition = AvatarPosition.bottomRight +// config.incomingBotConfig.avatar = UIImage(named: "agent") + config.incomingBotConfig.textColor = UIColor.red +// config.incomingBotConfig.dateFormatter = dateFormatterGet +// config.incomingBotConfig.timeFormatter = timeFormatterGet + +// +// // IncomingBotConfiguration - QuickOptionConfiguration *quickOptionConfig +// // QuickOptionConfiguration : ChatElementConfiguration +// config.incomingBotConfig.quickOptionConfig.backgroundColor = UIColor.purple +// config.incomingBotConfig.quickOptionConfig.backgroundImage = UIImage(named: "bold") +// config.incomingBotConfig.quickOptionConfig.dateStampColor = UIColor.brown +// config.incomingBotConfig.quickOptionConfig.customFont = customFont +// config.incomingBotConfig.quickOptionConfig.maxLength = 2 +// +// // IncomingBotConfiguration - PersistentOptionConfiguration *persistentOptionConfig +// // PersistentOptionConfiguration : ChatElementConfiguration +// config.incomingBotConfig.persistentOptionConfig.backgroundColor = UIColor.purple +// config.incomingBotConfig.persistentOptionConfig.backgroundImage = UIImage(named: "bold") +// config.incomingBotConfig.persistentOptionConfig.dateStampColor = UIColor.brown +// config.incomingBotConfig.persistentOptionConfig.customFont = customFont +// config.incomingBotConfig.persistentOptionConfig.maxLength = 2 +// +// // IncomingBotConfiguration - InstantFeedbackConfiguration *instantFeedbackConfig +// // IncomingBotTitleConfiguration : ChatElementConfiguration +// // TODO:: check if the inheritence is wrong +// config.incomingBotConfig.titleConfig.backgroundColor = UIColor.blue +// config.incomingBotConfig.titleConfig.backgroundImage = UIImage(named: "bold") +// config.incomingBotConfig.titleConfig.dateStampColor = UIColor.darkGray +// config.incomingBotConfig.titleConfig.customFont = customFont +// config.incomingBotConfig.titleConfig.maxLength = 3 +// +// // IncomingBotConfiguration - CarouselConfiguration *carouselConfig +// // CarouselConfiguration : ChatElementConfiguration +// config.incomingBotConfig.carouselConfig.backgroundColor = UIColor.yellow +// config.incomingBotConfig.carouselConfig.backgroundImage = UIImage(named: "bold") +// config.incomingBotConfig.carouselConfig.dateStampColor = UIColor.black +// config.incomingBotConfig.carouselConfig.customFont = customFont +// config.incomingBotConfig.carouselConfig.maxLength = 4 +// +// // CarouselButtonConfiguration : ChatElementConfiguration +// config.incomingBotConfig.carouselConfig.button.backgroundColor = UIColor.blue +// config.incomingBotConfig.carouselConfig.button.backgroundImage = UIImage(named: "bold") +// config.incomingBotConfig.carouselConfig.button.dateStampColor = UIColor.darkGray +// config.incomingBotConfig.carouselConfig.button.customFont = customFont +// config.incomingBotConfig.carouselConfig.button.maxLength = 3 +// +// // OutgoingConfiguration +// config.outgoingConfig.sentSuccessfullyIcon = UIImage(named: "bold") +// config.outgoingConfig.sentFailureIcon = UIImage(named: "bold") +// config.outgoingConfig.pendingIcon = UIImage(named: "bold") +// +// // OutgoingConfiguration : ChatElementConfiguration + config.outgoingConfig.backgroundColor = UIColor.blue +// config.outgoingConfig.backgroundImage = UIImage(named: "bold") + config.outgoingConfig.dateStampColor = UIColor.red + config.outgoingConfig.dateStampFont = UIFont(name: "Times New Roman", size: 13.0)// config.outgoingConfig.customFont = customFont +// config.outgoingConfig.maxLength = 3 +// +// config.outgoingConfig.avatarPosition = AvatarPosition.bottomRight +// config.outgoingConfig.avatar = UIImage(named: "agent") + config.outgoingConfig.textColor = UIColor.green +// config.outgoingConfig.dateFormatter = dateFormatterGet +// config.outgoingConfig.timeFormatter = timeFormatterGet + +// +// // SystemMessageConfiguration +// // SystemMessageConfiguration : ChatElementConfiguration +// config.systemMessageConfig.backgroundColor = UIColor.blue +// config.systemMessageConfig.backgroundImage = UIImage(named: "bold") +// config.systemMessageConfig.dateStampColor = UIColor.darkGray +// config.systemMessageConfig.customFont = customFont +// config.systemMessageConfig.maxLength = 3 +// +// // InfoViewConfiguration +// config.queueViewConfig.textColor = UIColor.blue +// config.queueViewConfig.backgroundColor = UIColor.blue +// config.queueViewConfig.font = UIFont.systemFont(ofSize: 12) +// +// // SearchViewConfiguration +// config.searchViewConfig.speechOnIcon = UIImage(named: "bold") +// config.searchViewConfig.speechOffIcon = UIImage(named: "bold") +// config.searchViewConfig.readoutIcon = UIImage(named: "bold") +// config.searchViewConfig.sendIcon = UIImage(named: "bold") +// config.searchViewConfig.uploadIcon = UIImage(named: "bold") +// config.searchViewConfig.voiceEnabled = false +// config.searchViewConfig.languageCode = "heb" +// // AutoCompleteConfiguration * autoCompleteConfiguration +// config.searchViewConfig.autoCompleteConfiguration?.isEnabled = true +// // AutoCompleteConfiguration : TextConfiguration +// config.searchViewConfig.autoCompleteConfiguration?.text = "Hey" +// config.searchViewConfig.autoCompleteConfiguration?.font = UIFont.systemFont(ofSize: 20) +// config.searchViewConfig.autoCompleteConfiguration?.backgroundColor = UIColor.red +// config.searchViewConfig.autoCompleteConfiguration?.textColor = UIColor.blue +// // PlaceholderConfiguration * placeholderConfiguration +// config.searchViewConfig.placeholderConfiguration?.recordText = "Recording Now.." +// config.searchViewConfig.placeholderConfiguration?.readoutext = "Readingout Now.." +// // PlaceholderConfiguration : TextConfiguration +// config.searchViewConfig.placeholderConfiguration?.text = "Placeholder text" +// config.searchViewConfig.placeholderConfiguration?.font = UIFont.systemFont(ofSize: 20) +// config.searchViewConfig.placeholderConfiguration?.backgroundColor = UIColor.red +// config.searchViewConfig.placeholderConfiguration?.textColor = UIColor.blue +// // SearchViewConfiguration : TextConfiguration +// config.searchViewConfig.text = "hey" +// config.searchViewConfig.font = customFont.font +// config.searchViewConfig.textColor = UIColor.green +// config.searchViewConfig.backgroundColor = UIColor.purple +// +// // ReadMoreViewConfiguration +// // ReadMoreTitleConfiguration *title +// // ReadMoreTitleConfiguration : AutoCompleteConfiguration +// config.readMoreViewConfig.title.isEnabled = false +// config.readMoreViewConfig.title.text = "hey" + config.readMoreViewConfig.title.customFont = customFont + config.readMoreViewConfig.title.textColor = UIColor.green + config.readMoreViewConfig.title.backgroundColor = UIColor.purple +// +// // ChatBarConfiguration +// config.chatBarConfiguration.image = UIImage(named: "bold")! +// config.chatBarConfiguration.agentName = "agent name" +// config.chatBarConfiguration.endChatBtnTitle = "endChatBtnTitle" +// config.chatBarConfiguration.endChatBtnTextColor = UIColor.green +// config.chatBarConfiguration.endChatButtonEnabled = true +// config.chatBarConfiguration.enabled = true +// +// // ChatBarConfiguration : InfoViewConfiguration +// config.chatBarConfiguration.textColor = UIColor.green +// config.chatBarConfiguration.backgroundColor = UIColor.brown +// config.chatBarConfiguration.font = customFont.font +// +// // VoiceToVoiceConfiguration +// config.voiceToVoiceConfiguration.type = .default +// config.voiceToVoiceConfiguration.silenceTimeBeforeMessageSent = 3.0 +// // SynthesizerConfiguration *synthesizerConfiguration +// config.voiceToVoiceConfiguration.synthesizerConfiguration.currentLanguageCode = "en-GB" +// config.voiceToVoiceConfiguration.synthesizerConfiguration.pitchMultiplier = 2.0 +// config.voiceToVoiceConfiguration.synthesizerConfiguration.preUtteranceDelay = 2.0 +// config.voiceToVoiceConfiguration.synthesizerConfiguration.rate = 2.0 +// config.voiceToVoiceConfiguration.synthesizerConfiguration.volume = 0.5 +// +// // BoldFormConfiguration +// // BoldFormElementConfiguration *titleConfig +// // BoldFormElementConfiguration +// config.formConfiguration.titleConfig.font = customFont.font +// config.formConfiguration.titleConfig.textColor = UIColor.green +// config.formConfiguration.titleConfig.backgroundColor = UIColor.blue +// +// config.formConfiguration.multiSelectElementConfig.font = customFont.font +// config.formConfiguration.multiSelectElementConfig.textColor = UIColor.green +// config.formConfiguration.multiSelectElementConfig.backgroundColor = UIColor.blue + + return config + } + } +} diff --git a/BasicSample/BasicSample/ChatViewControllers/FileUpload/FileUploadDemoViewController.swift b/BasicSample/BasicSample/ChatViewControllers/FileUpload/FileUploadDemoViewController.swift index 48ec699..baad3c8 100644 --- a/BasicSample/BasicSample/ChatViewControllers/FileUpload/FileUploadDemoViewController.swift +++ b/BasicSample/BasicSample/ChatViewControllers/FileUpload/FileUploadDemoViewController.swift @@ -101,6 +101,17 @@ extension FileUploadDemoViewController: UIDocumentMenuDelegate, UIDocumentPicker self.chatController.uploadFile(request, progress: { (progress) in print("application file upload progress ->") }) { (info) in + if((info.error) != nil) { + print(info.error.localizedDescription) + + let alert = UIAlertController(title: "Error", message:info.error.localizedDescription, preferredStyle: UIAlertController.Style.alert) + + // add an action (button) + alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil)) + + // show the alert + self.navigationController?.presentedViewController?.present(alert, animated: true, completion: nil) + } self.chatController.handle(BoldEvent.fileUploaded(info)) } } @@ -134,6 +145,9 @@ extension FileUploadDemoViewController: UIImagePickerControllerDelegate, UINavig self.chatController.uploadFile(request, progress: { (progress) in print("application file upload progress ->") }) { (info) in + if((info.error) != nil) { + + } self.chatController.handle(BoldEvent.fileUploaded(info)) } } diff --git a/BasicSample/BasicSample/HandOver/Base.lproj/Main.storyboard b/BasicSample/BasicSample/HandOver/Base.lproj/Main.storyboard index c423987..70b6f6e 100644 --- a/BasicSample/BasicSample/HandOver/Base.lproj/Main.storyboard +++ b/BasicSample/BasicSample/HandOver/Base.lproj/Main.storyboard @@ -1,10 +1,11 @@ - + - + + @@ -42,13 +43,13 @@ + - @@ -97,6 +98,7 @@ + @@ -106,7 +108,6 @@ - @@ -123,8 +124,8 @@ - + @@ -138,8 +139,8 @@ - + @@ -177,6 +178,7 @@ + @@ -187,7 +189,6 @@ - @@ -209,15 +210,15 @@ - + + + + + + + + + + + + @@ -313,7 +348,7 @@ - + @@ -333,12 +368,12 @@ - + - - + + @@ -354,7 +390,6 @@ - @@ -367,5 +402,14 @@ + + + + + + + + + diff --git a/BasicSample/Podfile b/BasicSample/Podfile index 59024d6..326bbf0 100755 --- a/BasicSample/Podfile +++ b/BasicSample/Podfile @@ -4,7 +4,7 @@ # All rights reserved. #=================================================================================================== -platform :ios, "9.0" +platform :ios, "10.0" use_frameworks! install! 'cocoapods', @@ -19,7 +19,7 @@ install! 'cocoapods', # Dev #source 'https://github.com/nanorepsdk/NRSDK-Dev-specs.git' # Production -source 'https://github.com/nanorepsdk/NRSDK-specs.git' +#source 'https://github.com/nanorepsdk/NRSDK-specs.git' source 'https://github.com/CocoaPods/Specs'