ソースを参照

update fix bugs

alqindiirsyam 2 年 前
コミット
5e7cd15e69

+ 7 - 1
appbuilder-ios/DigiXLite/DigiXLite/Source/DigiX.swift

@@ -1028,7 +1028,13 @@ public class DigiX: NSObject {
             }
             if is_call_center == "0" {
                 do {
-                    let queryGetLastMessageId = "SELECT message_id FROM MESSAGE where l_pin = '\(pin)' OR opposite_pin = '\(opposite_pin)' order by server_date desc LIMIT 1"
+                    var queryGetLastMessageId = "SELECT message_id FROM MESSAGE where f_pin = '\(pin)' OR l_pin = '\(pin)' order by server_date desc LIMIT 1"
+                    if scope == "4" {
+                        queryGetLastMessageId = "SELECT message_id FROM MESSAGE where l_pin = '\(pin)' order by server_date desc LIMIT 1"
+                        if !chat_id.isEmpty {
+                            queryGetLastMessageId = "SELECT message_id FROM MESSAGE where chat_id = '\(pin)' order by server_date desc LIMIT 1"
+                        }
+                    }
                     var messageId = ""
                     if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: queryGetLastMessageId), cursorData.next() {
                         messageId = cursorData.string(forColumnIndex: 0) ?? ""

+ 3 - 7
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorGroup.swift

@@ -2939,9 +2939,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
         containerView.addSubview(dateView)
         dateView.translatesAutoresizingMaskIntoConstraints = false
         var topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor)
-        if section == 0 {
-            topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
-        }
+        topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
         NSLayoutConstraint.activate([
             topAnchor,
             dateView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
@@ -2973,10 +2971,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
         if tableView == tableMention {
             return 0
         }
-        if section == 0 {
-            return 40
-        }
-        return 30
+        return 40
     }
     
     public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
@@ -4048,6 +4043,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
                                 ], replace: true)
                                 dataURL = json
                                 showLink()
+                                tableView.reloadRows(at: [indexPath], with: .none)
                             } catch {
                                 rollback.pointee = true
                                 //print(error)

+ 3 - 7
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorPersonal.swift

@@ -4265,9 +4265,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
         containerView.addSubview(dateView)
         dateView.translatesAutoresizingMaskIntoConstraints = false
         var topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor)
-        if section == 0 {
-            topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
-        }
+        topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
         NSLayoutConstraint.activate([
             topAnchor,
             dateView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
@@ -4302,10 +4300,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
     }
     
     public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        if section == 0 {
-            return 40
-        }
-        return 30
+        return 40
     }
     
     public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@@ -5433,6 +5428,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
                                 ], replace: true)
                                 dataURL = json
                                 showLink()
+                                tableView.reloadRows(at: [indexPath], with: .none)
                             } catch {
                                 rollback.pointee = true
                                 //print(error)

+ 3 - 7
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorStarMessages.swift

@@ -129,9 +129,7 @@ public class EditorStarMessages: UIViewController, UITableViewDataSource, UITabl
         containerView.addSubview(dateView)
         dateView.translatesAutoresizingMaskIntoConstraints = false
         var topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor)
-        if section == 0 {
-            topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
-        }
+        topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
         NSLayoutConstraint.activate([
             topAnchor,
             dateView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
@@ -160,10 +158,7 @@ public class EditorStarMessages: UIViewController, UITableViewDataSource, UITabl
     }
     
     public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        if section == 0 {
-            return 40
-        }
-        return 30
+        return 40
     }
     
     public func numberOfSections(in tableView: UITableView) -> Int {
@@ -805,6 +800,7 @@ public class EditorStarMessages: UIViewController, UITableViewDataSource, UITabl
                                 ], replace: true)
                                 dataURL = json
                                 showLink()
+                                tableView.reloadRows(at: [indexPath], with: .none)
                             } catch {
                                 rollback.pointee = true
                                 //print(error)

+ 7 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -1028,7 +1028,13 @@ public class Nexilis: NSObject {
             }
             if is_call_center == "0" {
                 do {
-                    let queryGetLastMessageId = "SELECT message_id FROM MESSAGE where l_pin = '\(pin)' OR opposite_pin = '\(opposite_pin)' order by server_date desc LIMIT 1"
+                    var queryGetLastMessageId = "SELECT message_id FROM MESSAGE where f_pin = '\(pin)' OR l_pin = '\(pin)' order by server_date desc LIMIT 1"
+                    if scope == "4" {
+                        queryGetLastMessageId = "SELECT message_id FROM MESSAGE where l_pin = '\(pin)' order by server_date desc LIMIT 1"
+                        if !chat_id.isEmpty {
+                            queryGetLastMessageId = "SELECT message_id FROM MESSAGE where chat_id = '\(pin)' order by server_date desc LIMIT 1"
+                        }
+                    }
                     var messageId = ""
                     if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: queryGetLastMessageId), cursorData.next() {
                         messageId = cursorData.string(forColumnIndex: 0) ?? ""

+ 3 - 7
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorGroup.swift

@@ -2939,9 +2939,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
         containerView.addSubview(dateView)
         dateView.translatesAutoresizingMaskIntoConstraints = false
         var topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor)
-        if section == 0 {
-            topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
-        }
+        topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
         NSLayoutConstraint.activate([
             topAnchor,
             dateView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
@@ -2973,10 +2971,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
         if tableView == tableMention {
             return 0
         }
-        if section == 0 {
-            return 40
-        }
-        return 30
+        return 40
     }
     
     public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
@@ -4048,6 +4043,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
                                 ], replace: true)
                                 dataURL = json
                                 showLink()
+                                tableView.reloadRows(at: [indexPath], with: .none)
                             } catch {
                                 rollback.pointee = true
                                 //print(error)

+ 3 - 7
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -4265,9 +4265,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
         containerView.addSubview(dateView)
         dateView.translatesAutoresizingMaskIntoConstraints = false
         var topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor)
-        if section == 0 {
-            topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
-        }
+        topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
         NSLayoutConstraint.activate([
             topAnchor,
             dateView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
@@ -4302,10 +4300,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
     }
     
     public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        if section == 0 {
-            return 40
-        }
-        return 30
+        return 40
     }
     
     public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@@ -5433,6 +5428,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
                                 ], replace: true)
                                 dataURL = json
                                 showLink()
+                                tableView.reloadRows(at: [indexPath], with: .none)
                             } catch {
                                 rollback.pointee = true
                                 //print(error)

+ 3 - 7
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorStarMessages.swift

@@ -129,9 +129,7 @@ public class EditorStarMessages: UIViewController, UITableViewDataSource, UITabl
         containerView.addSubview(dateView)
         dateView.translatesAutoresizingMaskIntoConstraints = false
         var topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor)
-        if section == 0 {
-            topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
-        }
+        topAnchor = dateView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10.0)
         NSLayoutConstraint.activate([
             topAnchor,
             dateView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
@@ -160,10 +158,7 @@ public class EditorStarMessages: UIViewController, UITableViewDataSource, UITabl
     }
     
     public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        if section == 0 {
-            return 40
-        }
-        return 30
+        return 40
     }
     
     public func numberOfSections(in tableView: UITableView) -> Int {
@@ -805,6 +800,7 @@ public class EditorStarMessages: UIViewController, UITableViewDataSource, UITabl
                                 ], replace: true)
                                 dataURL = json
                                 showLink()
+                                tableView.reloadRows(at: [indexPath], with: .none)
                             } catch {
                                 rollback.pointee = true
                                 //print(error)