Skip to content

Commit

Permalink
Update to 6.2.0 (1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Jun 5, 2020
1 parent e2f7baf commit f424ea1
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 103 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ android {
}
}

defaultConfig.versionCode = 1985
defaultConfig.versionCode = 1986

def tgVoipDexFileName = "libtgvoip.dex"
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1985;
public static int BUILD_VERSION = 1986;
public static String BUILD_VERSION_STRING = "6.2.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2046,8 +2046,8 @@ private void calcUnreadCounters(boolean apply) {
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
}
if ((flags & flag) != 0) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0)) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0)) {
unreadCount--;
}
}
Expand Down Expand Up @@ -3537,15 +3537,23 @@ public void markMessageAsMention(final long mid) {
public void resetMentionsCount(final long did, final int count) {
storageQueue.postRunnable(() -> {
try {
if (count == 0) {
database.executeFast(String.format(Locale.US, "UPDATE messages SET read_state = read_state | 2 WHERE uid = %d AND mention = 1 AND read_state IN(0, 1)", did)).stepThis().dispose();
int prevUnreadCount = 0;
SQLiteCursor cursor = database.queryFinalized("SELECT unread_count_i FROM dialogs WHERE did = " + did);
if (cursor.next()) {
prevUnreadCount = cursor.intValue(0);
}
database.executeFast(String.format(Locale.US, "UPDATE dialogs SET unread_count_i = %d WHERE did = %d", count, did)).stepThis().dispose();
LongSparseArray<Integer> sparseArray = new LongSparseArray<>(1);
sparseArray.put(did, count);
getMessagesController().processDialogsUpdateRead(null, sparseArray);
if (count == 0) {
updateFiltersReadCounter(null, sparseArray, true);
cursor.dispose();
if (prevUnreadCount != 0 || count != 0) {
if (count == 0) {
database.executeFast(String.format(Locale.US, "UPDATE messages SET read_state = read_state | 2 WHERE uid = %d AND mention = 1 AND read_state IN(0, 1)", did)).stepThis().dispose();
}
database.executeFast(String.format(Locale.US, "UPDATE dialogs SET unread_count_i = %d WHERE did = %d", count, did)).stepThis().dispose();
LongSparseArray<Integer> sparseArray = new LongSparseArray<>(1);
sparseArray.put(did, count);
getMessagesController().processDialogsUpdateRead(null, sparseArray);
if (count == 0) {
updateFiltersReadCounter(null, sparseArray, true);
}
}
} catch (Exception e) {
FileLog.e(e);
Expand Down Expand Up @@ -3967,74 +3975,6 @@ private void updateFiltersReadCounter(LongSparseArray<Integer> dialogsToUpdate,
}
}
if (filter != null) {
for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
int did = filter.alwaysShow.get(b);
if (did > 0) {
TLRPC.User user = usersDict.get(did);
if (user != null) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
unreadCount--;
} else {
if (user.bot) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) == 0) {
unreadCount--;
}
} else if (user.self || user.contact) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) == 0) {
unreadCount--;
}
} else {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) == 0) {
unreadCount--;
}
}
}
}
user = encUsersDict.get(did);
if (user != null) {
int count = encryptedChatsByUsersCount.get(did, 0);
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
unreadCount -= count;
} else {
if (user.bot) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) == 0) {
unreadCount -= count;
}
} else if (user.self || user.contact) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) == 0) {
unreadCount -= count;
}
} else {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) == 0) {
unreadCount -= count;
}
}
}
}
} else {
TLRPC.Chat chat = chatsDict.get(-did);
if (chat != null) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(-chat.id) >= 0 && dialogsWithMentions.indexOfKey(-chat.id) < 0 && dialogsWithUnread.indexOfKey(-chat.id) < 0) {
unreadCount--;
} else {
if (ChatObject.isChannel(chat) && !chat.megagroup) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) == 0) {
unreadCount--;
}
} else {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) == 0) {
boolean hasUnread = dialogsWithUnread.indexOfKey(did) >= 0;
boolean hasMention = dialogsWithMentions.indexOfKey(did) >= 0;
if (!hasUnread && !hasMention) {
unreadCount--;
}
}
}
}
}
}
}

for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
int did = filter.alwaysShow.get(b);
if (did > 0) {
Expand Down Expand Up @@ -4132,8 +4072,8 @@ private void updateFiltersReadCounter(LongSparseArray<Integer> dialogsToUpdate,
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
}
if ((flags & flag) != 0) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0)) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0)) {
unreadCount++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.graphics.drawable.Drawable;
import android.os.Build;
import androidx.annotation.Keep;

import android.view.DisplayCutout;
import android.view.Gravity;
import android.view.MotionEvent;
Expand Down Expand Up @@ -468,6 +469,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
}
}
inLayout = false;
} else {
AndroidUtilities.displaySize.y = heightSize - AndroidUtilities.statusBarHeight;
}

final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ public boolean onTouchEvent(MotionEvent event) {
showMagnifier(lastX);
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
hideMagnifier();
movingHandle = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13745,6 +13745,7 @@ protected void setInPreviewMode(boolean value) {
}
}
}
chatListView.setItemAnimator(null);
}
updateBottomOverlay();
updateSecretStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void requestLayout() {
@Override
protected void onDraw(Canvas canvas) {
int top = scrollOffsetY - backgroundPaddingTop - AndroidUtilities.dp(8);
int height = getMeasuredHeight() + AndroidUtilities.dp(28) + backgroundPaddingTop;
int height = getMeasuredHeight() + AndroidUtilities.dp(36) + backgroundPaddingTop;
int statusBarHeight = 0;
float radProgress = 1.0f;
if (Build.VERSION.SDK_INT >= 21) {
Expand Down Expand Up @@ -360,7 +360,11 @@ public MessagesController.DialogFilter getItem(int position) {

@Override
public int getItemCount() {
return dialogFilters.size() + 1;
int count = dialogFilters.size();
if (count < 10) {
count++;
}
return count;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ private void ensurePleyaerCreated() {
} else {
factory = new DefaultRenderersFactory(ApplicationLoader.applicationContext);
}
factory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER);
player = ExoPlayerFactory.newSimpleInstance(ApplicationLoader.applicationContext, factory, trackSelector, loadControl, null);

player.addListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2045,7 +2045,7 @@ private void runLinkRequest(final int intentAccount,
boolean hideProgressDialog = true;
if (error == null && actionBarLayout != null) {
TLRPC.ChatInvite invite = (TLRPC.ChatInvite) response;
if (invite.chat != null && (!ChatObject.isLeftFromChat(invite.chat) || !invite.chat.kicked && !TextUtils.isEmpty(invite.chat.username))) {
if (invite.chat != null && (!ChatObject.isLeftFromChat(invite.chat) || !invite.chat.kicked && (!TextUtils.isEmpty(invite.chat.username) || BuildVars.DEBUG_PRIVATE_VERSION))) {
MessagesController.getInstance(intentAccount).putChat(invite.chat, false);
ArrayList<TLRPC.Chat> chats = new ArrayList<>();
chats.add(invite.chat);
Expand Down
Loading

0 comments on commit f424ea1

Please sign in to comment.