|
@@ -935,8 +935,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
row["f_pin"] = nil
|
|
|
row["message_id"] = ""
|
|
|
row["chat_date"] = "Today".localized()
|
|
|
- let listStringName: [String] = ["Chat with a Representative".localized(), "Video Call a Representative".localized(), "Call a Representative".localized()]
|
|
|
+ let listStringName: [String] = ["Messaging".localized(), "Secure SMS".localized(), "VoIP Call".localized(), "Email".localized(), "Video Call".localized(), "GSM Call".localized(), "GPT Chatbot".localized(), "WhatsApp"]
|
|
|
var data : [CategoryCC] = []
|
|
|
+ let channels : [String] = ["0", "4", "2", "3", "1", "5", "7", "6"]
|
|
|
if Utils.getDefaultCC() == "No" {
|
|
|
let category = CategoryCC.getDatafromParent(parent: CategoryCC.default_parent)
|
|
|
for i in 0..<category.count {
|
|
@@ -944,7 +945,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
}
|
|
|
} else {
|
|
|
for i in 0..<listStringName.count {
|
|
|
- data.append(CategoryCC(id: "level0_\(i)", service_id: "", service_name: listStringName[i], parent: "\(i)", description: "", is_tablet: "0"))
|
|
|
+ data.append(CategoryCC(id: "level0_\(channels[i])", service_id: "", service_name: listStringName[i], parent: "\(i)", description: "", is_tablet: "0"))
|
|
|
}
|
|
|
row["attachment_flag"] = "503"
|
|
|
}
|
|
@@ -2432,20 +2433,18 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
}
|
|
|
return
|
|
|
} else {
|
|
|
- let listStringName: [String] = ["Chat with a Representative".localized(), "Video Call a Representative".localized(), "Call a Representative".localized()]
|
|
|
+ let listStringName: [String] = ["Messaging".localized(), "Secure SMS".localized(), "VoIP Call".localized(), "Email".localized(), "Video Call".localized(), "GSM Call".localized(), "GPT Chatbot".localized(), "WhatsApp"]
|
|
|
+// let listStringName: [String] = ["Chat with a Representative".localized(), "Video Call a Representative".localized(), "Call a Representative".localized()]
|
|
|
var data : [CategoryCC] = []
|
|
|
+ let channels : [String] = ["0", "4", "2", "3", "1", "5", "7", "6"]
|
|
|
for i in 0..<listStringName.count {
|
|
|
- data.append(CategoryCC(id: "level\(Int(level)! + 1)_\(i)", service_id: service_id!, service_name: listStringName[i], parent: id!, description: "", is_tablet: "0"))
|
|
|
+ data.append(CategoryCC(id: "level\(Int(level)! + 1)_\(channels[i])", service_id: service_id!, service_name: listStringName[i], parent: id!, description: "", is_tablet: "0"))
|
|
|
}
|
|
|
row["category_cc"] = data
|
|
|
row["attachment_flag"] = "503"
|
|
|
}
|
|
|
} else {
|
|
|
- if id == "level\(Int(level)!)_1" {
|
|
|
- channel = 2
|
|
|
- } else if id == "level\(Int(level)!)_2" {
|
|
|
- channel = 1
|
|
|
- }
|
|
|
+ channel = Int((id?.components(separatedBy: "_")[1])!)!
|
|
|
if channel == 1 || channel == 2 {
|
|
|
if channel == 2 {
|
|
|
let goAudioCall = DigiX.checkMicPermission()
|
|
@@ -2475,6 +2474,21 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ } else if channel == 3 {
|
|
|
+ requestEmailContactCenter(channel)
|
|
|
+ return
|
|
|
+ } else if channel == 4 {
|
|
|
+ requestSMSContactCenter(channel)
|
|
|
+ return
|
|
|
+ } else if channel == 5 {
|
|
|
+ requestGSMCallContactCenter(channel)
|
|
|
+ return
|
|
|
+ } else if channel == 6 {
|
|
|
+ requestWhatsappContactCenter(channel)
|
|
|
+ return
|
|
|
+ } else if channel == 7 {
|
|
|
+ APIS.openSmartChatbot()
|
|
|
+ return
|
|
|
}
|
|
|
row["category_cc"] = "Please wait while we connect you\nto one of our service representatives".localized()
|
|
|
isRequest = true
|
|
@@ -2601,6 +2615,58 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
// })
|
|
|
}
|
|
|
|
|
|
+ func requestEmailContactCenter(_ channel: Int){
|
|
|
+ let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
+ let complaintId = "CMP_\(idMe!)_\(String(Date().currentTimeMillis()))EML"
|
|
|
+ let message = CoreMessage_TMessageBank.getRequestEmailCallCenter(p_channel: channel)
|
|
|
+ if let response = DigiX.writeSync(message: message) {
|
|
|
+ if (response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "00") {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let email = response.getBody(key: CoreMessage_TMessageKey.EMAIL, default_value: "")
|
|
|
+ let officer = response.getBody(key: CoreMessage_TMessageKey.L_PIN, default_value: "")
|
|
|
+ if email.isEmpty {
|
|
|
+ self.showToast(message: "Invalid Email Address".localized(), font: UIFont.systemFont(ofSize: 12, weight: .medium), controller: self)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // TODO: check if mail available
|
|
|
+ DigiX.openmailAction(to: email)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ func requestSMSContactCenter(_ channel: Int){
|
|
|
+ let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
+ let complaintId = "CMP_\(idMe)_\(String(Date().currentTimeMillis()))SMS"
|
|
|
+ isRequestContactCenter = true
|
|
|
+ if let phoneNum = UserDefaults.standard.string(forKey: "whatsapp_center") {
|
|
|
+ APIS.sendSMS(phoneNumber: phoneNum)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ APIS.sendSMS(phoneNumber: "+628115881946")
|
|
|
+ }
|
|
|
+// let tmessage = TMessage()
|
|
|
+// tmessage.mCode = CoreMessage_TMessageCode.ACCEPT_CALL_CENTER
|
|
|
+// tmessage.mStatus = CoreMessage_TMessageUtil.getTID()
|
|
|
+// tmessage.mPIN = idMe
|
|
|
+// tmessage.mBodies[CoreMessage_TMessageKey.F_PIN] = me
|
|
|
+// tmessage.mBodies[CoreMessage_TMessageKey.UPLINE_PIN] = me
|
|
|
+// tmessage.mBodies[CoreMessage_TMessageKey.CHANNEL] = channel
|
|
|
+// tmessage.mBodies[CoreMessage_TMessageKey.CALL_CENTER_ID] = complaint_id
|
|
|
+ }
|
|
|
+
|
|
|
+ func requestGSMCallContactCenter(_ channel: Int){
|
|
|
+ if let url = URL(string: "tel://1500046") {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func requestWhatsappContactCenter(_ channel: Int){
|
|
|
+ let phone = UserDefaults.standard.string(forKey: "whatsapp_center") ?? "628115881946";
|
|
|
+ APIS.sendWhatsapp(phoneNumber: phone)
|
|
|
+ }
|
|
|
+
|
|
|
func requestContactCenter(channel: Int, service_id: String, row: [String: Any?]) {
|
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|