From 75d82185c18943d4a2e35fbcb71d594820033cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Kr=C3=BCger?= Date: Wed, 14 Jul 2021 09:26:17 +0200 Subject: [PATCH 1/7] Remove media in text message detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The method 'TextMatchers#getMessageTypeFromString' suggested MIME types for linked files in text message. Also for links like this not working example: - http://example.local/image.png - image.png In those cases no image can be loaded and that results in empty previews like shown in the issue #1167. So for alignment reasons to spreed and Talk iOS app this media detection is removed and only links will be shown. Resolves: #1167 Signed-off-by: Tim Krüger --- .../java/com/nextcloud/talk/models/json/chat/ChatMessage.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java index 41c5c48c3..700db89ed 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java @@ -2,6 +2,8 @@ * Nextcloud Talk application * * @author Mario Danic + * @author Tim Krüger + * Copyright (C) 2021 Tim Krüger * Copyright (C) 2017-2018 Mario Danic * * This program is free software: you can redistribute it and/or modify @@ -180,7 +182,7 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image } - return TextMatchers.getMessageTypeFromString(getText()); + return MessageType.REGULAR_TEXT_MESSAGE; } public Map getSelectedIndividualHashMap() { From 62f73aee05438cabab14cf456e601f2b5872f355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Kr=C3=BCger?= Date: Wed, 14 Jul 2021 09:49:06 +0200 Subject: [PATCH 2/7] Remove unused method and dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See: commit 4c4c5839, #1167 Signed-off-by: Tim Krüger --- app/build.gradle | 4 - .../nextcloud/talk/utils/TextMatchers.java | 62 +--------- .../talk/utils/TextMatchersTest.java | 109 ------------------ 3 files changed, 3 insertions(+), 172 deletions(-) delete mode 100644 app/src/test/java/com/nextcloud/talk/utils/TextMatchersTest.java diff --git a/app/build.gradle b/app/build.gradle index 1e8fe8a1e..9286fc31f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -269,10 +269,6 @@ dependencies { implementation 'com.github.nextcloud:PopupBubble:1.0.6' implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' - implementation('eu.medsea.mimeutil:mime-util:2.1.3', { - exclude group: 'org.slf4j' - }) - implementation "com.afollestad.material-dialogs:core:${materialDialogsVersion}" implementation "com.afollestad.material-dialogs:datetime:${materialDialogsVersion}" implementation "com.afollestad.material-dialogs:bottomsheets:${materialDialogsVersion}" diff --git a/app/src/main/java/com/nextcloud/talk/utils/TextMatchers.java b/app/src/main/java/com/nextcloud/talk/utils/TextMatchers.java index 3988f6e31..25fda04e9 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/TextMatchers.java +++ b/app/src/main/java/com/nextcloud/talk/utils/TextMatchers.java @@ -2,6 +2,8 @@ * Nextcloud Talk application * * @author Mario Danic + * @author Tim Krüger + * Copyright (C) 2021 Tim Krüger * Copyright (C) 2017-2018 Mario Danic * * This program is free software: you can redistribute it and/or modify @@ -22,71 +24,13 @@ package com.nextcloud.talk.utils; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.util.PatternsCompat; -import com.nextcloud.talk.models.json.chat.ChatMessage; import com.vanniktech.emoji.EmojiInformation; import com.vanniktech.emoji.EmojiUtils; -import eu.medsea.mimeutil.MimeUtil; -import eu.medsea.mimeutil.detector.ExtensionMimeDetector; -import eu.medsea.mimeutil.detector.MagicMimeMimeDetector; -import eu.medsea.mimeutil.detector.OpendesktopMimeDetector; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import androidx.annotation.Nullable; public final class TextMatchers { - private static final String TAG = "TextMatchers"; - - public static ChatMessage.MessageType getMessageTypeFromString(@NonNull final String text) { - List links = new ArrayList<>(); - Matcher m = PatternsCompat.WEB_URL.matcher(text); - while (m.find()) { - String url = m.group(); - links.add(url); - } - - if (links.size() == 1 && text.trim().length() == links.get(0).length()) { - String specialLink = links.get(0); - if (specialLink.startsWith("https://media.giphy.com/") && specialLink.endsWith(".gif")) { - return ChatMessage.MessageType.SINGLE_LINK_GIPHY_MESSAGE; - } else if (specialLink.contains("tenor.com/") && - Pattern.compile("https://media.*\\.tenor\\.com.*\\.gif.*", - Pattern.CASE_INSENSITIVE).matcher(specialLink).matches()) { - return ChatMessage.MessageType.SINGLE_LINK_TENOR_MESSAGE; - } else { - if (specialLink.contains("?")) { - specialLink = specialLink.substring(0, specialLink.indexOf("?")); - } - MimeUtil.registerMimeDetector(MagicMimeMimeDetector.class.getName()); - MimeUtil.registerMimeDetector(ExtensionMimeDetector.class.getName()); - MimeUtil.registerMimeDetector(OpendesktopMimeDetector.class.getName()); - - String mimeType = MimeUtil.getMostSpecificMimeType(MimeUtil.getMimeTypes(specialLink)).toString(); - if (mimeType.startsWith("image/")) { - if (mimeType.equalsIgnoreCase("image/gif")) { - return ChatMessage.MessageType.SINGLE_LINK_GIF_MESSAGE; - } else { - return ChatMessage.MessageType.SINGLE_LINK_IMAGE_MESSAGE; - } - } else if (mimeType.startsWith("video/")) { - return ChatMessage.MessageType.SINGLE_LINK_VIDEO_MESSAGE; - } else if (mimeType.startsWith("audio/")) { - return ChatMessage.MessageType.SINGLE_LINK_AUDIO_MESSAGE; - } - - return ChatMessage.MessageType.SINGLE_LINK_MESSAGE; - } - } - - // if we have 0 or more than 1 link, we're a regular message - return ChatMessage.MessageType.REGULAR_TEXT_MESSAGE; - } - public static boolean isMessageWithSingleEmoticonOnly(@Nullable final String text) { final EmojiInformation emojiInformation = EmojiUtils.emojiInformation(text); return (emojiInformation.isOnlyEmojis && emojiInformation.emojis.size() == 1); diff --git a/app/src/test/java/com/nextcloud/talk/utils/TextMatchersTest.java b/app/src/test/java/com/nextcloud/talk/utils/TextMatchersTest.java deleted file mode 100644 index fb295f317..000000000 --- a/app/src/test/java/com/nextcloud/talk/utils/TextMatchersTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.nextcloud.talk.utils; - -import com.nextcloud.talk.models.json.chat.ChatMessage; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class TextMatchersTest { - - @Test - public void getMessageTypeFromString_regularTextGiven_regularTextMessageTypeReturned() { - String simpleMessageText = "Hello world! Have a cookie!"; - String messageContainingLink = "Hello https://nextcloud.com! Have a good day"; - - assertEquals(ChatMessage.MessageType.REGULAR_TEXT_MESSAGE, - TextMatchers.getMessageTypeFromString(simpleMessageText)); - assertEquals(ChatMessage.MessageType.REGULAR_TEXT_MESSAGE, - TextMatchers.getMessageTypeFromString(messageContainingLink)); - } - - @Test - public void getMessageTypeFromString_singleUrlTextGiven_singleLinkMessageTypeReturned() { - String simpleUrlText = "https://nextcloud.com/"; - String complexUrlText = "https://docs.nextcloud.com/server/15/admin_manual/#target-audience"; - - assertEquals(ChatMessage.MessageType.SINGLE_LINK_MESSAGE, - TextMatchers.getMessageTypeFromString(simpleUrlText)); - assertEquals(ChatMessage.MessageType.SINGLE_LINK_MESSAGE, - TextMatchers.getMessageTypeFromString(complexUrlText)); - } - - @Test - public void getMessageTypeFromString_imageLinkGiven_singleLinkImageMessageReturned() { - String simpleImageText = "https://nextcloud.com/image.jpg"; - String complexImageUrlText = "https://nextcloud.com/wp-content/themes/next/assets/img/features/mobileDesktop.png?x22777"; - - assertEquals(ChatMessage.MessageType.SINGLE_LINK_IMAGE_MESSAGE, - TextMatchers.getMessageTypeFromString(simpleImageText)); - assertEquals(ChatMessage.MessageType.SINGLE_LINK_IMAGE_MESSAGE, - TextMatchers.getMessageTypeFromString(complexImageUrlText)); - } - - @Test - public void getMessageTypeFromString_gifLinkGiven_gifMessageTypeReturned() { - String gifImageText = "https://nextcloud.com/funny.gif"; - - assertEquals(ChatMessage.MessageType.SINGLE_LINK_GIF_MESSAGE, - TextMatchers.getMessageTypeFromString(gifImageText)); - } - - @Test - public void getMessageTypeFromString_audioLinkGiven_audioMessageTypeReturned() { - String wavLink = "https://nextcloud.com/message.wav"; - String mp3Link = "https://nextcloud.com/message.mp3"; - - assertEquals(ChatMessage.MessageType.SINGLE_LINK_AUDIO_MESSAGE, - TextMatchers.getMessageTypeFromString(wavLink)); - assertEquals(ChatMessage.MessageType.SINGLE_LINK_AUDIO_MESSAGE, - TextMatchers.getMessageTypeFromString(mp3Link)); - } - - @Test - public void getMessageTypeFromString_videoLinkGiven_videoMessageTypeReturned() { - String mp4Link = "https://nextcloud.com/message.mp4"; - String flvLink = "https://nextcloud.com/message.flv"; - - assertEquals(ChatMessage.MessageType.SINGLE_LINK_VIDEO_MESSAGE, - TextMatchers.getMessageTypeFromString(mp4Link)); - assertEquals(ChatMessage.MessageType.SINGLE_LINK_VIDEO_MESSAGE, - TextMatchers.getMessageTypeFromString(flvLink)); - } - - @Test - public void getMessageTypeFromString_giphyLinkGiven_giphyMessageTypeReturned() { - String giphyLink = "https://media.giphy.com/media/11fucLQCTOdvBS/giphy.gif"; - - assertEquals(ChatMessage.MessageType.SINGLE_LINK_GIPHY_MESSAGE, - TextMatchers.getMessageTypeFromString(giphyLink)); - } - - @Test - public void getMessageTypeFromString_tenorLinkGiven_tenorMessageTypeReturned() { - String tenorLink = "https://media.tenor.com/images/d98e76e3930cf171cc39e301c9e974af/tenor.gif"; - - assertEquals(ChatMessage.MessageType.SINGLE_LINK_TENOR_MESSAGE, - TextMatchers.getMessageTypeFromString(tenorLink)); - } -} From cbc4c62003082b942829298bc248ff712969c20d Mon Sep 17 00:00:00 2001 From: drone Date: Wed, 14 Jul 2021 08:50:56 +0000 Subject: [PATCH 3/7] Drone: update FindBugs results to reflect reduced error/warning count [skip ci] Signed-off-by: drone --- scripts/analysis/findbugs-results.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analysis/findbugs-results.txt b/scripts/analysis/findbugs-results.txt index e88ff725a..73623d101 100644 --- a/scripts/analysis/findbugs-results.txt +++ b/scripts/analysis/findbugs-results.txt @@ -1 +1 @@ -602 \ No newline at end of file +600 \ No newline at end of file From bd6ac2fa7e72f18b0dc61b4f33804fb0d62b132c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Jul 2021 01:05:42 +0000 Subject: [PATCH 4/7] Bump kotlin-gradle-plugin from 1.5.10 to 1.5.21 Bumps kotlin-gradle-plugin from 1.5.10 to 1.5.21. --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 173273d1d..a3614789b 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ buildscript { ext { - kotlinVersion = '1.5.10' + kotlinVersion = '1.5.21' } repositories { From eac46d9456a7190209d25ce6f5a1da1c4366e84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Kr=C3=BCger?= Date: Wed, 14 Jul 2021 13:43:00 +0200 Subject: [PATCH 5/7] Remove obsolete setting link preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The setting is obsolete since the functionality for media detection in text messages was removed. See: commit 8468535a Signed-off-by: Tim Krüger --- .../talk/controllers/ChatController.kt | 8 ++------ .../talk/controllers/SettingsController.java | 6 +++--- .../talk/models/json/chat/ChatMessage.java | 19 ++----------------- .../utils/preferences/AppPreferences.java | 13 ++----------- .../main/res/layout/controller_settings.xml | 11 ++--------- app/src/main/res/values/strings.xml | 3 --- 6 files changed, 11 insertions(+), 49 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt index 73c61c7d0..f5f8f2a9a 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -4,6 +4,8 @@ * @author Mario Danic * @author Marcel Hibbe * @author Andy Scherzinger + * @author Tim Krüger + * Copyright (C) 2021 Tim Krüger * Copyright (C) 2021 Andy Scherzinger * Copyright (C) 2021 Marcel Hibbe * Copyright (C) 2017-2019 Mario Danic @@ -229,7 +231,6 @@ class ChatController(args: Bundle) : val voiceOnly: Boolean var isFirstMessagesProcessing = true var isLeavingForConversation: Boolean = false - var isLinkPreviewAllowed: Boolean = false var wasDetached: Boolean = false var emojiPopup: EmojiPopup? = null @@ -1363,8 +1364,6 @@ class ChatController(args: Bundle) : ApplicationWideCurrentRoomHolder.getInstance().isInCall = false ApplicationWideCurrentRoomHolder.getInstance().userInRoom = conversationUser - isLinkPreviewAllowed = appPreferences?.areLinkPreviewsAllowed ?: false - val smileyButton = binding.messageInputView.findViewById(R.id.smileyButton) emojiPopup = binding.messageInputView.inputEditText?.let { @@ -1908,7 +1907,6 @@ class ChatController(args: Bundle) : val chatMessage = chatMessageList[i] chatMessage.isOneToOneConversation = currentConversation?.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL - chatMessage.isLinkPreviewAllowed = isLinkPreviewAllowed chatMessage.activeUser = conversationUser } @@ -1937,7 +1935,6 @@ class ChatController(args: Bundle) : chatMessage = chatMessageList[i] chatMessage.activeUser = conversationUser - chatMessage.isLinkPreviewAllowed = isLinkPreviewAllowed val shouldScroll = !isThereANewNotice && @@ -2377,7 +2374,6 @@ class ChatController(args: Bundle) : messageTemp.isOneToOneConversation = currentConversation?.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL - messageTemp.isLinkPreviewAllowed = isLinkPreviewAllowed messageTemp.activeUser = conversationUser adapter?.update(messageTemp) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java index f7ce60575..a0035bdce 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java @@ -3,6 +3,9 @@ * * @author Andy Scherzinger * @author Mario Danic + * @author Tim Krüger + * Copyright (C) 2021 Tim Krüger + * Copyright (C) 2021 Andy Scherzinger * Copyright (C) 2017 Mario Danic (mario@lovelyhq.com) * * This program is free software: you can redistribute it and/or modify @@ -173,8 +176,6 @@ public class SettingsController extends BaseController { MaterialSwitchPreference incognitoKeyboardSwitchPreference; @BindView(R.id.settings_screen_security) MaterialSwitchPreference screenSecuritySwitchPreference; - @BindView(R.id.settings_link_previews) - MaterialSwitchPreference linkPreviewsSwitchPreference; @BindView(R.id.settings_screen_lock) MaterialSwitchPreference screenLockSwitchPreference; @BindView(R.id.settings_screen_lock_timeout) @@ -463,7 +464,6 @@ public class SettingsController extends BaseController { readPrivacyPreference.setVisibility(View.GONE); } - ((Checkable) linkPreviewsSwitchPreference.findViewById(R.id.mp_checkable)).setChecked(appPreferences.getAreLinkPreviewsAllowed()); ((Checkable) phoneBookIntegrationPreference.findViewById(R.id.mp_checkable)).setChecked(appPreferences.isPhoneBookIntegrationEnabled()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { diff --git a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java index 700db89ed..155833ad1 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.java @@ -31,7 +31,6 @@ import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.models.database.UserEntity; import com.nextcloud.talk.models.json.converters.EnumSystemMessageTypeConverter; import com.nextcloud.talk.utils.ApiUtils; -import com.nextcloud.talk.utils.TextMatchers; import com.stfalcon.chatkit.commons.models.IUser; import com.stfalcon.chatkit.commons.models.MessageContentType; @@ -60,8 +59,6 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image @JsonIgnore public Map selectedIndividualHashMap; @JsonIgnore - public boolean isLinkPreviewAllowed; - @JsonIgnore public boolean isDeleted; @JsonField(name = "id") public int jsonMessageId; @@ -157,7 +154,7 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image } } - if (!messageTypesToIgnore.contains(getMessageType()) && isLinkPreviewAllowed) { + if (!messageTypesToIgnore.contains(getMessageType())) { return getMessage().trim(); } @@ -330,10 +327,6 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image return this.activeUser; } - public boolean isLinkPreviewAllowed() { - return this.isLinkPreviewAllowed; - } - public boolean isDeleted() { return this.isDeleted; } @@ -402,10 +395,6 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image this.activeUser = activeUser; } - public void setLinkPreviewAllowed(boolean isLinkPreviewAllowed) { - this.isLinkPreviewAllowed = isLinkPreviewAllowed; - } - public void setDeleted(boolean isDeleted) { this.isDeleted = isDeleted; } @@ -493,9 +482,6 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image if (this$selectedIndividualHashMap == null ? other$selectedIndividualHashMap != null : !this$selectedIndividualHashMap.equals(other$selectedIndividualHashMap)) { return false; } - if (this.isLinkPreviewAllowed() != other.isLinkPreviewAllowed()) { - return false; - } if (this.isDeleted() != other.isDeleted()) { return false; } @@ -572,7 +558,6 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image result = result * PRIME + ($activeUser == null ? 43 : $activeUser.hashCode()); final Object $selectedIndividualHashMap = this.getSelectedIndividualHashMap(); result = result * PRIME + ($selectedIndividualHashMap == null ? 43 : $selectedIndividualHashMap.hashCode()); - result = result * PRIME + (this.isLinkPreviewAllowed() ? 79 : 97); result = result * PRIME + (this.isDeleted() ? 79 : 97); result = result * PRIME + this.getJsonMessageId(); final Object $token = this.getToken(); @@ -602,7 +587,7 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image } public String toString() { - return "ChatMessage(isGrouped=" + this.isGrouped() + ", isOneToOneConversation=" + this.isOneToOneConversation() + ", activeUser=" + this.getActiveUser() + ", selectedIndividualHashMap=" + this.getSelectedIndividualHashMap() + ", isLinkPreviewAllowed=" + this.isLinkPreviewAllowed() + ", isDeleted=" + this.isDeleted() + ", jsonMessageId=" + this.getJsonMessageId() + ", token=" + this.getToken() + ", actorType=" + this.getActorType() + ", actorId=" + this.getActorId() + ", actorDisplayName=" + this.getActorDisplayName() + ", timestamp=" + this.getTimestamp() + ", message=" + this.getMessage() + ", messageParameters=" + this.getMessageParameters() + ", systemMessageType=" + this.getSystemMessageType() + ", replyable=" + this.isReplyable() + ", parentMessage=" + this.getParentMessage() + ", readStatus=" + this.getReadStatus() + ", messageTypesToIgnore=" + this.getMessageTypesToIgnore() + ")"; + return "ChatMessage(isGrouped=" + this.isGrouped() + ", isOneToOneConversation=" + this.isOneToOneConversation() + ", activeUser=" + this.getActiveUser() + ", selectedIndividualHashMap=" + this.getSelectedIndividualHashMap() + ", isDeleted=" + this.isDeleted() + ", jsonMessageId=" + this.getJsonMessageId() + ", token=" + this.getToken() + ", actorType=" + this.getActorType() + ", actorId=" + this.getActorId() + ", actorDisplayName=" + this.getActorDisplayName() + ", timestamp=" + this.getTimestamp() + ", message=" + this.getMessage() + ", messageParameters=" + this.getMessageParameters() + ", systemMessageType=" + this.getSystemMessageType() + ", replyable=" + this.isReplyable() + ", parentMessage=" + this.getParentMessage() + ", readStatus=" + this.getReadStatus() + ", messageTypesToIgnore=" + this.getMessageTypesToIgnore() + ")"; } public boolean isVoiceMessage(){ diff --git a/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java b/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java index bb0e053e5..9a7b4ba29 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java +++ b/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java @@ -2,6 +2,8 @@ * Nextcloud Talk application * * @author Mario Danic + * @author Tim Krüger + * Copyright (C) 2021 Tim Krüger * Copyright (C) 2017 Mario Danic * * This program is free software: you can redistribute it and/or modify @@ -241,10 +243,6 @@ public interface AppPreferences { @KeyByString("incognito_keyboard") @RemoveMethod void removeIncognitoKeyboard(); - - @KeyByString("link_previews") - @DefaultValue(R.bool.value_true) - boolean getAreLinkPreviewsAllowed(); @KeyByString("phone_book_integration") @DefaultValue(R.bool.value_false) @@ -253,13 +251,6 @@ public interface AppPreferences { @KeyByString("phone_book_integration") void setPhoneBookIntegration(boolean value); - @KeyByString("link_previews") - void setLinkPreviewsAllowed(boolean value); - - @KeyByString("link_previews") - @RemoveMethod - void removeLinkPreviews(); - @KeyByString("screen_lock_timeout") @DefaultValue(R.string.nc_screen_lock_timeout_sixty) String getScreenLockTimeout(); diff --git a/app/src/main/res/layout/controller_settings.xml b/app/src/main/res/layout/controller_settings.xml index 4dddab404..a7cacf340 100644 --- a/app/src/main/res/layout/controller_settings.xml +++ b/app/src/main/res/layout/controller_settings.xml @@ -3,6 +3,8 @@ ~ ~ @author Mario Danic ~ @author Andy Scherzinger + ~ @author Tim Krüger + ~ Copyright (C) 2021 Tim Krüger ~ Copyright (C) 2021 Andy Scherzinger ~ Copyright (C) 2017 Mario Danic ~ @@ -235,15 +237,6 @@ apc:mp_summary="@string/nc_settings_incognito_keyboard_desc" apc:mp_title="@string/nc_settings_incognito_keyboard_title" /> - - Incognito keyboard Instructs keyboard to disable personalized learning (without guarantees) incognito_keyboard - Show link previews - Allows previews of content from received links for supported services - link_previews read_privacy Tap to unlock Locked From dc22e7970cc591ede9f8bc314d1fae1efa8af0eb Mon Sep 17 00:00:00 2001 From: drone Date: Wed, 14 Jul 2021 12:45:01 +0000 Subject: [PATCH 6/7] Drone: update Lint results to reflect reduced error/warning count [skip ci] Signed-off-by: drone --- scripts/analysis/lint-results.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analysis/lint-results.txt b/scripts/analysis/lint-results.txt index 8e9192559..7ca98a429 100644 --- a/scripts/analysis/lint-results.txt +++ b/scripts/analysis/lint-results.txt @@ -1,2 +1,2 @@ DO NOT TOUCH; GENERATED BY DRONE - Lint Report: 3 errors and 272 warnings + Lint Report: 3 errors and 270 warnings From 19337b8e573d04d24d3656cba65a63c7ba5dbd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Kr=C3=BCger?= Date: Thu, 15 Jul 2021 11:39:02 +0200 Subject: [PATCH 7/7] Remove preference 'link_previews' from storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Krüger --- .../com/nextcloud/talk/dagger/modules/DatabaseModule.java | 4 +++- .../com/nextcloud/talk/utils/preferences/AppPreferences.java | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/dagger/modules/DatabaseModule.java b/app/src/main/java/com/nextcloud/talk/dagger/modules/DatabaseModule.java index f4a308c9b..c30b36a34 100644 --- a/app/src/main/java/com/nextcloud/talk/dagger/modules/DatabaseModule.java +++ b/app/src/main/java/com/nextcloud/talk/dagger/modules/DatabaseModule.java @@ -59,6 +59,8 @@ public class DatabaseModule { @Provides @Singleton public AppPreferences providePreferences(@NonNull final Context poContext) { - return StoreBox.create(poContext, AppPreferences.class); + AppPreferences p = StoreBox.create(poContext, AppPreferences.class); + p.removeLinkPreviews(); + return p; } } diff --git a/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java b/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java index 9a7b4ba29..321fc233a 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java +++ b/app/src/main/java/com/nextcloud/talk/utils/preferences/AppPreferences.java @@ -251,6 +251,11 @@ public interface AppPreferences { @KeyByString("phone_book_integration") void setPhoneBookIntegration(boolean value); + // TODO: Remove in 13.0.0 + @KeyByString("link_previews") + @RemoveMethod + void removeLinkPreviews(); + @KeyByString("screen_lock_timeout") @DefaultValue(R.string.nc_screen_lock_timeout_sixty) String getScreenLockTimeout();