diff --git a/Examples/SwiftExample/SwiftExample.xcodeproj/project.pbxproj b/Examples/SwiftExample/SwiftExample.xcodeproj/project.pbxproj index 93df08a..2d537cd 100644 --- a/Examples/SwiftExample/SwiftExample.xcodeproj/project.pbxproj +++ b/Examples/SwiftExample/SwiftExample.xcodeproj/project.pbxproj @@ -13,8 +13,8 @@ 5E19F59B2B477AE400E37F55 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E19F5992B477AE400E37F55 /* Main.storyboard */; }; 5E19F59D2B477AE400E37F55 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5E19F59C2B477AE400E37F55 /* Assets.xcassets */; }; 5E19F5A02B477AE400E37F55 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E19F59E2B477AE400E37F55 /* LaunchScreen.storyboard */; }; - 5E66BF0C2B7FB63100FAF349 /* messenger-sdk-ios in Frameworks */ = {isa = PBXBuildFile; productRef = 5E66BF0B2B7FB63100FAF349 /* messenger-sdk-ios */; }; 5E99636E2BA3339600F27D11 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5E99636D2BA3339600F27D11 /* GoogleService-Info.plist */; }; + 5EF7619E2C077539007C3E73 /* messenger-sdk-ios in Frameworks */ = {isa = PBXBuildFile; productRef = 5EF7619D2C077539007C3E73 /* messenger-sdk-ios */; }; 5EF899182B728D75005547BC /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 5EF899172B728D75005547BC /* FirebaseAnalytics */; }; 5EF899422B728D75005547BC /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 5EF899412B728D75005547BC /* FirebaseMessaging */; }; /* End PBXBuildFile section */ @@ -52,7 +52,7 @@ files = ( 5EF899182B728D75005547BC /* FirebaseAnalytics in Frameworks */, 5EF899422B728D75005547BC /* FirebaseMessaging in Frameworks */, - 5E66BF0C2B7FB63100FAF349 /* messenger-sdk-ios in Frameworks */, + 5EF7619E2C077539007C3E73 /* messenger-sdk-ios in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -111,7 +111,7 @@ packageProductDependencies = ( 5EF899172B728D75005547BC /* FirebaseAnalytics */, 5EF899412B728D75005547BC /* FirebaseMessaging */, - 5E66BF0B2B7FB63100FAF349 /* messenger-sdk-ios */, + 5EF7619D2C077539007C3E73 /* messenger-sdk-ios */, ); productName = SwiftExample; productReference = 5E19F5902B477AE400E37F55 /* SwiftExample.app */; @@ -143,7 +143,7 @@ mainGroup = 5E19F5872B477AE400E37F55; packageReferences = ( 5EF899162B728D75005547BC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, - 5E66BF0A2B7FB63100FAF349 /* XCRemoteSwiftPackageReference "messenger-sdk-ios" */, + 5EF7619C2C077539007C3E73 /* XCRemoteSwiftPackageReference "messenger-sdk-ios" */, ); productRefGroup = 5E19F5912B477AE400E37F55 /* Products */; projectDirPath = ""; @@ -323,7 +323,7 @@ CODE_SIGN_ENTITLEMENTS = SwiftExample/SwiftExample.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = HC9N5Z797X; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -333,6 +333,7 @@ INFOPLIST_FILE = SwiftExample/Info.plist; INFOPLIST_KEY_NSCameraUsageDescription = "This app requires camera access to take photos for uploading images directly from the camera."; INFOPLIST_KEY_NSMicrophoneUsageDescription = "This app requires microphone access to record audio for video uploads directly from the camera."; + INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "This app requires Photo Library Access for downloading photos."; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -364,7 +365,7 @@ CODE_SIGN_ENTITLEMENTS = SwiftExample/SwiftExample.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = HC9N5Z797X; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -374,6 +375,7 @@ INFOPLIST_FILE = SwiftExample/Info.plist; INFOPLIST_KEY_NSCameraUsageDescription = "This app requires camera access to take photos for uploading images directly from the camera."; INFOPLIST_KEY_NSMicrophoneUsageDescription = "This app requires microphone access to record audio for video uploads directly from the camera."; + INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "This app requires Photo Library Access for downloading photos."; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -421,12 +423,12 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 5E66BF0A2B7FB63100FAF349 /* XCRemoteSwiftPackageReference "messenger-sdk-ios" */ = { + 5EF7619C2C077539007C3E73 /* XCRemoteSwiftPackageReference "messenger-sdk-ios" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/deskpro/messenger-sdk-ios.git"; requirement = { - kind = exactVersion; - version = 0.0.10; + kind = upToNextMajorVersion; + minimumVersion = 0.0.14; }; }; 5EF899162B728D75005547BC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { @@ -440,9 +442,9 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 5E66BF0B2B7FB63100FAF349 /* messenger-sdk-ios */ = { + 5EF7619D2C077539007C3E73 /* messenger-sdk-ios */ = { isa = XCSwiftPackageProductDependency; - package = 5E66BF0A2B7FB63100FAF349 /* XCRemoteSwiftPackageReference "messenger-sdk-ios" */; + package = 5EF7619C2C077539007C3E73 /* XCRemoteSwiftPackageReference "messenger-sdk-ios" */; productName = "messenger-sdk-ios"; }; 5EF899172B728D75005547BC /* FirebaseAnalytics */ = { diff --git a/Examples/SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Examples/SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f944a0c..b0312b2 100644 --- a/Examples/SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Examples/SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/deskpro/messenger-sdk-ios.git", "state" : { - "revision" : "fba94d11fd01b7dac36627f0777cf5f8a0b2a1e8", - "version" : "0.0.10" + "revision" : "759bdc8bc52bf063fd48a109b6a35f5cfa0ec14d", + "version" : "0.0.14" } }, { diff --git a/Examples/SwiftExample/SwiftExample/Base.lproj/Main.storyboard b/Examples/SwiftExample/SwiftExample/Base.lproj/Main.storyboard index 2a33120..5210165 100644 --- a/Examples/SwiftExample/SwiftExample/Base.lproj/Main.storyboard +++ b/Examples/SwiftExample/SwiftExample/Base.lproj/Main.storyboard @@ -17,7 +17,7 @@ - + @@ -31,11 +31,11 @@ - + - + + @@ -210,15 +229,18 @@ + + - + + @@ -227,13 +249,16 @@ + - + + + @@ -242,17 +267,19 @@ + + + + + - - - diff --git a/Examples/SwiftExample/SwiftExample/Info.plist b/Examples/SwiftExample/SwiftExample/Info.plist index d512e0c..3174a5e 100644 --- a/Examples/SwiftExample/SwiftExample/Info.plist +++ b/Examples/SwiftExample/SwiftExample/Info.plist @@ -2,6 +2,12 @@ + BGTaskSchedulerPermittedIdentifiers + + $(PRODUCT_BUNDLE_IDENTIFIER) + + ITSAppUsesNonExemptEncryption + NSAppTransportSecurity NSAllowsArbitraryLoads @@ -32,11 +38,5 @@ processing remote-notification - BGTaskSchedulerPermittedIdentifiers - - $(PRODUCT_BUNDLE_IDENTIFIER) - - ITSAppUsesNonExemptEncryption - diff --git a/Examples/SwiftExample/SwiftExample/ViewController.swift b/Examples/SwiftExample/SwiftExample/ViewController.swift index 79017b0..9007cff 100644 --- a/Examples/SwiftExample/SwiftExample/ViewController.swift +++ b/Examples/SwiftExample/SwiftExample/ViewController.swift @@ -10,22 +10,26 @@ import messenger_sdk_ios class ViewController: UIViewController { - @IBOutlet weak var urlTextfield: UITextField! + @IBOutlet weak var appUrlTextfield: UITextField! + @IBOutlet weak var appIdTextfield: UITextField! @IBOutlet weak var jwtTextview: UITextView! @IBOutlet weak var userinfoTextview: UITextView! - @IBOutlet weak var updateBtn: UIButton! + @IBOutlet weak var appUrlUpdateBtn: UIButton! + @IBOutlet weak var appIdUpdateBtn: UIButton! @IBOutlet weak var setJwtButon: UIButton! @IBOutlet weak var setUserinfoBtn: UIButton! @IBOutlet weak var enableNotificationsBtn: UIButton! @IBOutlet weak var openMessengetBtn: UIButton! - @IBOutlet weak var openNewChatBtn: UIButton! + @IBOutlet weak var clearCookiesBtn: UIButton! @IBOutlet weak var eventLogTextView: UITextView! @IBOutlet weak var copyTokenBtn: UIButton! @IBOutlet weak var copyLogsBtn: UIButton! var messenger: DeskPro? - var appUrl = "https://master.earthly.deskprodemo.com/deskpro-messenger/00000000-0000-0000-0000-000000000000/0000000000HXER9KCGYDS93Z21/%7B%22platform%22%3A%22IOS%22%7D" + var appUrl = "https://master.earthly.deskprodemo.com/deskpro-messenger/00000000-0000-0000-0000-000000000000" + var appId = "/0000000000HXER9KCGYDS93Z21" + var userJSON = """ { "name": "", @@ -50,8 +54,10 @@ class ViewController: UIViewController { appDelegate.pushNotificationDelegate = self } - urlTextfield.keyboardType = .URL - urlTextfield.text = appUrl + appUrlTextfield.keyboardType = .URL + appUrlTextfield.text = appUrl + + appIdTextfield.text = appId jwtTextview.delegate = self jwtTextview.layer.cornerRadius = 4 @@ -71,14 +77,22 @@ class ViewController: UIViewController { view.endEditing(true) } - @IBAction func updateBtnTapped(_ sender: Any) { - if let url = urlTextfield.text, + @IBAction func appUrlUpdateBtnTapped(_ sender: Any) { + if let url = appUrlTextfield.text, !url.isEmpty { appUrl = url } dismissKeyboard() } + @IBAction func appIdUpdateBtnTapped(_ sender: Any) { + if let id = appIdTextfield.text, + !id.isEmpty { + appId = id + } + dismissKeyboard() + } + @IBAction func setJwtBtnTapped(_ sender: Any) { if let jwt = jwtTextview.text, !jwt.isEmpty { @@ -114,7 +128,7 @@ class ViewController: UIViewController { } @IBAction func openMessengerBtnTapped(_ sender: Any) { - let messengerConfig = MessengerConfig(appUrl: appUrl, appId: "1") + let messengerConfig = MessengerConfig(appUrl: appUrl, appId: appId) messenger = DeskPro(messengerConfig: messengerConfig, containingViewController: self) messenger?.eventRouter.handleEventCallback = { [weak self] event in self?.logEvent(event.debugDescription) @@ -122,7 +136,10 @@ class ViewController: UIViewController { messenger?.present().show() } - @IBAction func openNewChatBtnTapped(_ sender: Any) {} + @IBAction func clearCookiesBtnTapped(_ sender: Any) { + HTTPCookieStorage.shared.cookies?.forEach(HTTPCookieStorage.shared.deleteCookie) + self.showToast(message: "Cookies cleared", font: .systemFont(ofSize: 13.0)) + } @IBAction func copyTokenBtnTapped(_ sender: Any) { pasteboard.string = deviceToken