Desk360 is an iOS SDK to help you embedding customer support in your iOS applications with ease!
- Create new support tickets.
- View and comment on existing tickets.
- Interactively communicate with related support teams.
To integrate Desk360 in your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'Desk360'
dependencies: [
.package(url: "https://github.com/Teknasyon-Teknoloji/desk360-ios-sdk", .branch("master"))
]
You must add your info.plist file.
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow the app to access your photos.</string>
Permission text is optional. you can type whatever you want. But this permission not optional. If you didn't add this permission. Desk360 Images attachment property doesn't work.
Note: If no deviceId is provided, Desk360 will use device's UUID, which might cause your app to lose tickets when the application is deleted. If use environment type .production, Desk360 will look at prod url. If no application language is provided, Desk360 will use device's language.
import Desk360
let props = Desk360Properties(appKey: "1234")
// Or if you would like to provide more info here is a full list of the params
let props = Desk360Properties(
appKey: "1234",
deviceID: "34567",
environment: .production,
language: "en",
country: "TR",
userCredentials: .init(name: "John Doe", email: "john@doe.com"),
bypassCreateTicketIntro: true,
hidePastTickets: false,
jsonInfo: ["a": 500, "b": "c"]
)
Desk360.start(using: props)
import Desk360
class ExampleViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
Desk360.show(on: self, animated: true)
}
}
If you need to send a notification when a message is sent to the users. You have to do this integration.
import Desk360
@UIApplicationMain
final class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Desk360.setPushToken(deviceToken: deviceToken)
}
}
After the above integration, it is sufficient to make the notification certificate settings in the Desk360 admin panel. You can now use notifications
Also if you want notification redirect deeplink system. You should some extra integration.
import Desk360
@UIApplicationMain
final class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Desk360.applicationLaunchChecker(launchOptions)
if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.current()
center.delegate = self
}
return true
}
}
// MARK: - UNUserNotificationCenterDelegate
extension AppDelegate: UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.alert])
Desk360.willNotificationPresent(notification.request.content.userInfo)
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Desk360.applicationUserInfoChecker(userInfo)
}
@available(iOS 10.0, *)
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
Desk360.applicationUserInfoChecker(response.notification.request.content.userInfo)
}
}
When you click on the notification when your application is closed, you need to add this code on which page you want Des360 to open.
import Desk360
final class YourMainViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
Desk360.showWithPushDeeplink(on: self)
}
}
If you would like to get a list of the unread tickets you can do so like follows:
Desk360.getUnreadTickets { results in
switch results {
case .failure(let error):
print(error.localizedDescription)
case .success(let tickets):
print("Tickets: \(tickets.count)")
}
}
You can show the unread tickets the way that fits your app design and expierence. If you want to navigate to a specific ticket detail you can do so so by following:
let detailsViewController = Desk360.ticketDetailsViewController(ofTicket: unreadTicket)
self.present(detailsViewController, animated: true, completion: nil)
You should use Desk360 dashboard for custom config.
If you have any questions or feature requests, please create an issue.
Desk360 is released under the MIT license. See LICENSE for more information.