Giter VIP home page Giter VIP logo

desk360-ios-sdk's Introduction

Desk360 iOS SDK

Swift Xcode MIT

Table of Contents

Summary

Desk360 is an iOS SDK to help you embedding customer support in your iOS applications with ease!

Features

  • Create new support tickets.
  • View and comment on existing tickets.
  • Interactively communicate with related support teams.

Installation

Using CocoaPods

To integrate Desk360 in your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Desk360'

Using SPM

dependencies: [
    .package(url: "https://github.com/Teknasyon-Teknoloji/desk360-ios-sdk", .branch("master"))
]

Usage

Important footnot

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.

Start Desk360 with appId -and an optinal deviceId, an optional language-

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: "[email protected]"),
        bypassCreateTicketIntro: true,
        hidePastTickets: false,
        jsonInfo: ["a": 500, "b": "c"]
    )

Desk360.start(using: props)

Using Desk360

import Desk360

class ExampleViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()
    Desk360.show(on: self, animated: true)
  }
  
}

Using Optional Notification System

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)
  }

}

Getting the unread tickets

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)

Customize Desk360 Theme

You should use Desk360 dashboard for custom config.

Support

If you have any questions or feature requests, please create an issue.

License

Desk360 is released under the MIT license. See LICENSE for more information.

desk360-ios-sdk's People

Contributors

aktassamet avatar befy avatar cerenaarslan avatar dabaddah avatar dinncer avatar engali94 avatar osmanyildirim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

desk360-ios-sdk's Issues

Remove 3rd-party dependencies in favour of native solution

Proposition

  1. Change SnapKit dependency in favour of NSLayoutConstraint
  2. Change Moya to URLSession

Motivation

I'm trying to do not to use the 3rd-party library in my projects where it is possible for a few reasons:

  • I don't want to depend on another codebase;
  • in most cases I use 5-10% of available features;
  • I want to control the whole process and each part of my project as possible;
  • I don't want to increase the build time of my project and binary size;
  • I want to fix problems asap and not wait while contributors approve my PR to 3rd-party libs;

So, I think using 3rd-party libraries(e.g. SnapKit) in other 3rd-parties libraries (Desk360) should be if you can not do things in another way by yourself.

PS. I understand why were you using SnapKit and Moya, you were probably trying to save time and develop faster, but you develop not a private project only for yourself, and it means you have to think not only for yourself but about possible problems for your clients.
PPS. You have up to 10 views where you were using SnapKit and 7 requests to API.

Getting the following error while building

Undefined symbols for architecture x86_64:
  "associated conformance descriptor for Swift.Identifiable.Swift.Identifiable.ID: Swift.Hashable", referenced from:
      protocol conformance descriptor for Desk360.NewTicket : Swift.Identifiable in Desk360 in libDesk360.a(NewTicket.o)
  "associated type descriptor for Swift.Identifiable.ID", referenced from:
      protocol conformance descriptor for Desk360.NewTicket : Swift.Identifiable in Desk360 in libDesk360.a(NewTicket.o)
  "method descriptor for Swift.Identifiable.id.getter : A.ID", referenced from:
      protocol conformance descriptor for Desk360.NewTicket : Swift.Identifiable in Desk360 in libDesk360.a(NewTicket.o)
  "protocol descriptor for Swift.Identifiable", referenced from:
      protocol conformance descriptor for Desk360.NewTicket : Swift.Identifiable in Desk360 in libDesk360.a(NewTicket.o)
  "Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from:
      generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libAlamofire.a(NetworkReachabilityManager.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.