Desk360 Docs
Search…
Desk360 Flutter SDK
Desk360 Flutter SDK helps you embedding customer support in your Flutter mobile applications with ease.

Features

  • Turn all your customer support requests into tickets and interact with these messages using our powerful platform.
  • Flutter SDK has highly customizable and flexible UI options.
  • Push notifications and deep linking support options are both available.
  • Give multilingual support for your customers: It supports 40+ languages.
  • Flutter SDK supports different types of media and file formats.
  • It's easy to use and integrate. After writing only a few lines of code, you're ready to use!
The latest version of Desk360 Flutter SDK is 0.1.0.

Example

The example application is the best way to see Desk360FlutterSDK in action. Simply open the example and run flutter.

Installation

Add below code into your pubspec.yaml file under dependencies section.
1
desk360flutter:
2
git:
3
url: https://github.com/Teknasyon-Teknoloji/desk360-flutter-sdk.git
4
ref: 0.1.0
Copied!
And run $ flutter pub get

Installation Notes

For iOS:

  • Set minimum iOS version 10.0 or higher in ios/Podfile like follows: platform :ios, '10.0'
  • Add use_frameworks! into ios/Podfile if it doesn't exist.
  • Run $ cd ios && pod install

For Android:

  • Set kotlin_version "1.4.32" or higher in android/build.gradle
  • Set minSdkVersion to 21 or higher in android/app/build.gradle
  • Add maven { url 'https://raw.githubusercontent.com/Teknasyon-Teknoloji/desk360-android-sdk/master/' } into android/build.gradle (Add that into repositories under allprojects.)

Usage

Before start using the Flutter SDK, there is a platform-specific one time setup that needs to be done before going any further.

For iOS:

Navigate to the iOS folder and open the Runner.xcworkspace. Then, you should add the following into your info.plist file.
1
<key>NSPhotoLibraryUsageDescription</key>
2
<string>YOUR_PERMSIION_DESCRIPTION.</string>
Copied!
If you don't add this permission, Desk360 iOS Images attachment property will not work properly or may lead to crashes.

Using Optional Notification System for iOS

If you want to add support for push notifications by the same token, you should add the following to the iOS's AppDelegate:
1
import Desk360
2
3
@UIApplicationMain
4
final class AppDelegate: UIResponder, UIApplicationDelegate {
5
6
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
7
Desk360.setPushToken(deviceToken: deviceToken)
8
}
9
10
}
Copied!
After the above integration, it is sufficient to make the notification certificate settings in the Desk360 admin panel. You can now use notifications.
Also, for having a notification redirect deeplink system, you should do the extra integration below.
1
import Flutter
2
import Desk360
3
import UserNotifications
4
5
@UIApplicationMain
6
@objc class AppDelegate: FlutterAppDelegate {
7
override func application(\_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
8
Desk360.applicationLaunchChecker(launchOptions)
9
registerForRemoteNotification()
10
GeneratedPluginRegistrant.register(with: self)
11
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12
}
13
14
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
15
Desk360.setPushToken(deviceToken: deviceToken)
16
}
17
18
func registerForRemoteNotification() {
19
if #available(iOS 10.0, *) {
20
let center = UNUserNotificationCenter.current()
21
center.delegate = self
22
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
23
if error == nil {
24
DispatchQueue.main.async {
25
UIApplication.shared.registerForRemoteNotifications()
26
}
27
}
28
}
29
}
30
else {
31
UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.sound, .alert, .badge], categories: nil))
32
UIApplication.shared.registerForRemoteNotifications()
33
}
34
}
35
}
36
37
extension AppDelegate {
38
39
override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
40
completionHandler([.alert])
41
Desk360.willNotificationPresent(notification.request.content.userInfo)
42
}
43
44
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
45
Desk360.applicationUserInfoChecker(userInfo)
46
}
47
48
@available(iOS 10.0, *)
49
override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
50
Desk360.applicationUserInfoChecker(response.notification.request.content.userI
51
}
52
}
Copied!

Using Desk360

You can start the Desk360SDK like follows:
1
import 'package:desk360flutter/enums/environments.dart';
2
import 'package:desk360flutter/enums/platforms.dart' as Platforms;
3
import 'package:flutter/material.dart';
4
import 'package:desk360flutter/desk360flutter.dart';
5
6
if (Platform.isIOS) {
7
Desk360flutter.start(properties: {
8
"appID": "YOUR_APP_ID",
9
"deviceID": "YOUR_DEVICE_ID",
10
"languageCode": 'en',
11
"environment": Environment.SANDBOX.value, // Use PRODUCTION if you want to publish your app
12
"countryCode": 'tr',
13
"bypassCreateTicketIntro": true, // optional
14
});
15
Desk360flutter.show(animated: true);
16
17
} else { var androidDeviceInfo = await deviceInfo.androidInfo; var deviceId = androidDeviceInfo.androidId; Desk360flutter.initialize({ "appID": "YOUR_APP_ID", "appVersion": "1.0.0", "languageCode": 'en', "environment": Environment.SANDBOX.value,// Use PRODUCTION if you want to publish your app
18
"platform": Platforms.Platform.GOOGLE.value, "countryCode": 'tr', "name": "Test-092021" }, "", deviceId); Desk360flutter.start();
19
}
Copied!

Unread Tickets

If you would like to get a list of the unread tickets, you can do so like follows:
1
// iOS only
2
Desk360flutter.getUnreadTickets().then( (results) {
3
print(results);
4
});
5
// Android Only
6
Desk360flutter.getTicketId()
7
.then((value) => {print("Ticket ID: $value")});
Copied!
You can show the unread tickets the way that fits you app design and experience. If you want to navigate to a specific ticket detail, you can do so like follows:
1
// iOS only
2
Desk360flutter.ticketDetailsViewController(unreadTicket);
Copied!

Deep Linking

When the user clicks on the notification while the application is not running, you need to add the code below on which page you want Desk360 to open.
1
import 'package:desk360flutter/desk360flutter.dart';
2
3
...
4
Desk360flutter.showWithPushDeeplink();
5
...
Copied!
This will trigger Desk360 SDK and open the relevant ticket.

Theme Customization

You should use Desk360 dashboard for appearance configurations.

Licence

Desk360 Flutter SDK is released under the MIT licence. See GITHUB for more information.
Last modified 5d ago