Merge pull request #1472 from nextcloud/remove-obsolete-setting-link-preview

Remove obsolete setting link preview
This commit is contained in:
Tim Krueger 2021-07-15 16:14:50 +02:00 committed by GitHub
commit 0799945016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 47 deletions

View File

@ -4,6 +4,8 @@
* @author Mario Danic
* @author Marcel Hibbe
* @author Andy Scherzinger
* @author Tim Krüger
* Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
* Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
@ -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<ImageButton>(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)

View File

@ -3,6 +3,9 @@
*
* @author Andy Scherzinger
* @author Mario Danic
* @author Tim Krüger
* Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* 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) {

View File

@ -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;
}
}

View File

@ -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<String, String> 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(){

View File

@ -2,6 +2,8 @@
* Nextcloud Talk application
*
* @author Mario Danic
* @author Tim Krüger
* Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
@ -242,10 +244,6 @@ public interface AppPreferences {
@RemoveMethod
void removeIncognitoKeyboard();
@KeyByString("link_previews")
@DefaultValue(R.bool.value_true)
boolean getAreLinkPreviewsAllowed();
@KeyByString("phone_book_integration")
@DefaultValue(R.bool.value_false)
boolean isPhoneBookIntegrationEnabled();
@ -253,9 +251,7 @@ public interface AppPreferences {
@KeyByString("phone_book_integration")
void setPhoneBookIntegration(boolean value);
@KeyByString("link_previews")
void setLinkPreviewsAllowed(boolean value);
// TODO: Remove in 13.0.0
@KeyByString("link_previews")
@RemoveMethod
void removeLinkPreviews();

View File

@ -3,6 +3,8 @@
~
~ @author Mario Danic
~ @author Andy Scherzinger
~ @author Tim Krüger
~ Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
~ 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" />
<com.yarolegovich.mp.MaterialSwitchPreference
android:id="@+id/settings_link_previews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
apc:mp_default_value="@bool/value_true"
apc:mp_key="@string/nc_settings_link_previews_key"
apc:mp_summary="@string/nc_settings_link_previews_desc"
apc:mp_title="@string/nc_settings_link_previews_title" />
<com.yarolegovich.mp.MaterialSwitchPreference
android:id="@+id/settings_phone_book_integration"
android:layout_width="match_parent"

View File

@ -128,9 +128,6 @@
<string name="nc_settings_incognito_keyboard_title">Incognito keyboard</string>
<string name="nc_settings_incognito_keyboard_desc">Instructs keyboard to disable personalized learning (without guarantees)</string>
<string name="nc_settings_incognito_keyboard_key" translatable="false">incognito_keyboard</string>
<string name="nc_settings_link_previews_title">Show link previews</string>
<string name="nc_settings_link_previews_desc">Allows previews of content from received links for supported services</string>
<string name="nc_settings_link_previews_key" translatable="false">link_previews</string>
<string name="nc_settings_read_privacy_key" translatable="false">read_privacy</string>
<string name="nc_locked_tap_to_unlock">Tap to unlock</string>
<string name="nc_locked">Locked</string>

View File

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 3 errors and 272 warnings</span>
<span class="mdl-layout-title">Lint Report: 3 errors and 270 warnings</span>