Add disable remote emoji interactions and disableChoosingSticker

This commit is contained in:
luvletter2333 2021-09-20 21:30:57 +08:00
parent 1d25b61d10
commit b6c695022e
No known key found for this signature in database
GPG Key ID: BFD68B892BECC1D8
5 changed files with 40 additions and 1 deletions

View File

@ -6316,7 +6316,10 @@ public class MessagesController extends BaseController implements NotificationCe
} else if (action == 9) {
req.action = new TLRPC.TL_sendMessageUploadAudioAction();
} else if (action == 10) {
req.action = new TLRPC.TL_sendMessageChooseStickerAction();
if (NekoConfig.disableChoosingSticker)
req.action = new TLRPC.TL_sendMessageTypingAction();
else
req.action = new TLRPC.TL_sendMessageChooseStickerAction();
} else if (action == 11) {
TLRPC.TL_sendMessageEmojiInteractionSeen interactionSeen = new TLRPC.TL_sendMessageEmojiInteractionSeen();
interactionSeen.emoticon = emojicon;

View File

@ -34,6 +34,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import tw.nekomimi.nekogram.NekoConfig;
public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCenterDelegate {
private final int ANIMATION_JSON_VERSION = 1;
@ -149,6 +151,8 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
checkStickerPack();
}
} else if (id == NotificationCenter.onEmojiInteractionsReceived) {
if (NekoConfig.disableRemoteEmojiInteractions)
return;
long dialogId = (long) args[0];
TLRPC.TL_sendMessageEmojiInteraction action = (TLRPC.TL_sendMessageEmojiInteraction) args[1];
if (dialogId == this.dialogId && supportedEmoji.contains(action.emoticon)) {

View File

@ -152,6 +152,8 @@ public class NekoConfig {
public static boolean takeGIFasVideo;
public static int maxRecentStickerCount;
public static boolean disableSwipeToNext;
public static boolean disableRemoteEmojiInteractions;
public static boolean disableChoosingSticker;
public static boolean disableAutoDownloadingWin32Executable;
public static boolean disableAutoDownloadingArchive;
@ -326,6 +328,8 @@ public class NekoConfig {
takeGIFasVideo = preferences.getBoolean("takeGIFasVideo", false);
maxRecentStickerCount = preferences.getInt("maxRecentStickerCount", 20);
disableSwipeToNext = preferences.getBoolean("disableSwipeToNext", false);
disableRemoteEmojiInteractions = preferences.getBoolean("disableRemoteEmojiInteractions", false);
disableChoosingSticker = preferences.getBoolean("disableChoosingSticker", false);
disableAutoDownloadingWin32Executable = preferences.getBoolean("disableAutoDownloadingWin32Executable", true);
disableAutoDownloadingArchive = preferences.getBoolean("disableAutoDownloadingArchive", true);
@ -859,6 +863,14 @@ public class NekoConfig {
preferences.edit().putBoolean("disableGroupVoipAudioProcessing", disableGroupVoipAudioProcessing = !disableGroupVoipAudioProcessing).apply();
}
public static void toggleDisableRemoteEmojiInteractions() {
preferences.edit().putBoolean("disableRemoteEmojiInteractions", disableRemoteEmojiInteractions = !disableRemoteEmojiInteractions).apply();
}
public static void toggleDisableChoosingSticker() {
preferences.edit().putBoolean("disableChoosingSticker", disableChoosingSticker = !disableChoosingSticker).apply();
}
private static final String EMOJI_FONT_AOSP = "NotoColorEmoji.ttf";
public static Typeface getSystemEmojiTypeface() {

View File

@ -82,6 +82,8 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
private int takeGIFasVideoRow;
private int maxRecentStickerCountRow;
private int disableSwipeToNextRow;
private int disableChoosingStickerRow;
private int disableRemoteEmojiInteractionsRow;
private int mapPreviewRow;
private int messageMenuRow;
@ -310,6 +312,16 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.disableSwipeToNext);
}
} else if (position == disableChoosingStickerRow) {
NekoConfig.toggleDisableChoosingSticker();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.disableChoosingSticker);
}
} else if (position == disableRemoteEmojiInteractionsRow) {
NekoConfig.toggleDisableRemoteEmojiInteractions();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.disableRemoteEmojiInteractions);
}
} else if (position == win32Row) {
NekoConfig.toggleDisableAutoDownloadingWin32Executable();
if (view instanceof TextCheckCell) {
@ -362,6 +374,8 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
takeGIFasVideoRow = rowCount++;
maxRecentStickerCountRow = rowCount++;
disableSwipeToNextRow = rowCount++;
disableChoosingStickerRow = rowCount++;
disableRemoteEmojiInteractionsRow = rowCount++;
mapPreviewRow = rowCount++;
messageMenuRow = rowCount++;
@ -731,6 +745,10 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
textCell.setTextAndCheck(LocaleController.getString("TakeGIFasVideo", R.string.TakeGIFasVideo), NekoConfig.takeGIFasVideo, true);
} else if (position == disableSwipeToNextRow) {
textCell.setTextAndCheck(LocaleController.getString("disableSwipeToNextChannel", R.string.disableSwipeToNextChannel), NekoConfig.disableSwipeToNext, true);
} else if (position == disableChoosingStickerRow) {
textCell.setTextAndCheck(LocaleController.getString("disableChoosingSticker", R.string.disableChoosingSticker), NekoConfig.disableChoosingSticker, true);
} else if (position == disableRemoteEmojiInteractionsRow) {
textCell.setTextAndCheck(LocaleController.getString("disableRemoteEmojiInteractions", R.string.disableRemoteEmojiInteractions), NekoConfig.disableRemoteEmojiInteractions, true);
} else if (position == win32Row) {
textCell.setTextAndCheck(LocaleController.getString("Win32ExecutableFiles", R.string.Win32ExecutableFiles), !NekoConfig.disableAutoDownloadingWin32Executable, true);
} else if (position == archiveRow) {

View File

@ -119,5 +119,7 @@
<string name="customGroupVoipAudioBitrate">Group VoIP Audio Bitrate</string>
<string name="maxRecentStickerCount">Max recent stickers</string>
<string name="disableSwipeToNextChannel">Disable swipe to next channel</string>
<string name="disableChoosingSticker">Send typing instead of choosing sticker</string>
<string name="disableRemoteEmojiInteractions">Disable emoji interactions from remote</string>
</resources>