Mark directory retrieved on registered update

This commit is contained in:
Moxie Marlinspike 2017-11-30 13:30:15 -08:00
parent 6f10de5e30
commit 8cd5ff5fa1

View File

@ -17,6 +17,7 @@
package org.thoughtcrime.securesms; package org.thoughtcrime.securesms;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
@ -73,7 +74,8 @@ public class DatabaseUpgradeActivity extends BaseActivity {
public static final int NO_MORE_CANONICAL_DB_VERSION = 276; public static final int NO_MORE_CANONICAL_DB_VERSION = 276;
public static final int PROFILES = 289; public static final int PROFILES = 289;
public static final int SCREENSHOTS = 300; public static final int SCREENSHOTS = 300;
public static final int PERSISTENT_BLOBS = 307; public static final int PERSISTENT_BLOBS = 317;
public static final int INTERNALIZE_CONTACTS = 317;
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{ private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION); add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
@ -89,6 +91,8 @@ public class DatabaseUpgradeActivity extends BaseActivity {
add(REDPHONE_SUPPORT_VERSION); add(REDPHONE_SUPPORT_VERSION);
add(NO_MORE_CANONICAL_DB_VERSION); add(NO_MORE_CANONICAL_DB_VERSION);
add(SCREENSHOTS); add(SCREENSHOTS);
add(INTERNALIZE_CONTACTS);
add(PERSISTENT_BLOBS);
}}; }};
private MasterSecret masterSecret; private MasterSecret masterSecret;
@ -144,6 +148,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
} }
} }
@SuppressLint("StaticFieldLeak")
private void updateNotifications(final Context context, final MasterSecret masterSecret) { private void updateNotifications(final Context context, final MasterSecret masterSecret) {
new AsyncTask<Void, Void, Void>() { new AsyncTask<Void, Void, Void>() {
@Override @Override
@ -158,6 +163,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
public void setProgress(int progress, int total); public void setProgress(int progress, int total);
} }
@SuppressLint("StaticFieldLeak")
private class DatabaseUpgradeTask extends AsyncTask<Integer, Double, Void> private class DatabaseUpgradeTask extends AsyncTask<Integer, Double, Void>
implements DatabaseUpgradeListener implements DatabaseUpgradeListener
{ {
@ -260,6 +266,12 @@ public class DatabaseUpgradeActivity extends BaseActivity {
} }
} }
if (params[0] < INTERNALIZE_CONTACTS) {
if (TextSecurePreferences.isPushRegistered(getApplicationContext())) {
TextSecurePreferences.setHasSuccessfullyRetrievedDirectory(getApplicationContext(), true);
}
}
return null; return null;
} }