Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8299e41 authored by Andy Scherzinger's avatar Andy Scherzinger
Browse files

use apply instead of commit on preferences (do it in the background)

parent 07b65fa8
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -139,8 +139,7 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation
                  successfulChunks.add(String.valueOf(chunkIndex));
                } else {
                    SharedPreferences.Editor editor = sharedPref.edit();
                    editor.putStringSet(chunkId, successfulChunks);
                    editor.commit();
                    editor.putStringSet(chunkId, successfulChunks).apply();

                    break;
                }
@@ -148,14 +147,12 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation

            if (isSuccess(status)){
                SharedPreferences.Editor editor = sharedPref.edit();
                editor.remove(chunkId);
                editor.commit();
                editor.remove(chunkId).apply();
            }

        } finally {
            SharedPreferences.Editor editor = sharedPref.edit();
            editor.putStringSet(chunkId, successfulChunks);
            editor.commit();
            editor.putStringSet(chunkId, successfulChunks).apply();

            if (channel != null)
                channel.close();