mirror of
https://github.com/MGislv/NekoX.git
synced 2024-07-02 10:33:36 +00:00
fixes
This commit is contained in:
parent
9fd741ffa0
commit
1c57ed952e
|
@ -4230,6 +4230,7 @@ public class AndroidUtilities {
|
||||||
// Sets FLAG_SECURE to true, until it gets unregistered (when returned callback is run)
|
// Sets FLAG_SECURE to true, until it gets unregistered (when returned callback is run)
|
||||||
// Useful for having multiple reasons to have this flag on.
|
// Useful for having multiple reasons to have this flag on.
|
||||||
public static Runnable registerFlagSecure(Window window) {
|
public static Runnable registerFlagSecure(Window window) {
|
||||||
|
if (NekoXConfig.disableFlagSecure) return () -> {};
|
||||||
final long reasonId = (long) (Math.random() * 999999999);
|
final long reasonId = (long) (Math.random() * 999999999);
|
||||||
final ArrayList<Long> reasonIds;
|
final ArrayList<Long> reasonIds;
|
||||||
if (flagSecureReasons.containsKey(window)) {
|
if (flagSecureReasons.containsKey(window)) {
|
||||||
|
@ -4252,7 +4253,7 @@ public class AndroidUtilities {
|
||||||
}
|
}
|
||||||
final boolean value = flagSecureReasons.containsKey(window) && flagSecureReasons.get(window).size() > 0;
|
final boolean value = flagSecureReasons.containsKey(window) && flagSecureReasons.get(window).size() > 0;
|
||||||
try {
|
try {
|
||||||
if (value) {
|
if (value && !NekoXConfig.disableFlagSecure) {
|
||||||
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
} else {
|
} else {
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
|
|
|
@ -5888,7 +5888,7 @@ public class MessageObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canForwardMessage() {
|
public boolean canForwardMessage() {
|
||||||
return NekoXConfig.disableFlagSecure || !(messageOwner instanceof TLRPC.TL_message_secret) && !needDrawBluredPreview() && !isLiveLocation() && type != 16 && !isSponsored() && !messageOwner.noforwards;
|
return !(messageOwner instanceof TLRPC.TL_message_secret) && !needDrawBluredPreview() && !isLiveLocation() && type != 16 && !isSponsored() && !messageOwner.noforwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canEditMedia() {
|
public boolean canEditMedia() {
|
||||||
|
|
|
@ -2923,6 +2923,14 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
return isChatNoForwards(getChat(chatId));
|
return isChatNoForwards(getChat(chatId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isChatNoForwardsWithOverride(long chatId) {
|
||||||
|
return isChatNoForwards(getChat(chatId)) && !NekoXConfig.disableFlagSecure;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isChatNoForwardsWithOverride(TLRPC.Chat chat) {
|
||||||
|
return isChatNoForwards(chat) && !NekoXConfig.disableFlagSecure;
|
||||||
|
}
|
||||||
|
|
||||||
public TLRPC.User getUser(Long id) {
|
public TLRPC.User getUser(Long id) {
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
return UserConfig.getInstance(currentAccount).getCurrentUser();
|
return UserConfig.getInstance(currentAccount).getCurrentUser();
|
||||||
|
|
|
@ -2677,7 +2677,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
|
|
||||||
private boolean checkTextSelection(MotionEvent event) {
|
private boolean checkTextSelection(MotionEvent event) {
|
||||||
TextSelectionHelper.ChatListTextSelectionHelper textSelectionHelper = delegate.getTextSelectionHelper();
|
TextSelectionHelper.ChatListTextSelectionHelper textSelectionHelper = delegate.getTextSelectionHelper();
|
||||||
if (textSelectionHelper == null || MessagesController.getInstance(currentAccount).isChatNoForwards(currentMessageObject.getChatId()) || (currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.noforwards)) {
|
if (textSelectionHelper == null || MessagesController.getInstance(currentAccount).isChatNoForwardsWithOverride(currentMessageObject.getChatId()) || (currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.noforwards && !NekoXConfig.disableFlagSecure)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean hasTextBlocks = currentMessageObject.textLayoutBlocks != null && !currentMessageObject.textLayoutBlocks.isEmpty();
|
boolean hasTextBlocks = currentMessageObject.textLayoutBlocks != null && !currentMessageObject.textLayoutBlocks.isEmpty();
|
||||||
|
@ -3512,7 +3512,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
drawVideoSize = false;
|
drawVideoSize = false;
|
||||||
canStreamVideo = false;
|
canStreamVideo = false;
|
||||||
animatingNoSound = 0;
|
animatingNoSound = 0;
|
||||||
if (MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId()) || (messageObject.messageOwner != null && messageObject.messageOwner.noforwards)) {
|
if (MessagesController.getInstance(currentAccount).isChatNoForwardsWithOverride(messageObject.getChatId()) || (messageObject.messageOwner != null && messageObject.messageOwner.noforwards && !NekoXConfig.disableFlagSecure)) {
|
||||||
drawSideButton = 0;
|
drawSideButton = 0;
|
||||||
} else {
|
} else {
|
||||||
drawSideButton = !isRepliesChat && checkNeedDrawShareButton(messageObject) && (currentPosition == null || currentPosition.last) && !needHide ? 1 : 0;
|
drawSideButton = !isRepliesChat && checkNeedDrawShareButton(messageObject) && (currentPosition == null || currentPosition.last) && !needHide ? 1 : 0;
|
||||||
|
@ -6746,7 +6746,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFlagSecure() {
|
private void updateFlagSecure() {
|
||||||
boolean flagSecure = currentMessageObject != null && currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.noforwards;
|
boolean flagSecure = currentMessageObject != null && currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.noforwards && !NekoXConfig.disableFlagSecure;
|
||||||
Activity activity = AndroidUtilities.findActivity(getContext());
|
Activity activity = AndroidUtilities.findActivity(getContext());
|
||||||
if (flagSecure && unregisterFlagSecure == null && activity != null) {
|
if (flagSecure && unregisterFlagSecure == null && activity != null) {
|
||||||
unregisterFlagSecure = AndroidUtilities.registerFlagSecure(activity.getWindow());
|
unregisterFlagSecure = AndroidUtilities.registerFlagSecure(activity.getWindow());
|
||||||
|
|
|
@ -3039,7 +3039,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
boolean noforward = getMessagesController().isChatNoForwards(currentChat);
|
boolean noforward = getMessagesController().isChatNoForwards(currentChat);
|
||||||
|
|
||||||
if (currentEncryptedChat == null || NekoXConfig.disableFlagSecure && !noforward) {
|
if (currentEncryptedChat == null || !noforward) {
|
||||||
actionModeOtherItem.addSubItem(nkbtn_forward_noquote, R.drawable.baseline_fast_forward_24, LocaleController.getString("NoQuoteForward", R.string.NoQuoteForward));
|
actionModeOtherItem.addSubItem(nkbtn_forward_noquote, R.drawable.baseline_fast_forward_24, LocaleController.getString("NoQuoteForward", R.string.NoQuoteForward));
|
||||||
actionModeOtherItem.addSubItem(star, R.drawable.baseline_favorite_20, LocaleController.getString("AddToFavorites", R.string.AddToFavorites));
|
actionModeOtherItem.addSubItem(star, R.drawable.baseline_favorite_20, LocaleController.getString("AddToFavorites", R.string.AddToFavorites));
|
||||||
actionModeOtherItem.addSubItem(save_to, R.drawable.msg_download, LocaleController.getString("SaveToMusic", R.string.SaveToMusic));
|
actionModeOtherItem.addSubItem(save_to, R.drawable.msg_download, LocaleController.getString("SaveToMusic", R.string.SaveToMusic));
|
||||||
|
@ -3060,7 +3060,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
actionMode.getItem(nkactionbarbtn_reply).setVisibility(ChatObject.canSendMessages(currentChat) && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() == 1 ? View.VISIBLE : View.GONE);
|
actionMode.getItem(nkactionbarbtn_reply).setVisibility(ChatObject.canSendMessages(currentChat) && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() == 1 ? View.VISIBLE : View.GONE);
|
||||||
actionMode.getItem(edit).setVisibility(canEditMessagesCount == 1 && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() == 1 ? View.VISIBLE : View.GONE);
|
actionMode.getItem(edit).setVisibility(canEditMessagesCount == 1 && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() == 1 ? View.VISIBLE : View.GONE);
|
||||||
actionMode.getItem(copy).setVisibility(!getMessagesController().isChatNoForwards(currentChat) && selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE);
|
actionMode.getItem(copy).setVisibility(!getMessagesController().isChatNoForwardsWithOverride(currentChat) && selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE);
|
||||||
actionMode.getItem(delete).setVisibility(cantDeleteMessagesCount == 0 ? View.VISIBLE : View.GONE);
|
actionMode.getItem(delete).setVisibility(cantDeleteMessagesCount == 0 ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
actionModeOtherItem.setSubItemVisibility(star, selectedMessagesCanStarIds[0].size() + selectedMessagesCanStarIds[1].size() != 0);
|
actionModeOtherItem.setSubItemVisibility(star, selectedMessagesCanStarIds[0].size() + selectedMessagesCanStarIds[1].size() != 0);
|
||||||
|
@ -9832,6 +9832,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasSelectedNoforwardsMessage() {
|
private boolean hasSelectedNoforwardsMessage() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < selectedMessagesIds.length; ++i) {
|
for (int i = 0; i < selectedMessagesIds.length; ++i) {
|
||||||
for (int j = 0; j < selectedMessagesIds[i].size(); ++j) {
|
for (int j = 0; j < selectedMessagesIds[i].size(); ++j) {
|
||||||
|
@ -10900,7 +10901,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showTextSelectionHint(MessageObject messageObject) {
|
private void showTextSelectionHint(MessageObject messageObject) {
|
||||||
if (getParentActivity() == null || getMessagesController().isChatNoForwards(messageObject.getChatId()) || (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.noforwards)) {
|
if (getParentActivity() == null || (getMessagesController().isChatNoForwardsWithOverride(messageObject.getChatId()) || (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.noforwards && !NekoXConfig.disableFlagSecure))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CharSequence text;
|
CharSequence text;
|
||||||
|
@ -13724,7 +13725,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (selectedMessagesIds[index].indexOfKey(messageObject.getId()) >= 0) {
|
if (selectedMessagesIds[index].indexOfKey(messageObject.getId()) >= 0) {
|
||||||
selectedMessagesIds[index].remove(messageObject.getId());
|
selectedMessagesIds[index].remove(messageObject.getId());
|
||||||
if (reportType < 0) {
|
if (reportType < 0) {
|
||||||
if ((messageObject.type == 0 || messageObject.isAnimatedEmoji() || messageObject.caption != null) && !(messageObject.messageOwner != null && messageObject.messageOwner.noforwards)) {
|
if ((messageObject.type == 0 || messageObject.isAnimatedEmoji() || messageObject.caption != null) && !(messageObject.messageOwner != null && messageObject.messageOwner.noforwards && !NekoXConfig.disableFlagSecure)) {
|
||||||
selectedMessagesCanCopyIds[index].remove(messageObject.getId());
|
selectedMessagesCanCopyIds[index].remove(messageObject.getId());
|
||||||
}
|
}
|
||||||
if (!messageObject.isAnimatedEmoji() && (messageObject.isSticker() || messageObject.isAnimatedSticker()) && MessageObject.isStickerHasSet(messageObject.getDocument())) {
|
if (!messageObject.isAnimatedEmoji() && (messageObject.isSticker() || messageObject.isAnimatedSticker()) && MessageObject.isStickerHasSet(messageObject.getDocument())) {
|
||||||
|
@ -13736,7 +13737,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (!messageObject.canDeleteMessage(chatMode == MODE_SCHEDULED, currentChat)) {
|
if (!messageObject.canDeleteMessage(chatMode == MODE_SCHEDULED, currentChat)) {
|
||||||
cantDeleteMessagesCount--;
|
cantDeleteMessagesCount--;
|
||||||
}
|
}
|
||||||
boolean noforwards = getMessagesController().isChatNoForwards(currentChat);
|
boolean noforwards = getMessagesController().isChatNoForwardsWithOverride(currentChat);
|
||||||
if (chatMode == MODE_SCHEDULED || !messageObject.canForwardMessage() || noforwards) {
|
if (chatMode == MODE_SCHEDULED || !messageObject.canForwardMessage() || noforwards) {
|
||||||
cantForwardMessagesCount--;
|
cantForwardMessagesCount--;
|
||||||
} else {
|
} else {
|
||||||
|
@ -13761,7 +13762,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
selectedMessagesIds[index].put(messageObject.getId(), messageObject);
|
selectedMessagesIds[index].put(messageObject.getId(), messageObject);
|
||||||
if (reportType < 0) {
|
if (reportType < 0) {
|
||||||
if ((messageObject.type == 0 || messageObject.isAnimatedEmoji() || messageObject.caption != null) && !(messageObject.messageOwner != null && messageObject.messageOwner.noforwards)) {
|
if ((messageObject.type == 0 || messageObject.isAnimatedEmoji() || messageObject.caption != null) && !(messageObject.messageOwner != null && messageObject.messageOwner.noforwards && !NekoXConfig.disableFlagSecure)) {
|
||||||
selectedMessagesCanCopyIds[index].put(messageObject.getId(), messageObject);
|
selectedMessagesCanCopyIds[index].put(messageObject.getId(), messageObject);
|
||||||
}
|
}
|
||||||
if (!messageObject.isAnimatedEmoji() && (messageObject.isSticker() || messageObject.isAnimatedSticker()) && MessageObject.isStickerHasSet(messageObject.getDocument())) {
|
if (!messageObject.isAnimatedEmoji() && (messageObject.isSticker() || messageObject.isAnimatedSticker()) && MessageObject.isStickerHasSet(messageObject.getDocument())) {
|
||||||
|
@ -13885,7 +13886,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
int copyVisible = copyItem.getVisibility();
|
int copyVisible = copyItem.getVisibility();
|
||||||
copyItem.setVisibility(!noforwards && selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE);
|
boolean noforwardsOverride = noforwards && !NekoXConfig.disableFlagSecure;
|
||||||
|
copyItem.setVisibility(!noforwardsOverride && selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE);
|
||||||
actionModeOtherItem.setSubItemVisibility(star, getMediaDataController().canAddStickerToFavorites() && (selectedMessagesCanStarIds[0].size() + selectedMessagesCanStarIds[1].size()) == selectedCount);
|
actionModeOtherItem.setSubItemVisibility(star, getMediaDataController().canAddStickerToFavorites() && (selectedMessagesCanStarIds[0].size() + selectedMessagesCanStarIds[1].size()) == selectedCount);
|
||||||
if (selectItem != null) {
|
if (selectItem != null) {
|
||||||
ArrayList<Integer> ids = new ArrayList<>();
|
ArrayList<Integer> ids = new ArrayList<>();
|
||||||
|
@ -21443,6 +21445,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
allowPin = allowPin && message.getId() > 0 && (message.messageOwner.action == null || message.messageOwner.action instanceof TLRPC.TL_messageActionEmpty);
|
allowPin = allowPin && message.getId() > 0 && (message.messageOwner.action == null || message.messageOwner.action instanceof TLRPC.TL_messageActionEmpty);
|
||||||
boolean noforwards = getMessagesController().isChatNoForwards(currentChat) || message.messageOwner.noforwards;
|
boolean noforwards = getMessagesController().isChatNoForwards(currentChat) || message.messageOwner.noforwards;
|
||||||
|
boolean noforwardsOverride = noforwards && !NekoXConfig.disableFlagSecure;
|
||||||
boolean allowUnpin = message.getDialogId() != mergeDialogId && allowPin && (pinnedMessageObjects.containsKey(message.getId()) || groupedMessages != null && !groupedMessages.messages.isEmpty() && pinnedMessageObjects.containsKey(groupedMessages.messages.get(0).getId()));
|
boolean allowUnpin = message.getDialogId() != mergeDialogId && allowPin && (pinnedMessageObjects.containsKey(message.getId()) || groupedMessages != null && !groupedMessages.messages.isEmpty() && pinnedMessageObjects.containsKey(groupedMessages.messages.get(0).getId()));
|
||||||
boolean allowEdit = message.canEditMessage(currentChat) && !chatActivityEnterView.hasAudioToSend() && message.getDialogId() != mergeDialogId;
|
boolean allowEdit = message.canEditMessage(currentChat) && !chatActivityEnterView.hasAudioToSend() && message.getDialogId() != mergeDialogId;
|
||||||
if (allowEdit && groupedMessages != null) {
|
if (allowEdit && groupedMessages != null) {
|
||||||
|
@ -21499,7 +21502,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == -1) {
|
if (type == -1) {
|
||||||
if ((selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !noforwards) {
|
if ((selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("Copy", R.string.Copy));
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
||||||
options.add(OPTION_COPY);
|
options.add(OPTION_COPY);
|
||||||
icons.add(R.drawable.baseline_content_copy_24);
|
icons.add(R.drawable.baseline_content_copy_24);
|
||||||
|
@ -21573,7 +21576,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
items.add(LocaleController.getString("Retry", R.string.Retry));
|
items.add(LocaleController.getString("Retry", R.string.Retry));
|
||||||
options.add(OPTION_RETRY);
|
options.add(OPTION_RETRY);
|
||||||
icons.add(R.drawable.baseline_replay_24);
|
icons.add(R.drawable.baseline_replay_24);
|
||||||
if (!noforwards) {
|
if (!noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("Copy", R.string.Copy));
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
||||||
options.add(OPTION_COPY);
|
options.add(OPTION_COPY);
|
||||||
icons.add(R.drawable.baseline_content_copy_24);
|
icons.add(R.drawable.baseline_content_copy_24);
|
||||||
|
@ -21604,7 +21607,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
options.add(8);
|
options.add(8);
|
||||||
icons.add(R.drawable.baseline_reply_24);
|
icons.add(R.drawable.baseline_reply_24);
|
||||||
}
|
}
|
||||||
if ((selectedObject.type == 0 || selectedObject.isDice() || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !noforwards) {
|
if ((selectedObject.type == 0 || selectedObject.isDice() || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("Copy", R.string.Copy));
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
||||||
options.add(3);
|
options.add(3);
|
||||||
icons.add(R.drawable.baseline_content_copy_24);
|
icons.add(R.drawable.baseline_content_copy_24);
|
||||||
|
@ -21646,24 +21649,24 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
options.add(26);
|
options.add(26);
|
||||||
icons.add(R.drawable.msg_pollstop);
|
icons.add(R.drawable.msg_pollstop);
|
||||||
}
|
}
|
||||||
} else if (selectedObject.isMusic() && !noforwards) {
|
} else if (selectedObject.isMusic() && !noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic));
|
items.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic));
|
||||||
options.add(OPTION_SAVE_TO_DOWNLOADS_OR_MUSIC);
|
options.add(OPTION_SAVE_TO_DOWNLOADS_OR_MUSIC);
|
||||||
icons.add(R.drawable.msg_download);
|
icons.add(R.drawable.msg_download);
|
||||||
} else if (selectedObject.isDocument() && !noforwards) {
|
} else if (selectedObject.isDocument() && !noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
||||||
options.add(OPTION_SAVE_TO_DOWNLOADS_OR_MUSIC);
|
options.add(OPTION_SAVE_TO_DOWNLOADS_OR_MUSIC);
|
||||||
icons.add(R.drawable.msg_download);
|
icons.add(R.drawable.msg_download);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == 3 && !noforwards) {
|
} else if (type == 3 && !noforwardsOverride) {
|
||||||
if (selectedObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && MessageObject.isNewGifDocument(selectedObject.messageOwner.media.webpage.document)) {
|
if (selectedObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && MessageObject.isNewGifDocument(selectedObject.messageOwner.media.webpage.document)) {
|
||||||
items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
|
items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
|
||||||
options.add(11);
|
options.add(11);
|
||||||
icons.add(R.drawable.deproko_baseline_gif_24);
|
icons.add(R.drawable.deproko_baseline_gif_24);
|
||||||
}
|
}
|
||||||
} else if (type == 4) {
|
} else if (type == 4) {
|
||||||
if (!noforwards) {
|
if (!noforwardsOverride) {
|
||||||
if (selectedObject.isVideo()) {
|
if (selectedObject.isVideo()) {
|
||||||
if (!selectedObject.needDrawBluredPreview()) {
|
if (!selectedObject.needDrawBluredPreview()) {
|
||||||
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
||||||
|
@ -21680,7 +21683,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
|
||||||
options.add(6);
|
options.add(6);
|
||||||
icons.add(R.drawable.baseline_share_24);
|
icons.add(R.drawable.baseline_share_24);
|
||||||
} else if (selectedObject.getDocument() != null) {
|
} else if (selectedObject.getDocument() != null) {
|
||||||
if (MessageObject.isNewGifDocument(selectedObject.getDocument())) {
|
if (MessageObject.isNewGifDocument(selectedObject.getDocument())) {
|
||||||
items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
|
items.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
|
||||||
options.add(11);
|
options.add(11);
|
||||||
|
@ -21734,7 +21737,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
items.add(LocaleController.getString("ImportSettings", R.string.ImportSettings));
|
items.add(LocaleController.getString("ImportSettings", R.string.ImportSettings));
|
||||||
icons.add(R.drawable.baseline_security_24);
|
icons.add(R.drawable.baseline_security_24);
|
||||||
}
|
}
|
||||||
if (!noforwards) {
|
if (!noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
|
||||||
options.add(OPTION_SAVE_TO_DOWNLOADS_OR_MUSIC);
|
options.add(OPTION_SAVE_TO_DOWNLOADS_OR_MUSIC);
|
||||||
icons.add(R.drawable.baseline_file_download_24);
|
icons.add(R.drawable.baseline_file_download_24);
|
||||||
|
@ -21742,7 +21745,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
options.add(6);
|
options.add(6);
|
||||||
icons.add(R.drawable.baseline_share_24);
|
icons.add(R.drawable.baseline_share_24);
|
||||||
}
|
}
|
||||||
} else if (type == 6 && !noforwards) {
|
} else if (type == 6 && !noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
||||||
options.add(7);
|
options.add(7);
|
||||||
icons.add(R.drawable.baseline_image_24);
|
icons.add(R.drawable.baseline_image_24);
|
||||||
|
@ -21791,7 +21794,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
icons.add(R.drawable.baseline_person_add_24);
|
icons.add(R.drawable.baseline_person_add_24);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(selectedObject.messageOwner.media.phone_number)) {
|
if (!TextUtils.isEmpty(selectedObject.messageOwner.media.phone_number)) {
|
||||||
if (!noforwards) {
|
if (!noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("Copy", R.string.Copy));
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
||||||
options.add(16);
|
options.add(16);
|
||||||
icons.add(R.drawable.baseline_content_copy_24);
|
icons.add(R.drawable.baseline_content_copy_24);
|
||||||
|
@ -21820,6 +21823,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean noforward = getMessagesController().isChatNoForwards(currentChat);
|
boolean noforward = getMessagesController().isChatNoForwards(currentChat);
|
||||||
|
boolean noforwardOverride = noforward && !NekoXConfig.disableFlagSecure;
|
||||||
if (!selectedObject.isSponsored() && chatMode != MODE_SCHEDULED && !selectedObject.needDrawBluredPreview() && !selectedObject.isLiveLocation() && selectedObject.type != 16 && !noforwards) {
|
if (!selectedObject.isSponsored() && chatMode != MODE_SCHEDULED && !selectedObject.needDrawBluredPreview() && !selectedObject.isLiveLocation() && selectedObject.type != 16 && !noforwards) {
|
||||||
items.add(LocaleController.getString("Forward", R.string.Forward));
|
items.add(LocaleController.getString("Forward", R.string.Forward));
|
||||||
options.add(2);
|
options.add(2);
|
||||||
|
@ -21984,7 +21988,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
options.add(8);
|
options.add(8);
|
||||||
icons.add(R.drawable.baseline_reply_24);
|
icons.add(R.drawable.baseline_reply_24);
|
||||||
}
|
}
|
||||||
if ((selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !noforwards) {
|
if ((selectedObject.type == 0 || selectedObject.isAnimatedEmoji() || getMessageCaption(selectedObject, selectedObjectGroup) != null) && !noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("Copy", R.string.Copy));
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
||||||
options.add(3);
|
options.add(3);
|
||||||
icons.add(R.drawable.baseline_content_copy_24);
|
icons.add(R.drawable.baseline_content_copy_24);
|
||||||
|
@ -22002,7 +22006,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
icons.add(R.drawable.baseline_forum_24);
|
icons.add(R.drawable.baseline_forum_24);
|
||||||
items.add(LocaleController.getString("ViewInChat", R.string.ViewInChat));
|
items.add(LocaleController.getString("ViewInChat", R.string.ViewInChat));
|
||||||
}
|
}
|
||||||
if (type == 4 && !noforwards) {
|
if (type == 4 && !noforwardsOverride) {
|
||||||
if (selectedObject.isVideo()) {
|
if (selectedObject.isVideo()) {
|
||||||
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
|
||||||
options.add(4);
|
options.add(4);
|
||||||
|
@ -22057,7 +22061,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
icons.add(R.drawable.baseline_person_add_24);
|
icons.add(R.drawable.baseline_person_add_24);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(selectedObject.messageOwner.media.phone_number)) {
|
if (!TextUtils.isEmpty(selectedObject.messageOwner.media.phone_number)) {
|
||||||
if (!noforwards) {
|
if (!noforwardsOverride) {
|
||||||
items.add(LocaleController.getString("Copy", R.string.Copy));
|
items.add(LocaleController.getString("Copy", R.string.Copy));
|
||||||
options.add(16);
|
options.add(16);
|
||||||
icons.add(R.drawable.baseline_content_copy_24);
|
icons.add(R.drawable.baseline_content_copy_24);
|
||||||
|
@ -24841,8 +24845,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean noforwards = getMessagesController().isChatNoForwards(currentChat) || (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.noforwards);
|
boolean noforwards = getMessagesController().isChatNoForwards(currentChat) || (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.noforwards);
|
||||||
|
boolean noforwardsOverride = noforwards && !NekoXConfig.disableFlagSecure;
|
||||||
if (url instanceof URLSpanMono) {
|
if (url instanceof URLSpanMono) {
|
||||||
if (!noforwards) {
|
if (!noforwardsOverride) {
|
||||||
((URLSpanMono) url).copyToClipboard();
|
((URLSpanMono) url).copyToClipboard();
|
||||||
getUndoView().showWithAction(0, UndoView.ACTION_TEXT_COPIED, null);
|
getUndoView().showWithAction(0, UndoView.ACTION_TEXT_COPIED, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1875,7 +1875,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
|
||||||
} else {
|
} else {
|
||||||
optionsButton.setVisibility(View.VISIBLE);
|
optionsButton.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId())) {
|
if (MessagesController.getInstance(currentAccount).isChatNoForwardsWithOverride(messageObject.getChatId())) {
|
||||||
optionsButton.hideSubItem(1);
|
optionsButton.hideSubItem(1);
|
||||||
optionsButton.hideSubItem(2);
|
optionsButton.hideSubItem(2);
|
||||||
optionsButton.hideSubItem(5);
|
optionsButton.hideSubItem(5);
|
||||||
|
|
|
@ -115,6 +115,7 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
|
import tw.nekomimi.nekogram.NekoXConfig;
|
||||||
import tw.nekomimi.nekogram.ui.BottomBuilder;
|
import tw.nekomimi.nekogram.ui.BottomBuilder;
|
||||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||||
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
||||||
|
@ -2249,6 +2250,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private boolean hasNoforwardsMessage() {
|
private boolean hasNoforwardsMessage() {
|
||||||
|
if (NekoXConfig.disableFlagSecure) return false;
|
||||||
boolean hasNoforwardsMessage = false;
|
boolean hasNoforwardsMessage = false;
|
||||||
for (int a = 1; a >= 0; a--) {
|
for (int a = 1; a >= 0; a--) {
|
||||||
ArrayList<Integer> ids = new ArrayList<>();
|
ArrayList<Integer> ids = new ArrayList<>();
|
||||||
|
|
|
@ -10316,6 +10316,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
isVideo = newMessageObject.isVideo();
|
isVideo = newMessageObject.isVideo();
|
||||||
boolean isInvoice = newMessageObject.isInvoice();
|
boolean isInvoice = newMessageObject.isInvoice();
|
||||||
boolean noforwards = MessagesController.getInstance(currentAccount).isChatNoForwards(newMessageObject.getChatId()) || (newMessageObject.messageOwner != null && newMessageObject.messageOwner.noforwards);
|
boolean noforwards = MessagesController.getInstance(currentAccount).isChatNoForwards(newMessageObject.getChatId()) || (newMessageObject.messageOwner != null && newMessageObject.messageOwner.noforwards);
|
||||||
|
boolean noforwardsOverride = noforwards && !NekoXConfig.disableFlagSecure;
|
||||||
if (isInvoice) {
|
if (isInvoice) {
|
||||||
setItemVisible(masksItem, false, true);
|
setItemVisible(masksItem, false, true);
|
||||||
menuItem.hideSubItem(gallery_menu_delete);
|
menuItem.hideSubItem(gallery_menu_delete);
|
||||||
|
@ -10327,7 +10328,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
nameTextView.setText("");
|
nameTextView.setText("");
|
||||||
dateTextView.setText("");
|
dateTextView.setText("");
|
||||||
} else {
|
} else {
|
||||||
allowShare = !noforwards;
|
allowShare = !noforwardsOverride;
|
||||||
if (newMessageObject.isNewGif() && allowShare) {
|
if (newMessageObject.isNewGif() && allowShare) {
|
||||||
menuItem.showSubItem(gallery_menu_savegif);
|
menuItem.showSubItem(gallery_menu_savegif);
|
||||||
}
|
}
|
||||||
|
@ -10341,7 +10342,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
menuItem.showSubItem(gallery_menu_openin);
|
menuItem.showSubItem(gallery_menu_openin);
|
||||||
setItemVisible(pipItem, true, false);
|
setItemVisible(pipItem, true, false);
|
||||||
} else if (isVideo) {
|
} else if (isVideo) {
|
||||||
if (!noforwards || (slideshowMessageId == 0 ? newMessageObject.messageOwner.media.webpage != null && newMessageObject.messageOwner.media.webpage.url != null :
|
if (!noforwardsOverride || (slideshowMessageId == 0 ? newMessageObject.messageOwner.media.webpage != null && newMessageObject.messageOwner.media.webpage.url != null :
|
||||||
imagesArr.get(0).messageOwner.media.webpage != null && imagesArr.get(0).messageOwner.media.webpage.url != null)) {
|
imagesArr.get(0).messageOwner.media.webpage != null && imagesArr.get(0).messageOwner.media.webpage.url != null)) {
|
||||||
menuItem.showSubItem(gallery_menu_openin);
|
menuItem.showSubItem(gallery_menu_openin);
|
||||||
} else {
|
} else {
|
||||||
|
@ -10437,7 +10438,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (!newMessageObject.canDeleteMessage(parentChatActivity != null && parentChatActivity.isInScheduleMode(), null)) {
|
if (!newMessageObject.canDeleteMessage(parentChatActivity != null && parentChatActivity.isInScheduleMode(), null)) {
|
||||||
menuItem.hideSubItem(gallery_menu_delete);
|
menuItem.hideSubItem(gallery_menu_delete);
|
||||||
}
|
}
|
||||||
allowShare = !noforwards;
|
allowShare = !noforwardsOverride;
|
||||||
bottomButtonsLayout.setVisibility(View.VISIBLE);
|
bottomButtonsLayout.setVisibility(View.VISIBLE);
|
||||||
paintButton.setVisibility(View.GONE);
|
paintButton.setVisibility(View.GONE);
|
||||||
shareItem.setVisibility(allowShare ? View.VISIBLE : View.GONE);
|
shareItem.setVisibility(allowShare ? View.VISIBLE : View.GONE);
|
||||||
|
@ -10516,7 +10517,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
setItemVisible(sendNoQuoteItem, false, false);
|
setItemVisible(sendNoQuoteItem, false, false);
|
||||||
setItemVisible(sendItem, false, false);
|
setItemVisible(sendItem, false, false);
|
||||||
}
|
}
|
||||||
if (isEmbedVideo || newMessageObject.messageOwner.ttl != 0 && newMessageObject.messageOwner.ttl < 60 * 60 || noforwards) {
|
if (isEmbedVideo || newMessageObject.messageOwner.ttl != 0 && newMessageObject.messageOwner.ttl < 60 * 60 || noforwardsOverride) {
|
||||||
allowShare = false;
|
allowShare = false;
|
||||||
menuItem.hideSubItem(gallery_menu_save);
|
menuItem.hideSubItem(gallery_menu_save);
|
||||||
bottomButtonsLayout.setVisibility(View.GONE);
|
bottomButtonsLayout.setVisibility(View.GONE);
|
||||||
|
@ -10601,14 +10602,14 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
} else {
|
} else {
|
||||||
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, switchingToIndex + 1, imagesArrLocations.size()));
|
actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, switchingToIndex + 1, imagesArrLocations.size()));
|
||||||
}
|
}
|
||||||
boolean noforwards = avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-avatarsDialogId);
|
boolean noforwardsOverrided = avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwardsWithOverride(-avatarsDialogId);
|
||||||
if (noforwards) {
|
if (noforwardsOverrided) {
|
||||||
menuItem.hideSubItem(gallery_menu_save);
|
menuItem.hideSubItem(gallery_menu_save);
|
||||||
} else {
|
} else {
|
||||||
menuItem.showSubItem(gallery_menu_save);
|
menuItem.showSubItem(gallery_menu_save);
|
||||||
}
|
}
|
||||||
menuItem.showSubItem(gallery_menu_scan);
|
menuItem.showSubItem(gallery_menu_scan);
|
||||||
allowShare = !noforwards;
|
allowShare = !noforwardsOverrided;
|
||||||
shareButton.setVisibility(allowShare && shareItem.getVisibility() != View.VISIBLE ? View.VISIBLE : View.GONE);
|
shareButton.setVisibility(allowShare && shareItem.getVisibility() != View.VISIBLE ? View.VISIBLE : View.GONE);
|
||||||
bottomButtonsLayout.setVisibility(!videoPlayerControlVisible ? View.VISIBLE : View.GONE);
|
bottomButtonsLayout.setVisibility(!videoPlayerControlVisible ? View.VISIBLE : View.GONE);
|
||||||
if (bottomButtonsLayout.getVisibility() == View.VISIBLE) {
|
if (bottomButtonsLayout.getVisibility() == View.VISIBLE) {
|
||||||
|
@ -10818,7 +10819,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (switchingToIndex < 0 || switchingToIndex >= size) {
|
if (switchingToIndex < 0 || switchingToIndex >= size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
allowShare = !MessagesController.getInstance(currentAccount).isChatNoForwards(-currentDialogId);
|
allowShare = !MessagesController.getInstance(currentAccount).isChatNoForwardsWithOverride(-currentDialogId);
|
||||||
TLRPC.PageBlock pageBlock = pageBlocksAdapter.get(switchingToIndex);
|
TLRPC.PageBlock pageBlock = pageBlocksAdapter.get(switchingToIndex);
|
||||||
caption = pageBlocksAdapter.getCaption(switchingToIndex);
|
caption = pageBlocksAdapter.getCaption(switchingToIndex);
|
||||||
isVideo = pageBlocksAdapter.isVideo(switchingToIndex);
|
isVideo = pageBlocksAdapter.isVideo(switchingToIndex);
|
||||||
|
|
|
@ -6846,7 +6846,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
//otherItem.addSubItem(edit_avatar, R.drawable.photo_paint, LocaleController.getString("EditPhoto", R.string.EditPhoto));
|
//otherItem.addSubItem(edit_avatar, R.drawable.photo_paint, LocaleController.getString("EditPhoto", R.string.EditPhoto));
|
||||||
otherItem.addSubItem(delete_avatar, R.drawable.baseline_delete_24, LocaleController.getString("Delete", R.string.Delete));
|
otherItem.addSubItem(delete_avatar, R.drawable.baseline_delete_24, LocaleController.getString("Delete", R.string.Delete));
|
||||||
}
|
}
|
||||||
if (getMessagesController().isChatNoForwards(currentChat)) {
|
if (getMessagesController().isChatNoForwardsWithOverride(currentChat)) {
|
||||||
otherItem.hideSubItem(gallery_menu_save);
|
otherItem.hideSubItem(gallery_menu_save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ public class NekoXConfig {
|
||||||
if (hasDeveloper != null)
|
if (hasDeveloper != null)
|
||||||
return hasDeveloper;
|
return hasDeveloper;
|
||||||
hasDeveloper = false;
|
hasDeveloper = false;
|
||||||
|
if (BuildVars.DEBUG_VERSION) hasDeveloper = true;
|
||||||
for (int acc : SharedConfig.activeAccounts) {
|
for (int acc : SharedConfig.activeAccounts) {
|
||||||
long myId = UserConfig.getInstance(acc).clientUserId;
|
long myId = UserConfig.getInstance(acc).clientUserId;
|
||||||
if (ArrayUtil.contains(NekoXConfig.developers, myId)) {
|
if (ArrayUtil.contains(NekoXConfig.developers, myId)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user