From e4571be0ed909b1afcbc6745b9846043bb5f785b Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Tue, 26 Sep 2023 15:30:10 +0200 Subject: [PATCH] fix endless loop when opening urls and files app is not installed. Without this fix, the ChatActivity would be started again in FileViewerUtils. There was an endless loop between ChatActivity and FileViewerUtils because of the wrong context. Instead to open the browser, the app did nothing or freezed. Signed-off-by: Marcel Hibbe --- app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 88dbb53bdf..10dbe069be 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -2668,15 +2668,15 @@ class ChatActivity : if (uri.startsWith(user.baseUrl!!)) { if (UriUtils.isInstanceInternalFileShareUrl(user.baseUrl!!, uri)) { // https://cloud.nextcloud.com/f/41 - val fileViewerUtils = FileViewerUtils(this, user) + val fileViewerUtils = FileViewerUtils(applicationContext, user) fileViewerUtils.openFileInFilesApp(uri, UriUtils.extractInstanceInternalFileShareFileId(uri)) } else if (UriUtils.isInstanceInternalFileUrl(user.baseUrl!!, uri)) { // https://cloud.nextcloud.com/apps/files/?dir=/Engineering&fileid=41 - val fileViewerUtils = FileViewerUtils(this, user) + val fileViewerUtils = FileViewerUtils(applicationContext, user) fileViewerUtils.openFileInFilesApp(uri, UriUtils.extractInstanceInternalFileFileId(uri)) } else if (UriUtils.isInstanceInternalFileUrlNew(user.baseUrl!!, uri)) { // https://cloud.nextcloud.com/apps/files/?dir=/Engineering&fileid=41 - val fileViewerUtils = FileViewerUtils(this, user) + val fileViewerUtils = FileViewerUtils(applicationContext, user) fileViewerUtils.openFileInFilesApp(uri, UriUtils.extractInstanceInternalFileFileIdNew(uri)) } else { super.startActivity(intent)