mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 10:58:34 +00:00
Fix crash on unlink device when offline.
This commit is contained in:
parent
5ab72fd1a9
commit
cfcd451db7
@ -164,25 +164,29 @@ public class DeviceListFragment extends ListFragment
|
|||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private void handleDisconnectDevice(final long deviceId) {
|
private void handleDisconnectDevice(final long deviceId) {
|
||||||
new ProgressDialogAsyncTask<Void, Void, Void>(getActivity(),
|
new ProgressDialogAsyncTask<Void, Void, Boolean>(getActivity(),
|
||||||
R.string.DeviceListActivity_unlinking_device_no_ellipsis,
|
R.string.DeviceListActivity_unlinking_device_no_ellipsis,
|
||||||
R.string.DeviceListActivity_unlinking_device)
|
R.string.DeviceListActivity_unlinking_device)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Boolean doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
accountManager.removeDevice(deviceId);
|
accountManager.removeDevice(deviceId);
|
||||||
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
Toast.makeText(getActivity(), R.string.DeviceListActivity_network_failed, Toast.LENGTH_LONG).show();
|
return false;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
|
if (result) {
|
||||||
getLoaderManager().restartLoader(0, null, DeviceListFragment.this);
|
getLoaderManager().restartLoader(0, null, DeviceListFragment.this);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getActivity(), R.string.DeviceListActivity_network_failed, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user