|
@@ -47,20 +47,12 @@ public class APIS: NSObject {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static func openContactCenter() {
|
|
|
+ public static func openContactCenter(media: Int? = nil, category: Int? = nil) {
|
|
|
let isChangeProfile = Utils.getSetProfile()
|
|
|
if !isChangeProfile {
|
|
|
APIS.showChangeProfile()
|
|
|
return
|
|
|
}
|
|
|
- let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
|
|
|
- if isWaitingRequestCC {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- return
|
|
|
- }
|
|
|
if User.isCallCenter(userType: (User.getData(pin: User.getMyPin())?.userType)!) {
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "myHistoryCC") as! HistoryCCViewController
|
|
|
controller.isOfficer = true
|
|
@@ -73,43 +65,34 @@ public class APIS: NSObject {
|
|
|
UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
}
|
|
|
} else {
|
|
|
- let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
|
|
|
- controller.isContactCenter = true
|
|
|
- let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.defaultStyle()
|
|
|
- if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
|
- UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
|
|
|
- } else {
|
|
|
- UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ if media != nil {
|
|
|
+ if media! < 0 || media! > 2 {
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("108:Invalid Contact Center media parameter (0:Chat, 1:Audio Call, 2:Video Call)".localized(), duration: 2)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static func callContactCenter(mode: String, speciality: String) {
|
|
|
- let isChangeProfile = Utils.getSetProfile()
|
|
|
- if !isChangeProfile {
|
|
|
- APIS.showChangeProfile()
|
|
|
- return
|
|
|
- }
|
|
|
- let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
|
|
|
- if isWaitingRequestCC {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- return
|
|
|
- }
|
|
|
- if User.isCallCenter(userType: (User.getData(pin: User.getMyPin())?.userType)!) {
|
|
|
- let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "myHistoryCC") as! HistoryCCViewController
|
|
|
- controller.isOfficer = true
|
|
|
- let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.defaultStyle()
|
|
|
- if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
|
- UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
|
|
|
- } else {
|
|
|
- UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ if category != nil {
|
|
|
+ if category != 0 {
|
|
|
+ let service = CategoryCC.getDataFromServiceId(service_id: "\(category!)")
|
|
|
+ if service == nil {
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("109:Invalid Contact Center category parameter".localized(), duration: 2)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let serviceChilds = CategoryCC.getDatafromParent(parent: service!.service_id)
|
|
|
+ if serviceChilds.count > 0 {
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("109:Invalid Contact Center category parameter".localized(), duration: 2)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
|
|
|
+ if isWaitingRequestCC {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ return
|
|
|
}
|
|
|
- } else {
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
|
|
|
controller.isContactCenter = true
|
|
|
let navigationController = UINavigationController(rootViewController: controller)
|