alqindiirsyam 2 gadi atpakaļ
vecāks
revīzija
cb80e0dfa0

+ 3 - 1
appbuilder-ios/AppBuilder/AppBuilder/FirstTabViewController.swift

@@ -191,6 +191,9 @@ class FirstTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
         }
         if ViewController.middleButton.isDescendant(of: viewController!.view) {
             DispatchQueue.main.async {
+                if ViewController.isExpandButton {
+                    ViewController.expandButton()
+                }
                 ViewController.hideDockedButton()
                 if let viewController = viewController as? ViewController {
                     viewController.tabBar.isHidden = true
@@ -217,7 +220,6 @@ class FirstTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
             viewController = self.parent
         }
         if ViewController.middleButton.isHidden {
-            ViewController.isExpandButton = false
             if let viewController = viewController as? ViewController {
                 viewController.tabBar.isHidden = false
                 ViewController.middleButton.isHidden = false

+ 3 - 1
appbuilder-ios/AppBuilder/AppBuilder/ThirdTabViewController.swift

@@ -202,6 +202,9 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
         }
         if ViewController.middleButton.isDescendant(of: viewController!.view) {
             DispatchQueue.main.async {
+                if ViewController.isExpandButton {
+                    ViewController.expandButton()
+                }
                 ViewController.hideDockedButton()
                 if let viewController = viewController as? ViewController {
                     viewController.tabBar.isHidden = true
@@ -228,7 +231,6 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
             viewController = self.parent
         }
         if ViewController.middleButton.isHidden {
-            ViewController.isExpandButton = false
             if let viewController = viewController as? ViewController {
                 viewController.tabBar.isHidden = false
                 ViewController.middleButton.isHidden = false

+ 2 - 1
appbuilder-ios/NexilisLite/NexilisLite/Resource/Palio.storyboard

@@ -1060,7 +1060,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Change password to keep your account secure" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yqd-uF-xRd">
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Change password to keep your account secure" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yqd-uF-xRd">
                                 <rect key="frame" x="40" y="88" width="334" height="17"/>
                                 <color key="tintColor" systemColor="tintColor"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
@@ -1111,6 +1111,7 @@
                         </constraints>
                     </view>
                     <connections>
+                        <outlet property="labelDesc" destination="yqd-uF-xRd" id="jfY-KN-1vE"/>
                         <outlet property="newPassField" destination="bDv-aU-6EW" id="1vQ-SF-Fcv"/>
                         <outlet property="oldPassField" destination="g7J-Td-biq" id="5a1-Nz-tcw"/>
                         <outlet property="showNewPassButton" destination="ZZQ-tO-BPg" id="A7Z-eg-0JC"/>

+ 4 - 0
appbuilder-ios/NexilisLite/NexilisLite/Resource/id.lproj/Localizable.strings

@@ -195,3 +195,7 @@
 "Title" = "Judul";
 "Start Call" = "Mulai Panggilan";
 "Sticker" = "Stiker";
+"Change password to keep your account secure" = "Ubah kata sandi untuk menjaga keamanan akun Anda";
+"Old Password" = "Kata sandi lama";
+"New Password" = "Kata sandi baru";
+"added you as friend" = "menambahkan anda sebagai teman";

+ 78 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/IncomingThread.swift

@@ -54,6 +54,7 @@ class IncomingThread {
         } else if message.getCode() == CoreMessage_TMessageCode.PUSH_MYSELF || message.getCode() == CoreMessage_TMessageCode.PUSH_MYSELF_ACK || message.getCode() == CoreMessage_TMessageCode.PULL_MYSELF {
             pushMyself(message: message)
         } else if message.getCode() == CoreMessage_TMessageCode.PUSH_BUDDY {
+            makeNotifAddFriend(message: message)
             initBatchBuddy(message: message)
         } else if message.getCode() == CoreMessage_TMessageCode.INIT_BATCH_BUDDY {
             initBatchBuddy(message: message)
@@ -156,6 +157,83 @@ class IncomingThread {
     /**
      *
      */
+    var floating: FloatingNotificationBanner!
+    
+    private func makeNotifAddFriend(message: TMessage) {
+        let data  = message.getBody(key: CoreMessage_TMessageKey.DATA)
+        if let jsonArray = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] {
+            for json in jsonArray {
+                DispatchQueue.main.async { [self] in
+                    let container = UIView()
+                    container.backgroundColor = .gray
+                    let profileImage = UIImageView()
+                    profileImage.frame.size = CGSize(width: 60, height: 60)
+                    container.addSubview(profileImage)
+                    profileImage.translatesAutoresizingMaskIntoConstraints = false
+                    NSLayoutConstraint.activate([
+                        profileImage.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 8.0),
+                        profileImage.centerYAnchor.constraint(equalTo: container.centerYAnchor),
+                        profileImage.widthAnchor.constraint(equalToConstant: 60),
+                        profileImage.heightAnchor.constraint(equalToConstant: 60),
+                    ])
+                    
+                    let title = UILabel()
+                    container.addSubview(title)
+                    title.translatesAutoresizingMaskIntoConstraints = false
+                    NSLayoutConstraint.activate([
+                        title.leadingAnchor.constraint(equalTo: profileImage.trailingAnchor, constant: 8.0),
+                        title.centerYAnchor.constraint(equalTo: container.centerYAnchor),
+                    ])
+                    title.font = UIFont.systemFont(ofSize: 14)
+                    let firstname = CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.FIRST_NAME)
+                    let lastname = CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.LAST_NAME)
+                    title.text = (firstname + " " + lastname).trimmingCharacters(in: .whitespaces) + " " + "added you as friend".localized()
+                    title.textColor = .white
+                    
+                    if floating != nil {
+                        floating.dismiss()
+                    }
+                    floating = FloatingNotificationBanner(customView: container)
+                    floating.bannerHeight = 100.0
+                    floating.transparency = 0.9
+                    
+                    let profile = CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.THUMB_ID)
+                    if profile != "" {
+                        profileImage.circle()
+                        do {
+                            let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
+                            let file = documentDir.appendingPathComponent(profile)
+                            if FileManager().fileExists(atPath: file.path) {
+                                profileImage.image = UIImage(contentsOfFile: file.path)
+                                profileImage.backgroundColor = .clear
+                            } else {
+                                Download().start(forKey: profile) { (name, progress) in
+                                    guard progress == 100 else {
+                                        return
+                                    }
+                                    
+                                    DispatchQueue.main.async { [self] in
+                                        profileImage.image = UIImage(contentsOfFile: file.path)
+                                        profileImage.backgroundColor = .clear
+                                        floating.show(queuePosition: .front, bannerPosition: .top, queue: NotificationBannerQueue(maxBannersOnScreenSimultaneously: 1), on: nil, edgeInsets: UIEdgeInsets(top: 8.0, left: 8.0, bottom: 0, right: 8.0), cornerRadius: 8.0, shadowColor: .clear, shadowOpacity: .zero, shadowBlurRadius: .zero, shadowCornerRadius: .zero, shadowOffset: .zero, shadowEdgeInsets: nil)
+                                        return
+                                    }
+                                }
+                            }
+                        } catch {}
+                        profileImage.contentMode = .scaleAspectFill
+                    } else {
+                        profileImage.circle()
+                        profileImage.image = UIImage(systemName: "person")
+                        profileImage.contentMode = .scaleAspectFit
+                        profileImage.backgroundColor = .lightGray
+                        profileImage.tintColor = .white
+                    }
+                    floating.show(queuePosition: .front, bannerPosition: .top, queue: NotificationBannerQueue(maxBannersOnScreenSimultaneously: 1), on: nil, edgeInsets: UIEdgeInsets(top: 8.0, left: 8.0, bottom: 0, right: 8.0), cornerRadius: 8.0, shadowColor: .clear, shadowOpacity: .zero, shadowBlurRadius: .zero, shadowCornerRadius: .zero, shadowOffset: .zero, shadowEdgeInsets: nil)
+                }
+            }
+        }
+    }
     
     private func inquiry(message: TMessage) {
         let message_id = message.getBody(key: CoreMessage_TMessageKey.MESSAGE_ID, default_value: "")
@@ -876,7 +954,6 @@ class IncomingThread {
                     if let delegate = Nexilis.shared.personInfoDelegate {
                         delegate.onUpdatePersonInfo(state: 99, message: "delete_buddy,\(l_pin)")
                     }
-                    return
                 }
                 ack(message: message)
             }

+ 37 - 21
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorGroup.swift

@@ -161,6 +161,13 @@ public class EditorGroup: UIViewController {
         }
     }
     
+    public func afterUnfriend() {
+        DispatchQueue.main.async {
+            UserDefaults.standard.removeObject(forKey: "inEditorGroup")
+            NotificationCenter.default.removeObserver(self)
+        }
+    }
+    
     private func updateProfile() {
         let idMe = UserDefaults.standard.string(forKey: "me") as String?
         DispatchQueue.global().async {
@@ -820,28 +827,37 @@ public class EditorGroup: UIViewController {
                     return
                 }
                 removed = true
-                navigationItem.rightBarButtonItem = nil
-                view.addSubview(containerActionGroup)
-                containerActionGroup.translatesAutoresizingMaskIntoConstraints = false
-                NSLayoutConstraint.activate([
-                    containerActionGroup.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
-                    containerActionGroup.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
-                    containerActionGroup.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
-                    containerActionGroup.heightAnchor.constraint(equalToConstant: 120)
-                ])
-                containerActionGroup.backgroundColor = .secondaryColor.withAlphaComponent(0.8)
-                containerActionGroup.addSubview(labelKicked)
-                labelKicked.translatesAutoresizingMaskIntoConstraints = false
-                NSLayoutConstraint.activate([
-                    labelKicked.centerYAnchor.constraint(equalTo: containerActionGroup.centerYAnchor),
-                    labelKicked.centerXAnchor.constraint(equalTo: containerActionGroup.centerXAnchor),
-                ])
-                labelKicked.textColor = .black
-                labelKicked.font = UIFont.systemFont(ofSize: 12).bold
-                if contactChatNav.viewIfLoaded?.window != nil {
-                    contactChatNav.dismiss(animated: true)
-                }
                 cancelAction()
+                DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: { [self] in
+                    navigationItem.rightBarButtonItem = nil
+                    view.addSubview(containerActionGroup)
+                    containerActionGroup.translatesAutoresizingMaskIntoConstraints = false
+                    NSLayoutConstraint.activate([
+                        containerActionGroup.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
+                        containerActionGroup.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
+                        containerActionGroup.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
+                        containerActionGroup.heightAnchor.constraint(equalToConstant: 120)
+                    ])
+                    containerActionGroup.backgroundColor = .secondaryColor.withAlphaComponent(0.8)
+                    containerActionGroup.addSubview(labelKicked)
+                    labelKicked.translatesAutoresizingMaskIntoConstraints = false
+                    NSLayoutConstraint.activate([
+                        labelKicked.centerYAnchor.constraint(equalTo: containerActionGroup.centerYAnchor),
+                        labelKicked.centerXAnchor.constraint(equalTo: containerActionGroup.centerXAnchor),
+                    ])
+                    labelKicked.textColor = .black
+                    labelKicked.font = UIFont.systemFont(ofSize: 12).bold
+                    if contactChatNav.viewIfLoaded?.window != nil {
+                        contactChatNav.dismiss(animated: true)
+                    }
+                    DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: {
+                        if self.fromNotification {
+                            self.didTapExit()
+                        } else {
+                            self.navigationController?.popViewController(animated: true)
+                        }
+                    })
+                })
             }
         }
     }

+ 18 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -224,6 +224,17 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
 //        }
     }
     
+    public func afterUnfriend() {
+        DispatchQueue.main.async {
+            for timer in self.timerCredential.values {
+                timer.invalidate()
+            }
+            self.timeoutCC.invalidate()
+            UserDefaults.standard.removeObject(forKey: "inEditorPersonal")
+            NotificationCenter.default.removeObserver(self)
+        }
+    }
+    
     private func setRightButtonItem() {
         navigationItem.rightBarButtonItems = nil
         var menu = UIMenu(title: "", children: [
@@ -1530,6 +1541,13 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                     if contactChatNav.viewIfLoaded?.window != nil {
                         contactChatNav.dismiss(animated: true)
                     }
+                    DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: {
+                        if self.fromNotification {
+                            self.didTapExit()
+                        } else {
+                            self.navigationController?.popViewController(animated: true)
+                        }
+                    })
                 })
             } else if data["state"] as! Int == 01 {
                 if let dataMessage = try! JSONSerialization.jsonObject(with: (data["message"] as! String).data(using: .utf8)!, options: []) as? [String: String] {

+ 12 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Contact/ContactCallViewController.swift

@@ -34,8 +34,7 @@ class ContactCallViewController: UIViewController {
         }
     }
     
-    override func viewDidAppear(_ animated: Bool) {
-        print(#function, ">>>> DIDAPPEAR CONTACT CALL")
+    override func viewDidDisappear(_ animated: Bool) {
         NotificationCenter.default.removeObserver(self)
         NotificationCenter.default.post(name: NSNotification.Name(rawValue: "refreshView"), object: nil, userInfo: nil)
     }
@@ -124,6 +123,7 @@ class ContactCallViewController: UIViewController {
     
     @objc func refresh(notification: NSNotification) {
         DispatchQueue.main.async {
+            print("MASuK SINI DONG")
             self.getData()
             self.dataPersonNotChange = self.dataPerson
             self.tableView.reloadData()
@@ -287,4 +287,14 @@ extension ContactCallViewController: UISearchControllerDelegate, UISearchBarDele
     func updateSearchResults(for searchController: UISearchController) {
         filterContentForSearchText(searchController.searchBar.text!.trimmingCharacters(in: .whitespacesAndNewlines))
     }
+    
+    func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
+        searchBar.showsCancelButton = true
+        let cBtn = searchBar.value(forKey: "cancelButton") as! UIButton
+        cBtn.setTitle("Cancel".localized(), for: .normal)
+    }
+    
+    func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
+        searchBar.showsCancelButton = false
+    }
 }

+ 7 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ChangePasswordViewController.swift

@@ -13,12 +13,13 @@ class ChangePasswordViewController: UIViewController {
     @IBOutlet weak var newPassField: PasswordTextField!
     @IBOutlet weak var showOldPassButton: UIButton!
     @IBOutlet weak var showNewPassButton: UIButton!
+    @IBOutlet weak var labelDesc: UILabel!
     
     override func viewDidLoad() {
         super.viewDidLoad()
         
         self.title = "Change Password".localized()
-        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Next".localized(), style: .plain, target: self, action: #selector(didTapNext(sender:)))
+        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Save".localized(), style: .plain, target: self, action: #selector(didTapNext(sender:)))
         
         oldPassField.addPadding(.right(40))
         oldPassField.isSecureTextEntry = false
@@ -26,9 +27,14 @@ class ChangePasswordViewController: UIViewController {
         newPassField.addPadding(.right(40))
         newPassField.isSecureTextEntry = false
         
+        oldPassField.placeholder = "Old Password".localized()
+        newPassField.placeholder = "New Password".localized()
+        
         showOldPassButton.addTarget(self, action: #selector(showOldPassword), for: .touchUpInside)
         showNewPassButton.addTarget(self, action: #selector(showNewPassword), for: .touchUpInside)
         
+        labelDesc.text = "Change password to keep your account secure".localized()
+        
         let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
         tapGesture.cancelsTouchesInView = false
         view.addGestureRecognizer(tapGesture)

+ 13 - 15
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ProfileViewController.swift

@@ -508,22 +508,20 @@ public class ProfileViewController: UITableViewController {
                                 _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.data)'")
                                 _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.data)' or l_pin='\(self.data)') and message_scope_id='3'")
                                 cursor.close()
-                                Nexilis.hideLoader(completion: {
-                                    var data: [AnyHashable : Any] = [:]
-                                    data["state"] = 99
-                                    data["message"] = "delete_buddy,\(self.data)"
-                                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "onUpdatePersonInfo"), object: nil, userInfo: data)
-                                })
-                                return
-                            }
-                        })
-                        Nexilis.hideLoader(completion: {
-                            if self.previousViewController is GroupDetailViewController || self.isBNI {
-                                self.isDismiss?()
-                                self.navigationController?.popViewController(animated: true)
-                            } else {
-                                self.navigationController?.popToRootViewController(animated: true)
                             }
+                            Nexilis.hideLoader(completion: {
+                                if self.previousViewController is GroupDetailViewController || self.isBNI {
+                                    self.isDismiss?()
+                                    self.navigationController?.popViewController(animated: true)
+                                } else {
+                                    if let editor = self.previousViewController as? EditorPersonal {
+                                        editor.afterUnfriend()
+                                    } else if let editor = self.previousViewController as? EditorGroup {
+                                        editor.afterUnfriend()
+                                    }
+                                    self.navigationController?.popToRootViewController(animated: true)
+                                }
+                            })
                         })
                     } else {
                         if self.call != nil {