From ff6dc786f9994a941d83b72ecd4168e0f43e733c Mon Sep 17 00:00:00 2001
From: Scott Nonnenberg <scott@nonnenberg.com>
Date: Thu, 14 Sep 2017 12:08:10 -0700
Subject: [PATCH] Force full contact/group import on next launch if not first
 run (#1476)

* Force full contact/group import on next launch (if not first run)

FREEBIE

* Don't update contact sync key in storage on every reconnect

FREEBIE
---
 js/background.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/js/background.js b/js/background.js
index 3e47dd811..f5ddf780e 100644
--- a/js/background.js
+++ b/js/background.js
@@ -143,6 +143,18 @@
             SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD
         );
 
+        // Because v0.43.2 introduced a bug that lost contact details, v0.43.4 introduces
+        //   a one-time contact sync to restore all lost contact/group information. We
+        //   disable this checking if a user is first registering.
+        var key = 'chrome-contact-sync-v0.43.4';
+        if (!storage.get(key)) {
+            storage.put(key, true);
+
+            if (!firstRun && textsecure.storage.user.getDeviceId() != '1') {
+                window.getSyncRequest();
+            }
+        }
+
         if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') {
             if (!storage.get('theme-setting') && textsecure.storage.get('userAgent') === 'OWI') {
                 storage.put('theme-setting', 'ios');