|
@@ -326,6 +326,74 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
self.addMultipleSelectSession()
|
|
|
}
|
|
|
})
|
|
|
+ let actionUnblock = UIAction(title: "Unblock".localized(), handler: {(_) in
|
|
|
+ if !self.isContactCenter {
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ if let response = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.getUnBlock(l_pin: self.dataPerson["f_pin"]!!)) {
|
|
|
+ if !response.isOk() {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to complete action".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
+ _ = Database.shared.updateRecord(fmdb: fmdb, table: "BUDDY", cvalues: [
|
|
|
+ "ex_block" : "0"
|
|
|
+ ], _where: "f_pin = '\(self.dataPerson["f_pin"]!!)'")
|
|
|
+ })
|
|
|
+ containerAction.subviews.forEach({ $0.removeFromSuperview() })
|
|
|
+ containerAction.removeFromSuperview()
|
|
|
+ setRightButtonItem()
|
|
|
+ changeAppBar()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let actionBlock = UIAction(title: "Block".localized(), handler: {(_) in
|
|
|
+ if !self.isContactCenter {
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ if let response = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.getBlock(l_pin: self.dataPerson["f_pin"]!!)) {
|
|
|
+ if !response.isOk() {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to complete action".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
+ _ = Database.shared.updateRecord(fmdb: fmdb, table: "BUDDY", cvalues: [
|
|
|
+ "ex_block" : "1"
|
|
|
+ ], _where: "f_pin = '\(self.dataPerson["f_pin"]!!)'")
|
|
|
+ })
|
|
|
+ setRightButtonItem()
|
|
|
+ changeAppBar()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
var menu = UIMenu(title: "", children: [
|
|
|
actionSearch,
|
|
|
actionDelete
|
|
@@ -335,41 +403,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
if blocking == "1" && self.dataPerson["f_pin"]!! != "-999" {
|
|
|
menu = UIMenu(title: "", children: [
|
|
|
actionSearch,
|
|
|
- UIAction(title: "Unblock".localized(), handler: {(_) in
|
|
|
- if !self.isContactCenter {
|
|
|
- DispatchQueue.global().async {
|
|
|
- if let response = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.getUnBlock(l_pin: self.dataPerson["f_pin"]!!)) {
|
|
|
- if !response.isOk() {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to complete action".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- }
|
|
|
- } else {
|
|
|
- DispatchQueue.main.async { [self] in
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
- _ = Database.shared.updateRecord(fmdb: fmdb, table: "BUDDY", cvalues: [
|
|
|
- "ex_block" : "0"
|
|
|
- ], _where: "f_pin = '\(self.dataPerson["f_pin"]!!)'")
|
|
|
- })
|
|
|
- containerAction.subviews.forEach({ $0.removeFromSuperview() })
|
|
|
- containerAction.removeFromSuperview()
|
|
|
- setRightButtonItem()
|
|
|
- changeAppBar()
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }),
|
|
|
+ actionUnblock,
|
|
|
actionDelete
|
|
|
])
|
|
|
blockedView(blocked: "1")
|
|
@@ -377,39 +411,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
if self.dataPerson["f_pin"]!! != "-999"{
|
|
|
menu = UIMenu(title: "", children: [
|
|
|
actionSearch,
|
|
|
- UIAction(title: "Block".localized(), handler: {(_) in
|
|
|
- if !self.isContactCenter {
|
|
|
- DispatchQueue.global().async {
|
|
|
- if let response = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.getBlock(l_pin: self.dataPerson["f_pin"]!!)) {
|
|
|
- if !response.isOk() {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to complete action".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- }
|
|
|
- } else {
|
|
|
- DispatchQueue.main.async { [self] in
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
- _ = Database.shared.updateRecord(fmdb: fmdb, table: "BUDDY", cvalues: [
|
|
|
- "ex_block" : "1"
|
|
|
- ], _where: "f_pin = '\(self.dataPerson["f_pin"]!!)'")
|
|
|
- })
|
|
|
- setRightButtonItem()
|
|
|
- changeAppBar()
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }),
|
|
|
+ actionBlock,
|
|
|
actionDelete
|
|
|
])
|
|
|
} else {
|