Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1657,10 +1657,15 @@ class FileDisplayActivity :
RemoteOperationResult.ResultCode.NO_NETWORK_CONNECTION -> showInfoBox(R.string.offline_mode)
RemoteOperationResult.ResultCode.HOST_NOT_AVAILABLE -> showInfoBox(R.string.host_not_available)
RemoteOperationResult.ResultCode.SIGNING_TOS_NEEDED -> showTermsOfServiceDialog()
RemoteOperationResult.ResultCode.OUT_OF_MEMORY -> showOutOfMemoryEmptyListState()
else -> {}
}
}

private fun showOutOfMemoryEmptyListState() {
listOfFilesFragment?.setEmptyListMessage(EmptyListState.OUT_OF_MEMORY)
}

private fun showTermsOfServiceDialog() {
if (supportFragmentManager.findFragmentByTag(DIALOG_TAG_SHOW_TOS) == null) {
TermsOfServiceDialog().show(supportFragmentManager, DIALOG_TAG_SHOW_TOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ open class FolderPickerActivity :
"Detekt.LongMethod"
) // legacy code
override fun onReceive(context: Context, intent: Intent) {
var emptyListState = EmptyListState.LOCAL_FILE_LIST_EMPTY_FILE

try {
val event = intent.action
Log_OC.d(TAG, "Received broadcast $event")
Expand All @@ -569,6 +571,10 @@ open class FolderPickerActivity :
return
}

if (ResultCode.OUT_OF_MEMORY == syncResult.code) {
emptyListState = EmptyListState.OUT_OF_MEMORY
}

if (FileSyncAdapter.EVENT_FULL_SYNC_START != event) {
var (currentFile, currentDir) = getCurrentFileAndDirectory()

Expand All @@ -595,7 +601,7 @@ open class FolderPickerActivity :
// in owncloud library with broadcast notifications pending to process
DataHolderUtil.getInstance().delete(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT))
} finally {
listOfFilesFragment?.setEmptyListMessage(EmptyListState.LOCAL_FILE_LIST_EMPTY_FILE)
listOfFilesFragment?.setEmptyListMessage(emptyListState)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GallerySearchTask(
val result = performSearch(context)

withContext(Dispatchers.Main) {
fragment.searchCompleted(result.emptySearch, result.lastTimestamp)
fragment.searchCompleted(result)
}
}

Expand All @@ -62,7 +62,7 @@ class GallerySearchTask(
return if (operationResult.isSuccess) {
handleSuccess(operationResult)
} else {
Result(false, false, NO_TIMESTAMP)
Result(operationResult.code, false, NO_TIMESTAMP)
}
}

Expand Down Expand Up @@ -90,7 +90,7 @@ class GallerySearchTask(
val remoteFiles = operationResult.data.filterIsInstance<RemoteFile>()
val lastTimestamp = findLastTimestamp(remoteFiles)
val emptySearch = parseMedia(lastTimestamp, endDate, remoteFiles)
return Result(true, emptySearch, lastTimestamp)
return Result(operationResult.code, emptySearch, lastTimestamp)
}

private fun findLastTimestamp(remoteFiles: List<RemoteFile>): Long =
Expand Down Expand Up @@ -186,5 +186,9 @@ class GallerySearchTask(
)
}

data class Result(val success: Boolean, val emptySearch: Boolean, val lastTimestamp: Long)
data class Result(
val resultCode: RemoteOperationResult.ResultCode,
val emptySearch: Boolean,
val lastTimestamp: Long
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,15 @@ open class ExtendedListFragment :
)
}

EmptyListState.OUT_OF_MEMORY -> {
setMessageForEmptyList(
R.string.common_error_out_memory,
R.string.file_list_out_of_memory_description,
R.drawable.ic_list_empty_error,
false
)
}

else -> {
setMessageForEmptyList(
R.string.file_list_empty_headline,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import com.owncloud.android.BuildConfig
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.datamodel.ThumbnailsCacheManager
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.ui.EmptyRecyclerView
import com.owncloud.android.ui.activity.FileDisplayActivity
Expand Down Expand Up @@ -264,20 +265,25 @@ class GalleryFragment :
}
}

fun searchCompleted(emptySearch: Boolean, lastTimeStamp: Long) {
fun searchCompleted(result: GallerySearchTask.Result) {
if (!isAdded) return

this.isPhotoSearchQueryRunning = false

if (lastTimeStamp > -1) {
endDate = lastTimeStamp
if (result.resultCode == RemoteOperationResult.ResultCode.OUT_OF_MEMORY) {
setEmptyListMessage(EmptyListState.OUT_OF_MEMORY)
return
}

if (result.lastTimestamp > -1) {
endDate = result.lastTimestamp
}

if (adapter?.isEmpty() == true) {
setEmptyListMessage(SearchType.GALLERY_SEARCH)
}

if (!emptySearch) {
if (!result.emptySearch) {
showAllGalleryItems()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ class OCFileListSearchTask(
updateAdapterData(fragment, cachedFiles)
}

val result = fetchRemoteResults()?.takeIf { it.isSuccess } ?: run {
showSnackbarError(fragment)
val result = fetchRemoteResults()
if (result == null || !result.isSuccess) {
showError(fragment, result)
return@launch
}

Expand All @@ -89,6 +90,15 @@ class OCFileListSearchTask(
}
}

private suspend fun showError(fragment: OCFileListFragment, result: RemoteOperationResult<List<Any>>?) {
if (result?.code == RemoteOperationResult.ResultCode.OUT_OF_MEMORY) {
withContext(Dispatchers.Main) { fragment.setEmptyListMessage(EmptyListState.OUT_OF_MEMORY) }
return
}

showSnackbarError(fragment)
}

private suspend fun showSnackbarError(fragment: OCFileListFragment) {
withContext(Dispatchers.Main) {
fragment.activity?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ enum class EmptyListState : Parcelable {
ONLY_ON_DEVICE,
LOCAL_FILE_LIST_EMPTY_FILE,
LOCAL_FILE_LIST_EMPTY_FOLDER,
ERROR
ERROR,
OUT_OF_MEMORY
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
package com.owncloud.android.ui.trashbin

import android.os.AsyncTask
import androidx.annotation.StringRes
import com.nextcloud.client.account.User
import com.nextcloud.client.network.ClientFactory
import com.nextcloud.client.network.ClientFactory.CreationException
import com.owncloud.android.R
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.lib.resources.trashbin.EmptyTrashbinRemoteOperation
import com.owncloud.android.lib.resources.trashbin.ReadTrashbinFolderRemoteOperation
Expand Down Expand Up @@ -131,6 +133,9 @@ class RemoteTrashbinRepository internal constructor(private val user: User, priv
) : AsyncTask<Void?, Void?, Boolean>() {
private var trashbinFiles: List<TrashbinFile?>? = null

@StringRes
private var errorMessage: Int = R.string.trashbin_loading_failed

@Deprecated("Deprecated in Java")
override fun doInBackground(vararg voids: Void?): Boolean = try {
val client = clientFactory.create(user)
Expand All @@ -139,6 +144,9 @@ class RemoteTrashbinRepository internal constructor(private val user: User, priv
trashbinFiles = result.resultData
true
} else {
if (result.code == ResultCode.OUT_OF_MEMORY) {
errorMessage = R.string.file_list_out_of_memory_description
}
false
}
} catch (e: CreationException) {
Expand All @@ -152,7 +160,7 @@ class RemoteTrashbinRepository internal constructor(private val user: User, priv
if (success) {
callback.onSuccess(trashbinFiles)
} else {
callback.onError(R.string.trashbin_loading_failed)
callback.onError(errorMessage)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string name="bottom_navigation_menu_media_label">Media</string>
<string name="file_list_error_headline">Poor connection</string>
<string name="file_list_error_description">Check your internet connection or try again later</string>
<string name="file_list_out_of_memory_description">Could not able to load content</string>
<string name="about_android">%1$s Android app</string>
<string name="about_version">version %1$s</string>
<string name="about_version_with_build">version %1$s, build #%2$s</string>
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
androidCommonLibraryVersion = "0.33.2"
androidGifDrawableVersion = "1.2.32"
androidImageCropperVersion = "4.7.0"
androidLibraryVersion ="c28feb04383aa123629222ecb702c3f428b225d9"
androidLibraryVersion ="fca2fdfc6c"
androidOpensslVersion = "3.5.6"
androidPluginVersion = "9.3.1"
androidsvgVersion = "1.4"
Expand Down
8 changes: 8 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22338,6 +22338,14 @@
<sha256 value="b1a8e2a1443ab5079faf569baeb4c4e98db835d0f3719b841c60b2583687ee17" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="fca2fdfc6c">
<artifact name="android-library-fca2fdfc6c.aar">
<sha256 value="724a358a0a669c810ec2778850a30ed1e01df56029c6859f6d8279830e4dba66" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="android-library-fca2fdfc6c.module">
<sha256 value="6c89f764e480b9ca139fb8f9fb259fc5ce7a02c2b2e2a274ff266b2c6621f7ee" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="fcb36db7ba">
<artifact name="android-library-fcb36db7ba.aar">
<sha256 value="2bae1a11ea687d92fcf6a76a52f4c20ee338e710d2281ce4cd8cae5d1e108151" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down
Loading