mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 05:02:20 +00:00
Make directory refresh async task more careful.
// FREEBIE
This commit is contained in:
@@ -30,37 +30,6 @@ import java.util.Set;
|
||||
public class DirectoryHelper {
|
||||
private static final String TAG = DirectoryHelper.class.getSimpleName();
|
||||
|
||||
public static void refreshDirectoryWithProgressDialog(final Context context, final DirectoryUpdateFinishedListener listener) {
|
||||
if (!TextSecurePreferences.isPushRegistered(context)) {
|
||||
Toast.makeText(context.getApplicationContext(),
|
||||
context.getString(R.string.SingleContactSelectionActivity_you_are_not_registered_with_the_push_service),
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
new ProgressDialogAsyncTask<Void,Void,Void>(context,
|
||||
R.string.SingleContactSelectionActivity_updating_directory,
|
||||
R.string.SingleContactSelectionActivity_updating_push_directory)
|
||||
{
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectory(context.getApplicationContext());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
if (listener != null) listener.onUpdateFinished();
|
||||
}
|
||||
}.execute();
|
||||
|
||||
}
|
||||
|
||||
public static void refreshDirectory(final Context context) throws IOException {
|
||||
refreshDirectory(context, TextSecureCommunicationFactory.createManager(context));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user