AppDelegate.swift 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 if call.method == "openProfile" {
  63. APIS.openProfile()
  64. } else if call.method == "openNotificationCenter" {
  65. APIS.openNotificationCenter()
  66. } else {
  67. result(FlutterMethodNotImplemented)
  68. }
  69. })
  70. GeneratedPluginRegistrant.register(with: self)
  71. return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  72. }
  73. }