Update notifications on background thread.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-08-12 10:44:27 -07:00
parent 3edda51379
commit d6179bc12b

View File

@ -88,7 +88,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
.execute(VersionTracker.getLastSeenVersion(this)); .execute(VersionTracker.getLastSeenVersion(this));
} else { } else {
VersionTracker.updateLastSeenVersion(this); VersionTracker.updateLastSeenVersion(this);
MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret); updateNotifications(this, masterSecret);
startActivity((Intent)getIntent().getParcelableExtra("next_intent")); startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
finish(); finish();
} }
@ -123,6 +123,16 @@ public class DatabaseUpgradeActivity extends BaseActivity {
} }
} }
private void updateNotifications(final Context context, final MasterSecret masterSecret) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
MessageNotifier.updateNotification(context, masterSecret);
return null;
}
}.execute();
}
public interface DatabaseUpgradeListener { public interface DatabaseUpgradeListener {
public void setProgress(int progress, int total); public void setProgress(int progress, int total);
} }
@ -230,7 +240,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
VersionTracker.updateLastSeenVersion(DatabaseUpgradeActivity.this); VersionTracker.updateLastSeenVersion(DatabaseUpgradeActivity.this);
MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret); updateNotifications(DatabaseUpgradeActivity.this, masterSecret);
startActivity((Intent)getIntent().getParcelableExtra("next_intent")); startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
finish(); finish();