|
@@ -117,6 +117,7 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
|
|
|
|
|
|
|
|
|
tableView.tableHeaderView = segment
|
|
|
+ tableView.tableFooterView = UIView()
|
|
|
|
|
|
pullBuddy()
|
|
|
let cpaasMode = PrefsUtil.getCpaasMode()
|
|
@@ -278,8 +279,18 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
|
|
|
if ViewController.middleButton.isHidden {
|
|
|
ViewController.isExpandButton = false
|
|
|
if let viewController = viewController as? ViewController {
|
|
|
- viewController.tabBar.isHidden = false
|
|
|
- ViewController.middleButton.isHidden = false
|
|
|
+ if viewController.tabBar.isHidden {
|
|
|
+ viewController.tabBar.isHidden = false
|
|
|
+ ViewController.middleButton.isHidden = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if PrefsUtil.getCpaasMode() != PrefsUtil.CPAAS_MODE_DOCKED {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ if let viewController = viewController as? ViewController {
|
|
|
+ if viewController.tabBar.isHidden {
|
|
|
+ viewController.tabBar.isHidden = false
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -323,10 +334,15 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
|
|
|
segment.setTitle("Groups".localized(), forSegmentAt: 1)
|
|
|
}
|
|
|
searchController.searchBar.placeholder = "Search chats & messages".localized()
|
|
|
- groupMap.removeAll()
|
|
|
+ removeAllData()
|
|
|
+ getData()
|
|
|
+ }
|
|
|
+
|
|
|
+ func removeAllData() {
|
|
|
groups.removeAll()
|
|
|
+ groupMap.removeAll()
|
|
|
+ chats.removeAll()
|
|
|
tableView.reloadData()
|
|
|
- getData()
|
|
|
}
|
|
|
|
|
|
override func viewWillDisappear(_ animated: Bool) {
|
|
@@ -365,6 +381,7 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
|
|
|
getChats {
|
|
|
self.getContacts {
|
|
|
self.getGroups { g1 in
|
|
|
+ self.groupMap.removeAll()
|
|
|
self.groups.removeAll()
|
|
|
self.groups.append(contentsOf: g1)
|
|
|
DispatchQueue.main.async {
|
|
@@ -584,8 +601,7 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
dismiss(animated: true, completion: nil)
|
|
|
return
|
|
|
}
|
|
|
- let user = User.getData(pin: data.pin)
|
|
|
- if user != nil || data.pin == "-999" {
|
|
|
+ if data.messageScope == "3" {
|
|
|
let editorPersonalVC = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
|
|
|
editorPersonalVC.hidesBottomBarWhenPushed = true
|
|
|
editorPersonalVC.unique_l_pin = data.pin
|
|
@@ -602,7 +618,11 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
if indexPath.row == 0 {
|
|
|
group = fillteredData[indexPath.section] as! Group
|
|
|
} else {
|
|
|
- group = (fillteredData[indexPath.section] as! Group).childs[indexPath.row - 1]
|
|
|
+ if (fillteredData[indexPath.section] as! Group).childs.count > 0 {
|
|
|
+ group = (fillteredData[indexPath.section] as! Group).childs[indexPath.row - 1]
|
|
|
+ } else {
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
if indexPath.row == 0 {
|
|
@@ -741,7 +761,7 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
var value = 0
|
|
|
if isFilltering {
|
|
|
- if segment.selectedSegmentIndex == 2, let groups = fillteredData as? [Group] {
|
|
|
+ if segment.selectedSegmentIndex == 1, let groups = fillteredData as? [Group] {
|
|
|
let group = groups[section]
|
|
|
if group.isSelected {
|
|
|
if let _ = groupMap[group.id] {
|
|
@@ -754,7 +774,7 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
value = 1
|
|
|
}
|
|
|
}
|
|
|
- return fillteredData.count
|
|
|
+ return value
|
|
|
}
|
|
|
switch segment.selectedSegmentIndex {
|
|
|
case 0:
|
|
@@ -807,8 +827,7 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
imageView.heightAnchor.constraint(equalToConstant: 40.0)
|
|
|
])
|
|
|
if data.profile.isEmpty && data.pin != "-999" {
|
|
|
- let user = User.getData(pin: data.pin)
|
|
|
- if user != nil {
|
|
|
+ if data.messageScope == "3" {
|
|
|
imageView.image = UIImage(named: "Profile---Purple", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
|
|
|
} else {
|
|
|
imageView.image = UIImage(named: "Conversation---Purple", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
|
|
@@ -938,9 +957,15 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
let group: Group
|
|
|
if isFilltering {
|
|
|
if indexPath.row == 0 {
|
|
|
+ print("DATA GROUP1 \((fillteredData[indexPath.section] as! Group).name)")
|
|
|
group = fillteredData[indexPath.section] as! Group
|
|
|
} else {
|
|
|
- group = (fillteredData[indexPath.section] as! Group).childs[indexPath.row - 1]
|
|
|
+ if (fillteredData[indexPath.section] as! Group).childs.count > 0 {
|
|
|
+ print("DATA GROUP2 \((fillteredData[indexPath.section] as! Group).name)")
|
|
|
+ group = (fillteredData[indexPath.section] as! Group).childs[indexPath.row - 1]
|
|
|
+ } else {
|
|
|
+ return cell
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
if indexPath.row == 0 {
|