ViewController.swift 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // ViewController.swift
  3. // ExampleCode
  4. //
  5. // Created by Akhmad Al Qindi Irsyam on 10/05/23.
  6. //
  7. import Foundation
  8. import UIKit
  9. import NexilisLite
  10. import StreamShield
  11. class ViewController: UIViewController, ConnectDelegate {
  12. func onSuccess(userId: String) {
  13. print("SUCCESS \(userId)")
  14. }
  15. func onFailed(error: String) {
  16. print("FAILED")
  17. }
  18. override func viewDidLoad() {
  19. super.viewDidLoad()
  20. APIS.connect(appName: "SecureComm" ,apiKey: "8E784770B239FA3044A1DB44E276FB575B9BF3800ED11E200F4ACDD8FB476ABA", delegate: self, showButton: false)
  21. //"OneApp","38747683290F62E9667A018F490396EAE47BC16ADECD85B7E865C733E6DBD6A2"
  22. }
  23. override func viewDidAppear(_ animated: Bool) {
  24. let childrenMenu : [UIAction] = [
  25. UIAction(title: "Contact Center".localized(), handler: {(_) in
  26. APIS.openContactCenter()
  27. }),
  28. UIAction(title: "Chat".localized(), handler: {(_) in
  29. APIS.openChat()
  30. }),
  31. UIAction(title: "Notification Center".localized(), handler: {(_) in
  32. APIS.openNotificationCenter()
  33. }),
  34. UIAction(title: "Call".localized(), handler: {(_) in
  35. APIS.openCall()
  36. }),
  37. UIAction(title: "Live Streaming".localized(), handler: {(_) in
  38. APIS.openStreaming()
  39. }),
  40. UIAction(title: "Settings".localized(), handler: {(_) in
  41. APIS.openSetting()
  42. }),
  43. ]
  44. self.navigationController?.navigationBar.backgroundColor = .mainColor
  45. let menu = UIMenu(title: "", children: childrenMenu)
  46. self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: nil, image: UIImage(systemName: "ellipsis"), primaryAction: .none, menu: menu)
  47. self.navigationItem.rightBarButtonItem?.tintColor = .white
  48. }
  49. }