@@ -2544,7 +2544,7 @@ class FileDisplayActivity :
25442544 fun startSyncFolderOperation (folder : OCFile ? , ignoreETag : Boolean , ignoreFocus : Boolean = false) {
25452545 Log_OC .d(TAG , " startSyncFolderOperation called, ignoreEtag: $ignoreETag , ignoreFocus: $ignoreFocus " )
25462546
2547- if (! TextUtils .isEmpty(searchQuery ) || ! user.isPresent) {
2547+ if (! searchQuery.isNullOrEmpty( ) || ! user.isPresent) {
25482548 return
25492549 }
25502550
@@ -2575,30 +2575,29 @@ class FileDisplayActivity :
25752575 }
25762576
25772577 private fun executeSyncFolderOperation (folder : OCFile ? , ignoreETag : Boolean ) {
2578- val user = getUser()
2579- if (! user.isPresent) {
2580- return
2581- }
2578+ val folder = folder ? : return
25822579
2583- syncState = EmptyListState .LOADING
2584-
2585- RefreshFolderOperation (
2586- folder,
2587- System .currentTimeMillis(),
2588- false ,
2589- ignoreETag,
2590- storageManager,
2591- user.get(),
2592- applicationContext
2593- ).execute(
2594- account,
2595- MainApp .getAppContext(),
2596- { _, _ -> onSyncFinished() },
2597- handler,
2598- null
2599- )
2580+ user.ifPresent { user ->
2581+ syncState = EmptyListState .LOADING
2582+
2583+ RefreshFolderOperation (
2584+ folder,
2585+ System .currentTimeMillis(),
2586+ false ,
2587+ ignoreETag,
2588+ storageManager,
2589+ user,
2590+ applicationContext
2591+ ).execute(
2592+ account,
2593+ this ,
2594+ { _, _ -> onSyncFinished() },
2595+ handler,
2596+ null
2597+ )
26002598
2601- fetchRecommendedFilesIfNeeded(ignoreETag, folder)
2599+ fetchRecommendedFilesIfNeeded(ignoreETag, folder)
2600+ }
26022601 }
26032602
26042603 private fun fetchRecommendedFilesIfNeeded (ignoreETag : Boolean , folder : OCFile ? ) {
@@ -2611,8 +2610,8 @@ class FileDisplayActivity :
26112610 return
26122611 }
26132612
2614- if ( user.isPresent) {
2615- val accountName = user.get(). accountName
2613+ user.ifPresent { user ->
2614+ val accountName = user.accountName
26162615 val fragment = this .listOfFilesFragment
26172616 lifecycleScope.launch(Dispatchers .IO ) {
26182617 val recommendedFiles = filesRepository.fetchRecommendedFiles(accountName, ignoreETag, storageManager)
0 commit comments