瀏覽代碼

Bump ktlint from 0.36.0 to 0.37.2

Bumps [ktlint](https://github.com/pinterest/ktlint) from 0.36.0 to 0.37.0.
- [Release notes](https://github.com/pinterest/ktlint/releases)
- [Changelog](https://github.com/pinterest/ktlint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pinterest/ktlint/compare/0.36.0...0.37.0)

changed to new syntax

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
dependabot-preview[bot] 4 年之前
父節點
當前提交
78b879d10f
共有 27 個文件被更改,包括 485 次插入305 次删除
  1. 1 1
      build.gradle
  2. 5 3
      src/androidTest/java/com/nextcloud/client/etm/EtmActivityTest.kt
  3. 1 4
      src/androidTest/java/com/nextcloud/client/migrations/MigrationsManagerTest.kt
  4. 119 90
      src/androidTest/java/com/owncloud/android/files/services/FileUploaderIT.kt
  5. 69 40
      src/androidTest/java/com/owncloud/android/ui/fragment/OCFileListFragmentIT.kt
  6. 5 3
      src/main/java/com/nextcloud/client/core/Task.kt
  7. 2 1
      src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt
  8. 6 3
      src/main/java/com/nextcloud/client/etm/EtmActivity.kt
  9. 4 4
      src/main/java/com/nextcloud/client/etm/pages/EtmBackgroundJobsFragment.kt
  10. 13 8
      src/main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt
  11. 4 2
      src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt
  12. 12 6
      src/main/java/com/nextcloud/client/jobs/ContactsBackupWork.kt
  13. 21 10
      src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt
  14. 31 15
      src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt
  15. 66 50
      src/main/java/com/nextcloud/client/jobs/NotificationWork.kt
  16. 8 4
      src/main/java/com/nextcloud/client/jobs/OfflineSyncWork.kt
  17. 2 1
      src/main/java/com/nextcloud/client/logger/LogEntry.kt
  18. 4 2
      src/main/java/com/nextcloud/client/logger/ui/LogsViewModel.kt
  19. 4 2
      src/main/java/com/nextcloud/client/migrations/Migrations.kt
  20. 10 5
      src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt
  21. 11 5
      src/test/java/com/nextcloud/client/core/ManualAsyncRunnerTest.kt
  22. 28 16
      src/test/java/com/nextcloud/client/core/ThreadPoolAsyncRunnerTest.kt
  23. 2 1
      src/test/java/com/nextcloud/client/logger/LogEntryTest.kt
  24. 11 6
      src/test/java/com/nextcloud/client/logger/LoggerTest.kt
  25. 4 2
      src/test/java/com/nextcloud/client/logger/ui/LogsViewModelTest.kt
  26. 14 7
      src/test/java/com/nextcloud/client/network/ConnectivityServiceTest.kt
  27. 28 14
      src/test/java/com/nextcloud/client/utils/FileStorageUtilsTest.kt

+ 1 - 1
build.gradle

@@ -341,7 +341,7 @@ dependencies {
     kapt "com.google.dagger:dagger-compiler:$daggerVersion"
     kapt "com.google.dagger:dagger-compiler:$daggerVersion"
     kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
     kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
 
 
-    ktlint "com.pinterest:ktlint:0.36.0"
+    ktlint "com.pinterest:ktlint:0.37.2"
     implementation 'org.conscrypt:conscrypt-android:2.4.0'
     implementation 'org.conscrypt:conscrypt-android:2.4.0'
 
 
     // Shimmer animation
     // Shimmer animation

+ 5 - 3
src/androidTest/java/com/nextcloud/client/etm/EtmActivityTest.kt

@@ -41,9 +41,11 @@ class EtmActivityTest : AbstractIT() {
     @Before
     @Before
     fun before() {
     fun before() {
         // tests only on NC 18
         // tests only on NC 18
-        Assume.assumeTrue(storageManager
-            .getCapability(account.name)
-            .version.compareTo(OwnCloudVersion.nextcloud_18) == 0)
+        Assume.assumeTrue(
+            storageManager
+                .getCapability(account.name)
+                .version.compareTo(OwnCloudVersion.nextcloud_18) == 0
+        )
     }
     }
 
 
     @Test
     @Test

+ 1 - 4
src/androidTest/java/com/nextcloud/client/migrations/MigrationsManagerTest.kt

@@ -243,10 +243,7 @@ class MigrationsManagerTest {
         //      pending migrations
         //      pending migrations
         //      mandatory migrations are passing
         //      mandatory migrations are passing
         //      one migration is optional and fails
         //      one migration is optional and fails
-        assertEquals("Fixture should provide 1 optional, failing migration",
-            1,
-            migrations.count { !it.mandatory }
-        )
+        assertEquals("Fixture should provide 1 optional, failing migration", 1, migrations.count { !it.mandatory })
         val optionalFailingMigration = migrations.first { !it.mandatory }
         val optionalFailingMigration = migrations.first { !it.mandatory }
         whenever(optionalFailingMigration.run()).thenThrow(RuntimeException())
         whenever(optionalFailingMigration.run()).thenThrow(RuntimeException())
 
 

+ 119 - 90
src/androidTest/java/com/owncloud/android/files/services/FileUploaderIT.kt

@@ -77,20 +77,24 @@ class FileUploaderIT : AbstractIT() {
         val file = File(getSavePath(account.name) + "/chunkedFile.txt")
         val file = File(getSavePath(account.name) + "/chunkedFile.txt")
         val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
         val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
 
 
-        assertTrue(UploadFileOperation(
-            uploadsStorageManager,
-            connectivityServiceMock,
-            powerManagementServiceMock,
-            account,
-            null,
-            ocUpload,
-            FileUploader.NameCollisionPolicy.DEFAULT,
-            FileUploader.LOCAL_BEHAVIOUR_COPY,
-            targetContext,
-            false,
-            false)
-            .setRemoteFolderToBeCreated()
-            .execute(client, storageManager).isSuccess)
+        assertTrue(
+            UploadFileOperation(
+                uploadsStorageManager,
+                connectivityServiceMock,
+                powerManagementServiceMock,
+                account,
+                null,
+                ocUpload,
+                FileUploader.NameCollisionPolicy.DEFAULT,
+                FileUploader.LOCAL_BEHAVIOUR_COPY,
+                targetContext,
+                false,
+                false
+            )
+                .setRemoteFolderToBeCreated()
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
         val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
         assertTrue(result.isSuccess)
         assertTrue(result.isSuccess)
@@ -99,19 +103,23 @@ class FileUploaderIT : AbstractIT() {
 
 
         val ocUpload2 = OCUpload(getSavePath(account.name) + "/empty.txt", "/testFile.txt", account.name)
         val ocUpload2 = OCUpload(getSavePath(account.name) + "/empty.txt", "/testFile.txt", account.name)
 
 
-        assertTrue(UploadFileOperation(
-            uploadsStorageManager,
-            connectivityServiceMock,
-            powerManagementServiceMock,
-            account,
-            null,
-            ocUpload2,
-            FileUploader.NameCollisionPolicy.OVERWRITE,
-            FileUploader.LOCAL_BEHAVIOUR_COPY,
-            targetContext,
-            false,
-            false)
-            .execute(client, storageManager).isSuccess)
+        assertTrue(
+            UploadFileOperation(
+                uploadsStorageManager,
+                connectivityServiceMock,
+                powerManagementServiceMock,
+                account,
+                null,
+                ocUpload2,
+                FileUploader.NameCollisionPolicy.OVERWRITE,
+                FileUploader.LOCAL_BEHAVIOUR_COPY,
+                targetContext,
+                false,
+                false
+            )
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
         val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
         assertTrue(result2.isSuccess)
         assertTrue(result2.isSuccess)
@@ -137,7 +145,8 @@ class FileUploaderIT : AbstractIT() {
             UploadFileOperation.CREATED_BY_USER,
             UploadFileOperation.CREATED_BY_USER,
             false,
             false,
             false,
             false,
-            FileUploader.NameCollisionPolicy.DEFAULT)
+            FileUploader.NameCollisionPolicy.DEFAULT
+        )
 
 
         longSleep()
         longSleep()
 
 
@@ -154,7 +163,8 @@ class FileUploaderIT : AbstractIT() {
             account,
             account,
             ocFile2,
             ocFile2,
             FileUploader.LOCAL_BEHAVIOUR_COPY,
             FileUploader.LOCAL_BEHAVIOUR_COPY,
-            FileUploader.NameCollisionPolicy.OVERWRITE)
+            FileUploader.NameCollisionPolicy.OVERWRITE
+        )
 
 
         shortSleep()
         shortSleep()
 
 
@@ -174,20 +184,24 @@ class FileUploaderIT : AbstractIT() {
         val file = File(getSavePath(account.name) + "/chunkedFile.txt")
         val file = File(getSavePath(account.name) + "/chunkedFile.txt")
         val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
         val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
 
 
-        assertTrue(UploadFileOperation(
-            uploadsStorageManager,
-            connectivityServiceMock,
-            powerManagementServiceMock,
-            account,
-            null,
-            ocUpload,
-            FileUploader.NameCollisionPolicy.DEFAULT,
-            FileUploader.LOCAL_BEHAVIOUR_COPY,
-            targetContext,
-            false,
-            false)
-            .setRemoteFolderToBeCreated()
-            .execute(client, storageManager).isSuccess)
+        assertTrue(
+            UploadFileOperation(
+                uploadsStorageManager,
+                connectivityServiceMock,
+                powerManagementServiceMock,
+                account,
+                null,
+                ocUpload,
+                FileUploader.NameCollisionPolicy.DEFAULT,
+                FileUploader.LOCAL_BEHAVIOUR_COPY,
+                targetContext,
+                false,
+                false
+            )
+                .setRemoteFolderToBeCreated()
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
         val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
         assertTrue(result.isSuccess)
         assertTrue(result.isSuccess)
@@ -197,22 +211,26 @@ class FileUploaderIT : AbstractIT() {
         val file2 = File(getSavePath(account.name) + "/empty.txt")
         val file2 = File(getSavePath(account.name) + "/empty.txt")
         val ocUpload2 = OCUpload(file2.absolutePath, "/testFile.txt", account.name)
         val ocUpload2 = OCUpload(file2.absolutePath, "/testFile.txt", account.name)
 
 
-        assertTrue(UploadFileOperation(
-            uploadsStorageManager,
-            connectivityServiceMock,
-            powerManagementServiceMock,
-            account,
-            null,
-            ocUpload2,
-            FileUploader.NameCollisionPolicy.RENAME,
-            FileUploader.LOCAL_BEHAVIOUR_COPY,
-            targetContext,
-            false,
-            false)
-            .addRenameUploadListener {
-                renameListenerWasTriggered = true
-            }
-            .execute(client, storageManager).isSuccess)
+        assertTrue(
+            UploadFileOperation(
+                uploadsStorageManager,
+                connectivityServiceMock,
+                powerManagementServiceMock,
+                account,
+                null,
+                ocUpload2,
+                FileUploader.NameCollisionPolicy.RENAME,
+                FileUploader.LOCAL_BEHAVIOUR_COPY,
+                targetContext,
+                false,
+                false
+            )
+                .addRenameUploadListener {
+                    renameListenerWasTriggered = true
+                }
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
         val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
         assertTrue(result2.isSuccess)
         assertTrue(result2.isSuccess)
@@ -244,7 +262,8 @@ class FileUploaderIT : AbstractIT() {
             UploadFileOperation.CREATED_BY_USER,
             UploadFileOperation.CREATED_BY_USER,
             false,
             false,
             false,
             false,
-            FileUploader.NameCollisionPolicy.DEFAULT)
+            FileUploader.NameCollisionPolicy.DEFAULT
+        )
 
 
         longSleep()
         longSleep()
 
 
@@ -261,7 +280,8 @@ class FileUploaderIT : AbstractIT() {
             account,
             account,
             ocFile2,
             ocFile2,
             FileUploader.LOCAL_BEHAVIOUR_COPY,
             FileUploader.LOCAL_BEHAVIOUR_COPY,
-            FileUploader.NameCollisionPolicy.RENAME)
+            FileUploader.NameCollisionPolicy.RENAME
+        )
 
 
         shortSleep()
         shortSleep()
 
 
@@ -284,20 +304,24 @@ class FileUploaderIT : AbstractIT() {
         val file = File(getSavePath(account.name) + "/chunkedFile.txt")
         val file = File(getSavePath(account.name) + "/chunkedFile.txt")
         val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
         val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
 
 
-        assertTrue(UploadFileOperation(
-            uploadsStorageManager,
-            connectivityServiceMock,
-            powerManagementServiceMock,
-            account,
-            null,
-            ocUpload,
-            FileUploader.NameCollisionPolicy.DEFAULT,
-            FileUploader.LOCAL_BEHAVIOUR_COPY,
-            targetContext,
-            false,
-            false)
-            .setRemoteFolderToBeCreated()
-            .execute(client, storageManager).isSuccess)
+        assertTrue(
+            UploadFileOperation(
+                uploadsStorageManager,
+                connectivityServiceMock,
+                powerManagementServiceMock,
+                account,
+                null,
+                ocUpload,
+                FileUploader.NameCollisionPolicy.DEFAULT,
+                FileUploader.LOCAL_BEHAVIOUR_COPY,
+                targetContext,
+                false,
+                false
+            )
+                .setRemoteFolderToBeCreated()
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
         val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
         assertTrue(result.isSuccess)
         assertTrue(result.isSuccess)
@@ -306,19 +330,22 @@ class FileUploaderIT : AbstractIT() {
 
 
         val ocUpload2 = OCUpload(getSavePath(account.name) + "/empty.txt", "/testFile.txt", account.name)
         val ocUpload2 = OCUpload(getSavePath(account.name) + "/empty.txt", "/testFile.txt", account.name)
 
 
-        assertFalse(UploadFileOperation(
-            uploadsStorageManager,
-            connectivityServiceMock,
-            powerManagementServiceMock,
-            account,
-            null,
-            ocUpload2,
-            FileUploader.NameCollisionPolicy.CANCEL,
-            FileUploader.LOCAL_BEHAVIOUR_COPY,
-            targetContext,
-            false,
-            false)
-            .execute(client, storageManager).isSuccess)
+        assertFalse(
+            UploadFileOperation(
+                uploadsStorageManager,
+                connectivityServiceMock,
+                powerManagementServiceMock,
+                account,
+                null,
+                ocUpload2,
+                FileUploader.NameCollisionPolicy.CANCEL,
+                FileUploader.LOCAL_BEHAVIOUR_COPY,
+                targetContext,
+                false,
+                false
+            )
+                .execute(client, storageManager).isSuccess
+        )
 
 
         val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
         val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
         assertTrue(result2.isSuccess)
         assertTrue(result2.isSuccess)
@@ -344,7 +371,8 @@ class FileUploaderIT : AbstractIT() {
             UploadFileOperation.CREATED_BY_USER,
             UploadFileOperation.CREATED_BY_USER,
             false,
             false,
             false,
             false,
-            FileUploader.NameCollisionPolicy.DEFAULT)
+            FileUploader.NameCollisionPolicy.DEFAULT
+        )
 
 
         longSleep()
         longSleep()
 
 
@@ -361,7 +389,8 @@ class FileUploaderIT : AbstractIT() {
             account,
             account,
             ocFile2,
             ocFile2,
             FileUploader.LOCAL_BEHAVIOUR_COPY,
             FileUploader.LOCAL_BEHAVIOUR_COPY,
-            FileUploader.NameCollisionPolicy.CANCEL)
+            FileUploader.NameCollisionPolicy.CANCEL
+        )
 
 
         shortSleep()
         shortSleep()
 
 

+ 69 - 40
src/androidTest/java/com/owncloud/android/ui/fragment/OCFileListFragmentIT.kt

@@ -93,9 +93,11 @@ class OCFileListFragmentIT : AbstractIT() {
     fun showRichWorkspace() {
     fun showRichWorkspace() {
         assertTrue(CreateFolderOperation("/test/", account, targetContext).execute(client, storageManager).isSuccess)
         assertTrue(CreateFolderOperation("/test/", account, targetContext).execute(client, storageManager).isSuccess)
 
 
-        val ocUpload = OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
+        val ocUpload = OCUpload(
+            FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
             "/test/Readme.md",
             "/test/Readme.md",
-            account.name)
+            account.name
+        )
         val newUpload = UploadFileOperation(
         val newUpload = UploadFileOperation(
             UploadsStorageManager(UserAccountManagerImpl.fromContext(targetContext), targetContext.contentResolver),
             UploadsStorageManager(UserAccountManagerImpl.fromContext(targetContext), targetContext.contentResolver),
             connectivityServiceMock,
             connectivityServiceMock,
@@ -107,20 +109,27 @@ class OCFileListFragmentIT : AbstractIT() {
             FileUploader.LOCAL_BEHAVIOUR_COPY,
             FileUploader.LOCAL_BEHAVIOUR_COPY,
             targetContext,
             targetContext,
             false,
             false,
-            false)
+            false
+        )
 
 
         newUpload.addRenameUploadListener {}
         newUpload.addRenameUploadListener {}
         newUpload.setRemoteFolderToBeCreated()
         newUpload.setRemoteFolderToBeCreated()
 
 
         assertTrue(newUpload.execute(client, storageManager).isSuccess)
         assertTrue(newUpload.execute(client, storageManager).isSuccess)
 
 
-        assertTrue(RefreshFolderOperation(storageManager.getFileByPath("/test/"),
-            System.currentTimeMillis() / SECOND_IN_MILLIS,
-            false,
-            true,
-            storageManager,
-            account,
-            targetContext).execute(client).isSuccess)
+        assertTrue(
+            RefreshFolderOperation(
+                storageManager.getFileByPath("/test/"),
+                System.currentTimeMillis() / SECOND_IN_MILLIS,
+                false,
+                true,
+                storageManager,
+                account,
+                targetContext
+            )
+                .execute(client)
+                .isSuccess
+        )
 
 
         val sut = ActivityScenario.launch(FileDisplayActivity::class.java)
         val sut = ActivityScenario.launch(FileDisplayActivity::class.java)
         shortSleep()
         shortSleep()
@@ -170,18 +179,24 @@ class OCFileListFragmentIT : AbstractIT() {
     @ScreenshotTest
     @ScreenshotTest
     fun createAndShowShareToUser() {
     fun createAndShowShareToUser() {
         val path = "/shareToAdmin/"
         val path = "/shareToAdmin/"
-        TestCase.assertTrue(CreateFolderOperation(path, account, targetContext)
-            .execute(client, storageManager)
-            .isSuccess)
+        TestCase.assertTrue(
+            CreateFolderOperation(path, account, targetContext)
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         // share folder to user "admin"
         // share folder to user "admin"
-        TestCase.assertTrue(CreateShareRemoteOperation(path,
-            ShareType.USER,
-            "admin",
-            false,
-            "",
-            OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
-            .execute(client).isSuccess)
+        TestCase.assertTrue(
+            CreateShareRemoteOperation(
+                path,
+                ShareType.USER,
+                "admin",
+                false,
+                "",
+                OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER
+            )
+                .execute(client).isSuccess
+        )
 
 
         val sut: FileDisplayActivity = activityRule.launchActivity(null)
         val sut: FileDisplayActivity = activityRule.launchActivity(null)
         sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
         sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
@@ -195,18 +210,25 @@ class OCFileListFragmentIT : AbstractIT() {
     @ScreenshotTest
     @ScreenshotTest
     fun createAndShowShareToGroup() {
     fun createAndShowShareToGroup() {
         val path = "/shareToGroup/"
         val path = "/shareToGroup/"
-        TestCase.assertTrue(CreateFolderOperation(path, account, targetContext)
-            .execute(client, storageManager)
-            .isSuccess)
+        TestCase.assertTrue(
+            CreateFolderOperation(path, account, targetContext)
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         // share folder to group
         // share folder to group
-        assertTrue(CreateShareRemoteOperation("/shareToGroup/",
-            ShareType.GROUP,
-            "users",
-            false,
-            "",
-            OCShare.DEFAULT_PERMISSION)
-            .execute(client).isSuccess)
+        assertTrue(
+            CreateShareRemoteOperation(
+                "/shareToGroup/",
+                ShareType.GROUP,
+                "users",
+                false,
+                "",
+                OCShare.DEFAULT_PERMISSION
+            )
+                .execute(client)
+                .isSuccess
+        )
 
 
         val sut: FileDisplayActivity = activityRule.launchActivity(null)
         val sut: FileDisplayActivity = activityRule.launchActivity(null)
         sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
         sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
@@ -252,18 +274,25 @@ class OCFileListFragmentIT : AbstractIT() {
     @ScreenshotTest
     @ScreenshotTest
     fun createAndShowShareViaLink() {
     fun createAndShowShareViaLink() {
         val path = "/shareViaLink/"
         val path = "/shareViaLink/"
-        TestCase.assertTrue(CreateFolderOperation(path, account, targetContext)
-            .execute(client, storageManager)
-            .isSuccess)
+        TestCase.assertTrue(
+            CreateFolderOperation(path, account, targetContext)
+                .execute(client, storageManager)
+                .isSuccess
+        )
 
 
         // share folder via public link
         // share folder via public link
-        TestCase.assertTrue(CreateShareRemoteOperation("/shareViaLink/",
-            ShareType.PUBLIC_LINK,
-            "",
-            true,
-            "",
-            OCShare.READ_PERMISSION_FLAG)
-            .execute(client).isSuccess)
+        TestCase.assertTrue(
+            CreateShareRemoteOperation(
+                "/shareViaLink/",
+                ShareType.PUBLIC_LINK,
+                "",
+                true,
+                "",
+                OCShare.READ_PERMISSION_FLAG
+            )
+                .execute(client)
+                .isSuccess
+        )
 
 
         val sut: FileDisplayActivity = activityRule.launchActivity(null)
         val sut: FileDisplayActivity = activityRule.launchActivity(null)
         sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
         sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)

+ 5 - 3
src/main/java/com/nextcloud/client/core/Task.kt

@@ -40,9 +40,11 @@ internal class Task<T>(
         try {
         try {
             val result = taskBody.invoke()
             val result = taskBody.invoke()
             if (!cancelled.get()) {
             if (!cancelled.get()) {
-                postResult.invoke(Runnable {
-                    onSuccess?.invoke(result)
-                })
+                postResult.invoke(
+                    Runnable {
+                        onSuccess?.invoke(result)
+                    }
+                )
             }
             }
         } catch (t: Throwable) {
         } catch (t: Throwable) {
             if (!cancelled.get()) {
             if (!cancelled.get()) {

+ 2 - 1
src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt

@@ -49,7 +49,8 @@ class ShowErrorActivity : AppCompatActivity() {
 
 
         val snackbar = DisplayUtils.createSnackbar(
         val snackbar = DisplayUtils.createSnackbar(
             error_page_container,
             error_page_container,
-            R.string.error_report_issue_text, Snackbar.LENGTH_INDEFINITE)
+            R.string.error_report_issue_text, Snackbar.LENGTH_INDEFINITE
+        )
             .setAction(R.string.error_report_issue_action) { reportIssue() }
             .setAction(R.string.error_report_issue_action) { reportIssue() }
 
 
         snackbar.show()
         snackbar.show()

+ 6 - 3
src/main/java/com/nextcloud/client/etm/EtmActivity.kt

@@ -51,9 +51,12 @@ class EtmActivity : ToolbarActivity(), Injectable {
         setupToolbar()
         setupToolbar()
         updateActionBarTitleAndHomeButtonByString(getString(R.string.etm_title))
         updateActionBarTitleAndHomeButtonByString(getString(R.string.etm_title))
         vm = ViewModelProvider(this, viewModelFactory).get(EtmViewModel::class.java)
         vm = ViewModelProvider(this, viewModelFactory).get(EtmViewModel::class.java)
-        vm.currentPage.observe(this, Observer {
-            onPageChanged(it)
-        })
+        vm.currentPage.observe(
+            this,
+            Observer {
+                onPageChanged(it)
+            }
+        )
     }
     }
 
 
     override fun onOptionsItemSelected(item: MenuItem?): Boolean {
     override fun onOptionsItemSelected(item: MenuItem?): Boolean {

+ 4 - 4
src/main/java/com/nextcloud/client/etm/pages/EtmBackgroundJobsFragment.kt

@@ -67,10 +67,10 @@ class EtmBackgroundJobsFragment : EtmBaseFragment() {
 
 
         private val dateFormat = SimpleDateFormat("YYYY-MM-dd HH:MM:ssZ", Locale.getDefault())
         private val dateFormat = SimpleDateFormat("YYYY-MM-dd HH:MM:ssZ", Locale.getDefault())
         var backgroundJobs: List<JobInfo> = emptyList()
         var backgroundJobs: List<JobInfo> = emptyList()
-        set(value) {
-            field = value
-            notifyDataSetChanged()
-        }
+            set(value) {
+                field = value
+                notifyDataSetChanged()
+            }
 
 
         override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
         override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
             val view = inflater.inflate(R.layout.etm_background_job_list_item, parent, false)
             val view = inflater.inflate(R.layout.etm_background_job_list_item, parent, false)

+ 13 - 8
src/main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt

@@ -140,24 +140,29 @@ class AccountRemovalWork(
         user: User,
         user: User,
         arbitraryDataProvider: ArbitraryDataProvider
         arbitraryDataProvider: ArbitraryDataProvider
     ) {
     ) {
-        val arbitraryDataPushString = arbitraryDataProvider.getValue(user.toPlatformAccount(),
-            PushUtils.KEY_PUSH)
+        val arbitraryDataPushString = arbitraryDataProvider.getValue(user.toPlatformAccount(), PushUtils.KEY_PUSH)
         val pushServerUrl = context.resources.getString(R.string.push_server_url)
         val pushServerUrl = context.resources.getString(R.string.push_server_url)
         if (!TextUtils.isEmpty(arbitraryDataPushString) && !TextUtils.isEmpty(pushServerUrl)) {
         if (!TextUtils.isEmpty(arbitraryDataPushString) && !TextUtils.isEmpty(pushServerUrl)) {
             val gson = Gson()
             val gson = Gson()
-            val pushArbitraryData = gson.fromJson(arbitraryDataPushString,
-                PushConfigurationState::class.java)
+            val pushArbitraryData = gson.fromJson(
+                arbitraryDataPushString,
+                PushConfigurationState::class.java
+            )
             pushArbitraryData.isShouldBeDeleted = true
             pushArbitraryData.isShouldBeDeleted = true
-            arbitraryDataProvider.storeOrUpdateKeyValue(user.accountName, PushUtils.KEY_PUSH,
-                gson.toJson(pushArbitraryData))
+            arbitraryDataProvider.storeOrUpdateKeyValue(
+                user.accountName, PushUtils.KEY_PUSH,
+                gson.toJson(pushArbitraryData)
+            )
             PushUtils.pushRegistrationToServer(userAccountManager, pushArbitraryData.getPushToken())
             PushUtils.pushRegistrationToServer(userAccountManager, pushArbitraryData.getPushToken())
         }
         }
     }
     }
 
 
     private fun remoceSyncedFolders(context: Context, account: Account, clock: Clock) {
     private fun remoceSyncedFolders(context: Context, account: Account, clock: Clock) {
-        val syncedFolderProvider = SyncedFolderProvider(context.contentResolver,
+        val syncedFolderProvider = SyncedFolderProvider(
+            context.contentResolver,
             AppPreferencesImpl.fromContext(context),
             AppPreferencesImpl.fromContext(context),
-            clock)
+            clock
+        )
         val syncedFolders = syncedFolderProvider.syncedFolders
         val syncedFolders = syncedFolderProvider.syncedFolders
         val syncedFolderIds: MutableList<Long> = ArrayList()
         val syncedFolderIds: MutableList<Long> = ArrayList()
         for (syncedFolder in syncedFolders) {
         for (syncedFolder in syncedFolders) {

+ 4 - 2
src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt

@@ -285,7 +285,8 @@ internal class BackgroundJobManagerImpl(
         val request = periodicRequestBuilder(
         val request = periodicRequestBuilder(
             jobClass = FilesSyncWork::class,
             jobClass = FilesSyncWork::class,
             jobName = JOB_PERIODIC_FILES_SYNC,
             jobName = JOB_PERIODIC_FILES_SYNC,
-            intervalMins = DEFAULT_PERIODIC_JOB_INTERVAL_MINUTES).build()
+            intervalMins = DEFAULT_PERIODIC_JOB_INTERVAL_MINUTES
+        ).build()
         workManager.enqueueUniquePeriodicWork(JOB_PERIODIC_FILES_SYNC, ExistingPeriodicWorkPolicy.REPLACE, request)
         workManager.enqueueUniquePeriodicWork(JOB_PERIODIC_FILES_SYNC, ExistingPeriodicWorkPolicy.REPLACE, request)
     }
     }
 
 
@@ -297,7 +298,8 @@ internal class BackgroundJobManagerImpl(
 
 
         val request = oneTimeRequestBuilder(
         val request = oneTimeRequestBuilder(
             jobClass = FilesSyncWork::class,
             jobClass = FilesSyncWork::class,
-            jobName = JOB_IMMEDIATE_FILES_SYNC)
+            jobName = JOB_IMMEDIATE_FILES_SYNC
+        )
             .setInputData(arguments)
             .setInputData(arguments)
             .build()
             .build()
 
 

+ 12 - 6
src/main/java/com/nextcloud/client/jobs/ContactsBackupWork.kt

@@ -87,8 +87,10 @@ class ContactsBackupWork(
             return Result.failure()
             return Result.failure()
         }
         }
         val user = optionalUser.get()
         val user = optionalUser.get()
-        val lastExecution = arbitraryDataProvider.getLongValue(user.toPlatformAccount(),
-            ContactsPreferenceActivity.PREFERENCE_CONTACTS_LAST_BACKUP)
+        val lastExecution = arbitraryDataProvider.getLongValue(
+            user.toPlatformAccount(),
+            ContactsPreferenceActivity.PREFERENCE_CONTACTS_LAST_BACKUP
+        )
         val force = inputData.getBoolean(FORCE, false)
         val force = inputData.getBoolean(FORCE, false)
         if (force || lastExecution + JOB_INTERVAL_MS < Calendar.getInstance().timeInMillis) {
         if (force || lastExecution + JOB_INTERVAL_MS < Calendar.getInstance().timeInMillis) {
             Log_OC.d(TAG, "start contacts backup job")
             Log_OC.d(TAG, "start contacts backup job")
@@ -121,8 +123,10 @@ class ContactsBackupWork(
 
 
     private fun backupContact(user: User, backupFolder: String) {
     private fun backupContact(user: User, backupFolder: String) {
         val vCard = ArrayList<String>()
         val vCard = ArrayList<String>()
-        val cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null,
-            null, null, null)
+        val cursor = contentResolver.query(
+            ContactsContract.Contacts.CONTENT_URI, null,
+            null, null, null
+        )
         if (cursor != null && cursor.count > 0) {
         if (cursor != null && cursor.count > 0) {
             cursor.moveToFirst()
             cursor.moveToFirst()
             for (i in 0 until cursor.count) {
             for (i in 0 until cursor.count) {
@@ -168,8 +172,10 @@ class ContactsBackupWork(
 
 
     private fun expireFiles(daysToExpire: Int, backupFolderString: String, user: User) { // -1 disables expiration
     private fun expireFiles(daysToExpire: Int, backupFolderString: String, user: User) { // -1 disables expiration
         if (daysToExpire > -1) {
         if (daysToExpire > -1) {
-            val storageManager = FileDataStorageManager(user.toPlatformAccount(),
-                applicationContext.getContentResolver())
+            val storageManager = FileDataStorageManager(
+                user.toPlatformAccount(),
+                applicationContext.getContentResolver()
+            )
             val backupFolder: OCFile = storageManager.getFileByPath(backupFolderString)
             val backupFolder: OCFile = storageManager.getFileByPath(backupFolderString)
             val cal = Calendar.getInstance()
             val cal = Calendar.getInstance()
             cal.add(Calendar.DAY_OF_YEAR, -daysToExpire)
             cal.add(Calendar.DAY_OF_YEAR, -daysToExpire)

+ 21 - 10
src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt

@@ -86,8 +86,11 @@ class FilesSyncWork(
         var wakeLock: WakeLock? = null
         var wakeLock: WakeLock? = null
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
             val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
             val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
-            wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, MainApp.getAuthority() +
-                WAKELOCK_TAG_SEPARATION + TAG)
+            wakeLock = powerManager.newWakeLock(
+                PowerManager.PARTIAL_WAKE_LOCK,
+                MainApp.getAuthority() +
+                    WAKELOCK_TAG_SEPARATION + TAG
+            )
             wakeLock.acquire(WAKELOCK_ACQUIRE_TIMEOUT_MS)
             wakeLock.acquire(WAKELOCK_ACQUIRE_TIMEOUT_MS)
         }
         }
         val overridePowerSaving = inputData.getBoolean(OVERRIDE_POWER_SAVING, false)
         val overridePowerSaving = inputData.getBoolean(OVERRIDE_POWER_SAVING, false)
@@ -99,10 +102,12 @@ class FilesSyncWork(
         val resources = context.resources
         val resources = context.resources
         val lightVersion = resources.getBoolean(R.bool.syncedFolder_light)
         val lightVersion = resources.getBoolean(R.bool.syncedFolder_light)
         val skipCustom = inputData.getBoolean(SKIP_CUSTOM, false)
         val skipCustom = inputData.getBoolean(SKIP_CUSTOM, false)
-        FilesSyncHelper.restartJobsIfNeeded(uploadsStorageManager,
+        FilesSyncHelper.restartJobsIfNeeded(
+            uploadsStorageManager,
             userAccountManager,
             userAccountManager,
             connectivityService,
             connectivityService,
-            powerManagementService)
+            powerManagementService
+        )
         FilesSyncHelper.insertAllDBEntries(preferences, clock, skipCustom)
         FilesSyncHelper.insertAllDBEntries(preferences, clock, skipCustom)
         // Create all the providers we'll needq
         // Create all the providers we'll needq
         val filesystemDataProvider = FilesystemDataProvider(contentResolver)
         val filesystemDataProvider = FilesystemDataProvider(contentResolver)
@@ -112,8 +117,10 @@ class FilesSyncWork(
         dateFormat.timeZone = TimeZone.getTimeZone(TimeZone.getDefault().id)
         dateFormat.timeZone = TimeZone.getTimeZone(TimeZone.getDefault().id)
         for (syncedFolder in syncedFolderProvider.syncedFolders) {
         for (syncedFolder in syncedFolderProvider.syncedFolders) {
             if (syncedFolder.isEnabled && (!skipCustom || MediaFolderType.CUSTOM != syncedFolder.type)) {
             if (syncedFolder.isEnabled && (!skipCustom || MediaFolderType.CUSTOM != syncedFolder.type)) {
-                syncFolder(context, resources, lightVersion, filesystemDataProvider, currentLocale, dateFormat,
-                    syncedFolder)
+                syncFolder(
+                    context, resources, lightVersion, filesystemDataProvider, currentLocale, dateFormat,
+                    syncedFolder
+                )
             }
             }
         }
         }
         wakeLock?.release()
         wakeLock?.release()
@@ -157,8 +164,10 @@ class FilesSyncWork(
             val mimeType = MimeTypeUtil.getBestMimeTypeByFilename(file.absolutePath)
             val mimeType = MimeTypeUtil.getBestMimeTypeByFilename(file.absolutePath)
             if (lightVersion) {
             if (lightVersion) {
                 needsCharging = resources.getBoolean(R.bool.syncedFolder_light_on_charging)
                 needsCharging = resources.getBoolean(R.bool.syncedFolder_light_on_charging)
-                needsWifi = arbitraryDataProvider!!.getBooleanValue(accountName,
-                    SettingsActivity.SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI)
+                needsWifi = arbitraryDataProvider!!.getBooleanValue(
+                    accountName,
+                    SettingsActivity.SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI
+                )
                 val uploadActionString = resources.getString(R.string.syncedFolder_light_upload_behaviour)
                 val uploadActionString = resources.getString(R.string.syncedFolder_light_upload_behaviour)
                 uploadAction = getUploadAction(uploadActionString)
                 uploadAction = getUploadAction(uploadActionString)
                 subfolderByDate = resources.getBoolean(R.bool.syncedFolder_light_use_subfolders)
                 subfolderByDate = resources.getBoolean(R.bool.syncedFolder_light_use_subfolders)
@@ -190,8 +199,10 @@ class FilesSyncWork(
                 needsCharging,
                 needsCharging,
                 FileUploader.NameCollisionPolicy.ASK_USER
                 FileUploader.NameCollisionPolicy.ASK_USER
             )
             )
-            filesystemDataProvider.updateFilesystemFileAsSentForUpload(path,
-                java.lang.Long.toString(syncedFolder.id))
+            filesystemDataProvider.updateFilesystemFileAsSentForUpload(
+                path,
+                java.lang.Long.toString(syncedFolder.id)
+            )
         }
         }
     }
     }
 
 

+ 31 - 15
src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt

@@ -123,38 +123,51 @@ class MediaFoldersDetectionWork constructor(
                     val allUsers = userAccountManager.allUsers
                     val allUsers = userAccountManager.allUsers
                     val activeUsers: MutableList<User> = ArrayList()
                     val activeUsers: MutableList<User> = ArrayList()
                     for (account in allUsers) {
                     for (account in allUsers) {
-                        if (!arbitraryDataProvider.getBooleanValue(account.toPlatformAccount(),
-                                ManageAccountsActivity.PENDING_FOR_REMOVAL)) {
+                        if (!arbitraryDataProvider.getBooleanValue(
+                            account.toPlatformAccount(),
+                            ManageAccountsActivity.PENDING_FOR_REMOVAL
+                        )
+                        ) {
                             activeUsers.add(account)
                             activeUsers.add(account)
                         }
                         }
                     }
                     }
                     for (user in activeUsers) {
                     for (user in activeUsers) {
                         for (imageMediaFolder in imageMediaFolderPaths) {
                         for (imageMediaFolder in imageMediaFolderPaths) {
-                            val folder = syncedFolderProvider.findByLocalPathAndAccount(imageMediaFolder,
-                                user.toPlatformAccount())
+                            val folder = syncedFolderProvider.findByLocalPathAndAccount(
+                                imageMediaFolder,
+                                user.toPlatformAccount()
+                            )
                             if (folder == null) {
                             if (folder == null) {
                                 val contentTitle = String.format(
                                 val contentTitle = String.format(
                                     resources.getString(R.string.new_media_folder_detected),
                                     resources.getString(R.string.new_media_folder_detected),
                                     resources.getString(R.string.new_media_folder_photos)
                                     resources.getString(R.string.new_media_folder_photos)
                                 )
                                 )
-                                sendNotification(contentTitle,
+                                sendNotification(
+                                    contentTitle,
                                     imageMediaFolder.substring(imageMediaFolder.lastIndexOf('/') + 1),
                                     imageMediaFolder.substring(imageMediaFolder.lastIndexOf('/') + 1),
                                     user,
                                     user,
                                     imageMediaFolder,
                                     imageMediaFolder,
-                                    1)
+                                    1
+                                )
                             }
                             }
                         }
                         }
                         for (videoMediaFolder in videoMediaFolderPaths) {
                         for (videoMediaFolder in videoMediaFolderPaths) {
-                            val folder = syncedFolderProvider.findByLocalPathAndAccount(videoMediaFolder,
-                                user.toPlatformAccount())
+                            val folder = syncedFolderProvider.findByLocalPathAndAccount(
+                                videoMediaFolder,
+                                user.toPlatformAccount()
+                            )
                             if (folder == null) {
                             if (folder == null) {
-                                val contentTitle = String.format(context.getString(R.string.new_media_folder_detected),
-                                    context.getString(R.string.new_media_folder_videos))
-                                sendNotification(contentTitle,
+                                val contentTitle = String.format(
+                                    context.getString(R.string.new_media_folder_detected),
+                                    context.getString(R.string.new_media_folder_videos)
+                                )
+                                sendNotification(
+                                    contentTitle,
                                     videoMediaFolder.substring(videoMediaFolder.lastIndexOf('/') + 1),
                                     videoMediaFolder.substring(videoMediaFolder.lastIndexOf('/') + 1),
                                     user,
                                     user,
                                     videoMediaFolder,
                                     videoMediaFolder,
-                                    2)
+                                    2
+                                )
                             }
                             }
                         }
                         }
                     }
                     }
@@ -162,8 +175,10 @@ class MediaFoldersDetectionWork constructor(
             }
             }
         } else {
         } else {
             mediaFoldersModel = MediaFoldersModel(imageMediaFolderPaths, videoMediaFolderPaths)
             mediaFoldersModel = MediaFoldersModel(imageMediaFolderPaths, videoMediaFolderPaths)
-            arbitraryDataProvider.storeOrUpdateKeyValue(ACCOUNT_NAME_GLOBAL, KEY_MEDIA_FOLDERS,
-                gson.toJson(mediaFoldersModel))
+            arbitraryDataProvider.storeOrUpdateKeyValue(
+                ACCOUNT_NAME_GLOBAL, KEY_MEDIA_FOLDERS,
+                gson.toJson(mediaFoldersModel)
+            )
         }
         }
         return Result.success()
         return Result.success()
     }
     }
@@ -180,7 +195,8 @@ class MediaFoldersDetectionWork constructor(
         intent.putExtra(SyncedFoldersActivity.EXTRA_SHOW_SIDEBAR, true)
         intent.putExtra(SyncedFoldersActivity.EXTRA_SHOW_SIDEBAR, true)
         val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT)
         val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT)
         val notificationBuilder = NotificationCompat.Builder(
         val notificationBuilder = NotificationCompat.Builder(
-            context, NotificationUtils.NOTIFICATION_CHANNEL_GENERAL)
+            context, NotificationUtils.NOTIFICATION_CHANNEL_GENERAL
+        )
             .setSmallIcon(R.drawable.notification_icon)
             .setSmallIcon(R.drawable.notification_icon)
             .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.notification_icon))
             .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.notification_icon))
             .setColor(ThemeUtils.primaryColor(context))
             .setColor(ThemeUtils.primaryColor(context))

+ 66 - 50
src/main/java/com/nextcloud/client/jobs/NotificationWork.kt

@@ -99,17 +99,21 @@ class NotificationWork constructor(
                 val base64DecodedSignature = Base64.decode(signature, Base64.DEFAULT)
                 val base64DecodedSignature = Base64.decode(signature, Base64.DEFAULT)
                 val privateKey = PushUtils.readKeyFromFile(false) as PrivateKey
                 val privateKey = PushUtils.readKeyFromFile(false) as PrivateKey
                 try {
                 try {
-                    val signatureVerification = PushUtils.verifySignature(context,
+                    val signatureVerification = PushUtils.verifySignature(
+                        context,
                         accountManager,
                         accountManager,
                         base64DecodedSignature,
                         base64DecodedSignature,
-                        base64DecodedSubject)
+                        base64DecodedSubject
+                    )
                     if (signatureVerification != null && signatureVerification.isSignatureValid) {
                     if (signatureVerification != null && signatureVerification.isSignatureValid) {
                         val cipher = Cipher.getInstance("RSA/None/PKCS1Padding")
                         val cipher = Cipher.getInstance("RSA/None/PKCS1Padding")
                         cipher.init(Cipher.DECRYPT_MODE, privateKey)
                         cipher.init(Cipher.DECRYPT_MODE, privateKey)
                         val decryptedSubject = cipher.doFinal(base64DecodedSubject)
                         val decryptedSubject = cipher.doFinal(base64DecodedSubject)
                         val gson = Gson()
                         val gson = Gson()
-                        val decryptedPushMessage = gson.fromJson(String(decryptedSubject),
-                            DecryptedPushMessage::class.java)
+                        val decryptedPushMessage = gson.fromJson(
+                            String(decryptedSubject),
+                            DecryptedPushMessage::class.java
+                        )
                         if (decryptedPushMessage.delete) {
                         if (decryptedPushMessage.delete) {
                             notificationManager.cancel(decryptedPushMessage.nid)
                             notificationManager.cancel(decryptedPushMessage.nid)
                         } else if (decryptedPushMessage.deleteAll) {
                         } else if (decryptedPushMessage.deleteAll) {
@@ -174,10 +178,16 @@ class NotificationWork constructor(
             disableDetection.putExtra(NUMERIC_NOTIFICATION_ID, notification.getNotificationId())
             disableDetection.putExtra(NUMERIC_NOTIFICATION_ID, notification.getNotificationId())
             disableDetection.putExtra(PUSH_NOTIFICATION_ID, pushNotificationId)
             disableDetection.putExtra(PUSH_NOTIFICATION_ID, pushNotificationId)
             disableDetection.putExtra(KEY_NOTIFICATION_ACCOUNT, user.accountName)
             disableDetection.putExtra(KEY_NOTIFICATION_ACCOUNT, user.accountName)
-            val disableIntent = PendingIntent.getBroadcast(context, pushNotificationId, disableDetection,
-                PendingIntent.FLAG_CANCEL_CURRENT)
-            notificationBuilder.addAction(NotificationCompat.Action(R.drawable.ic_close,
-                context.getString(R.string.remove_push_notification), disableIntent))
+            val disableIntent = PendingIntent.getBroadcast(
+                context, pushNotificationId, disableDetection,
+                PendingIntent.FLAG_CANCEL_CURRENT
+            )
+            notificationBuilder.addAction(
+                NotificationCompat.Action(
+                    R.drawable.ic_close,
+                    context.getString(R.string.remove_push_notification), disableIntent
+                )
+            )
         } else { // Actions
         } else { // Actions
             for (action in notification.getActions()) {
             for (action in notification.getActions()) {
                 val actionIntent = Intent(context, NotificationReceiver::class.java)
                 val actionIntent = Intent(context, NotificationReceiver::class.java)
@@ -186,9 +196,11 @@ class NotificationWork constructor(
                 actionIntent.putExtra(KEY_NOTIFICATION_ACCOUNT, user.accountName)
                 actionIntent.putExtra(KEY_NOTIFICATION_ACCOUNT, user.accountName)
                 actionIntent.putExtra(KEY_NOTIFICATION_ACTION_LINK, action.link)
                 actionIntent.putExtra(KEY_NOTIFICATION_ACTION_LINK, action.link)
                 actionIntent.putExtra(KEY_NOTIFICATION_ACTION_TYPE, action.type)
                 actionIntent.putExtra(KEY_NOTIFICATION_ACTION_TYPE, action.type)
-                val actionPendingIntent = PendingIntent.getBroadcast(context, randomId.nextInt(),
+                val actionPendingIntent = PendingIntent.getBroadcast(
+                    context, randomId.nextInt(),
                     actionIntent,
                     actionIntent,
-                    PendingIntent.FLAG_CANCEL_CURRENT)
+                    PendingIntent.FLAG_CANCEL_CURRENT
+                )
                 var icon: Int
                 var icon: Int
                 icon = if (action.primary) {
                 icon = if (action.primary) {
                     R.drawable.ic_check_circle
                     R.drawable.ic_check_circle
@@ -209,7 +221,8 @@ class NotificationWork constructor(
                 .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                 .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                 .setAutoCancel(true)
                 .setAutoCancel(true)
                 .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
                 .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
-                .setContentIntent(pendingIntent).build())
+                .setContentIntent(pendingIntent).build()
+        )
         val notificationManager = NotificationManagerCompat.from(context)
         val notificationManager = NotificationManagerCompat.from(context)
         notificationManager.notify(notification.getNotificationId(), notificationBuilder.build())
         notificationManager.notify(notification.getNotificationId(), notificationBuilder.build())
     }
     }
@@ -255,51 +268,54 @@ class NotificationWork constructor(
             val numericNotificationId = intent.getIntExtra(NUMERIC_NOTIFICATION_ID, 0)
             val numericNotificationId = intent.getIntExtra(NUMERIC_NOTIFICATION_ID, 0)
             val accountName = intent.getStringExtra(KEY_NOTIFICATION_ACCOUNT)
             val accountName = intent.getStringExtra(KEY_NOTIFICATION_ACCOUNT)
             if (numericNotificationId != 0) {
             if (numericNotificationId != 0) {
-                Thread(Runnable {
-                    val notificationManager = context.getSystemService(
-                        Activity.NOTIFICATION_SERVICE) as NotificationManager
-                    var oldNotification: android.app.Notification? = null
-                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && notificationManager != null) {
-                        for (statusBarNotification in notificationManager.activeNotifications) {
-                            if (numericNotificationId == statusBarNotification.id) {
-                                oldNotification = statusBarNotification.notification
-                                break
+                Thread(
+                    Runnable {
+                        val notificationManager = context.getSystemService(
+                            Activity.NOTIFICATION_SERVICE
+                        ) as NotificationManager
+                        var oldNotification: android.app.Notification? = null
+                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && notificationManager != null) {
+                            for (statusBarNotification in notificationManager.activeNotifications) {
+                                if (numericNotificationId == statusBarNotification.id) {
+                                    oldNotification = statusBarNotification.notification
+                                    break
+                                }
                             }
                             }
+                            cancel(context, numericNotificationId)
                         }
                         }
-                        cancel(context, numericNotificationId)
-                    }
-                    try {
-                        val optionalUser = accountManager.getUser(accountName)
-                        if (optionalUser.isPresent) {
-                            val user = optionalUser.get()
-                            val client = OwnCloudClientManagerFactory.getDefaultSingleton()
-                                .getClientFor(user.toOwnCloudAccount(), context)
-                            val actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE)
-                            val actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK)
-                            val success: Boolean
-                            success = if (!TextUtils.isEmpty(actionType) && !TextUtils.isEmpty(actionLink)) {
-                                val resultCode = executeAction(actionType, actionLink, client)
-                                resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_ACCEPTED
-                            } else {
-                                DeleteNotificationRemoteOperation(numericNotificationId)
-                                    .execute(client).isSuccess
-                            }
-                            if (success) {
-                                if (oldNotification == null) {
-                                    cancel(context, numericNotificationId)
+                        try {
+                            val optionalUser = accountManager.getUser(accountName)
+                            if (optionalUser.isPresent) {
+                                val user = optionalUser.get()
+                                val client = OwnCloudClientManagerFactory.getDefaultSingleton()
+                                    .getClientFor(user.toOwnCloudAccount(), context)
+                                val actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE)
+                                val actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK)
+                                val success: Boolean
+                                success = if (!TextUtils.isEmpty(actionType) && !TextUtils.isEmpty(actionLink)) {
+                                    val resultCode = executeAction(actionType, actionLink, client)
+                                    resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_ACCEPTED
+                                } else {
+                                    DeleteNotificationRemoteOperation(numericNotificationId)
+                                        .execute(client).isSuccess
+                                }
+                                if (success) {
+                                    if (oldNotification == null) {
+                                        cancel(context, numericNotificationId)
+                                    }
+                                } else {
+                                    notificationManager.notify(numericNotificationId, oldNotification)
                                 }
                                 }
-                            } else {
-                                notificationManager.notify(numericNotificationId, oldNotification)
                             }
                             }
+                        } catch (e: IOException) {
+                            Log_OC.e(TAG, "Error initializing client", e)
+                        } catch (e: OperationCanceledException) {
+                            Log_OC.e(TAG, "Error initializing client", e)
+                        } catch (e: AuthenticatorException) {
+                            Log_OC.e(TAG, "Error initializing client", e)
                         }
                         }
-                    } catch (e: IOException) {
-                        Log_OC.e(TAG, "Error initializing client", e)
-                    } catch (e: OperationCanceledException) {
-                        Log_OC.e(TAG, "Error initializing client", e)
-                    } catch (e: AuthenticatorException) {
-                        Log_OC.e(TAG, "Error initializing client", e)
                     }
                     }
-                }).start()
+                ).start()
             }
             }
         }
         }
 
 

+ 8 - 4
src/main/java/com/nextcloud/client/jobs/OfflineSyncWork.kt

@@ -93,8 +93,10 @@ class OfflineSyncWork constructor(
         val ocFolder = storageManager.getFileByPath(folderName)
         val ocFolder = storageManager.getFileByPath(folderName)
         Log_OC.d(TAG, folderName + ": currentEtag: " + ocFolder.etag)
         Log_OC.d(TAG, folderName + ": currentEtag: " + ocFolder.etag)
         // check for etag change, if false, skip
         // check for etag change, if false, skip
-        val checkEtagOperation = CheckEtagRemoteOperation(ocFolder.encryptedFileName,
-            ocFolder.etagOnServer)
+        val checkEtagOperation = CheckEtagRemoteOperation(
+            ocFolder.encryptedFileName,
+            ocFolder.etagOnServer
+        )
         val result = checkEtagOperation.execute(user.toPlatformAccount(), context)
         val result = checkEtagOperation.execute(user.toPlatformAccount(), context)
         when (result.code) {
         when (result.code) {
             ResultCode.ETAG_UNCHANGED -> {
             ResultCode.ETAG_UNCHANGED -> {
@@ -116,10 +118,12 @@ class OfflineSyncWork constructor(
         if (files != null) {
         if (files != null) {
             for (file in files) {
             for (file in files) {
                 val ocFile = storageManager.getFileByLocalPath(file.path)
                 val ocFile = storageManager.getFileByLocalPath(file.path)
-                val synchronizeFileOperation = SynchronizeFileOperation(ocFile.remotePath,
+                val synchronizeFileOperation = SynchronizeFileOperation(
+                    ocFile.remotePath,
                     user,
                     user,
                     true,
                     true,
-                    context)
+                    context
+                )
                 synchronizeFileOperation.execute(storageManager, context)
                 synchronizeFileOperation.execute(storageManager, context)
             }
             }
         }
         }

+ 2 - 1
src/main/java/com/nextcloud/client/logger/LogEntry.kt

@@ -41,7 +41,8 @@ data class LogEntry(val timestamp: Date, val level: Level, val tag: String, val
          *  1970-01-01T00:00:00.000Z;D;tag;some message
          *  1970-01-01T00:00:00.000Z;D;tag;some message
          */
          */
         private val ENTRY_PARSE_REGEXP = Regex(
         private val ENTRY_PARSE_REGEXP = Regex(
-            pattern = """(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z);([ADEIVW]);([^;]+);(.*)"""
+            pattern =
+                """(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z);([ADEIVW]);([^;]+);(.*)"""
         )
         )
 
 
         @JvmStatic
         @JvmStatic

+ 4 - 2
src/main/java/com/nextcloud/client/logger/ui/LogsViewModel.kt

@@ -114,11 +114,13 @@ class LogsViewModel @Inject constructor(
         val sizeKb = logsSize / KILOBYTE
         val sizeKb = logsSize / KILOBYTE
         return when {
         return when {
             isLoading.value == true -> context.getString(R.string.logs_status_loading)
             isLoading.value == true -> context.getString(R.string.logs_status_loading)
-            isFiltered -> context.getString(R.string.logs_status_filtered,
+            isFiltered -> context.getString(
+                R.string.logs_status_filtered,
                 sizeKb,
                 sizeKb,
                 displayedEntries,
                 displayedEntries,
                 allEntries.size,
                 allEntries.size,
-                filterDurationMs)
+                filterDurationMs
+            )
             !isFiltered -> context.getString(R.string.logs_status_not_filtered, sizeKb)
             !isFiltered -> context.getString(R.string.logs_status_not_filtered, sizeKb)
             else -> ""
             else -> ""
         }
         }

+ 4 - 2
src/main/java/com/nextcloud/client/migrations/Migrations.kt

@@ -104,8 +104,10 @@ class Migrations @Inject constructor(
                 logger.i(TAG, "$description: no users to migrate")
                 logger.i(TAG, "$description: no users to migrate")
             } else {
             } else {
                 users.forEach {
                 users.forEach {
-                    val backupEnabled = arbitraryDataProvider.getBooleanValue(it.accountName,
-                        ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP)
+                    val backupEnabled = arbitraryDataProvider.getBooleanValue(
+                        it.accountName,
+                        ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP
+                    )
                     if (backupEnabled) {
                     if (backupEnabled) {
                         jobManager.schedulePeriodicContactsBackup(it)
                         jobManager.schedulePeriodicContactsBackup(it)
                     }
                     }

+ 10 - 5
src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt

@@ -80,7 +80,8 @@ class ChooseAccountDialogFragment : DialogFragment(), AvatarGenerationListener,
                 resources.getDimension(R.dimen.list_item_avatar_icon_radius),
                 resources.getDimension(R.dimen.list_item_avatar_icon_radius),
                 resources,
                 resources,
                 user_icon,
                 user_icon,
-                context)
+                context
+            )
 
 
             // Defining user texts, accounts, etc.
             // Defining user texts, accounts, etc.
             user_name.text = user.toOwnCloudAccount().displayName
             user_name.text = user.toOwnCloudAccount().displayName
@@ -88,17 +89,21 @@ class ChooseAccountDialogFragment : DialogFragment(), AvatarGenerationListener,
             account.text = user.accountName
             account.text = user.accountName
 
 
             // Defining user right indicator
             // Defining user right indicator
-            val icon = ThemeUtils.tintDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_check_circle),
-                ThemeUtils.primaryColor(requireContext(), true))
+            val icon = ThemeUtils.tintDrawable(
+                ContextCompat.getDrawable(requireContext(), R.drawable.ic_check_circle),
+                ThemeUtils.primaryColor(requireContext(), true)
+            )
             account_menu.setImageDrawable(icon)
             account_menu.setImageDrawable(icon)
 
 
             // Creating adapter for accounts list
             // Creating adapter for accounts list
-            val adapter = UserListAdapter(activity as BaseActivity,
+            val adapter = UserListAdapter(
+                activity as BaseActivity,
                 accountManager,
                 accountManager,
                 getAccountListItems(),
                 getAccountListItems(),
                 this,
                 this,
                 false,
                 false,
-                false)
+                false
+            )
             accounts_list.adapter = adapter
             accounts_list.adapter = adapter
 
 
             // Creating listeners for quick-actions
             // Creating listeners for quick-actions

+ 11 - 5
src/test/java/com/nextcloud/client/core/ManualAsyncRunnerTest.kt

@@ -115,11 +115,17 @@ class ManualAsyncRunnerTest {
         // WHEN
         // WHEN
         //      one task is scheduled
         //      one task is scheduled
         //      task callback schedules another task
         //      task callback schedules another task
-        runner.post(task, {
-            runner.post(task, {
-                runner.post(task)
-            })
-        })
+        runner.post(
+            task,
+            {
+                runner.post(
+                    task,
+                    {
+                        runner.post(task)
+                    }
+                )
+            }
+        )
         assertEquals(ONE_TASK, runner.size)
         assertEquals(ONE_TASK, runner.size)
 
 
         // WHEN
         // WHEN

+ 28 - 16
src/test/java/com/nextcloud/client/core/ThreadPoolAsyncRunnerTest.kt

@@ -79,9 +79,12 @@ class ThreadPoolAsyncRunnerTest {
         }.whenever(handler).post(any())
         }.whenever(handler).post(any())
 
 
         val onResult: OnResultCallback<String> = mock()
         val onResult: OnResultCallback<String> = mock()
-        r.post({
-            "result"
-        }, onResult = onResult)
+        r.post(
+            {
+                "result"
+            },
+            onResult = onResult
+        )
         assertAwait(afterPostLatch)
         assertAwait(afterPostLatch)
         verify(onResult).invoke(eq("result"))
         verify(onResult).invoke(eq("result"))
     }
     }
@@ -96,9 +99,12 @@ class ThreadPoolAsyncRunnerTest {
 
 
         val onResult: OnResultCallback<String> = mock()
         val onResult: OnResultCallback<String> = mock()
         val onError: OnErrorCallback = mock()
         val onError: OnErrorCallback = mock()
-        r.post({
-            throw IllegalArgumentException("whatever")
-        }, onResult = onResult, onError = onError)
+        r.post(
+            {
+                throw IllegalArgumentException("whatever")
+            },
+            onResult = onResult, onError = onError
+        )
         assertAwait(afterPostLatch)
         assertAwait(afterPostLatch)
         verify(onResult, never()).invoke(any())
         verify(onResult, never()).invoke(any())
         verify(onError).invoke(argThat { this is java.lang.IllegalArgumentException })
         verify(onError).invoke(argThat { this is java.lang.IllegalArgumentException })
@@ -108,11 +114,14 @@ class ThreadPoolAsyncRunnerTest {
     fun `cancelled task does not return result`() {
     fun `cancelled task does not return result`() {
         val taskIsCancelled = CountDownLatch(INIT_COUNT)
         val taskIsCancelled = CountDownLatch(INIT_COUNT)
         val taskIsRunning = CountDownLatch(INIT_COUNT)
         val taskIsRunning = CountDownLatch(INIT_COUNT)
-        val t = r.post({
-            taskIsRunning.countDown()
-            taskIsCancelled.await()
-            "result"
-        }, onResult = {}, onError = {})
+        val t = r.post(
+            {
+                taskIsRunning.countDown()
+                taskIsCancelled.await()
+                "result"
+            },
+            onResult = {}, onError = {}
+        )
         assertAwait(taskIsRunning)
         assertAwait(taskIsRunning)
         t.cancel()
         t.cancel()
         taskIsCancelled.countDown()
         taskIsCancelled.countDown()
@@ -124,11 +133,14 @@ class ThreadPoolAsyncRunnerTest {
     fun `cancelled task does not return error`() {
     fun `cancelled task does not return error`() {
         val taskIsCancelled = CountDownLatch(INIT_COUNT)
         val taskIsCancelled = CountDownLatch(INIT_COUNT)
         val taskIsRunning = CountDownLatch(INIT_COUNT)
         val taskIsRunning = CountDownLatch(INIT_COUNT)
-        val t = r.post({
-            taskIsRunning.countDown()
-            taskIsCancelled.await()
-            throw IllegalStateException("whatever")
-        }, onResult = {}, onError = {})
+        val t = r.post(
+            {
+                taskIsRunning.countDown()
+                taskIsCancelled.await()
+                throw IllegalStateException("whatever")
+            },
+            onResult = {}, onError = {}
+        )
         assertAwait(taskIsRunning)
         assertAwait(taskIsRunning)
         t.cancel()
         t.cancel()
         taskIsCancelled.countDown()
         taskIsCancelled.countDown()

+ 2 - 1
src/test/java/com/nextcloud/client/logger/LogEntryTest.kt

@@ -92,7 +92,8 @@ class LogEntryTest {
             val entry = LogEntry(
             val entry = LogEntry(
                 timestamp = Date(0),
                 timestamp = Date(0),
                 level = Level.DEBUG,
                 level = Level.DEBUG,
-                tag = """靖康緗素雜記""",
+                tag =
+                    """靖康緗素雜記""",
                 message = "夏炉冬扇"
                 message = "夏炉冬扇"
             )
             )
             assertEquals("1970-01-01T00:00:00.000Z;D;靖康緗素雜記;夏炉冬扇", entry.toString())
             assertEquals("1970-01-01T00:00:00.000Z;D;靖康緗素雜記;夏炉冬扇", entry.toString())

+ 11 - 6
src/test/java/com/nextcloud/client/logger/LoggerTest.kt

@@ -146,9 +146,11 @@ class LoggerTest {
         assertTrue("Expected open(), write() and close() calls on bg thread", called)
         assertTrue("Expected open(), write() and close() calls on bg thread", called)
         val inOrder = inOrder(logHandler)
         val inOrder = inOrder(logHandler)
         inOrder.verify(logHandler).open()
         inOrder.verify(logHandler).open()
-        inOrder.verify(logHandler).write(argThat {
-            tag in this && message in this
-        })
+        inOrder.verify(logHandler).write(
+            argThat {
+                tag in this && message in this
+            }
+        )
         inOrder.verify(logHandler).close()
         inOrder.verify(logHandler).close()
         assertFalse(logger.lostEntries)
         assertFalse(logger.lostEntries)
     }
     }
@@ -258,9 +260,12 @@ class LoggerTest {
         logger.load(listener)
         logger.load(listener)
         assertTrue("Logs not loaded", posted.await(1, TimeUnit.SECONDS))
         assertTrue("Logs not loaded", posted.await(1, TimeUnit.SECONDS))
 
 
-        verify(listener).invoke(argThat {
-            "Logger queue overflow" in last().message
-        }, any())
+        verify(listener).invoke(
+            argThat {
+                "Logger queue overflow" in last().message
+            },
+            any()
+        )
     }
     }
 
 
     @Test
     @Test

+ 4 - 2
src/test/java/com/nextcloud/client/logger/ui/LogsViewModelTest.kt

@@ -236,9 +236,11 @@ class LogsViewModelTest {
 
 
             assertEquals("Status should contain size in kB", TEST_LOG_SIZE_KILOBYTES, statusArgs[1])
             assertEquals("Status should contain size in kB", TEST_LOG_SIZE_KILOBYTES, statusArgs[1])
             assertEquals("Status should show matched entries count", vm.entries.value?.size, statusArgs[2])
             assertEquals("Status should show matched entries count", vm.entries.value?.size, statusArgs[2])
-            assertEquals("Status should contain total entries count",
+            assertEquals(
+                "Status should contain total entries count",
                 TEST_LOG_ENTRIES.size,
                 TEST_LOG_ENTRIES.size,
-                statusArgs[TOTAL_ENTRY_COUNT])
+                statusArgs[TOTAL_ENTRY_COUNT]
+            )
             assertTrue("Status should contain query time in ms", statusArgs[QUERY_TIME] is Long)
             assertTrue("Status should contain query time in ms", statusArgs[QUERY_TIME] is Long)
         }
         }
     }
     }

+ 14 - 7
src/test/java/com/nextcloud/client/network/ConnectivityServiceTest.kt

@@ -191,14 +191,18 @@ class ConnectivityServiceTest {
             whenever(networkInfo.isConnectedOrConnecting).thenReturn(true)
             whenever(networkInfo.isConnectedOrConnecting).thenReturn(true)
             whenever(networkInfo.type).thenReturn(ConnectivityManager.TYPE_WIFI)
             whenever(networkInfo.type).thenReturn(ConnectivityManager.TYPE_WIFI)
             whenever(user.server).thenReturn(legacyServer)
             whenever(user.server).thenReturn(legacyServer)
-            assertTrue("Precondition failed", connectivityService.connectivity.let {
-                it.isConnected && it.isWifi
-            })
+            assertTrue(
+                "Precondition failed",
+                connectivityService.connectivity.let {
+                    it.isConnected && it.isWifi
+                }
+            )
         }
         }
 
 
         fun mockResponse(maintenance: Boolean = true, httpStatus: Int = HttpStatus.SC_OK) {
         fun mockResponse(maintenance: Boolean = true, httpStatus: Int = HttpStatus.SC_OK) {
             whenever(client.executeMethod(getRequest)).thenReturn(httpStatus)
             whenever(client.executeMethod(getRequest)).thenReturn(httpStatus)
-            val body = """{"maintenance":$maintenance}"""
+            val body =
+                """{"maintenance":$maintenance}"""
             whenever(getRequest.responseContentLength).thenReturn(body.length.toLong())
             whenever(getRequest.responseContentLength).thenReturn(body.length.toLong())
             whenever(getRequest.responseBodyAsString).thenReturn(body)
             whenever(getRequest.responseBodyAsString).thenReturn(body)
         }
         }
@@ -238,9 +242,12 @@ class ConnectivityServiceTest {
             whenever(networkInfo.isConnectedOrConnecting).thenReturn(true)
             whenever(networkInfo.isConnectedOrConnecting).thenReturn(true)
             whenever(networkInfo.type).thenReturn(ConnectivityManager.TYPE_WIFI)
             whenever(networkInfo.type).thenReturn(ConnectivityManager.TYPE_WIFI)
             whenever(accountManager.getServerVersion(any())).thenReturn(OwnCloudVersion.nextcloud_14)
             whenever(accountManager.getServerVersion(any())).thenReturn(OwnCloudVersion.nextcloud_14)
-            assertTrue("Precondition failed", connectivityService.connectivity.let {
-                it.isConnected && it.isWifi
-            })
+            assertTrue(
+                "Precondition failed",
+                connectivityService.connectivity.let {
+                    it.isConnected && it.isWifi
+                }
+            )
         }
         }
 
 
         @Test
         @Test

+ 28 - 14
src/test/java/com/nextcloud/client/utils/FileStorageUtilsTest.kt

@@ -36,12 +36,14 @@ class FileStorageUtilsTest {
         val subFolderByDate = false
         val subFolderByDate = false
         val dateTaken = 123123123L
         val dateTaken = 123123123L
 
 
-        val result = FileStorageUtils.getInstantUploadFilePath(file,
+        val result = FileStorageUtils.getInstantUploadFilePath(
+            file,
             Locale.ROOT,
             Locale.ROOT,
             syncedFolderRemotePath,
             syncedFolderRemotePath,
             syncedFolderLocalPath,
             syncedFolderLocalPath,
             dateTaken,
             dateTaken,
-            subFolderByDate)
+            subFolderByDate
+        )
         val expected = "/Camera/subfolder/file.jpg"
         val expected = "/Camera/subfolder/file.jpg"
 
 
         assertEquals(expected, result)
         assertEquals(expected, result)
@@ -55,12 +57,14 @@ class FileStorageUtilsTest {
         val subFolderByDate = false
         val subFolderByDate = false
         val dateTaken = 123123123L
         val dateTaken = 123123123L
 
 
-        val result = FileStorageUtils.getInstantUploadFilePath(file,
+        val result = FileStorageUtils.getInstantUploadFilePath(
+            file,
             Locale.ROOT,
             Locale.ROOT,
             syncedFolderRemotePath,
             syncedFolderRemotePath,
             syncedFolderLocalPath,
             syncedFolderLocalPath,
             dateTaken,
             dateTaken,
-            subFolderByDate)
+            subFolderByDate
+        )
         val expected = "/Camera/file.jpg"
         val expected = "/Camera/file.jpg"
 
 
         assertEquals(expected, result)
         assertEquals(expected, result)
@@ -74,12 +78,14 @@ class FileStorageUtilsTest {
         val subFolderByDate = true
         val subFolderByDate = true
         val dateTaken = 0L
         val dateTaken = 0L
 
 
-        val result = FileStorageUtils.getInstantUploadFilePath(file,
+        val result = FileStorageUtils.getInstantUploadFilePath(
+            file,
             Locale.ROOT,
             Locale.ROOT,
             syncedFolderRemotePath,
             syncedFolderRemotePath,
             syncedFolderLocalPath,
             syncedFolderLocalPath,
             dateTaken,
             dateTaken,
-            subFolderByDate)
+            subFolderByDate
+        )
         val expected = "/Camera/file.jpg"
         val expected = "/Camera/file.jpg"
 
 
         assertEquals(expected, result)
         assertEquals(expected, result)
@@ -93,12 +99,14 @@ class FileStorageUtilsTest {
         val subFolderByDate = false
         val subFolderByDate = false
         val dateTaken = 123123123L
         val dateTaken = 123123123L
 
 
-        val result = FileStorageUtils.getInstantUploadFilePath(file,
+        val result = FileStorageUtils.getInstantUploadFilePath(
+            file,
             Locale.ROOT,
             Locale.ROOT,
             syncedFolderRemotePath,
             syncedFolderRemotePath,
             syncedFolderLocalPath,
             syncedFolderLocalPath,
             dateTaken,
             dateTaken,
-            subFolderByDate)
+            subFolderByDate
+        )
         val expected = "/Camera/file.jpg"
         val expected = "/Camera/file.jpg"
 
 
         assertEquals(expected, result)
         assertEquals(expected, result)
@@ -112,12 +120,14 @@ class FileStorageUtilsTest {
         val subFolderByDate = true
         val subFolderByDate = true
         val dateTaken = 1569918628000L
         val dateTaken = 1569918628000L
 
 
-        val result = FileStorageUtils.getInstantUploadFilePath(file,
+        val result = FileStorageUtils.getInstantUploadFilePath(
+            file,
             Locale.ROOT,
             Locale.ROOT,
             syncedFolderRemotePath,
             syncedFolderRemotePath,
             syncedFolderLocalPath,
             syncedFolderLocalPath,
             dateTaken,
             dateTaken,
-            subFolderByDate)
+            subFolderByDate
+        )
         val expected = "/Camera/2019/10/file.jpg"
         val expected = "/Camera/2019/10/file.jpg"
 
 
         assertEquals(expected, result)
         assertEquals(expected, result)
@@ -131,12 +141,14 @@ class FileStorageUtilsTest {
         val subFolderByDate = false
         val subFolderByDate = false
         val dateTaken = 123123123L
         val dateTaken = 123123123L
 
 
-        val result = FileStorageUtils.getInstantUploadFilePath(file,
+        val result = FileStorageUtils.getInstantUploadFilePath(
+            file,
             Locale.ROOT,
             Locale.ROOT,
             syncedFolderRemotePath,
             syncedFolderRemotePath,
             syncedFolderLocalPath,
             syncedFolderLocalPath,
             dateTaken,
             dateTaken,
-            subFolderByDate)
+            subFolderByDate
+        )
         val expected = "/Camera/subfolder/file.jpg"
         val expected = "/Camera/subfolder/file.jpg"
 
 
         assertEquals(expected, result)
         assertEquals(expected, result)
@@ -150,12 +162,14 @@ class FileStorageUtilsTest {
         val subFolderByDate = true
         val subFolderByDate = true
         val dateTaken = 1569918628000L
         val dateTaken = 1569918628000L
 
 
-        val result = FileStorageUtils.getInstantUploadFilePath(file,
+        val result = FileStorageUtils.getInstantUploadFilePath(
+            file,
             Locale.ROOT,
             Locale.ROOT,
             syncedFolderRemotePath,
             syncedFolderRemotePath,
             syncedFolderLocalPath,
             syncedFolderLocalPath,
             dateTaken,
             dateTaken,
-            subFolderByDate)
+            subFolderByDate
+        )
         val expected = "/Camera/2019/10/subfolder/file.jpg"
         val expected = "/Camera/2019/10/subfolder/file.jpg"
 
 
         assertEquals(expected, result)
         assertEquals(expected, result)