ソースを参照

update smooth load message

alqindiirsyam 2 年 前
コミット
8ef6dbd9f5

+ 14 - 2
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorGroup.swift

@@ -378,8 +378,12 @@ public class EditorGroup: UIViewController {
         let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
         tapGesture.cancelsTouchesInView = false
         tableChatView.addGestureRecognizer(tapGesture)
-        UIView.animate(withDuration: 0.5, animations: {
-            self.tableChatView.alpha = 1.0
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
+            if self.tableChatView.alpha != 1.0 {
+                UIView.animate(withDuration: 0.5, animations: {
+                    self.tableChatView.alpha = 1.0
+                })
+            }
         })
     }
     
@@ -2909,6 +2913,14 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
 //        checkNewMessage(tableView: tableView)
 //    }
     
+    public func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
+        if self.tableChatView.alpha != 1.0 {
+            UIView.animate(withDuration: 0.5, animations: {
+                self.tableChatView.alpha = 1.0
+            })
+        }
+    }
+    
     public func scrollViewDidScroll(_ scrollView: UIScrollView) {
         checkNewMessage(tableView: self.tableChatView)
     }

+ 14 - 2
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Chat/EditorPersonal.swift

@@ -630,8 +630,12 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
         } else {
             tableChatView.scrollToBottom(isAnimated: false)
         }
-        UIView.animate(withDuration: 0.5, animations: {
-            self.tableChatView.alpha = 1.0
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
+            if self.tableChatView.alpha != 1.0 {
+                UIView.animate(withDuration: 0.5, animations: {
+                    self.tableChatView.alpha = 1.0
+                })
+            }
         })
         for data in listTimerCredential {
             if data.value > 0 {
@@ -4163,6 +4167,14 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
 //        checkNewMessage(tableView: tableView)
 //    }
     
+    public func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
+        if self.tableChatView.alpha != 1.0 {
+            UIView.animate(withDuration: 0.5, animations: {
+                self.tableChatView.alpha = 1.0
+            })
+        }
+    }
+    
     public func scrollViewDidScroll(_ scrollView: UIScrollView) {
         checkNewMessage(tableView: self.tableChatView)
     }

+ 14 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorGroup.swift

@@ -378,8 +378,12 @@ public class EditorGroup: UIViewController {
         let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
         tapGesture.cancelsTouchesInView = false
         tableChatView.addGestureRecognizer(tapGesture)
-        UIView.animate(withDuration: 0.5, animations: {
-            self.tableChatView.alpha = 1.0
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
+            if self.tableChatView.alpha != 1.0 {
+                UIView.animate(withDuration: 0.5, animations: {
+                    self.tableChatView.alpha = 1.0
+                })
+            }
         })
     }
     
@@ -2909,6 +2913,14 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
 //        checkNewMessage(tableView: tableView)
 //    }
     
+    public func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
+        if self.tableChatView.alpha != 1.0 {
+            UIView.animate(withDuration: 0.5, animations: {
+                self.tableChatView.alpha = 1.0
+            })
+        }
+    }
+    
     public func scrollViewDidScroll(_ scrollView: UIScrollView) {
         checkNewMessage(tableView: self.tableChatView)
     }

+ 14 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -630,8 +630,12 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
         } else {
             tableChatView.scrollToBottom(isAnimated: false)
         }
-        UIView.animate(withDuration: 0.5, animations: {
-            self.tableChatView.alpha = 1.0
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
+            if self.tableChatView.alpha != 1.0 {
+                UIView.animate(withDuration: 0.5, animations: {
+                    self.tableChatView.alpha = 1.0
+                })
+            }
         })
         for data in listTimerCredential {
             if data.value > 0 {
@@ -4163,6 +4167,14 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
 //        checkNewMessage(tableView: tableView)
 //    }
     
+    public func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
+        if self.tableChatView.alpha != 1.0 {
+            UIView.animate(withDuration: 0.5, animations: {
+                self.tableChatView.alpha = 1.0
+            })
+        }
+    }
+    
     public func scrollViewDidScroll(_ scrollView: UIScrollView) {
         checkNewMessage(tableView: self.tableChatView)
     }