|
@@ -116,14 +116,14 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
timer.invalidate()
|
|
timer.invalidate()
|
|
}
|
|
}
|
|
self.timeoutCC.invalidate()
|
|
self.timeoutCC.invalidate()
|
|
- UserDefaults.standard.removeObject(forKey: "inEditorPersonal")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "inEditorPersonal")
|
|
NotificationCenter.default.removeObserver(self)
|
|
NotificationCenter.default.removeObserver(self)
|
|
super.viewDidDisappear(true)
|
|
super.viewDidDisappear(true)
|
|
self.removeFromParent()
|
|
self.removeFromParent()
|
|
self.dismiss(animated: true, completion: nil)
|
|
self.dismiss(animated: true, completion: nil)
|
|
if !isContactCenter {
|
|
if !isContactCenter {
|
|
let l_pin = self.dataPerson["f_pin"]!!
|
|
let l_pin = self.dataPerson["f_pin"]!!
|
|
- UserDefaults.standard.set("\(textFieldSend.textColor != UIColor.lightGray ? textFieldSend.text! : ""),\(reffId ?? "")", forKey: "saved_\(l_pin)")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set("\(textFieldSend.textColor != UIColor.lightGray ? textFieldSend.text! : ""),\(reffId ?? "")", forKey: "saved_\(l_pin)")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -245,7 +245,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
})
|
|
})
|
|
self.dateStartCC = "\(Date().currentTimeMillis())"
|
|
self.dateStartCC = "\(Date().currentTimeMillis())"
|
|
- let myName = User.getData(pin: UserDefaults.standard.string(forKey: "me") as String?)
|
|
|
|
|
|
+ let myName = User.getData(pin: User.getMyPin() as String?)
|
|
sendChat(message_text: "Hi \(dataPerson["name"]!!), thank you for contacting \(companyName). My name is \(myName!.fullName.trimmingCharacters(in: .whitespaces)), how can I help you?".localized(), ex_format: "1", is_call_center: "1", call_center_id: complaintId, viewController: self, isAutoSendCC: true)
|
|
sendChat(message_text: "Hi \(dataPerson["name"]!!), thank you for contacting \(companyName). My name is \(myName!.fullName.trimmingCharacters(in: .whitespaces)), how can I help you?".localized(), ex_format: "1", is_call_center: "1", call_center_id: complaintId, viewController: self, isAutoSendCC: true)
|
|
if channelContactCenter == "1" {
|
|
if channelContactCenter == "1" {
|
|
if let pin = dataPerson["f_pin"] {
|
|
if let pin = dataPerson["f_pin"] {
|
|
@@ -285,7 +285,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
timer.invalidate()
|
|
timer.invalidate()
|
|
}
|
|
}
|
|
self.timeoutCC.invalidate()
|
|
self.timeoutCC.invalidate()
|
|
- UserDefaults.standard.removeObject(forKey: "inEditorPersonal")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "inEditorPersonal")
|
|
NotificationCenter.default.removeObserver(self)
|
|
NotificationCenter.default.removeObserver(self)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -301,7 +301,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
let l_pin = self.dataPerson["f_pin"]!!
|
|
let l_pin = self.dataPerson["f_pin"]!!
|
|
- UserDefaults.standard.removeObject(forKey: "saved_\(l_pin)")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "saved_\(l_pin)")
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
|
|
if self.fromNotification {
|
|
if self.fromNotification {
|
|
self.didTapExit()
|
|
self.didTapExit()
|
|
@@ -461,9 +461,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
|
|
|
|
if onGoingCC {
|
|
if onGoingCC {
|
|
- UserDefaults.standard.set(self.fPinContacCenter, forKey: "inEditorPersonal")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set(self.fPinContacCenter, forKey: "inEditorPersonal")
|
|
} else {
|
|
} else {
|
|
- UserDefaults.standard.set(dataPerson["f_pin"]!, forKey: "inEditorPersonal")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set(dataPerson["f_pin"]!, forKey: "inEditorPersonal")
|
|
}
|
|
}
|
|
UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [dataPerson["f_pin"]!!])
|
|
UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [dataPerson["f_pin"]!!])
|
|
|
|
|
|
@@ -516,7 +516,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [self] in
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [self] in
|
|
if currentIndexpath == nil && counter != 0 {
|
|
if currentIndexpath == nil && counter != 0 {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
if let idx = dataMessages.firstIndex(where: { $0["message_id"] as? String == markerCounter}) {
|
|
if let idx = dataMessages.firstIndex(where: { $0["message_id"] as? String == markerCounter}) {
|
|
for i in idx..<dataMessages.count {
|
|
for i in idx..<dataMessages.count {
|
|
if dataMessages[i]["f_pin"] as? String != idMe {
|
|
if dataMessages[i]["f_pin"] as? String != idMe {
|
|
@@ -530,7 +530,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
let l_pin = self.dataPerson["f_pin"]
|
|
let l_pin = self.dataPerson["f_pin"]
|
|
- if let dataSaved = UserDefaults.standard.string(forKey: "saved_\(l_pin)") {
|
|
|
|
|
|
+ if let dataSaved: String = SecureUserDefaults.shared.value(forKey: "saved_\(l_pin)") {
|
|
let last_m = dataSaved.components(separatedBy: ",")[0]
|
|
let last_m = dataSaved.components(separatedBy: ",")[0]
|
|
let last_r = dataSaved.components(separatedBy: ",")[1]
|
|
let last_r = dataSaved.components(separatedBy: ",")[1]
|
|
if !last_m.isEmpty {
|
|
if !last_m.isEmpty {
|
|
@@ -545,7 +545,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
tableChatView.scrollToBottom(isAnimated: false)
|
|
tableChatView.scrollToBottom(isAnimated: false)
|
|
}
|
|
}
|
|
} else if isContactCenter && onGoingCC {
|
|
} else if isContactCenter && onGoingCC {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
for i in 0..<dataMessages.count {
|
|
for i in 0..<dataMessages.count {
|
|
if dataMessages[i]["f_pin"] as? String != idMe {
|
|
if dataMessages[i]["f_pin"] as? String != idMe {
|
|
sendReadMessageStatus(chat_id: "", f_pin: dataPerson["f_pin"]!!, message_scope_id: "3", message_id: dataMessages[i]["message_id"] as! String)
|
|
sendReadMessageStatus(chat_id: "", f_pin: dataPerson["f_pin"]!!, message_scope_id: "3", message_id: dataMessages[i]["message_id"] as! String)
|
|
@@ -578,7 +578,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
timer.invalidate()
|
|
timer.invalidate()
|
|
self.listTimerCredential.removeValue(forKey: data.key)
|
|
self.listTimerCredential.removeValue(forKey: data.key)
|
|
self.timerCredential.removeValue(forKey: data.key)
|
|
self.timerCredential.removeValue(forKey: data.key)
|
|
- UserDefaults.standard.removeObject(forKey: data.key)
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: data.key)
|
|
let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == data.key})
|
|
let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == data.key})
|
|
if idx != nil {
|
|
if idx != nil {
|
|
self.dataMessages[idx!]["lock"] = "2"
|
|
self.dataMessages[idx!]["lock"] = "2"
|
|
@@ -866,7 +866,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
row["chat_date"] = chatDate(stringDate: row["server_date"] as! String)
|
|
row["chat_date"] = chatDate(stringDate: row["server_date"] as! String)
|
|
row["isSelected"] = false
|
|
row["isSelected"] = false
|
|
if row["credential"] != nil && row["credential"] as! String == "1" {
|
|
if row["credential"] != nil && row["credential"] as! String == "1" {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
|
|
+ let idMe = User.getMyPin()!
|
|
if row["f_pin"] as! String == idMe {
|
|
if row["f_pin"] as! String == idMe {
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(row["server_date"] as! String)!), end: Date())
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(row["server_date"] as! String)!), end: Date())
|
|
if second > 60 {
|
|
if second > 60 {
|
|
@@ -885,7 +885,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- let hasMessageId = UserDefaults.standard.string(forKey: row["message_id"] as! String)
|
|
|
|
|
|
+ let hasMessageId: String? = SecureUserDefaults.shared.value(forKey: row["message_id"] as! String) ?? nil
|
|
if hasMessageId != nil {
|
|
if hasMessageId != nil {
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(hasMessageId!)!), end: Date())
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(hasMessageId!)!), end: Date())
|
|
if second > 60 {
|
|
if second > 60 {
|
|
@@ -904,7 +904,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- UserDefaults.standard.set("\(Date().currentTimeMillis())", forKey: row["message_id"] as! String)
|
|
|
|
|
|
+ SecureUserDefaults.shared.set("\(Date().currentTimeMillis())", forKey: row["message_id"] as! String)
|
|
listTimerCredential[row["message_id"] as! String] = 60
|
|
listTimerCredential[row["message_id"] as! String] = 60
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1026,7 +1026,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
row["chat_date"] = chatDate(stringDate: row["server_date"] as! String)
|
|
row["chat_date"] = chatDate(stringDate: row["server_date"] as! String)
|
|
row["isSelected"] = false
|
|
row["isSelected"] = false
|
|
if row["credential"] != nil && row["credential"] as! String == "1" {
|
|
if row["credential"] != nil && row["credential"] as! String == "1" {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
|
|
+ let idMe = User.getMyPin()!
|
|
if row["f_pin"] as! String == idMe {
|
|
if row["f_pin"] as! String == idMe {
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(row["server_date"] as! String)!), end: Date())
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(row["server_date"] as! String)!), end: Date())
|
|
if second > 60 {
|
|
if second > 60 {
|
|
@@ -1045,7 +1045,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- let hasMessageId = UserDefaults.standard.string(forKey: row["message_id"] as! String)
|
|
|
|
|
|
+ let hasMessageId: String? = SecureUserDefaults.shared.value(forKey: row["message_id"] as! String) ?? nil
|
|
if hasMessageId != nil {
|
|
if hasMessageId != nil {
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(hasMessageId!)!), end: Date())
|
|
let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(hasMessageId!)!), end: Date())
|
|
if second > 60 {
|
|
if second > 60 {
|
|
@@ -1064,7 +1064,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
listTimerCredential[row["message_id"] as! String] = second
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- UserDefaults.standard.set("\(Date().currentTimeMillis())", forKey: row["message_id"] as! String)
|
|
|
|
|
|
+ SecureUserDefaults.shared.set("\(Date().currentTimeMillis())", forKey: row["message_id"] as! String)
|
|
listTimerCredential[row["message_id"] as! String] = 60
|
|
listTimerCredential[row["message_id"] as! String] = 60
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1140,7 +1140,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
} else if day < 7 {
|
|
} else if day < 7 {
|
|
let formatter = DateFormatter()
|
|
let formatter = DateFormatter()
|
|
formatter.dateFormat = "EEEE"
|
|
formatter.dateFormat = "EEEE"
|
|
- let lang = UserDefaults.standard.string(forKey: "i18n_language")
|
|
|
|
|
|
+ let lang: String = SecureUserDefaults.shared.value(forKey: "i18n_language") ?? "en"
|
|
if lang == "id" {
|
|
if lang == "id" {
|
|
formatter.locale = NSLocale(localeIdentifier: "id") as Locale?
|
|
formatter.locale = NSLocale(localeIdentifier: "id") as Locale?
|
|
}
|
|
}
|
|
@@ -1151,7 +1151,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
} else {
|
|
} else {
|
|
let formatter = DateFormatter()
|
|
let formatter = DateFormatter()
|
|
formatter.dateFormat = "EE, dd MMM"
|
|
formatter.dateFormat = "EE, dd MMM"
|
|
- let lang = UserDefaults.standard.string(forKey: "i18n_language")
|
|
|
|
|
|
+ let lang: String = SecureUserDefaults.shared.value(forKey: "i18n_language") ?? "en"
|
|
if lang == "id" {
|
|
if lang == "id" {
|
|
formatter.locale = NSLocale(localeIdentifier: "id") as Locale?
|
|
formatter.locale = NSLocale(localeIdentifier: "id") as Locale?
|
|
}
|
|
}
|
|
@@ -1282,7 +1282,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
if !data.isEmpty {
|
|
if !data.isEmpty {
|
|
if let jsonArray = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] {
|
|
if let jsonArray = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] {
|
|
var members = ""
|
|
var members = ""
|
|
- let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
|
|
+ let idMe = User.getMyPin()!
|
|
var user : [User] = []
|
|
var user : [User] = []
|
|
for json in jsonArray {
|
|
for json in jsonArray {
|
|
if "\(json)" != idMe {
|
|
if "\(json)" != idMe {
|
|
@@ -1313,14 +1313,14 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
self.users = user
|
|
self.users = user
|
|
self.fPinContacCenter = members
|
|
self.fPinContacCenter = members
|
|
self.changeAppBar()
|
|
self.changeAppBar()
|
|
- UserDefaults.standard.set(members, forKey: "inEditorPersonal")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set(members, forKey: "inEditorPersonal")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (dataMessage.getCode() == CoreMessage_TMessageCode.ACCEPT_CALL_CENTER) {
|
|
} else if (dataMessage.getCode() == CoreMessage_TMessageCode.ACCEPT_CALL_CENTER) {
|
|
if !self.isRequestContactCenter || !isContactCenter {
|
|
if !self.isRequestContactCenter || !isContactCenter {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- UserDefaults.standard.set(dataMessage.getBody(key: CoreMessage_TMessageKey.F_PIN), forKey: "inEditorPersonal")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set(dataMessage.getBody(key: CoreMessage_TMessageKey.F_PIN), forKey: "inEditorPersonal")
|
|
let date = Date()
|
|
let date = Date()
|
|
let formatter = DateFormatter()
|
|
let formatter = DateFormatter()
|
|
formatter.dateFormat = "HH:mm"
|
|
formatter.dateFormat = "HH:mm"
|
|
@@ -1340,10 +1340,10 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
self.dateStartCC = "\(Date().currentTimeMillis())"
|
|
self.dateStartCC = "\(Date().currentTimeMillis())"
|
|
self.tableChatView.insertRows(at: [IndexPath(row: self.dataMessages.count - 1, section: 0)], with: .none)
|
|
self.tableChatView.insertRows(at: [IndexPath(row: self.dataMessages.count - 1, section: 0)], with: .none)
|
|
self.tableChatView.scrollToBottom()
|
|
self.tableChatView.scrollToBottom()
|
|
- UserDefaults.standard.removeObject(forKey: "waitingRequestCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "waitingRequestCC")
|
|
if dataMessage.getBody(key: CoreMessage_TMessageKey.CHANNEL) != "0" {
|
|
if dataMessage.getBody(key: CoreMessage_TMessageKey.CHANNEL) != "0" {
|
|
- UserDefaults.standard.set("\(Date().currentTimeMillis())", forKey: "startTimeCC")
|
|
|
|
- UserDefaults.standard.set(dataMessage.getBody(key: CoreMessage_TMessageKey.CHANNEL), forKey: "channelCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set("\(Date().currentTimeMillis())", forKey: "startTimeCC")
|
|
|
|
+ SecureUserDefaults.shared.set(dataMessage.getBody(key: CoreMessage_TMessageKey.CHANNEL), forKey: "channelCC")
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
|
|
self.dismiss(animated: true, completion: nil)
|
|
self.dismiss(animated: true, completion: nil)
|
|
})
|
|
})
|
|
@@ -1352,7 +1352,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
viewTextfield.isHidden = false
|
|
viewTextfield.isHidden = false
|
|
}
|
|
}
|
|
} else if (dataMessage.getCode() == CoreMessage_TMessageCode.INVITE_END_CONTACT_CENTER || dataMessage.getCode() == CoreMessage_TMessageCode.END_CALL_CENTER || dataMessage.getCode() == CoreMessage_TMessageCode.INVITE_EXIT_CONTACT_CENTER) && !fromVCAC {
|
|
} else if (dataMessage.getCode() == CoreMessage_TMessageCode.INVITE_END_CONTACT_CENTER || dataMessage.getCode() == CoreMessage_TMessageCode.END_CALL_CENTER || dataMessage.getCode() == CoreMessage_TMessageCode.INVITE_EXIT_CONTACT_CENTER) && !fromVCAC {
|
|
- let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
|
|
|
|
+ let onGoingCC: String = SecureUserDefaults.shared.value(forKey: "onGoingCC") ?? ""
|
|
if onGoingCC.isEmpty || !isContactCenter {
|
|
if onGoingCC.isEmpty || !isContactCenter {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -1383,9 +1383,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
self.dismissKeyboard()
|
|
self.dismissKeyboard()
|
|
self.disableEditor()
|
|
self.disableEditor()
|
|
- UserDefaults.standard.removeObject(forKey: "onGoingCC")
|
|
|
|
- UserDefaults.standard.removeObject(forKey: "membersCC")
|
|
|
|
- UserDefaults.standard.removeObject(forKey: "waitingRequestCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "onGoingCC")
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "membersCC")
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "waitingRequestCC")
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
|
|
imageView.tintColor = .white
|
|
imageView.tintColor = .white
|
|
@@ -1411,7 +1411,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
members = ",\(user.pin)"
|
|
members = ",\(user.pin)"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- UserDefaults.standard.set("\(members)", forKey: "membersCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set("\(members)", forKey: "membersCC")
|
|
self.fPinContacCenter = members
|
|
self.fPinContacCenter = members
|
|
self.changeAppBar()
|
|
self.changeAppBar()
|
|
}
|
|
}
|
|
@@ -1486,7 +1486,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
var timer = Timer()
|
|
var timer = Timer()
|
|
var minute = 60
|
|
var minute = 60
|
|
self.timerCredential[row["message_id"] as! String] = timer
|
|
self.timerCredential[row["message_id"] as! String] = timer
|
|
- UserDefaults.standard.set("\(Date().currentTimeMillis())", forKey: row["message_id"] as! String)
|
|
|
|
|
|
+ SecureUserDefaults.shared.set("\(Date().currentTimeMillis())", forKey: row["message_id"] as! String)
|
|
timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: {_ in
|
|
timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: {_ in
|
|
minute -= 1
|
|
minute -= 1
|
|
self.listTimerCredential[row["message_id"] as! String] = minute
|
|
self.listTimerCredential[row["message_id"] as! String] = minute
|
|
@@ -1494,7 +1494,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
timer.invalidate()
|
|
timer.invalidate()
|
|
self.listTimerCredential.removeValue(forKey: row["message_id"] as! String)
|
|
self.listTimerCredential.removeValue(forKey: row["message_id"] as! String)
|
|
self.timerCredential.removeValue(forKey: row["message_id"] as! String)
|
|
self.timerCredential.removeValue(forKey: row["message_id"] as! String)
|
|
- UserDefaults.standard.removeObject(forKey: row["message_id"] as! String)
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: row["message_id"] as! String)
|
|
let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == row["message_id"] as? String})
|
|
let idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == row["message_id"] as? String})
|
|
if idx != nil {
|
|
if idx != nil {
|
|
self.dataMessages[idx!]["lock"] = "2"
|
|
self.dataMessages[idx!]["lock"] = "2"
|
|
@@ -1512,8 +1512,8 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if self.isContactCenter {
|
|
if self.isContactCenter {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
- let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
|
|
|
|
+ let idMe = User.getMyPin()!
|
|
|
|
+ let onGoingCC: String = SecureUserDefaults.shared.value(forKey: "onGoingCC") ?? ""
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
if officer == idMe {
|
|
if officer == idMe {
|
|
self.timeoutCC.invalidate()
|
|
self.timeoutCC.invalidate()
|
|
@@ -1611,9 +1611,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
let data:[AnyHashable : Any] = notification.userInfo!
|
|
let data:[AnyHashable : Any] = notification.userInfo!
|
|
if let dataMessage = data["message"] as? TMessage {
|
|
if let dataMessage = data["message"] as? TMessage {
|
|
let chatData = dataMessage.mBodies
|
|
let chatData = dataMessage.mBodies
|
|
- let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
|
|
|
|
+ let onGoingCC: String = SecureUserDefaults.shared.value(forKey: "onGoingCC") ?? ""
|
|
let requester = onGoingCC.components(separatedBy: ",")[0]
|
|
let requester = onGoingCC.components(separatedBy: ",")[0]
|
|
- let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
|
|
+ let idMe = User.getMyPin()!
|
|
if chatData[CoreMessage_TMessageKey.F_PIN] == self.dataPerson["f_pin"]!! || chatData[CoreMessage_TMessageKey.L_PIN] == self.dataPerson["f_pin"]!! || chatData[CoreMessage_TMessageKey.L_PIN] == self.fPinContacCenter || requester == idMe {
|
|
if chatData[CoreMessage_TMessageKey.F_PIN] == self.dataPerson["f_pin"]!! || chatData[CoreMessage_TMessageKey.L_PIN] == self.dataPerson["f_pin"]!! || chatData[CoreMessage_TMessageKey.L_PIN] == self.fPinContacCenter || requester == idMe {
|
|
if (chatData.keys.contains(CoreMessage_TMessageKey.MESSAGE_ID) && !(chatData[CoreMessage_TMessageKey.MESSAGE_ID]!).contains("-2,")) {
|
|
if (chatData.keys.contains(CoreMessage_TMessageKey.MESSAGE_ID) && !(chatData[CoreMessage_TMessageKey.MESSAGE_ID]!).contains("-2,")) {
|
|
var idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! })
|
|
var idx = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == chatData[CoreMessage_TMessageKey.MESSAGE_ID]! })
|
|
@@ -1715,7 +1715,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
self.listTimerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
self.listTimerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
self.timerCredential[self.dataMessages[idx!]["message_id"] as! String]?.invalidate()
|
|
self.timerCredential[self.dataMessages[idx!]["message_id"] as! String]?.invalidate()
|
|
self.timerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
self.timerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
- UserDefaults.standard.removeObject(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
}
|
|
}
|
|
if self.reffId != nil && self.reffId == chatData["message_id"]! {
|
|
if self.reffId != nil && self.reffId == chatData["message_id"]! {
|
|
self.deleteReplyView()
|
|
self.deleteReplyView()
|
|
@@ -1743,7 +1743,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
DispatchQueue.main.async { [self] in
|
|
DispatchQueue.main.async { [self] in
|
|
let data:[AnyHashable : Any] = notification.userInfo!
|
|
let data:[AnyHashable : Any] = notification.userInfo!
|
|
let message: TMessage = data["message"] as! TMessage
|
|
let message: TMessage = data["message"] as! TMessage
|
|
- let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
|
|
|
|
+ let onGoingCC: String = SecureUserDefaults.shared.value(forKey: "onGoingCC") ?? ""
|
|
if !onGoingCC.isEmpty {
|
|
if !onGoingCC.isEmpty {
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
if message.getBody(key: CoreMessage_TMessageKey.F_PIN) != officer {
|
|
if message.getBody(key: CoreMessage_TMessageKey.F_PIN) != officer {
|
|
@@ -1868,7 +1868,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
var listData = self.dataMessages
|
|
var listData = self.dataMessages
|
|
listData = listData.filter({$0["status"] as! String != "4" && $0["status"] as! String != "8"})
|
|
listData = listData.filter({$0["status"] as! String != "4" && $0["status"] as! String != "8"})
|
|
if listData.count != 0 && !self.isContactCenter {
|
|
if listData.count != 0 && !self.isContactCenter {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
for i in 0...listData.count - 1 {
|
|
for i in 0...listData.count - 1 {
|
|
if listData[i]["f_pin"] as? String != idMe {
|
|
if listData[i]["f_pin"] as? String != idMe {
|
|
self.sendReadMessageStatus(chat_id: "", f_pin: self.dataPerson["f_pin"]!!, message_scope_id: "3", message_id: listData[i]["message_id"] as! String)
|
|
self.sendReadMessageStatus(chat_id: "", f_pin: self.dataPerson["f_pin"]!!, message_scope_id: "3", message_id: listData[i]["message_id"] as! String)
|
|
@@ -1880,7 +1880,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
var listData = dataMessages
|
|
var listData = dataMessages
|
|
listData = listData.filter({$0["status"] as! String != "4" && $0["status"] as! String != "8"})
|
|
listData = listData.filter({$0["status"] as! String != "4" && $0["status"] as! String != "8"})
|
|
if listData.count != 0 && !self.isContactCenter {
|
|
if listData.count != 0 && !self.isContactCenter {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
for i in 0...listData.count - 1 {
|
|
for i in 0...listData.count - 1 {
|
|
if listData[i]["f_pin"] as? String != idMe {
|
|
if listData[i]["f_pin"] as? String != idMe {
|
|
self.sendReadMessageStatus(chat_id: "", f_pin: self.dataPerson["f_pin"]!!, message_scope_id: "3", message_id: listData[i]["message_id"] as! String)
|
|
self.sendReadMessageStatus(chat_id: "", f_pin: self.dataPerson["f_pin"]!!, message_scope_id: "3", message_id: listData[i]["message_id"] as! String)
|
|
@@ -2163,7 +2163,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
timer.invalidate()
|
|
timer.invalidate()
|
|
}
|
|
}
|
|
self.timeoutCC.invalidate()
|
|
self.timeoutCC.invalidate()
|
|
- UserDefaults.standard.removeObject(forKey: "inEditorPersonal")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "inEditorPersonal")
|
|
NotificationCenter.default.removeObserver(self)
|
|
NotificationCenter.default.removeObserver(self)
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "refreshView"), object: nil, userInfo: nil)
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "refreshView"), object: nil, userInfo: nil)
|
|
self.dismiss(animated: true, completion: nil)
|
|
self.dismiss(animated: true, completion: nil)
|
|
@@ -2180,8 +2180,8 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
public func endCallCenter() {
|
|
public func endCallCenter() {
|
|
timeoutCC.invalidate()
|
|
timeoutCC.invalidate()
|
|
let complaintId = self.complaintId
|
|
let complaintId = self.complaintId
|
|
- let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
- let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
|
|
|
|
+ let idMe = User.getMyPin()!
|
|
|
|
+ let onGoingCC: String = SecureUserDefaults.shared.value(forKey: "onGoingCC") ?? ""
|
|
let requester = onGoingCC.components(separatedBy: ",")[0]
|
|
let requester = onGoingCC.components(separatedBy: ",")[0]
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
DispatchQueue.global().async {
|
|
DispatchQueue.global().async {
|
|
@@ -2213,9 +2213,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
_ = Nexilis.write(message: CoreMessage_TMessageBank.leaveCCRoomInvite(ticket_id: complaintId))
|
|
_ = Nexilis.write(message: CoreMessage_TMessageBank.leaveCCRoomInvite(ticket_id: complaintId))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- UserDefaults.standard.removeObject(forKey: "onGoingCC")
|
|
|
|
- UserDefaults.standard.removeObject(forKey: "membersCC")
|
|
|
|
- UserDefaults.standard.removeObject(forKey: "waitingRequestCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "onGoingCC")
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "membersCC")
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "waitingRequestCC")
|
|
}
|
|
}
|
|
self.dismiss(animated: true, completion: nil)
|
|
self.dismiss(animated: true, completion: nil)
|
|
}
|
|
}
|
|
@@ -2322,7 +2322,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
let message_text = message_text.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
let message_text = message_text.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
|
|
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
var opposite_pin = ""
|
|
var opposite_pin = ""
|
|
if isContactCenter {
|
|
if isContactCenter {
|
|
opposite_pin = ""
|
|
opposite_pin = ""
|
|
@@ -2650,7 +2650,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
let level = id!.substring(from: 5, to: 5)
|
|
let level = id!.substring(from: 5, to: 5)
|
|
var row: [String: Any?] = [:]
|
|
var row: [String: Any?] = [:]
|
|
if id == "level\(Int(level)!)_0" {
|
|
if id == "level\(Int(level)!)_0" {
|
|
- UserDefaults.standard.set(true, forKey: "waitingRequestCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set(true, forKey: "waitingRequestCC")
|
|
DispatchQueue.global().async {
|
|
DispatchQueue.global().async {
|
|
let message = CoreMessage_TMessageBank.getQueuingCallCenter(p_channel: Int(self.channelContactCenter)!)
|
|
let message = CoreMessage_TMessageBank.getQueuingCallCenter(p_channel: Int(self.channelContactCenter)!)
|
|
message.mBodies[CoreMessage_TMessageKey.CATEGORY_ID] = "\(service_id!)"
|
|
message.mBodies[CoreMessage_TMessageKey.CATEGORY_ID] = "\(service_id!)"
|
|
@@ -2672,7 +2672,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
|
|
|
|
func requestEmailContactCenter(_ channel: Int){
|
|
func requestEmailContactCenter(_ channel: Int){
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
let complaintId = "CMP_\(idMe!)_\(String(Date().currentTimeMillis()))EML"
|
|
let complaintId = "CMP_\(idMe!)_\(String(Date().currentTimeMillis()))EML"
|
|
let message = CoreMessage_TMessageBank.getRequestEmailCallCenter(p_channel: channel)
|
|
let message = CoreMessage_TMessageBank.getRequestEmailCallCenter(p_channel: channel)
|
|
if let response = Nexilis.writeSync(message: message) {
|
|
if let response = Nexilis.writeSync(message: message) {
|
|
@@ -2693,7 +2693,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
|
|
|
|
func requestSMSContactCenter(_ channel: Int){
|
|
func requestSMSContactCenter(_ channel: Int){
|
|
-// let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
|
|
+// let idMe = User.getMyPin()!
|
|
// let complaintId = "CMP_\(idMe)_\(String(Date().currentTimeMillis()))SMS"
|
|
// let complaintId = "CMP_\(idMe)_\(String(Date().currentTimeMillis()))SMS"
|
|
// isRequestContactCenter = true
|
|
// isRequestContactCenter = true
|
|
var phone = Utils.getSMSCenter()
|
|
var phone = Utils.getSMSCenter()
|
|
@@ -2750,10 +2750,10 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
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 {
|
|
- UserDefaults.standard.set(true, forKey: "waitingRequestCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.set(true, forKey: "waitingRequestCC")
|
|
let data = response.getBody(key: CoreMessage_TMessageKey.DATA, default_value: "")
|
|
let data = response.getBody(key: CoreMessage_TMessageKey.DATA, default_value: "")
|
|
if data.isEmpty {
|
|
if data.isEmpty {
|
|
- UserDefaults.standard.removeObject(forKey: "waitingRequestCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "waitingRequestCC")
|
|
var row: [String: Any?] = [:]
|
|
var row: [String: Any?] = [:]
|
|
row["message_id"] = ""
|
|
row["message_id"] = ""
|
|
row["chat_date"] = "Today".localized()
|
|
row["chat_date"] = "Today".localized()
|
|
@@ -2774,7 +2774,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
- UserDefaults.standard.removeObject(forKey: "waitingRequestCC")
|
|
|
|
|
|
+ SecureUserDefaults.shared.removeValue(forKey: "waitingRequestCC")
|
|
var row: [String: Any?] = [:]
|
|
var row: [String: Any?] = [:]
|
|
row["message_id"] = ""
|
|
row["message_id"] = ""
|
|
row["chat_date"] = "Today".localized()
|
|
row["chat_date"] = "Today".localized()
|
|
@@ -2831,7 +2831,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
if let index = dataMessages.firstIndex(where: {$0["message_id"] as? String == message_id}) {
|
|
if let index = dataMessages.firstIndex(where: {$0["message_id"] as? String == message_id}) {
|
|
dataMessages[index]["status"] = "4"
|
|
dataMessages[index]["status"] = "4"
|
|
- let auto = UserDefaults.standard.bool(forKey: "autoDownload")
|
|
|
|
|
|
+ let auto: Bool = SecureUserDefaults.shared.value(forKey: "autoDownload") ?? false
|
|
if auto {
|
|
if auto {
|
|
if dataMessages[index]["image_id"] as? String != nil && !((dataMessages[index]["image_id"] as? String)!.isEmpty) {
|
|
if dataMessages[index]["image_id"] as? String != nil && !((dataMessages[index]["image_id"] as? String)!.isEmpty) {
|
|
if let listGroupImages = self.groupImages.first(where: { $0.key == message_id }) {
|
|
if let listGroupImages = self.groupImages.first(where: { $0.key == message_id }) {
|
|
@@ -2847,7 +2847,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
if let dirPath = paths.first {
|
|
if let dirPath = paths.first {
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(valueListGroupImages[i].imageId)
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(valueListGroupImages[i].imageId)
|
|
let image = UIImage(contentsOfFile: imageURL.path)
|
|
let image = UIImage(contentsOfFile: imageURL.path)
|
|
- let save = UserDefaults.standard.bool(forKey: "saveToGallery")
|
|
|
|
|
|
+ let save: Bool = SecureUserDefaults.shared.value(forKey: "saveToGallery") ?? false
|
|
if save {
|
|
if save {
|
|
UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
|
|
UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
|
|
}
|
|
}
|
|
@@ -2872,7 +2872,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
if let dirPath = paths.first {
|
|
if let dirPath = paths.first {
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(self.dataMessages[index]["image_id"] as! String)
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(self.dataMessages[index]["image_id"] as! String)
|
|
let image = UIImage(contentsOfFile: imageURL.path)
|
|
let image = UIImage(contentsOfFile: imageURL.path)
|
|
- let save = UserDefaults.standard.bool(forKey: "saveToGallery")
|
|
|
|
|
|
+ let save: Bool = SecureUserDefaults.shared.value(forKey: "saveToGallery") ?? false
|
|
if save {
|
|
if save {
|
|
UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
|
|
UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
|
|
}
|
|
}
|
|
@@ -2896,7 +2896,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
if let dirPath = paths.first {
|
|
if let dirPath = paths.first {
|
|
let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(self.dataMessages[index]["video_id"] as! String)
|
|
let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(self.dataMessages[index]["video_id"] as! String)
|
|
- let save = UserDefaults.standard.bool(forKey: "saveToGallery")
|
|
|
|
|
|
+ let save: Bool = SecureUserDefaults.shared.value(forKey: "saveToGallery") ?? false
|
|
if save {
|
|
if save {
|
|
PHPhotoLibrary.shared().performChanges({
|
|
PHPhotoLibrary.shared().performChanges({
|
|
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: videoURL)
|
|
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: videoURL)
|
|
@@ -3069,7 +3069,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
var listData = dataMessages[0...currentIndexpath!.row]
|
|
var listData = dataMessages[0...currentIndexpath!.row]
|
|
listData = listData.filter({$0["status"] as? String != "4" && $0["status"] as? String != "8"})
|
|
listData = listData.filter({$0["status"] as? String != "4" && $0["status"] as? String != "8"})
|
|
if listData.count != 0 && !isContactCenter {
|
|
if listData.count != 0 && !isContactCenter {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
for i in 0...listData.count - 1 {
|
|
for i in 0...listData.count - 1 {
|
|
if listData[i]["f_pin"] as? String != idMe {
|
|
if listData[i]["f_pin"] as? String != idMe {
|
|
sendReadMessageStatus(chat_id: "", f_pin: dataPerson["f_pin"]!!, message_scope_id: "3", message_id: listData[i]["message_id"] as! String)
|
|
sendReadMessageStatus(chat_id: "", f_pin: dataPerson["f_pin"]!!, message_scope_id: "3", message_id: listData[i]["message_id"] as! String)
|
|
@@ -3714,7 +3714,7 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
|
|
|
|
|
|
var children: [UIMenuElement] = [star, reply, forward, copy, delete]
|
|
var children: [UIMenuElement] = [star, reply, forward, copy, delete]
|
|
// let copyOption = self.copyOption(indexPath: indexPath!)
|
|
// let copyOption = self.copyOption(indexPath: indexPath!)
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
if dataMessages[indexPath!.row]["status"] as! String == "0" {
|
|
if dataMessages[indexPath!.row]["status"] as! String == "0" {
|
|
children = [resend, delete]
|
|
children = [resend, delete]
|
|
} else if isContactCenter {
|
|
} else if isContactCenter {
|
|
@@ -4047,7 +4047,7 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
|
|
if let action = self.actionDelete(for: "me", title: "Delete".localized() + " \(countSelected) " + "For Me".localized(), dataMessages: dataMessages) {
|
|
if let action = self.actionDelete(for: "me", title: "Delete".localized() + " \(countSelected) " + "For Me".localized(), dataMessages: dataMessages) {
|
|
alertController.addAction(action)
|
|
alertController.addAction(action)
|
|
}
|
|
}
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
let dataFilterFpin = dataMessages.filter({ $0["l_pin"] as? String == idMe})
|
|
let dataFilterFpin = dataMessages.filter({ $0["l_pin"] as? String == idMe})
|
|
let dataFilterLock = dataMessages.filter({ $0["lock"] as? String == "1" || $0["lock"] as? String == "2" })
|
|
let dataFilterLock = dataMessages.filter({ $0["lock"] as? String == "1" || $0["lock"] as? String == "2" })
|
|
// let statusDataRead = dataMessages.filter({ Int($0["status"] as! String)! >= 4})
|
|
// let statusDataRead = dataMessages.filter({ Int($0["status"] as! String)! >= 4})
|
|
@@ -4252,7 +4252,7 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
|
|
}
|
|
}
|
|
|
|
|
|
private func updateProfile() {
|
|
private func updateProfile() {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
DispatchQueue.global().async {
|
|
DispatchQueue.global().async {
|
|
let message = CoreMessage_TMessageBank.getBatchBuddiesInfos(p_f_pin: idMe!, last_update: 0)
|
|
let message = CoreMessage_TMessageBank.getBatchBuddiesInfos(p_f_pin: idMe!, last_update: 0)
|
|
let _ = Nexilis.write(message: message)
|
|
let _ = Nexilis.write(message: message)
|
|
@@ -4417,7 +4417,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
default:
|
|
default:
|
|
(streamingController as! CreateSeminarViewController).data = json
|
|
(streamingController as! CreateSeminarViewController).data = json
|
|
}
|
|
}
|
|
- if json["by"] as? String != UserDefaults.standard.string(forKey: "me") as String? {
|
|
|
|
|
|
+ if json["by"] as? String != User.getMyPin() as String? {
|
|
switch(attachmentFlag){
|
|
switch(attachmentFlag){
|
|
case "27":
|
|
case "27":
|
|
(streamingController as! QmeraCreateStreamingViewController).isJoin = true
|
|
(streamingController as! QmeraCreateStreamingViewController).isJoin = true
|
|
@@ -4501,7 +4501,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
}
|
|
}
|
|
|
|
|
|
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
let dataMessages = dataMessages.filter({$0["chat_date"] as! String == dataDates[indexPath.section]})
|
|
let dataMessages = dataMessages.filter({$0["chat_date"] as! String == dataDates[indexPath.section]})
|
|
let profileMessage = UIImageView()
|
|
let profileMessage = UIImageView()
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "cellEditorPersonal", for: indexPath as IndexPath)
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "cellEditorPersonal", for: indexPath as IndexPath)
|
|
@@ -6041,7 +6041,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// if x <= -(recognizer.view?.frame.size.width ?? 0) * 0.05 {
|
|
// if x <= -(recognizer.view?.frame.size.width ?? 0) * 0.05 {
|
|
-// let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+// let idMe = User.getMyPin() as String?
|
|
// let indexPath = self.tableChatView.indexPath(for: recognizer.view! as! UITableViewCell)
|
|
// let indexPath = self.tableChatView.indexPath(for: recognizer.view! as! UITableViewCell)
|
|
// let dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPath!.section]})
|
|
// let dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPath!.section]})
|
|
// if (dataMessages[indexPath!.row]["f_pin"] as? String == idMe) {
|
|
// if (dataMessages[indexPath!.row]["f_pin"] as? String == idMe) {
|
|
@@ -6114,7 +6114,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
}
|
|
}
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(sender.image_id)
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(sender.image_id)
|
|
let image = UIImage(contentsOfFile: imageURL.path)
|
|
let image = UIImage(contentsOfFile: imageURL.path)
|
|
- let save = UserDefaults.standard.bool(forKey: "saveToGallery")
|
|
|
|
|
|
+ let save: Bool = SecureUserDefaults.shared.value(forKey: "saveToGallery") ?? false
|
|
if save {
|
|
if save {
|
|
UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
|
|
UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
|
|
}
|
|
}
|
|
@@ -6176,7 +6176,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
shapeLoading.strokeEnd = CGFloat(progress / 100)
|
|
shapeLoading.strokeEnd = CGFloat(progress / 100)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- let save = UserDefaults.standard.bool(forKey: "saveToGallery")
|
|
|
|
|
|
+ let save: Bool = SecureUserDefaults.shared.value(forKey: "saveToGallery") ?? false
|
|
if save {
|
|
if save {
|
|
let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(sender.video_id)
|
|
let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(sender.video_id)
|
|
PHPhotoLibrary.shared().performChanges({
|
|
PHPhotoLibrary.shared().performChanges({
|
|
@@ -6275,7 +6275,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
|
if let cell = self.tableChatView.cellForRow(at: indexPath) {
|
|
if let cell = self.tableChatView.cellForRow(at: indexPath) {
|
|
let containerMessage = cell.contentView.subviews[0]
|
|
let containerMessage = cell.contentView.subviews[0]
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
if (self.dataMessages[idx!]["f_pin"] as? String == idMe) {
|
|
if (self.dataMessages[idx!]["f_pin"] as? String == idMe) {
|
|
containerMessage.backgroundColor = .blueBubbleColor.withAlphaComponent(0.3)
|
|
containerMessage.backgroundColor = .blueBubbleColor.withAlphaComponent(0.3)
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
@@ -6426,7 +6426,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
// if copySession || forwardSession || deleteSession {
|
|
// if copySession || forwardSession || deleteSession {
|
|
// return nil
|
|
// return nil
|
|
// }
|
|
// }
|
|
-// let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+// let idMe = User.getMyPin() as String?
|
|
// if (dataMessages[indexPath.row]["f_pin"] as? String != idMe) {
|
|
// if (dataMessages[indexPath.row]["f_pin"] as? String != idMe) {
|
|
// return nil
|
|
// return nil
|
|
// }
|
|
// }
|
|
@@ -6503,7 +6503,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
titleReply.leadingAnchor.constraint(equalTo: leftReply.leadingAnchor, constant: 10).isActive = true
|
|
titleReply.leadingAnchor.constraint(equalTo: leftReply.leadingAnchor, constant: 10).isActive = true
|
|
titleReply.topAnchor.constraint(equalTo: self.containerPreviewReply.topAnchor, constant: 10).isActive = true
|
|
titleReply.topAnchor.constraint(equalTo: self.containerPreviewReply.topAnchor, constant: 10).isActive = true
|
|
titleReply.font = UIFont.systemFont(ofSize: 12).bold
|
|
titleReply.font = UIFont.systemFont(ofSize: 12).bold
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
if (dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
if (dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
titleReply.text = "You".localized()
|
|
titleReply.text = "You".localized()
|
|
} else {
|
|
} else {
|
|
@@ -6638,7 +6638,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
|
if let cell = self.tableChatView.cellForRow(at: indexPath) {
|
|
if let cell = self.tableChatView.cellForRow(at: indexPath) {
|
|
let containerMessage = cell.contentView.subviews[0]
|
|
let containerMessage = cell.contentView.subviews[0]
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
|
|
|
+ let idMe = User.getMyPin() as String?
|
|
if (messageTextForSearch[idx]["f_pin"] as? String == idMe) {
|
|
if (messageTextForSearch[idx]["f_pin"] as? String == idMe) {
|
|
containerMessage.backgroundColor = .blueBubbleColor.withAlphaComponent(0.3)
|
|
containerMessage.backgroundColor = .blueBubbleColor.withAlphaComponent(0.3)
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|