Update to 8.1.1 (2431)

This commit is contained in:
xaxtix 2021-09-21 12:51:08 +03:00
parent 42feed0f42
commit 58aded63e9
17 changed files with 1125 additions and 1054 deletions

View file

@ -2242,33 +2242,12 @@ public class AndroidUtilities {
}*/
public static void startAppCenter(Activity context) {
// if (BuildConfig.DEBUG) {
// return;
// }
// try {
// if (BuildVars.DEBUG_VERSION) {
// Distribute.setEnabledForDebuggableBuild(true);
// AppCenter.start(context.getApplication(), BuildVars.DEBUG_VERSION ? BuildVars.APPCENTER_HASH_DEBUG : BuildVars.APPCENTER_HASH, Distribute.class, Crashes.class);
// AppCenter.setUserId("uid=" + UserConfig.getInstance(UserConfig.selectedAccount).clientUserId);
// }
// } catch (Throwable e) {
// FileLog.e(e);
// }
}
private static long lastUpdateCheckTime;
public static void checkForUpdates() {
// try {
// if (BuildVars.DEBUG_VERSION) {
// if (SystemClock.elapsedRealtime() - lastUpdateCheckTime < 60 * 60 * 1000) {
// return;
// }
// lastUpdateCheckTime = SystemClock.elapsedRealtime();
// Distribute.checkForUpdate();
// }
// } catch (Throwable e) {
// FileLog.e(e);
// }
}
public static void addToClipboard(CharSequence str) {

View file

@ -19,8 +19,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/;
public static int BUILD_VERSION = 2428;
public static String BUILD_VERSION_STRING = "8.0.1";
public static int BUILD_VERSION = 2431;
public static String BUILD_VERSION_STRING = "8.1.1";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");

View file

@ -99,6 +99,7 @@ public class MessagesStorage extends BaseController {
private static volatile MessagesStorage[] Instance = new MessagesStorage[UserConfig.MAX_ACCOUNT_COUNT];
private final static int LAST_DB_VERSION = 84;
private boolean databaseMigrationInProgress;
public static MessagesStorage getInstance(int num) {
MessagesStorage localInstance = Instance[num];
@ -469,13 +470,18 @@ public class MessagesStorage extends BaseController {
}
}
private void updateDbToLastVersion(int currentVersion) {
public boolean isDatabaseMigrationInProgress() {
return databaseMigrationInProgress;
}
private void updateDbToLastVersion(int currentVersion) throws Exception {
AndroidUtilities.runOnUIThread(() -> {
databaseMigrationInProgress = true;
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.onDatabaseMigration, true);
});
storageQueue.postRunnable(() -> {
try {
int version = currentVersion;
FileLog.d("MessagesStorage start db migration from " + version + " to " + LAST_DB_VERSION);
if (version < 4) {
database.executeFast("CREATE TABLE IF NOT EXISTS user_photos(uid INTEGER, id INTEGER, data BLOB, PRIMARY KEY (uid, id))").stepThis().dispose();
@ -1257,12 +1263,9 @@ public class MessagesStorage extends BaseController {
database.beginTransaction();
SQLiteCursor cursor;
try {
cursor = database.queryFinalized("SELECT mid, uid, read_state, send_state, date, data, out, ttl, media, replydata, imp, mention, forwards, replies_data, thread_reply_id FROM messages WHERE 1");
} catch (Exception e) {
cursor = null;
FileLog.e(e);
}
if (cursor != null) {
SQLitePreparedStatement statement = database.executeFast("REPLACE INTO messages_v2 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
int num = 0;
@ -1446,14 +1449,13 @@ public class MessagesStorage extends BaseController {
if (version == 84) {
}
} catch (Exception e) {
FileLog.e(e);
}
FileLog.d("MessagesStorage db migration finished");
AndroidUtilities.runOnUIThread(() -> {
databaseMigrationInProgress = false;
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.onDatabaseMigration, false);
});
});
}
private void executeNoException(String query) {
@ -2285,6 +2287,7 @@ public class MessagesStorage extends BaseController {
private int[] mentionGroups = new int[2];
private LongSparseArray<Integer> dialogsWithMentions = new LongSparseArray<>();
private LongSparseArray<Integer> dialogsWithUnread = new LongSparseArray<>();
private void calcUnreadCounters(boolean apply) {
try {
for (int a = 0; a < 2; a++) {

View file

@ -29,13 +29,14 @@ public class OpenChatReceiver extends Activity {
return;
}
try {
long chatId = intent.getLongExtra("chatId", 0);
long userId = intent.getLongExtra("userId", 0);
long chatId = intent.getLongExtra("chatId", intent.getIntExtra("chatId", 0));
long userId = intent.getLongExtra("userId", intent.getIntExtra("userId", 0));
int encId = intent.getIntExtra("encId", 0);
if (chatId == 0 && userId == 0 && encId == 0) {
return;
}
} catch (Throwable e) {
FileLog.e(e);
return;
}
Intent intent2 = new Intent(this, LaunchActivity.class);

View file

@ -155,8 +155,10 @@ public class ChatTheme {
public void loadWallpaperThumb(boolean isDark, ResultCallback<Pair<Long, Bitmap>> callback) {
final TLRPC.WallPaper wallpaper = getWallpaper(isDark);
if (wallpaper == null && callback != null) {
if (wallpaper == null) {
if (callback != null) {
callback.onComplete(null);
}
return;
}

View file

@ -316,7 +316,7 @@ public class Theme {
} else {
num = currentType == TYPE_PREVIEW ? 1 : 0;
}
if (gradientColor2 != 0 && animatedGradient && motionBackground[num] != null) {
if (!isCrossfadeBackground && gradientColor2 != 0 && animatedGradient && motionBackground[num] != null) {
int[] colors = motionBackground[num].getColors();
currentColor = colors[0];
currentGradientColor1 = colors[1];
@ -325,8 +325,10 @@ public class Theme {
}
if (isCrossfadeBackground && gradientColor2 != 0 && animatedGradient) {
if (backgroundHeight != currentBackgroundHeight || crosfadeFromBitmapShader == null || currentColor != color || currentGradientColor1 != gradientColor1 || currentGradientColor2 != gradientColor2 || currentGradientColor3 != gradientColor3 || currentAnimateGradient != animatedGradient) {
if (crosfadeFromBitmap == null) {
crosfadeFromBitmap = Bitmap.createBitmap(60, 80, Bitmap.Config.ARGB_8888);
crosfadeFromBitmapShader = new BitmapShader(crosfadeFromBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
}
if (motionBackground[num] == null) {
motionBackground[num] = new MotionBackgroundDrawable();
if (currentType != TYPE_PREVIEW) {

View file

@ -28,6 +28,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLog;
@ -155,6 +156,9 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
dialogsCount = array.size();
if (!forceShowEmptyCell && dialogsType != 7 && dialogsType != 8 && dialogsType != 11 && dialogsCount == 0 && (folderId != 0 || messagesController.isLoadingDialogs(folderId) || !MessagesController.getInstance(currentAccount).isDialogsEndReached(folderId))) {
onlineContacts = null;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("DialogsAdapter dialogsCount=" + dialogsCount + " dialogsType=" + dialogsType + " isLoadingDialogs=" + messagesController.isLoadingDialogs(folderId) + " isDialogsEndReached=" + MessagesController.getInstance(currentAccount).isDialogsEndReached(folderId));
}
if (folderId == 1 && showArchiveHint) {
return (currentCount = 2);
}
@ -176,6 +180,9 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
} else if (dialogsType == 0 && messagesController.dialogs_dict.size() <= 10 && folderId == 0 && messagesController.isDialogsEndReached(folderId)) {
if (ContactsController.getInstance(currentAccount).contacts.isEmpty() && !ContactsController.getInstance(currentAccount).doneLoadingContacts) {
onlineContacts = null;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("DialogsAdapter loadingContacts=" + (ContactsController.getInstance(currentAccount).contacts.isEmpty() && !ContactsController.getInstance(currentAccount).doneLoadingContacts) + "dialogsCount=" + dialogsCount + " dialogsType=" + dialogsType);
}
return (currentCount = 0);
}
@ -224,6 +231,10 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
count += 1;
}
currentCount = count;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("DialogsAdapter dialogsCount=" + dialogsCount + " dialogsType=" + dialogsType);
}
return count;
}

View file

@ -8039,7 +8039,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void openAnotherForward() {
if (forwardingMessages == null) {
if (forwardingMessages == null || forwardingMessages.messages == null) {
return;
}
boolean fewSenders = false;
@ -8063,7 +8063,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
message = LocaleController.formatString("CancelForwardPrivate", R.string.CancelForwardPrivate, LocaleController.formatPluralString("MessagesBold", forwardingMessages.messages.size()), ContactsController.formatName(user.first_name, user.last_name));
} else {
TLRPC.Chat chat = getMessagesController().getChat(-dialogId);
message = LocaleController.formatString("CancelForwardChat", R.string.CancelForwardChat, LocaleController.formatPluralString("MessagesBold", forwardingMessages.messages.size()), chat.title);
message = LocaleController.formatString("CancelForwardChat", R.string.CancelForwardChat, LocaleController.formatPluralString("MessagesBold", forwardingMessages.messages.size()), chat == null ? "" : chat.title);
}
builder.setMessage(AndroidUtilities.replaceTags(message));
builder.setTitle(LocaleController.formatPluralString("messages", forwardingMessages.messages.size()));
@ -19956,7 +19956,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean showMessageSeen = currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count < 50;
MessageSeenView messageSeenView = null;
if (showMessageSeen) {
messageSeenView = new MessageSeenView(contentView.getContext(), currentAccount, message);
messageSeenView = new MessageSeenView(contentView.getContext(), currentAccount, message, currentChat);
Drawable shadowDrawable2 = ContextCompat.getDrawable(contentView.getContext(), R.drawable.popup_fixed_alert).mutate();
shadowDrawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY));
FrameLayout messageSeenLayout = new FrameLayout(contentView.getContext());
@ -20116,7 +20116,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
args.putLong("user_id", user.id);
ProfileActivity fragment = new ProfileActivity(args);
presentFragment(fragment);
if (mesageSeenUsersPopupWindow != null) {
mesageSeenUsersPopupWindow.dismiss();
}
});
}
});
@ -24648,7 +24650,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(alertNameTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelTitle));
themeDescriptions.add(new ThemeDescription(alertTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelMessage));
themeDescriptions.add(new ThemeDescription(closePinned, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose));
themeDescriptions.add(new ThemeDescription(pinnedListButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelTitle));
themeDescriptions.add(new ThemeDescription(pinnedListButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose));
themeDescriptions.add(new ThemeDescription(closeReportSpam, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose));
themeDescriptions.add(new ThemeDescription(topChatPanelView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_topPanelBackground));
themeDescriptions.add(new ThemeDescription(alertView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_topPanelBackground));
@ -25041,7 +25043,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
if (!setup) {
Theme.refreshThemeColors();
Theme.refreshThemeColors(true, false);
}
}
@ -25223,6 +25225,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
animatingMessageDrawable.crossfadeFromDrawable = parentLayout.messageDrawableOutStart;
animatingMessageMediaDrawable = (Theme.MessageDrawable) getThemedDrawable(Theme.key_drawable_msgOutMedia);
animatingMessageMediaDrawable.crossfadeFromDrawable = parentLayout.messageDrawableOutMediaStart;
animatingMessageDrawable.crossfadeProgress = 0f;
animatingMessageMediaDrawable.crossfadeProgress = 0f;
updateMessagesVisiblePart(false);
updateServiceMessageColor(0);
};
animationSettings.afterAnimationRunnable = () -> {
@ -25263,7 +25268,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
Theme.ThemeInfo activeTheme;
if (Theme.getActiveTheme().isDark() == isDark) {
activeTheme = Theme.getCurrentTheme();
activeTheme = Theme.getActiveTheme();
} else {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", Activity.MODE_PRIVATE);
String dayThemeName = preferences.getString("lastDayTheme", "Blue");
@ -25277,7 +25282,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
activeTheme = isDark ? Theme.getTheme(nightThemeName) : Theme.getTheme(dayThemeName);
}
Theme.applyTheme(activeTheme, false, isDark);
} else {
currentColors = chatTheme.getCurrentColors(currentAccount, isDark);

View file

@ -153,7 +153,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen
recyclerView.setLayoutManager(layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
recyclerView.setPadding(AndroidUtilities.dp(12), 0, AndroidUtilities.dp(12), 0);
recyclerView.setOnItemClickListener((view, position) -> {
if (adapter.items.get(position) == selectedItem) {
if (adapter.items.get(position) == selectedItem || changeDayNightView != null) {
return;
}
selectedItem = adapter.items.get(position);
@ -855,6 +855,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen
drawable.setPatternBitmap(intensity >= 0 ? 100 : -100, result.second);
drawable.setPatternColorFilter(drawable.getPatternColor());
}
invalidate();
}
});
}
@ -965,7 +966,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen
noThemeTextPaint.setTextSize(AndroidUtilities.dp(14));
noThemeTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textLayout = StaticLayoutEx.createStaticLayout2(
LocaleController.getString("NoTheme", R.string.ChatNoTheme),
LocaleController.getString("ChatNoTheme", R.string.ChatNoTheme),
noThemeTextPaint,
AndroidUtilities.dp(52),
Layout.Alignment.ALIGN_CENTER,

View file

@ -2829,7 +2829,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
}
private boolean onItemLongClick(MessageObject item, View view, int a) {
if (isActionModeShowed || profileActivity.getParentActivity() == null) {
if (isActionModeShowed || profileActivity.getParentActivity() == null || item == null) {
return false;
}
AndroidUtilities.hideKeyboard(profileActivity.getParentActivity().getCurrentFocus());

View file

@ -3,6 +3,8 @@ package org.telegram.ui;
import android.content.Context;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -60,6 +62,11 @@ public class DatabaseMigrationHint extends FrameLayout {
addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
});
}
}

View file

@ -736,7 +736,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (child == null || child.getVisibility() == GONE || child == commentView || child == actionBar) {
continue;
}
if (child instanceof ViewPage) {
if (child instanceof DatabaseMigrationHint) {
int contentWidthSpec = View.MeasureSpec.makeMeasureSpec(widthSize, View.MeasureSpec.EXACTLY);
int h = View.MeasureSpec.getSize(heightMeasureSpec) + keyboardSize;
int contentHeightSpec = View.MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10), h - inputFieldHeight + AndroidUtilities.dp(2) - actionBar.getMeasuredHeight()), View.MeasureSpec.EXACTLY);
child.measure(contentWidthSpec, contentHeightSpec);
} else if (child instanceof ViewPage) {
int contentWidthSpec = View.MeasureSpec.makeMeasureSpec(widthSize, View.MeasureSpec.EXACTLY);
int h;
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
@ -850,6 +855,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
childTop = actionBar.getMeasuredHeight();
} else if (child == searchViewPager) {
childTop = (onlySelect ? 0 : actionBar.getMeasuredHeight()) + topPadding + (searchTabsView == null ? 0 : AndroidUtilities.dp(44));
} else if (child instanceof DatabaseMigrationHint) {
childTop = actionBar.getMeasuredHeight();
} else if (child instanceof ViewPage) {
if (!onlySelect) {
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
@ -1815,18 +1822,24 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
getNotificationCenter().addObserver(this, NotificationCenter.fileLoaded);
getNotificationCenter().addObserver(this, NotificationCenter.fileLoadFailed);
getNotificationCenter().addObserver(this, NotificationCenter.fileLoadProgressChanged);
getNotificationCenter().addObserver(this, NotificationCenter.onDatabaseMigration);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetPasscode);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.appUpdateAvailable);
}
getNotificationCenter().addObserver(this, NotificationCenter.messagesDeleted);
getNotificationCenter().addObserver(this, NotificationCenter.onDatabaseMigration);
getNotificationCenter().addObserver(this, NotificationCenter.didClearDatabase);
loadDialogs(getAccountInstance());
getMessagesController().loadPinnedDialogs(folderId, 0, null);
if (databaseMigrationHint != null && !getMessagesStorage().isDatabaseMigrationInProgress()) {
View localView = databaseMigrationHint;
if (localView.getParent() != null) {
((ViewGroup) localView.getParent()).removeView(localView);
}
databaseMigrationHint = null;
}
return true;
}
@ -1887,6 +1900,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.appUpdateAvailable);
}
getNotificationCenter().removeObserver(this, NotificationCenter.onDatabaseMigration);
getNotificationCenter().removeObserver(this, NotificationCenter.didClearDatabase);
if (commentView != null) {
commentView.onDestroy();
@ -2056,7 +2070,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
public boolean canToggleSearch() {
return !actionBar.isActionModeShowed();
return !actionBar.isActionModeShowed() && databaseMigrationHint == null;
}
});
searchItem.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
@ -4530,7 +4544,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
private void updateFilterTabsVisibility(boolean animated) {
if (isPaused) {
if (isPaused || databaseMigrationHint != null) {
animated = false;
}
if (searchIsShowed) {
@ -6539,22 +6553,21 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
((ContentView) fragmentView).addView(databaseMigrationHint);
databaseMigrationHint.animate().alpha(1).setDuration(300).setStartDelay(1000).start();
}
databaseMigrationHint.setTag(1);
} else {
if (databaseMigrationHint != null) {
if (databaseMigrationHint != null && databaseMigrationHint.getTag() != null) {
View localView = databaseMigrationHint;
localView.animate().setListener(null).cancel();
localView.animate().setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (localView.getParent() != null) {
((ContentView) fragmentView).removeView(localView);
((ViewGroup) localView.getParent()).removeView(localView);
}
}
}).alpha(0f).setDuration(150).start();
databaseMigrationHint = null;
}
}).alpha(0f).setStartDelay(0).setDuration(150).start();
databaseMigrationHint.setTag(null);
}
}
}

View file

@ -55,8 +55,10 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
ArrayList<Integer> animationIndexes = new ArrayList<>();
Runnable sentInteractionsRunnable;
Runnable hintRunnable;
private final static HashSet<String> supportedEmoji = new HashSet<>();
private final static HashSet<String> excludeEmojiFromPack = new HashSet<>();
static {
// 1, 2, 3... etc
excludeEmojiFromPack.add("\u0030\u20E3");
@ -93,12 +95,14 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
checkStickerPack();
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.diceStickersDidLoad);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.onEmojiInteractionsReceived);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces);
}
protected void onDetachedFromWindow() {
attached = false;
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.diceStickersDidLoad);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.onEmojiInteractionsReceived);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces);
}
public void checkStickerPack() {
@ -174,6 +178,11 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
}
}
} else if (id == NotificationCenter.updateInterfaces) {
Integer printingType = MessagesController.getInstance(currentAccount).getPrintingStringType(dialogId, threadMsgId);
if (printingType != null && printingType == 5) {
cancelHintRunnable();
}
}
}
@ -262,7 +271,13 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
if (show && !EmojiData.hasEmojiSupportVibration(view.getMessageObject().getStickerEmoji())) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
if ((Bulletin.getVisibleBulletin() == null || !Bulletin.getVisibleBulletin().isShowing()) && SharedConfig.emojiInteractionsHintCount > 0) {
Integer printingType = MessagesController.getInstance(currentAccount).getPrintingStringType(dialogId, threadMsgId);
boolean canShowHint = true;
if (printingType != null && printingType == 5) {
canShowHint = false;
}
if (canShowHint && hintRunnable == null && show && (Bulletin.getVisibleBulletin() == null || !Bulletin.getVisibleBulletin().isShowing()) && SharedConfig.emojiInteractionsHintCount > 0) {
SharedConfig.updateEmojiInteractionsHintCount(SharedConfig.emojiInteractionsHintCount - 1);
TLRPC.Document document = MediaDataController.getInstance(currentAccount).getEmojiAnimatedSticker(view.getMessageObject().getStickerEmoji());
StickerSetBulletinLayout layout = new StickerSetBulletinLayout(chatActivity.getParentActivity(), null, StickerSetBulletinLayout.TYPE_EMPTY, document, chatActivity.getResourceProvider());
@ -271,8 +286,22 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
layout.titleTextView.setTypeface(null);
layout.titleTextView.setMaxLines(3);
layout.titleTextView.setSingleLine(false);
Bulletin.make(chatActivity, layout, Bulletin.DURATION_LONG).show();
Bulletin bulletin = Bulletin.make(chatActivity, layout, Bulletin.DURATION_LONG);
AndroidUtilities.runOnUIThread(hintRunnable = new Runnable() {
@Override
public void run() {
bulletin.show();
hintRunnable = null;
}
}, 1500);
}
}
public void cancelHintRunnable() {
if (hintRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(hintRunnable);
}
hintRunnable = null;
}
private boolean showAnimationForCell(ChatMessageCell view, int animation, boolean sendTap, boolean sendSeen) {
@ -351,7 +380,8 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
if (lastTappedTime == 0) {
lastTappedTime = System.currentTimeMillis();
timeIntervals.clear();
animationIndexes.clear();;
animationIndexes.clear();
;
timeIntervals.add(0L);
animationIndexes.add(animation);
} else {

View file

@ -2109,8 +2109,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
} else if (intent.getAction().equals("new_dialog")) {
open_new_dialog = 1;
} else if (intent.getAction().startsWith("com.tmessages.openchat")) {
long chatId = intent.getLongExtra("chatId", 0);
long userId = intent.getLongExtra("userId", 0);
long chatId = intent.getLongExtra("chatId", intent.getIntExtra("chatId", 0));
long userId = intent.getLongExtra("userId", intent.getIntExtra("userId", 0));
int encId = intent.getIntExtra("encId", 0);
int widgetId = intent.getIntExtra("appWidgetId", 0);
if (widgetId != 0) {

View file

@ -1542,7 +1542,7 @@ public class LoginActivity extends BaseFragment {
private void setCountry(HashMap<String, String> languageMap, String country) {
String name = languageMap.get(country);
if (name != null) {
if (name != null && countriesArray != null) {
CountrySelectActivity.Country countryWithCode = null;
for (int i = 0; i < countriesArray.size(); i++) {
if (countriesArray.get(i) != null && countriesArray.get(i).name.equals(country)) {

View file

@ -21,8 +21,12 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessageObject;
@ -57,7 +61,7 @@ public class MessageSeenView extends FrameLayout {
FlickerLoadingView flickerLoadingView;
public MessageSeenView(@NonNull Context context, int currentAccount, MessageObject messageObject) {
public MessageSeenView(@NonNull Context context, int currentAccount, MessageObject messageObject, TLRPC.Chat chat) {
super(context);
this.currentAccount = currentAccount;
isVoice = (messageObject.isRoundVideo() || messageObject.isVoice());
@ -98,6 +102,7 @@ public class MessageSeenView extends FrameLayout {
}
long finalFromId = fromId;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
FileLog.e("MessageSeenView request completed");
if (error == null) {
TLRPC.Vector vector = (TLRPC.Vector) response;
ArrayList<Long> unknownUsers = new ArrayList<>();
@ -112,7 +117,7 @@ public class MessageSeenView extends FrameLayout {
}
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(peerId);
allPeers.add(peerId);
if (user == null) {
if (true || user == null) {
unknownUsers.add(peerId);
} else {
usersLocal.put(peerId, user);
@ -127,15 +132,17 @@ public class MessageSeenView extends FrameLayout {
}
updateView();
} else {
TLRPC.TL_users_getUsers usersReq = new TLRPC.TL_users_getUsers();
for (int i = 0; i < unknownUsers.size(); i++) {
usersReq.id.add(MessagesController.getInstance(currentAccount).getInputUser(unknownUsers.get(i)));
}
if (ChatObject.isChannel(chat)) {
TLRPC.TL_channels_getParticipants usersReq = new TLRPC.TL_channels_getParticipants();
usersReq.limit = 50;
usersReq.offset = 0;
usersReq.filter = new TLRPC.TL_channelParticipantsRecent();
usersReq.channel = MessagesController.getInstance(currentAccount).getInputChannel(chat.id);
ConnectionsManager.getInstance(currentAccount).sendRequest(usersReq, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> {
if (response1 != null) {
TLRPC.Vector users = (TLRPC.Vector) response1;
for (int i = 0; i < users.objects.size(); i++) {
TLRPC.User user = (TLRPC.User) users.objects.get(i);
TLRPC.TL_channels_channelParticipants users = (TLRPC.TL_channels_channelParticipants) response1;
for (int i = 0; i < users.users.size(); i++) {
TLRPC.User user = users.users.get(i);
MessagesController.getInstance(currentAccount).putUser(user, false);
usersLocal.put(user.id, user);
}
@ -146,6 +153,25 @@ public class MessageSeenView extends FrameLayout {
}
updateView();
}));
} else {
TLRPC.TL_messages_getFullChat usersReq = new TLRPC.TL_messages_getFullChat();
usersReq.chat_id = chat.id;
ConnectionsManager.getInstance(currentAccount).sendRequest(usersReq, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> {
if (response1 != null) {
TLRPC.TL_messages_chatFull chatFull = (TLRPC.TL_messages_chatFull) response1;
for (int i = 0; i < chatFull.users.size(); i++) {
TLRPC.User user = chatFull.users.get(i);
MessagesController.getInstance(currentAccount).putUser(user, false);
usersLocal.put(user.id, user);
}
for (int i = 0; i < allPeers.size(); i++) {
peerIds.add(allPeers.get(i));
this.users.add(usersLocal.get(allPeers.get(i)));
}
}
updateView();
}));
}
}
} else {
updateView();

View file

@ -4742,14 +4742,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
} else if (id == NotificationCenter.reloadInterface) {
int prevEmptyRow = emptyRow;
updateRowsIds();
if (listAdapter != null && prevEmptyRow != emptyRow) {
if (emptyRow == -1) {
listAdapter.notifyItemRemoved(emptyRow);
} else {
listAdapter.notifyItemInserted(emptyRow);
}
}
updateListAnimated(false);
} else if (id == NotificationCenter.newSuggestionsAvailable) {
int prevRow1 = passwordSuggestionRow;
int prevRow2 = phoneSuggestionRow;
@ -6847,9 +6840,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
getMessagesController().removeSuggestion(0, type == SettingsSuggestionCell.TYPE_PHONE ? "VALIDATE_PHONE_NUMBER" : "VALIDATE_PASSWORD");
getNotificationCenter().addObserver(ProfileActivity.this, NotificationCenter.newSuggestionsAvailable);
int oldRow = type == SettingsSuggestionCell.TYPE_PHONE ? phoneSuggestionRow : passwordSuggestionRow;
updateRowsIds();
saveScrollPosition();
listAdapter.notifyItemRangeRemoved(oldRow, 2);
updateListAnimated(false);
}
@Override
@ -8106,7 +8097,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
int oldIndex = oldPositionToItem.get(oldItemPosition, -1);
int newIndex = newPositionToItem.get(newItemPosition, -1);
return oldIndex == newIndex && oldIndex >= 0 && newIndex >= 0;
return oldIndex == newIndex && oldIndex >= 0;
}
@Override