Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky authored and AndyScherzinger committed Mar 28, 2023
1 parent 3d4df5b commit adeb988
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import com.google.android.material.card.MaterialCardView
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
Expand All @@ -61,6 +60,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
Expand Down Expand Up @@ -318,7 +318,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;
Expand Down Expand Up @@ -73,8 +72,6 @@ public DavResponse readRemotePath() {
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,
Expand All @@ -101,16 +98,12 @@ public void onResponse(@NonNull Response response, @NonNull Response.HrefRelatio

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)));
}
Expand Down

0 comments on commit adeb988

Please sign in to comment.