浏览代码

made change conditional

nayooti 5 年之前
父节点
当前提交
f773306239
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      deltachat-ios/Controller/QrPageController.swift

+ 6 - 3
deltachat-ios/Controller/QrPageController.swift

@@ -69,7 +69,7 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
         if let qrCodeReaderController = self.qrCodeReaderController {
             qrCodeReaderController.startSession()
         }
-        updateHintText()    // needed in case user changes profile name
+        updateHintTextIfNeeded()    // needed in case user changes profile name
     }
 
     override func viewWillDisappear(_ animated: Bool) {
@@ -101,9 +101,12 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
     }
 
     // MARK: - update
-    private func updateHintText() {
+    private func updateHintTextIfNeeded() {
         for case let qrViewController as QrViewController in self.viewControllers ?? [] {
-            qrViewController.qrCodeHint = qrCodeHint
+            let newHint = qrCodeHint
+            if qrCodeHint != qrViewController.qrCodeHint {
+                qrViewController.qrCodeHint = newHint
+            }
         }
     }