|
@@ -101,6 +101,8 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
var touchedSubview = UIView()
|
|
var touchedSubview = UIView()
|
|
var listViewOnSection: [UIView] = []
|
|
var listViewOnSection: [UIView] = []
|
|
var fromVCAC = false
|
|
var fromVCAC = false
|
|
|
|
+ var serviceIdCC = ""
|
|
|
|
+ var isDirectCC = false
|
|
|
|
|
|
public override func viewDidDisappear(_ animated: Bool) {
|
|
public override func viewDidDisappear(_ animated: Bool) {
|
|
if self.isMovingFromParent {
|
|
if self.isMovingFromParent {
|
|
@@ -240,6 +242,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
self.show(videoVC, sender: nil)
|
|
self.show(videoVC, sender: nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if isDirectCC {
|
|
|
|
+ directCC()
|
|
|
|
+ }
|
|
// else if isContactCenter {
|
|
// else if isContactCenter {
|
|
// let buttonId = UIButton()
|
|
// let buttonId = UIButton()
|
|
// if channelContactCenter == "0" {
|
|
// if channelContactCenter == "0" {
|
|
@@ -988,7 +993,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
} else {
|
|
} else {
|
|
query = "SELECT message_id, f_pin, l_pin, message_scope_id, server_date, status, message_text, audio_id, video_id, image_id, thumb_id, read_receipts, chat_id, file_id, attachment_flag, reff_id, lock, is_stared FROM MESSAGE where message_scope_id = '5' AND broadcast_flag = 0 AND is_call_center = 1 AND call_center_id = '\(complaintId)' order by server_date asc"
|
|
query = "SELECT message_id, f_pin, l_pin, message_scope_id, server_date, status, message_text, audio_id, video_id, image_id, thumb_id, read_receipts, chat_id, file_id, attachment_flag, reff_id, lock, is_stared FROM MESSAGE where message_scope_id = '5' AND broadcast_flag = 0 AND is_call_center = 1 AND call_center_id = '\(complaintId)' order by server_date asc"
|
|
}
|
|
}
|
|
- if isRequestContactCenter {
|
|
|
|
|
|
+ if isRequestContactCenter && !isDirectCC {
|
|
var row: [String: Any?] = [:]
|
|
var row: [String: Any?] = [:]
|
|
row["f_pin"] = nil
|
|
row["f_pin"] = nil
|
|
row["message_id"] = ""
|
|
row["message_id"] = ""
|
|
@@ -996,7 +1001,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
let listStringName: [String] = ["Chat with a Representative".localized(), "Video Call a Representative".localized(), "Call a Representative".localized()]
|
|
let listStringName: [String] = ["Chat with a Representative".localized(), "Video Call a Representative".localized(), "Call a Representative".localized()]
|
|
var data : [CategoryCC] = []
|
|
var data : [CategoryCC] = []
|
|
if Utils.getDefaultCC() == "No" {
|
|
if Utils.getDefaultCC() == "No" {
|
|
- let category = CategoryCC.getDatafromParent(parent: "-99")
|
|
|
|
|
|
+ let category = CategoryCC.getDatafromParent(parent: CategoryCC.default_parent)
|
|
for i in 0..<category.count {
|
|
for i in 0..<category.count {
|
|
data.append(CategoryCC(id: "level0_\(i)", service_id: category[i].service_id, service_name: category[i].service_name, parent: category[i].parent, description: category[i].description, is_tablet: "0"))
|
|
data.append(CategoryCC(id: "level0_\(i)", service_id: category[i].service_id, service_name: category[i].service_name, parent: category[i].parent, description: category[i].description, is_tablet: "0"))
|
|
}
|
|
}
|
|
@@ -1009,6 +1014,8 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
row["category_cc"] = data
|
|
row["category_cc"] = data
|
|
dataDates.append("Today".localized())
|
|
dataDates.append("Today".localized())
|
|
dataMessages.append(row)
|
|
dataMessages.append(row)
|
|
|
|
+ } else if isDirectCC {
|
|
|
|
+ dataDates.append("Today".localized())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
@@ -2492,6 +2499,47 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private func directCC() {
|
|
|
|
+ if channelContactCenter == "1" || channelContactCenter == "2" {
|
|
|
|
+ if channelContactCenter == "2" {
|
|
|
|
+ let goAudioCall = Nexilis.checkMicPermission()
|
|
|
|
+ let goVideoCall = Nexilis.checkCameraPermission()
|
|
|
|
+ if goVideoCall == 0 {
|
|
|
|
+ let alert = UIAlertController(title: "Attention!".localized(), message: !goAudioCall && goVideoCall == 0 && channelContactCenter == "2" ? "Please allow microphone & camera permission in your settings".localized() : !goAudioCall ? "Please allow microphone permission in your settings".localized() : "Please allow camera permission in your settings", preferredStyle: .alert)
|
|
|
|
+ alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {_ in
|
|
|
|
+ if let url = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(url) {
|
|
|
|
+ UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
|
|
+ }
|
|
|
|
+ }))
|
|
|
|
+ self.navigationController?.present(alert, animated: true, completion: nil)
|
|
|
|
+ return
|
|
|
|
+ } else if goVideoCall == -1 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ } else if channelContactCenter == "1" {
|
|
|
|
+ let goAudioCall = Nexilis.checkMicPermission()
|
|
|
|
+ if !goAudioCall{
|
|
|
|
+ let alert = UIAlertController(title: "Attention!".localized(), message: "Please allow microphone permission in your settings".localized(), preferredStyle: .alert)
|
|
|
|
+ alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {_ in
|
|
|
|
+ if let url = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(url) {
|
|
|
|
+ UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
|
|
+ }
|
|
|
|
+ }))
|
|
|
|
+ self.navigationController?.present(alert, animated: true, completion: nil)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ var row: [String: Any?] = [:]
|
|
|
|
+ row["message_id"] = ""
|
|
|
|
+ row["chat_date"] = "Today".localized()
|
|
|
|
+ row["category_cc"] = "Please wait while we connect you\nto one of our service representatives".localized()
|
|
|
|
+ dataMessages.append(row)
|
|
|
|
+ nowSelectedCategoryCC = "CantReturn"
|
|
|
|
+ tableChatView.insertRows(at: [IndexPath(row: 0, section: 0)], with: .none)
|
|
|
|
+ requestContactCenter(channel: Int(channelContactCenter)!, service_id: serviceIdCC, row: row)
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc func busyCCAction(sender: UIButton) {
|
|
@objc func busyCCAction(sender: UIButton) {
|
|
let id = sender.restorationIdentifier?.components(separatedBy: ",")[0]
|
|
let id = sender.restorationIdentifier?.components(separatedBy: ",")[0]
|
|
let service_id = sender.restorationIdentifier?.components(separatedBy: ",")[1]
|
|
let service_id = sender.restorationIdentifier?.components(separatedBy: ",")[1]
|
|
@@ -2528,13 +2576,15 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
return
|
|
return
|
|
}
|
|
}
|
|
DispatchQueue.global().async {
|
|
DispatchQueue.global().async {
|
|
- let message = CoreMessage_TMessageBank.getRequestCallCenter(p_channel: channel)
|
|
|
|
|
|
+ let message = CoreMessage_TMessageBank.getRequestCallCenter(p_channel: channel, category_id: service_id)
|
|
if let response = Nexilis.writeSync(message: message) {
|
|
if let response = Nexilis.writeSync(message: message) {
|
|
- DispatchQueue.main.async {
|
|
|
|
- self.dataMessages.append(row)
|
|
|
|
- self.nowSelectedCategoryCC = "CantReturn"
|
|
|
|
- self.tableChatView.insertRows(at: [IndexPath(row: self.dataMessages.count - 1, section: 0)], with: .none)
|
|
|
|
- self.tableChatView.scrollToBottom()
|
|
|
|
|
|
+ if !self.isDirectCC {
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
+ self.dataMessages.append(row)
|
|
|
|
+ self.nowSelectedCategoryCC = "CantReturn"
|
|
|
|
+ self.tableChatView.insertRows(at: [IndexPath(row: self.dataMessages.count - 1, section: 0)], with: .none)
|
|
|
|
+ self.tableChatView.scrollToBottom()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "00") {
|
|
if (response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "00") {
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
@@ -4026,7 +4076,6 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
cell.contentView.subviews.forEach({ $0.removeFromSuperview() })
|
|
cell.contentView.subviews.forEach({ $0.removeFromSuperview() })
|
|
|
|
|
|
if isContactCenter && isRequestContactCenter && dataMessages[indexPath.row]["category_cc"] != nil {
|
|
if isContactCenter && isRequestContactCenter && dataMessages[indexPath.row]["category_cc"] != nil {
|
|
-
|
|
|
|
cell.backgroundColor = .clear
|
|
cell.backgroundColor = .clear
|
|
cell.selectionStyle = .none
|
|
cell.selectionStyle = .none
|
|
|
|
|
|
@@ -4118,7 +4167,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
containerButton.addSubview(buttonChat)
|
|
containerButton.addSubview(buttonChat)
|
|
buttonChat.translatesAutoresizingMaskIntoConstraints = false
|
|
buttonChat.translatesAutoresizingMaskIntoConstraints = false
|
|
buttonChat.widthAnchor.constraint(equalToConstant: self.view!.frame.size.width * 0.65 / 2 - 10).isActive = true
|
|
buttonChat.widthAnchor.constraint(equalToConstant: self.view!.frame.size.width * 0.65 / 2 - 10).isActive = true
|
|
- buttonChat.heightAnchor.constraint(equalToConstant: 45).isActive = true
|
|
|
|
|
|
+ buttonChat.heightAnchor.constraint(greaterThanOrEqualToConstant: 45).isActive = true
|
|
if i % 2 == 0 {
|
|
if i % 2 == 0 {
|
|
if i / 2 + 1 == 1 {
|
|
if i / 2 + 1 == 1 {
|
|
buttonChat.topAnchor.constraint(equalTo: containerButton.topAnchor, constant: 5).isActive = true
|
|
buttonChat.topAnchor.constraint(equalTo: containerButton.topAnchor, constant: 5).isActive = true
|