Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2023-01-04 11:28:43 +01:00 committed by Andy Scherzinger
parent f1e10f7479
commit ac9d96d3ba
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 3 additions and 10 deletions

View file

@ -44,7 +44,6 @@ import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.components.filebrowser.models.BrowserFile
import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation
import com.nextcloud.talk.data.user.model.User
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
@ -56,6 +55,7 @@ import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.DrawableUtils.getDrawableResourceIdForMimeType
import com.nextcloud.talk.utils.FileViewerUtils
import com.nextcloud.talk.utils.FileViewerUtils.ProgressUi
import com.owncloud.android.lib.resources.files.model.RemoteFile
import com.stfalcon.chatkit.messages.MessageHolders.IncomingImageMessageViewHolder
import io.reactivex.Single
import io.reactivex.SingleObserver
@ -287,7 +287,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
override fun onSuccess(readFilesystemOperation: ReadFilesystemOperation) {
val davResponse = readFilesystemOperation.readRemotePath()
if (davResponse.data != null) {
val browserFileList = davResponse.data as List<BrowserFile>
val browserFileList = davResponse.data as List<RemoteFile>
if (browserFileList.isNotEmpty()) {
Handler(context!!.mainLooper).post {
val resourceId = getDrawableResourceIdForMimeType(browserFileList[0].mimeType)

View file

@ -23,7 +23,6 @@ package com.nextcloud.talk.components.filebrowser.webdav;
import android.net.Uri;
import android.util.Log;
import com.nextcloud.talk.components.filebrowser.models.BrowserFile;
import com.nextcloud.talk.components.filebrowser.models.DavResponse;
import com.nextcloud.talk.dagger.modules.RestModule;
import com.nextcloud.talk.data.user.model.User;
@ -73,8 +72,6 @@ public class ReadFilesystemOperation {
DavResponse davResponse = new DavResponse();
final List<Response> memberElements = new ArrayList<>();
final Response[] rootElement = new Response[1];
final List<BrowserFile> browserFiles = new ArrayList<>();
final List<RemoteFile> remoteFiles = new ArrayList<>();
try {
new DavResource(okHttpClient, HttpUrl.parse(url)).propfind(depth,
@ -101,16 +98,12 @@ public class ReadFilesystemOperation {
WebDavFileUtils webDavFileUtils = new WebDavFileUtils();
browserFiles.add(BrowserFile.Companion.getModelFromResponse(rootElement[0],
rootElement[0].getHref().toString().substring(basePath.length())));
final List<RemoteFile> remoteFiles = new ArrayList<>(1 + memberElements.size());
remoteFiles.add(webDavFileUtils.parseResponse(rootElement[0],
Uri.parse(basePath)));
for (Response memberElement : memberElements) {
browserFiles.add(BrowserFile.Companion.getModelFromResponse(memberElement,
memberElement.getHref().toString().substring(basePath.length())));
remoteFiles.add(webDavFileUtils.parseResponse(memberElement,
Uri.parse(basePath)));
}