Add "Disable reactions"

This commit is contained in:
Ivan K
2022-03-19 12:34:27 +03:00
parent abe1074655
commit 21ae69605a
4 changed files with 27 additions and 5 deletions

View File

@@ -31,6 +31,8 @@ public class ExteraConfig {
public static boolean archiveOnPull;
public static boolean dateOfForwardedMsg;
public static boolean disableReactions;
public static boolean rearVideoMessages;
public static boolean disableCamera;
public static boolean pauseOnMinimize;
@@ -78,6 +80,8 @@ public class ExteraConfig {
archiveOnPull = preferences.getBoolean("archiveOnPull", true);
dateOfForwardedMsg = preferences.getBoolean("dateOfForwardedMsg", false);
disableReactions = preferences.getBoolean("disableReactions", false);
rearVideoMessages = preferences.getBoolean("rearVideoMessages", false);
disableCamera = preferences.getBoolean("disableCamera", false);
pauseOnMinimize = preferences.getBoolean("pauseOnMinimize", true);
@@ -202,6 +206,14 @@ public class ExteraConfig {
editor.commit();
}
public static void toggleDisableReactions() {
disableReactions = !disableReactions;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("disableReactions", disableReactions);
editor.commit();
}
public static void toggleRearVideoMessages() {
rearVideoMessages = !rearVideoMessages;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);

View File

@@ -36,9 +36,6 @@ import org.telegram.ui.Components.SeekBarView;
import org.telegram.ui.Components.UndoView;
import com.exteragram.messenger.ExteraConfig;
import com.google.android.gms.vision.text.Text;
import java.util.Locale;
public class ChatsPreferencesEntry extends BaseFragment {
@@ -56,6 +53,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
private int hideSendAsChannelRow;
private int hideStickerTimeRow;
private int hideKeyboardOnScrollRow;
private int disableReactionsRow;
private int archiveOnPullRow;
private int dateOfForwardedMsgRow;
private int chatDividerRow;
@@ -239,6 +237,11 @@ public class ChatsPreferencesEntry extends BaseFragment {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(ExteraConfig.dateOfForwardedMsg);
}
} else if (position == disableReactionsRow) {
ExteraConfig.toggleDisableReactions();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(ExteraConfig.disableReactions);
}
} else if (position == rearVideoMessagesRow) {
ExteraConfig.toggleRearVideoMessages();
if (view instanceof TextCheckCell) {
@@ -279,6 +282,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
hideSendAsChannelRow = rowCount++;
hideStickerTimeRow = rowCount++;
hideKeyboardOnScrollRow = rowCount++;
disableReactionsRow = rowCount++;
archiveOnPullRow = rowCount++;
dateOfForwardedMsgRow = rowCount++;
chatDividerRow = rowCount++;
@@ -345,6 +349,8 @@ public class ChatsPreferencesEntry extends BaseFragment {
textCheckCell.setTextAndCheck(LocaleController.getString("ArchiveOnPull", R.string.ArchiveOnPull), ExteraConfig.archiveOnPull, true);
} else if (position == dateOfForwardedMsgRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("DateOfForwardedMsg", R.string.DateOfForwardedMsg), ExteraConfig.dateOfForwardedMsg, true);
} else if (position == disableReactionsRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("DisableReactions", R.string.DisableReactions), ExteraConfig.disableReactions, true);
} else if (position == rearVideoMessagesRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("RearVideoMessages", R.string.RearVideoMessages), ExteraConfig.rearVideoMessages, true);
} else if (position == disableCameraRow) {
@@ -396,8 +402,9 @@ public class ChatsPreferencesEntry extends BaseFragment {
} else if (position == stickersHeaderRow || position == chatHeaderRow || position == mediaHeaderRow) {
return 2;
} else if (position == hideStickerTimeRow || position == hideSendAsChannelRow || position == hideKeyboardOnScrollRow ||
position == archiveOnPullRow || position == dateOfForwardedMsgRow || position == rearVideoMessagesRow ||
position == disableCameraRow || position == pauseOnMinimizeRow || position == disablePlaybackRow) {
position == archiveOnPullRow || position == dateOfForwardedMsgRow || position == disableReactionsRow ||
position == rearVideoMessagesRow || position == disableCameraRow || position == pauseOnMinimizeRow ||
position == disablePlaybackRow) {
return 3;
} else if (position == stickerSizeRow) {
return 4;

View File

@@ -1424,6 +1424,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (reaction == null) {
return false;
}
if (ExteraConfig.disableReactions) return false;
boolean available = dialog_id >= 0;
if (!available && chatInfo != null) {
for (String s : chatInfo.available_reactions) {
@@ -1452,6 +1453,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (reaction == null || cell.getMessageObject().isSponsored()) {
return;
}
if (ExteraConfig.disableReactions) return;
boolean available = dialog_id >= 0;
if (!available && chatInfo != null) {
for (String s : chatInfo.available_reactions) {

View File

@@ -39,6 +39,7 @@
<string name="HideSendAsChannel">Hide \"Send as Channel\"</string>
<string name="HideKeyboardOnScroll">Hide Keyboard on Scrolling</string>
<string name="DisableReactions">Disable reactions</string>
<string name="ArchiveOnPull">Open Archive on Pulldown</string>
<string name="DateOfForwardedMsg">Show date of forwarded message</string>