mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 16:07:30 +00:00
Fix for concurrentmodificationexception on race condition.
This commit is contained in:
parent
eb9b2ef318
commit
5ca7b1080c
@ -138,24 +138,28 @@ public class MmsDownloader extends MmscProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void handleConnectivityChange() {
|
protected void handleConnectivityChange() {
|
||||||
if (!isConnected()) {
|
LinkedList<DownloadItem> downloadItems = (LinkedList<DownloadItem>)pendingMessages.clone();
|
||||||
if (!isConnectivityPossible() && !pendingMessages.isEmpty()) {
|
|
||||||
DatabaseFactory.getMmsDatabase(context).markDownloadState(pendingMessages.remove().getMessageId(), MmsDatabase.Types.DOWNLOAD_NO_CONNECTIVITY);
|
if (isConnected()) {
|
||||||
toastHandler.makeToast(context
|
pendingMessages.clear();
|
||||||
.getString(R.string.MmsDownloader_no_connectivity_available_for_mms_download_try_again_later));
|
|
||||||
Log.w("MmsDownloadService", "Unable to download MMS, please try again later.");
|
for (DownloadItem item : downloadItems) {
|
||||||
finishConnectivity();
|
downloadMms(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
finishConnectivity();
|
||||||
}
|
} else if (!isConnected() && !isConnectivityPossible()) {
|
||||||
|
pendingMessages.clear();
|
||||||
|
|
||||||
for (DownloadItem item : pendingMessages) {
|
for (DownloadItem item : downloadItems) {
|
||||||
downloadMms(item);
|
DatabaseFactory.getMmsDatabase(context).markDownloadState(item.getMessageId(), MmsDatabase.Types.DOWNLOAD_NO_CONNECTIVITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingMessages.clear();
|
toastHandler.makeToast(context
|
||||||
finishConnectivity();
|
.getString(R.string.MmsDownloader_no_connectivity_available_for_mms_download_try_again_later));
|
||||||
|
|
||||||
|
finishConnectivity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user