From 67bcc9b4c77e90113898baa4e14cbe4faaccfd37 Mon Sep 17 00:00:00 2001 From: QSD_faris Date: Wed, 22 May 2024 17:34:41 +0200 Subject: [PATCH 1/2] edit url configuration --- Sources/Deskpro.swift | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Sources/Deskpro.swift b/Sources/Deskpro.swift index d6d9e80..54bc1b9 100644 --- a/Sources/Deskpro.swift +++ b/Sources/Deskpro.swift @@ -148,9 +148,23 @@ import UIKit /// - Returns: A [PresentBuilder](x-source-tag://PresentBuilder) instance to start building presentation paths. /// @objc public final func present() -> PresentBuilder { - let url = messengerConfig.appUrl//.appending(messengerConfig.appId) - //return PresentBuilder(url: url, containingViewController: containingViewController) - return PresentBuilder(url: url, appId: messengerConfig.appId, coordinator: coordinator) + let url = buildUrl(baseUrl: messengerConfig.appUrl, appId: messengerConfig.appId) + return PresentBuilder(url: url ?? "", appId: messengerConfig.appId, coordinator: coordinator) + } + + func buildUrl(baseUrl: String, appId: String) -> String? { + let platformData = ["platform": "IOS"] + + guard let platformJsonData = try? JSONSerialization.data(withJSONObject: platformData, options: []), + let platformJsonString = String(data: platformJsonData, encoding: .utf8), + let encodedPlatform = platformJsonString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else { + return nil + } + + let formattedBaseUrl = baseUrl.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + let formattedAppId = "/" + appId.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + + return "\(formattedBaseUrl)\(formattedAppId)/\(encodedPlatform)" } /// Closes the chat view presented by the DeskPro SDK. From 531a6a8ad727522fb4f38320236c11180031ee6a Mon Sep 17 00:00:00 2001 From: qsd-faris <92013327+qsd-faris@users.noreply.github.com> Date: Wed, 29 May 2024 14:18:29 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 36ad29f..8b341cb 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,14 @@ messenger?.setPushRegistrationToken(token: token) Prerequisite: The application should be connected to the notifications platform, enabled for receiving notifications and obtaining tokens. + +## Privacy + +In order to make the file upload and download fully work, make sure to add these permissions with appropriate messages in your `Info.plist` file: +- Privacy - Camera Usage Description +- Privacy - Microphone Usage Description +- Privacy - Photo Library Additions Usage Description + ## Versioning We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/deskpro/messenger-sdk-ios/tags).