mirror of https://github.com/NekoX-Dev/NekoX.git
Merge upstream 7.3.0 (2197)
This commit is contained in:
commit
39ff12cca8
|
@ -1,8 +1,8 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
def verName = "7.3.0-preview03"
|
||||
def verCode = 124
|
||||
def verName = "7.3.0-preview05"
|
||||
def verCode = 128
|
||||
|
||||
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
|
||||
|
||||
|
|
|
@ -4282,7 +4282,8 @@ public class MessageObject {
|
|||
}
|
||||
int selfUserId = UserConfig.getInstance(currentAccount).getClientUserId();
|
||||
if (getDialogId() == selfUserId) {
|
||||
return messageOwner.fwd_from.from_id instanceof TLRPC.TL_peerUser && messageOwner.fwd_from.from_id.user_id == selfUserId && (messageOwner.fwd_from.saved_from_peer == null || messageOwner.fwd_from.saved_from_peer.user_id == selfUserId) || messageOwner.fwd_from.saved_from_peer != null && messageOwner.fwd_from.saved_from_peer.user_id == selfUserId;
|
||||
return messageOwner.fwd_from.from_id instanceof TLRPC.TL_peerUser && messageOwner.fwd_from.from_id.user_id == selfUserId && (messageOwner.fwd_from.saved_from_peer == null || messageOwner.fwd_from.saved_from_peer.user_id == selfUserId)
|
||||
|| messageOwner.fwd_from.saved_from_peer != null && messageOwner.fwd_from.saved_from_peer.user_id == selfUserId && (messageOwner.fwd_from.from_id == null || messageOwner.fwd_from.from_id.user_id == selfUserId);
|
||||
}
|
||||
return messageOwner.fwd_from.saved_from_peer == null || messageOwner.fwd_from.saved_from_peer.user_id == selfUserId;
|
||||
}
|
||||
|
|
|
@ -9770,7 +9770,6 @@ public class MessagesStorage extends BaseController {
|
|||
public void putMessages(final TLRPC.messages_Messages messages, final long dialog_id, final int load_type, final int max_id, final boolean createDialog, final boolean scheduled) {
|
||||
storageQueue.postRunnable(() -> {
|
||||
try {
|
||||
FileLog.d("put messages to " + dialog_id);
|
||||
if (scheduled) {
|
||||
database.executeFast(String.format(Locale.US, "DELETE FROM scheduled_messages WHERE uid = %d AND mid > 0", dialog_id)).stepThis().dispose();
|
||||
SQLitePreparedStatement state_messages = database.executeFast("REPLACE INTO scheduled_messages VALUES(?, ?, ?, ?, ?, ?, NULL)");
|
||||
|
|
|
@ -1237,9 +1237,9 @@ public boolean retriedToSend;
|
|||
int lower_id = (int) peer;
|
||||
int sendResult = 0;
|
||||
int myId = getUserConfig().getClientUserId();
|
||||
boolean isChannel = false;
|
||||
if (lower_id != 0) {
|
||||
final TLRPC.Peer peer_id = getMessagesController().getPeer((int) peer);
|
||||
boolean isMegagroup = false;
|
||||
boolean isSignature = false;
|
||||
boolean canSendStickers = true;
|
||||
boolean canSendMedia = true;
|
||||
|
@ -1257,10 +1257,10 @@ public boolean retriedToSend;
|
|||
} else {
|
||||
chat = getMessagesController().getChat(-lower_id);
|
||||
if (ChatObject.isChannel(chat)) {
|
||||
isMegagroup = chat.megagroup;
|
||||
isSignature = chat.signatures;
|
||||
isChannel = !chat.megagroup;
|
||||
|
||||
if (!isMegagroup && chat.has_link) {
|
||||
if (isChannel && chat.has_link) {
|
||||
TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chat.id);
|
||||
if (chatFull != null) {
|
||||
linkedToGroup = chatFull.linked_chat_id;
|
||||
|
@ -1329,7 +1329,7 @@ public boolean retriedToSend;
|
|||
newMsg.fwd_from.flags |= 8;
|
||||
newMsg.fwd_from.post_author = msgObj.messageOwner.fwd_from.post_author;
|
||||
}
|
||||
if ((msgObj.messageOwner.fwd_from.flags & 16) != 0 && !UserObject.isReplyUser(msgObj.getDialogId())) {
|
||||
if ((peer == myId || isChannel) && (msgObj.messageOwner.fwd_from.flags & 16) != 0 && !UserObject.isReplyUser(msgObj.getDialogId())) {
|
||||
newMsg.fwd_from.flags |= 16;
|
||||
newMsg.fwd_from.saved_from_peer = msgObj.messageOwner.fwd_from.saved_from_peer;
|
||||
newMsg.fwd_from.saved_from_msg_id = msgObj.messageOwner.fwd_from.saved_from_msg_id;
|
||||
|
@ -1455,7 +1455,7 @@ public boolean retriedToSend;
|
|||
newMsg.grouped_id = gId;
|
||||
newMsg.flags |= 131072;
|
||||
}
|
||||
if (peer_id.channel_id != 0 && !isMegagroup) {
|
||||
if (peer_id.channel_id != 0 && isChannel) {
|
||||
if (isSignature) {
|
||||
newMsg.from_id = new TLRPC.TL_peerUser();
|
||||
newMsg.from_id.user_id = myId;
|
||||
|
@ -1481,7 +1481,7 @@ public boolean retriedToSend;
|
|||
messagesByRandomIds.put(newMsg.random_id, newMsg);
|
||||
ids.add(newMsg.fwd_msg_id);
|
||||
newMsg.date = scheduleDate != 0 ? scheduleDate : getConnectionsManager().getCurrentTime();
|
||||
if (inputPeer instanceof TLRPC.TL_inputPeerChannel && !isMegagroup) {
|
||||
if (inputPeer instanceof TLRPC.TL_inputPeerChannel && isChannel) {
|
||||
if (scheduleDate == 0) {
|
||||
newMsg.views = 1;
|
||||
newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_VIEWS;
|
||||
|
@ -5053,7 +5053,7 @@ public boolean retriedToSend;
|
|||
}
|
||||
}
|
||||
}
|
||||
sentMessage.message = newMsg.message;
|
||||
newMsg.message = sentMessage.message;
|
||||
sentMessage.attachPath = newMsg.attachPath;
|
||||
newMsg.media.photo.id = sentMessage.media.photo.id;
|
||||
newMsg.media.photo.dc_id = sentMessage.media.photo.dc_id;
|
||||
|
|
|
@ -855,6 +855,20 @@ public class BottomSheet extends Dialog {
|
|||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
public void setUseLightStatusBar(boolean value) {
|
||||
useLightStatusBar = value;
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
int color = Theme.getColor(Theme.key_actionBarDefault, null, true);
|
||||
int flags = container.getSystemUiVisibility();
|
||||
if (useLightStatusBar && color == 0xffffffff) {
|
||||
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
} else {
|
||||
flags &=~ View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
}
|
||||
container.setSystemUiVisibility(flags);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFocusable() {
|
||||
return focusable;
|
||||
}
|
||||
|
|
|
@ -12311,26 +12311,35 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
endReached[loadIndex] = true;
|
||||
}
|
||||
|
||||
if (isThreadChat() && load_type == 0 && forwardEndReached[0] && !pendingSendMessages.isEmpty()) {
|
||||
int pasteIndex = 0;
|
||||
int date = pendingSendMessages.get(0).messageOwner.date;
|
||||
if (!messArr.isEmpty()) {
|
||||
if (date >= messArr.get(0).messageOwner.date) {
|
||||
pasteIndex = 0;
|
||||
} else if (date <= messArr.get(messArr.size() - 1).messageOwner.date) {
|
||||
pasteIndex = messArr.size();
|
||||
} else {
|
||||
for (int a = 0, N = messArr.size(); a < N - 1; a++) {
|
||||
if (messArr.get(a).messageOwner.date >= date && messArr.get(a + 1).messageOwner.date <= date) {
|
||||
pasteIndex = a + 1;
|
||||
if (load_type == 0 && forwardEndReached[0] && !pendingSendMessages.isEmpty()) {
|
||||
for (int a = 0, N = messArr.size(); a < N; a++) {
|
||||
MessageObject existing = pendingSendMessagesDict.get(messArr.get(a).getId());
|
||||
if (existing != null) {
|
||||
pendingSendMessagesDict.remove(existing.getId());
|
||||
pendingSendMessages.remove(existing);
|
||||
}
|
||||
}
|
||||
if (!pendingSendMessages.isEmpty()) {
|
||||
int pasteIndex = 0;
|
||||
int date = pendingSendMessages.get(0).messageOwner.date;
|
||||
if (!messArr.isEmpty()) {
|
||||
if (date >= messArr.get(0).messageOwner.date) {
|
||||
pasteIndex = 0;
|
||||
} else if (date <= messArr.get(messArr.size() - 1).messageOwner.date) {
|
||||
pasteIndex = messArr.size();
|
||||
} else {
|
||||
for (int a = 0, N = messArr.size(); a < N - 1; a++) {
|
||||
if (messArr.get(a).messageOwner.date >= date && messArr.get(a + 1).messageOwner.date <= date) {
|
||||
pasteIndex = a + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
messArr = new ArrayList<>(messArr);
|
||||
messArr.addAll(pasteIndex, pendingSendMessages);
|
||||
pendingSendMessages.clear();
|
||||
pendingSendMessagesDict.clear();
|
||||
}
|
||||
messArr = new ArrayList<>(messArr);
|
||||
messArr.addAll(pasteIndex, pendingSendMessages);
|
||||
pendingSendMessages.clear();
|
||||
pendingSendMessagesDict.clear();
|
||||
}
|
||||
|
||||
if (!threadMessageAdded && isThreadChat() && (load_type == 0 && messArr.size() < count || (load_type == 2 || load_type == 3) && endReached[0])) {
|
||||
|
@ -14832,10 +14841,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (messageId > 0 && messageId <= (messageObject.isOut() ? threadMaxOutboxReadId : threadMaxInboxReadId)) {
|
||||
messageObject.setIsRead();
|
||||
}
|
||||
if (!forwardEndReached[0] && messageId < 0) {
|
||||
pendingSendMessagesDict.put(messageId, messageObject);
|
||||
pendingSendMessages.add(messageObject);
|
||||
}
|
||||
}
|
||||
if (currentEncryptedChat == null && !forwardEndReached[0] && messageId < 0) {
|
||||
pendingSendMessagesDict.put(messageId, messageObject);
|
||||
pendingSendMessages.add(0, messageObject);
|
||||
}
|
||||
if (messageObject.isDice() && !messageObject.isForwarded()) {
|
||||
messageObject.wasUnread = true;
|
||||
|
@ -16436,7 +16445,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
|
||||
private boolean hidePinnedMessageView(boolean animated) {
|
||||
if (pinnedMessageView.getTag() == null) {
|
||||
if (pinnedMessageView != null && pinnedMessageView.getTag() == null) {
|
||||
for (int a = 0; a < pinnedNextAnimation.length; a++) {
|
||||
if (pinnedNextAnimation[a] != null) {
|
||||
pinnedNextAnimation[a].cancel();
|
||||
|
@ -20718,6 +20727,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
|
||||
private void openOriginalReplyChat(MessageObject messageObject) {
|
||||
if (UserObject.isUserSelf(currentUser) && messageObject.messageOwner.fwd_from.saved_from_peer.user_id == currentUser.id) {
|
||||
scrollToMessageId(messageObject.messageOwner.fwd_from.saved_from_msg_id, messageObject.getId(), true, 0, true, 0);
|
||||
return;
|
||||
}
|
||||
Bundle args = new Bundle();
|
||||
if (messageObject.messageOwner.fwd_from.saved_from_peer.channel_id != 0) {
|
||||
args.putInt("chat_id", messageObject.messageOwner.fwd_from.saved_from_peer.channel_id);
|
||||
|
|
|
@ -4404,7 +4404,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
|||
}
|
||||
return;
|
||||
}
|
||||
CharSequence[] message = new CharSequence[]{messageEditText.getText()};
|
||||
CharSequence[] message = new CharSequence[]{AndroidUtilities.getTrimmedString(messageEditText.getText())};
|
||||
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(currentAccount).getEntities(message, supportsSendingNewEntities());
|
||||
if (!TextUtils.equals(message[0], editingMessageObject.messageText) || entities != null && !entities.isEmpty() || editingMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) {
|
||||
editingMessageObject.editingMessage = message[0];
|
||||
|
|
|
@ -263,7 +263,9 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
|||
emptyView.showProgress(!dialogsSearchAdapter.isSearching(), false);
|
||||
emptyView.showProgress(dialogsSearchAdapter.isSearching(), false);
|
||||
} else {
|
||||
emptyView.showProgress(dialogsSearchAdapter.isSearching(), true);
|
||||
if (!dialogsSearchAdapter.hasRecentSearch()) {
|
||||
emptyView.showProgress(dialogsSearchAdapter.isSearching(), true);
|
||||
}
|
||||
}
|
||||
if (reset) {
|
||||
noMediaFiltersSearchView.setVisibility(View.GONE);
|
||||
|
|
|
@ -1799,6 +1799,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
|
|||
actionBarAnimation.cancel();
|
||||
actionBarAnimation = null;
|
||||
}
|
||||
setUseLightStatusBar(actionBar.getTag() == null);
|
||||
|
||||
actionBar.getBackButton().animate()
|
||||
.scaleX(show ? 1.0f : 0.9f)
|
||||
|
|
|
@ -2087,6 +2087,16 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (view == null) {
|
||||
view = listView.getChildAt(0);
|
||||
if (view != null) {
|
||||
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(view);
|
||||
pos = holder.getAdapterPosition();
|
||||
if (pos == RecyclerView.NO_POSITION) {
|
||||
pos = holder.getPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int top = 0;
|
||||
if (view != null) {
|
||||
|
|
Loading…
Reference in New Issue