ViewController.swift 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // SecurityShield.check(appName: "OneApp", apiKey: "38747683290F62E9667A018F490396EAE47BC16ADECD85B7E865C733E6DBD6A2")
  15. }
  16. func onFailed(error: String) {
  17. print("FAILED")
  18. }
  19. override func viewDidLoad() {
  20. super.viewDidLoad()
  21. APIS.connect(appName: "esApp" ,apiKey: "FE44324020F0F0196F29D86987B63047D58E546BA8CE5E349F0F5058041C40A7", delegate: self, showButton: true)
  22. // "ps29ios" ,apiKey: "31D080A9F46FBCAAE18F122B8C621CAC2994151978DD3D9BEBD01EB927EE840C"
  23. //"OneApp","38747683290F62E9667A018F490396EAE47BC16ADECD85B7E865C733E6DBD6A2"
  24. }
  25. override func viewDidAppear(_ animated: Bool) {
  26. let childrenMenu : [UIAction] = [
  27. UIAction(title: "Contact Center".localized(), handler: {(_) in
  28. APIS.openContactCenter()
  29. }),
  30. UIAction(title: "Chat".localized(), handler: {(_) in
  31. APIS.openConversation()
  32. }),
  33. UIAction(title: "Notification Center".localized(), handler: {(_) in
  34. APIS.openNotificationCenter()
  35. }),
  36. UIAction(title: "Call".localized(), handler: {(_) in
  37. APIS.openCall()
  38. }),
  39. UIAction(title: "Live Streaming".localized(), handler: {(_) in
  40. APIS.openStreaming()
  41. }),
  42. UIAction(title: "Settings".localized(), handler: {(_) in
  43. APIS.openSetting()
  44. }),
  45. UIAction(title: "Conference Call".localized(), handler: {(_) in
  46. APIS.openConference()
  47. }),
  48. ]
  49. self.navigationController?.navigationBar.backgroundColor = .mainColor
  50. let menu = UIMenu(title: "", children: childrenMenu)
  51. self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: nil, image: UIImage(systemName: "ellipsis"), primaryAction: .none, menu: menu)
  52. self.navigationItem.rightBarButtonItem?.tintColor = .white
  53. }
  54. }