AppDelegate.swift 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import UIKit
  2. import Flutter
  3. import NexilisLite
  4. @UIApplicationMain
  5. @objc class AppDelegate: FlutterAppDelegate, ConnectDelegate {
  6. func onSuccess(userId: String) {
  7. }
  8. func onFailed(error: String) {
  9. }
  10. override func application(
  11. _ application: UIApplication,
  12. didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  13. ) -> Bool {
  14. //FLOATING
  15. APIS.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: false)
  16. let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
  17. let batteryChannel = FlutterMethodChannel(name: "nativeChannel", binaryMessenger: controller.binaryMessenger)
  18. batteryChannel.setMethodCallHandler({(call: FlutterMethodCall, result: FlutterResult) -> Void in
  19. // Note: this method is invoked on the UI thread.
  20. if call.method == "openContactCenter" {
  21. APIS.openContactCenter()
  22. } else if call.method == "openInstantMessaging" {
  23. APIS.openChat()
  24. } else if call.method == "openCall" {
  25. APIS.openCall()
  26. } else if call.method == "openStreaming" {
  27. APIS.openStreaming()
  28. } else if call.method == "openWhiteboard" {
  29. APIS.openWhiteboard()
  30. } else if call.method == "openSettings" {
  31. APIS.openSetting()
  32. } else if call.method == "openSetOfficer" {
  33. APIS.openSetAsOfficerForm()
  34. } else if call.method == "openContactCenterChat" {
  35. var category: Int?
  36. if let arguments = call.arguments as? [String: Any],
  37. let param1 = arguments["category"] as? Int {
  38. category = param1
  39. }
  40. APIS.openContactCenter(media: 0, category: category)
  41. } else if call.method == "openContactCenterAudioCall" {
  42. var category: Int?
  43. if let arguments = call.arguments as? [String: Any],
  44. let param1 = arguments["category"] as? Int {
  45. category = param1
  46. }
  47. APIS.openContactCenter(media: 1, category: category)
  48. } else if call.method == "openContactCenterVideoCall" {
  49. var category: Int?
  50. if let arguments = call.arguments as? [String: Any],
  51. let param1 = arguments["category"] as? Int {
  52. category = param1
  53. }
  54. APIS.openContactCenter(media: 2, category: category)
  55. } else if call.method == "signInAdmin" {
  56. var pwd: String?
  57. if let arguments = call.arguments as? [String: Any],
  58. let param1 = arguments["pwd"] as? String {
  59. pwd = param1
  60. }
  61. APIS.signInAdmin(password: pwd ?? "")
  62. } else {
  63. result(FlutterMethodNotImplemented)
  64. }
  65. })
  66. GeneratedPluginRegistrant.register(with: self)
  67. return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  68. }
  69. }