|
@@ -64,6 +64,7 @@ public class ProfileViewController: UITableViewController {
|
|
|
private func reload() {
|
|
|
if let user = self.user {
|
|
|
self.navigationController?.navigationBar.topItem?.title = "\(user.firstName) \(user.lastName)"
|
|
|
+ self.navigationController?.navigationBar.setNeedsLayout()
|
|
|
self.title = "\(user.firstName) \(user.lastName)"
|
|
|
if !user.thumb.isEmpty {
|
|
|
self.profile.setImage(name: user.thumb)
|
|
@@ -114,6 +115,7 @@ public class ProfileViewController: UITableViewController {
|
|
|
}
|
|
|
}
|
|
|
self.navigationController?.navigationBar.topItem?.title = "\(user.firstName) \(user.lastName)"
|
|
|
+ self.navigationController?.navigationBar.setNeedsLayout()
|
|
|
self.title = "\(user.firstName) \(user.lastName)"
|
|
|
if !user.thumb.isEmpty {
|
|
|
self.profile.setImage(name: user.thumb)
|
|
@@ -447,7 +449,7 @@ public class ProfileViewController: UITableViewController {
|
|
|
self.user?.thumb = ""
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully removed image".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully removed profile picture".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
banner.show()
|
|
|
self.dismissImage?(UIImage(systemName: "person.circle.fill")!, "")
|
|
|
}
|
|
@@ -575,7 +577,7 @@ public class ProfileViewController: UITableViewController {
|
|
|
}
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully changed named".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully changed name".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
banner.show()
|
|
|
}
|
|
|
navigationItem.backButtonTitle = ""
|
|
@@ -620,42 +622,42 @@ extension ProfileViewController: ImageVideoPickerDelegate {
|
|
|
}
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: {
|
|
|
Nexilis.showLoader()
|
|
|
- })
|
|
|
- DispatchQueue.global().async {
|
|
|
- let resize = image.resize(target: CGSize(width: 800, height: 600))
|
|
|
- let documentDir = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
- let fileDir = documentDir.appendingPathComponent("THUMB_\(me)\(Date().currentTimeMillis().toHex())")
|
|
|
- if !FileManager.default.fileExists(atPath: fileDir.path), let data = resize.jpegData(compressionQuality: 0.8) {
|
|
|
- try! data.write(to: fileDir)
|
|
|
- Network().upload(name: fileDir.lastPathComponent) { result, progress in
|
|
|
- guard result, progress == 100 else {
|
|
|
- return
|
|
|
- }
|
|
|
- if let response = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.getChangePersonImage(thumb_id: fileDir.lastPathComponent)), response.isOk() {
|
|
|
- Database.shared.database?.inTransaction({ fmdb, rollback in
|
|
|
- _ = Database.shared.updateRecord(fmdb: fmdb, table: "BUDDY", cvalues: ["image_id": fileDir.lastPathComponent], _where: "f_pin = '\(me)'")
|
|
|
- })
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "updateFifthTab"), object: nil, userInfo: nil)
|
|
|
-
|
|
|
- DispatchQueue.main.async {
|
|
|
- Nexilis.hideLoader(completion: {
|
|
|
- self.profile.image = image
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
- self.user?.thumb = fileDir.lastPathComponent
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully changed image".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- self.dismissImage?(image, fileDir.lastPathComponent)
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ let resize = image.resize(target: CGSize(width: 800, height: 600))
|
|
|
+ let documentDir = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
+ let fileDir = documentDir.appendingPathComponent("THUMB_\(me)\(Date().currentTimeMillis().toHex())")
|
|
|
+ if !FileManager.default.fileExists(atPath: fileDir.path), let data = resize.jpegData(compressionQuality: 0.8) {
|
|
|
+ try! data.write(to: fileDir)
|
|
|
+ Network().upload(name: fileDir.lastPathComponent) { result, progress in
|
|
|
+ guard result, progress == 100 else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if let response = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.getChangePersonImage(thumb_id: fileDir.lastPathComponent)), response.isOk() {
|
|
|
+ Database.shared.database?.inTransaction({ fmdb, rollback in
|
|
|
+ _ = Database.shared.updateRecord(fmdb: fmdb, table: "BUDDY", cvalues: ["image_id": fileDir.lastPathComponent], _where: "f_pin = '\(me)'")
|
|
|
})
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "updateFifthTab"), object: nil, userInfo: nil)
|
|
|
+
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ Nexilis.hideLoader(completion: {
|
|
|
+ self.profile.image = image
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
+ self.user?.thumb = fileDir.lastPathComponent
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully changed profile picture".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ self.dismissImage?(image, fileDir.lastPathComponent)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Nexilis.hideLoader(completion: {})
|
|
|
}
|
|
|
- } else {
|
|
|
- Nexilis.hideLoader(completion: {})
|
|
|
}
|
|
|
+ } else {
|
|
|
+ Nexilis.hideLoader(completion: {})
|
|
|
}
|
|
|
- } else {
|
|
|
- Nexilis.hideLoader(completion: {})
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|