AppDelegate.swift 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. APIS.connect(apiKey: "1C4FA430BC9F44484AFBE99C8974D70B68CE7891DBE83505CBF01205DE51FC18", delegate: self)
  15. let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
  16. let batteryChannel = FlutterMethodChannel(name: "nativeChannel", binaryMessenger: controller.binaryMessenger)
  17. batteryChannel.setMethodCallHandler({(call: FlutterMethodCall, result: FlutterResult) -> Void in
  18. // Note: this method is invoked on the UI thread.
  19. if call.method == "openContactCenter" {
  20. APIS.openContactCenter()
  21. } else if call.method == "openInstantMessaging" {
  22. APIS.openChat()
  23. } else if call.method == "openCall" {
  24. APIS.openCall()
  25. } else if call.method == "openStreaming" {
  26. APIS.openStreaming()
  27. } else if call.method == "openWhiteboard" {
  28. APIS.openWhiteboard()
  29. } else if call.method == "openSettings" {
  30. APIS.openSetting()
  31. } else if call.method == "openSetOfficer" {
  32. APIS.openSetAsOfficerForm()
  33. } else if call.method == "openContactCenterChat" {
  34. var category: Int?
  35. if let arguments = call.arguments as? [String: Any],
  36. let param1 = arguments["category"] as? Int {
  37. category = param1
  38. }
  39. APIS.openContactCenter(media: 0, category: category)
  40. } else if call.method == "openContactCenterAudioCall" {
  41. var category: Int?
  42. if let arguments = call.arguments as? [String: Any],
  43. let param1 = arguments["category"] as? Int {
  44. category = param1
  45. }
  46. APIS.openContactCenter(media: 1, category: category)
  47. } else if call.method == "openContactCenterVideoCall" {
  48. var category: Int?
  49. if let arguments = call.arguments as? [String: Any],
  50. let param1 = arguments["category"] as? Int {
  51. category = param1
  52. }
  53. APIS.openContactCenter(media: 2, category: category)
  54. } else if call.method == "signInAdmin" {
  55. var pwd: String?
  56. if let arguments = call.arguments as? [String: Any],
  57. let param1 = arguments["pwd"] as? String {
  58. pwd = param1
  59. }
  60. APIS.signInAdmin(password: pwd ?? "")
  61. } else {
  62. result(FlutterMethodNotImplemented)
  63. }
  64. })
  65. GeneratedPluginRegistrant.register(with: self)
  66. return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  67. }
  68. }