Browse Source

add comments about the timer checks

cyberta 4 years ago
parent
commit
faf6e53840
1 changed files with 2 additions and 0 deletions
  1. 2 0
      deltachat-ios/Chat/ChatViewController.swift

+ 2 - 0
deltachat-ios/Chat/ChatViewController.swift

@@ -282,6 +282,7 @@ class ChatViewController: UITableViewController {
     }
     }
 
 
     private func startTimer() {
     private func startTimer() {
+        // check if the timer is not yet started
         if !(timer?.isValid ?? false) {
         if !(timer?.isValid ?? false) {
             timer = Timer.scheduledTimer(withTimeInterval: 60, repeats: true) { [weak self] _ in
             timer = Timer.scheduledTimer(withTimeInterval: 60, repeats: true) { [weak self] _ in
                 //reload table
                 //reload table
@@ -295,6 +296,7 @@ class ChatViewController: UITableViewController {
     }
     }
 
 
     private func stopTimer() {
     private func stopTimer() {
+        // check if the timer is not already stopped
         if timer?.isValid ?? false {
         if timer?.isValid ?? false {
             timer?.invalidate()
             timer?.invalidate()
         }
         }