mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
update to 9.5.4
This commit is contained in:
parent
07a2c9a330
commit
c06f56dcad
53 changed files with 1298 additions and 526 deletions
|
@ -887,13 +887,7 @@ void ConnectionsManager::onConnectionDataReceived(Connection *connection, Native
|
|||
}
|
||||
|
||||
deserializingDatacenter = datacenter;
|
||||
bool error = false;
|
||||
uint32_t constructor = data->readUint32(&error);
|
||||
TLObject *object = request->deserializeResponse(data, constructor, instanceNum, error);
|
||||
if (object != nullptr && error) {
|
||||
delete object;
|
||||
object = nullptr;
|
||||
}
|
||||
TLObject *object = TLdeserialize(request, messageLength, data);
|
||||
|
||||
if (object != nullptr) {
|
||||
if (datacenter->isHandshaking(connection->isMediaConnection)) {
|
||||
|
|
|
@ -59,6 +59,7 @@ import android.telephony.TelephonyManager;
|
|||
import android.text.Layout;
|
||||
import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.SpannedString;
|
||||
|
@ -136,6 +137,7 @@ import org.telegram.ui.Components.AlertsCreator;
|
|||
import org.telegram.ui.Components.BackgroundGradientDrawable;
|
||||
import org.telegram.ui.Components.Bulletin;
|
||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
import org.telegram.ui.Components.EllipsizeSpanAnimator;
|
||||
import org.telegram.ui.Components.ForegroundColorSpanThemable;
|
||||
import org.telegram.ui.Components.ForegroundDetector;
|
||||
import org.telegram.ui.Components.HideViewAfterAnimation;
|
||||
|
@ -185,6 +187,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -3436,24 +3439,25 @@ public class AndroidUtilities {
|
|||
return openForView(f, fileName, document.mime_type, activity, null);
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder formatSpannableSimple(String format, CharSequence... cs) {
|
||||
public static SpannableStringBuilder formatSpannableSimple(CharSequence format, CharSequence... cs) {
|
||||
return formatSpannable(format, i -> "%s", cs);
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder formatSpannable(String format, CharSequence... cs) {
|
||||
if (format.contains("%s"))
|
||||
public static SpannableStringBuilder formatSpannable(CharSequence format, CharSequence... cs) {
|
||||
if (format.toString().contains("%s"))
|
||||
return formatSpannableSimple(format, cs);
|
||||
return formatSpannable(format, i -> "%" + (i + 1) + "$s", cs);
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder formatSpannable(String format, GenericProvider<Integer, String> keysProvider, CharSequence... cs) {
|
||||
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(format);
|
||||
public static SpannableStringBuilder formatSpannable(CharSequence format, GenericProvider<Integer, String> keysProvider, CharSequence... cs) {
|
||||
String str = format.toString();
|
||||
SpannableStringBuilder stringBuilder = SpannableStringBuilder.valueOf(format);
|
||||
for (int i = 0; i < cs.length; i++) {
|
||||
String key = keysProvider.provide(i);
|
||||
int j = format.indexOf(key);
|
||||
int j = str.indexOf(key);
|
||||
if (j != -1) {
|
||||
stringBuilder.replace(j, j + key.length(), cs[i]);
|
||||
format = format.substring(0, j) + cs[i].toString() + format.substring(j + key.length());
|
||||
str = str.substring(0, j) + cs[i].toString() + str.substring(j + key.length());
|
||||
}
|
||||
}
|
||||
return stringBuilder;
|
||||
|
@ -3758,14 +3762,43 @@ public class AndroidUtilities {
|
|||
text = password;
|
||||
detail = LocaleController.getString("UseProxyPassword", R.string.UseProxyPassword);
|
||||
} else if (a == 5) {
|
||||
text = LocaleController.getString(R.string.Checking);
|
||||
text = LocaleController.getString(R.string.ProxyBottomSheetChecking);
|
||||
detail = LocaleController.getString(R.string.ProxyStatus);
|
||||
}
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
continue;
|
||||
}
|
||||
TextDetailSettingsCell cell = new TextDetailSettingsCell(activity);
|
||||
cell.setTextAndValue(text, detail, true);
|
||||
AtomicReference<EllipsizeSpanAnimator> ellRef = new AtomicReference<>();
|
||||
TextDetailSettingsCell cell = new TextDetailSettingsCell(activity) {
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
if (ellRef.get() != null) {
|
||||
ellRef.get().onAttachedToWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (ellRef.get() != null) {
|
||||
ellRef.get().onDetachedFromWindow();
|
||||
}
|
||||
}
|
||||
};
|
||||
if (a == 5) {
|
||||
SpannableStringBuilder spannableStringBuilder = SpannableStringBuilder.valueOf(text);
|
||||
EllipsizeSpanAnimator ellipsizeAnimator = new EllipsizeSpanAnimator(cell);
|
||||
ellipsizeAnimator.addView(cell);
|
||||
SpannableString ell = new SpannableString("...");
|
||||
ellipsizeAnimator.wrap(ell, 0);
|
||||
spannableStringBuilder.append(ell);
|
||||
ellRef.set(ellipsizeAnimator);
|
||||
|
||||
cell.setTextAndValue(spannableStringBuilder, detail, true);
|
||||
} else {
|
||||
cell.setTextAndValue(text, detail, true);
|
||||
}
|
||||
cell.getTextView().setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
||||
cell.getValueTextView().setTextColor(Theme.getColor(Theme.key_dialogTextGray3));
|
||||
linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
|
|
@ -24,8 +24,8 @@ public class BuildVars {
|
|||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||
public static int BUILD_VERSION = 3213;
|
||||
public static String BUILD_VERSION_STRING = "9.5.3";
|
||||
public static int BUILD_VERSION = 3227;
|
||||
public static String BUILD_VERSION_STRING = "9.5.4";
|
||||
public static int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
|
||||
|
|
|
@ -23,8 +23,39 @@ public class CallReceiver extends BroadcastReceiver {
|
|||
String phoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
|
||||
if (TelephonyManager.EXTRA_STATE_RINGING.equals(phoneState)) {
|
||||
String phoneNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didReceiveCall, PhoneFormat.stripExceptNumbers(phoneNumber));
|
||||
String phone = PhoneFormat.stripExceptNumbers(phoneNumber);
|
||||
SharedConfig.getPreferences().edit()
|
||||
.putString("last_call_phone_number", phone)
|
||||
.putLong("last_call_time", System.currentTimeMillis())
|
||||
.apply();
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didReceiveCall, phone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLastReceivedCall() {
|
||||
String phone = SharedConfig.getPreferences().getString("last_call_phone_number", null);
|
||||
if (phone == null) {
|
||||
return null;
|
||||
}
|
||||
long lastTime = SharedConfig.getPreferences().getLong("last_call_time", 0);
|
||||
if (System.currentTimeMillis() - lastTime < 1000 * 60 * 60 * 15) {
|
||||
return phone;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void checkLastReceivedCall() {
|
||||
String lastCall = getLastReceivedCall();
|
||||
if (lastCall != null) {
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didReceiveCall, lastCall);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearLastCall() {
|
||||
SharedConfig.getPreferences().edit()
|
||||
.remove("last_call_phone_number")
|
||||
.remove("last_call_time")
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1296,7 +1296,11 @@ public class ChatObject {
|
|||
return Integer.compare(o2.date, o1.date);
|
||||
}
|
||||
};
|
||||
Collections.sort(sortedParticipants, comparator);
|
||||
try {
|
||||
Collections.sort(sortedParticipants, comparator);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
TLRPC.TL_groupCallParticipant lastParticipant = sortedParticipants.isEmpty() ? null : sortedParticipants.get(sortedParticipants.size() - 1);
|
||||
if (videoIsActive(lastParticipant, false, this) || videoIsActive(lastParticipant, true, this)) {
|
||||
if (call.unmuted_video_count > activeVideos) {
|
||||
|
|
|
@ -1241,6 +1241,12 @@ public class DatabaseMigrationHelper {
|
|||
database.executeFast("PRAGMA user_version = 114").stepThis().dispose();
|
||||
version = 114;
|
||||
}
|
||||
if (version == 114) {
|
||||
database.executeFast("CREATE TABLE bot_keyboard_topics(uid INTEGER, tid INTEGER, mid INTEGER, info BLOB, PRIMARY KEY(uid, tid))").stepThis().dispose();
|
||||
database.executeFast("CREATE INDEX IF NOT EXISTS bot_keyboard_topics_idx_mid_v2 ON bot_keyboard_topics(mid, uid, tid);").stepThis().dispose();
|
||||
database.executeFast("PRAGMA user_version = 115").stepThis().dispose();
|
||||
version = 115;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ public class EmojiData {
|
|||
"⌚", "📱", "📲", "💻", "⌨", "🖥", "🖨", "🖱", "🖲", "🕹", "🗜", "💽", "💾", "💿", "📀", "📼", "📷", "📸", "📹", "🎥", "📽", "🎞", "📞", "☎", "📟", "📠", "📺", "📻", "🎙", "🎚", "🎛", "🧭", "⏱", "⏲", "⏰", "🕰", "⌛", "⏳", "📡", "🔋", "🪫", "🔌", "💡", "🔦", "🕯", "🪔", "🧯", "🛢", "💸", "💵", "💴", "💶", "💷", "🪙", "💰", "💳", "🪪", "💎", "⚖", "🪜", "🧰", "🪛", "🔧", "🔨", "⚒", "🛠", "⛏", "🪚", "🔩", "⚙", "🪤", "🧱", "⛓", "🧲", "🔫", "💣", "🧨", "🪓", "🔪", "🗡", "⚔", "🛡", "🚬", "⚰", "🪦", "⚱", "🏺", "🔮", "📿", "🧿", "🪬", "💈", "⚗", "🔭", "🔬", "🕳️", "🩻", "🩹", "🩺", "💊", "💉", "🩸", "🧬", "🦠", "🧫", "🧪", "🌡", "🧹", "🪠", "🧺", "🧻", "🚽", "🚰", "🚿", "🛁", "🛀", "🛀🏻", "🛀🏼", "🛀🏽", "🛀🏾", "🛀🏿", "🧼", "🪥", "🪒", "🪮", "🧽", "🪣", "🧴", "🛎", "🔑", "🗝", "🚪", "🪑", "🛋", "🛏", "🛌", "🧸", "🪆", "🖼", "🪞", "🪟", "🛍", "🛒", "🎁", "🎈", "🎏", "🎀", "🪄", "🪅", "🎊", "🎉", "🎎", "🪭", "🏮", "🎐", "🪩", "🧧", "✉", "📩", "📨", "📧", "💌", "📥", "📤", "📦", "🏷", "🪧", "📪", "📫", "📬", "📭", "📮", "📯", "📜", "📃", "📄", "📑", "🧾", "📊", "📈", "📉", "🗒", "🗓", "📆", "📅", "🗑", "📇", "🗃", "🗳", "🗄", "📋", "📁", "📂", "🗂", "🗞", "📰", "📓", "📔", "📒", "📕", "📗", "📘", "📙", "📚", "📖", "🔖", "🧷", "🔗", "📎", "🖇", "📐", "📏", "🧮", "📌", "📍", "✂", "🖊", "🖋", "✒", "🖌", "🖍", "📝", "✏", "🔍", "🔎", "🔏", "🔐", "🔒", "🔓"
|
||||
},
|
||||
new String[]{
|
||||
"🩷", "❤", "🧡", "💛", "💚", "🩵", "💙", "💜", "🖤", "🩶", "🤍", "🤎", "💔", "❤🔥", "❤🩹", "❣", "💕", "💞", "💓", "💗", "💖", "💘", "💝", "💟", "☮", "✝", "☪", "🕉", "☸", "🪯", "✡", "🔯", "🕎", "☯", "☦", "🛐", "⛎", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "🆔", "⚛", "🉑", "☢", "☣", "📴", "📳", "🈶", "🈚", "🈸", "🈺", "🈷", "✴", "🆚", "💮", "🉐", "㊙", "㊗", "🈴", "🈵", "🈹", "🈲", "🅰", "🅱", "🆎", "🆑", "🅾", "🆘", "❌", "⭕", "🛑", "⛔", "📛", "🚫", "💯", "💢", "♨", "🚷", "🚯", "🚳", "🚱", "🔞", "📵", "🚭", "❗", "❕", "❓", "❔", "‼", "⁉", "🔅", "🔆", "〽", "⚠", "🚸", "🔱", "⚜", "🔰", "♻", "✅", "🈯", "💹", "❇", "✳", "❎", "🌐", "💠", "Ⓜ", "🌀", "💤", "🏧", "🚾", "♿", "🅿", "🛗", "🈳", "🈂", "🛂", "🛃", "🛄", "🛅", "🛜", "🚹", "🚺", "🚼", "⚧", "🚻", "🚮", "🎦", "📶", "🈁", "🔣", "ℹ", "🔤", "🔡", "🔠", "🆖", "🆗", "🆙", "🆒", "🆕", "🆓", "0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟", "🔢", "#⃣", "*⃣", "⏏", "▶", "⏸", "⏯", "⏹", "⏺", "⏭", "⏮", "⏩", "⏪", "⏫", "⏬", "◀", "🔼", "🔽", "➡", "⬅", "⬆", "⬇", "↗", "↘", "↙", "↖", "↕", "↔", "↪", "↩", "⤴", "⤵", "🔀", "🔁", "🔂", "🔄", "🔃", "🎵", "🎶", "➕", "➖", "➗", "✖", "🟰", "♾", "💲", "💱", "™", "©", "®", "👁🗨", "🔚", "🔙", "🔛", "🔝", "🔜", "〰", "➰", "➿", "✔", "☑", "🔘", "🔴", "🟠", "🟡", "🟢", "🔵", "🟣", "⚫", "⚪", "🟤", "🔺", "🔻", "🔸", "🔹", "🔶", "🔷", "🔳", "🔲", "▪", "▫", "◾", "◽", "◼", "◻", "🟥", "🟧", "🟨", "🟩", "🟦", "🟪", "⬛", "⬜", "🟫", "🔈", "🔇", "🔉", "🔊", "🔔", "🔕", "📣", "📢", "💬", "💭", "🗯", "♠", "♣", "♥", "♦", "🃏", "🎴", "🀄", "🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚", "🕛", "🕜", "🕝", "🕞", "🕟", "🕠", "🕡", "🕢", "🕣", "🕤", "🕥", "🕦", "🕧"
|
||||
"🩷", "❤", "🧡", "💛", "💚", "🩵", "💙", "💜", "🖤", "🩶", "🤍", "🤎", "💔", "❤🔥", "❤🩹", "❣", "💕", "💞", "💓", "💗", "💖", "💘", "💝", "💟", "☮", "✝", "☪", "🕉", "☸", "🪯", "✡", "🔯", "🕎", "☯", "☦", "🛐", "⛎", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "🆔", "⚛", "🉑", "☢", "☣", "📴", "📳", "🈶", "🈚", "🈸", "🈺", "🈷", "✴", "🆚", "💮", "🉐", "㊙", "㊗", "🈴", "🈵", "🈹", "🈲", "🅰", "🅱", "🆎", "🆑", "🅾", "🆘", "❌", "⭕", "🛑", "⛔", "📛", "🚫", "💯", "💢", "♨", "🚷", "🚯", "🚳", "🚱", "🔞", "📵", "🚭", "❗", "❕", "❓", "❔", "‼", "⁉", "🔅", "🔆", "〽", "⚠", "🚸", "🔱", "⚜", "🔰", "♻", "✅", "🈯", "💹", "❇", "✳", "❎", "🌐", "💠", "Ⓜ", "🌀", "💤", "🏧", "🚾", "♿", "🅿", "🛗", "🈳", "🈂", "🛂", "🛃", "🛄", "🛅", "🛜", "🚹", "🚺", "🚼", "⚧", "🚻", "🚮", "🎦", "📶", "🈁", "🔣", "ℹ", "🔤", "🔡", "🔠", "🆖", "🆗", "🆙", "🆒", "🆕", "🆓", "0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟", "🔢", "#⃣", "*⃣", "⏏", "▶", "⏸", "⏯", "⏹", "⏺", "⏭", "⏮", "⏩", "⏪", "⏫", "⏬", "◀", "🔼", "🔽", "➡", "⬅", "⬆", "⬇", "↗", "↘", "↙", "↖", "↕", "↔", "↪", "↩", "⤴", "⤵", "🔀", "🔁", "🔂", "🔄", "🔃", "🎵", "🎶", "➕", "➖", "➗", "✖", "🟰", "♾", "💲", "💱", "™️", "©", "®", "👁🗨", "🔚", "🔙", "🔛", "🔝", "🔜", "〰", "➰", "➿", "✔", "☑", "🔘", "🔴", "🟠", "🟡", "🟢", "🔵", "🟣", "⚫", "⚪", "🟤", "🔺", "🔻", "🔸", "🔹", "🔶", "🔷", "🔳", "🔲", "▪", "▫", "◾", "◽", "◼", "◻", "🟥", "🟧", "🟨", "🟩", "🟦", "🟪", "⬛", "⬜", "🟫", "🔈", "🔇", "🔉", "🔊", "🔔", "🔕", "📣", "📢", "💬", "💭", "🗯", "♠", "♣", "♥", "♦", "🃏", "🎴", "🀄", "🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚", "🕛", "🕜", "🕝", "🕞", "🕟", "🕠", "🕡", "🕢", "🕣", "🕤", "🕥", "🕦", "🕧"
|
||||
},
|
||||
new String[]{
|
||||
"🏳", "🏴", "🏴☠", "🏁", "🚩", "🏳🌈", "🏳⚧", "🇺🇳", "🇦🇫", "🇦🇽", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇩", "🇦🇴", "🇦🇮", "🇦🇶", "🇦🇬", "🇦🇷", "🇦🇲", "🇦🇼", "🇦🇺", "🇦🇹", "🇦🇿", "🇧🇸", "🇧🇭", "🇧🇩", "🇧🇧", "🇧🇾", "🇧🇪", "🇧🇿", "🇧🇯", "🇧🇲", "🇧🇹", "🇧🇴", "🇧🇦", "🇧🇼", "🇧🇷", "🇻🇬", "🇧🇳", "🇧🇬", "🇧🇫", "🇧🇮", "🇰🇭", "🇨🇲", "🇨🇦", "🇮🇨", "🇨🇻", "🇧🇶", "🇰🇾", "🇨🇫", "🇹🇩", "🇮🇴", "🇨🇱", "🇨🇳", "🇨🇽", "🇨🇨", "🇨🇴", "🇰🇲", "🇨🇬", "🇨🇩", "🇨🇰", "🇨🇷", "🇨🇮", "🇭🇷", "🇨🇺", "🇨🇼", "🇨🇾", "🇨🇿", "🇩🇰", "🇩🇯", "🇩🇲", "🇩🇴", "🇪🇨", "🇪🇬", "🇸🇻", "🇬🇶", "🇪🇷", "🇪🇪", "🇸🇿", "🇪🇹", "🇪🇺", "🇫🇰", "🇫🇴", "🇫🇯", "🇫🇮", "🇫🇷", "🇬🇫", "🇵🇫", "🇹🇫", "🇬🇦", "🇬🇲", "🇬🇪", "🇩🇪", "🇬🇭", "🇬🇮", "🇬🇷", "🇬🇱", "🇬🇩", "🇬🇵", "🇬🇺", "🇬🇹", "🇬🇬", "🇬🇳", "🇬🇼", "🇬🇾", "🇭🇹", "🇭🇳", "🇭🇰", "🇭🇺", "🇮🇸", "🇮🇳", "🇮🇩", "🇮🇷", "🇮🇶", "🇮🇪", "🇮🇲", "🇮🇱", "🇮🇹", "🇯🇲", "🇯🇵", "🎌", "🇯🇪", "🇯🇴", "🇰🇿", "🇰🇪", "🇰🇮", "🇽🇰", "🇰🇼", "🇰🇬", "🇱🇦", "🇱🇻", "🇱🇧", "🇱🇸", "🇱🇷", "🇱🇾", "🇱🇮", "🇱🇹", "🇱🇺", "🇲🇴", "🇲🇬", "🇲🇼", "🇲🇾", "🇲🇻", "🇲🇱", "🇲🇹", "🇲🇭", "🇲🇶", "🇲🇷", "🇲🇺", "🇾🇹", "🇲🇽", "🇫🇲", "🇲🇩", "🇲🇨", "🇲🇳", "🇲🇪", "🇲🇸", "🇲🇦", "🇲🇿", "🇲🇲", "🇳🇦", "🇳🇷", "🇳🇵", "🇳🇱", "🇳🇨", "🇳🇿", "🇳🇮", "🇳🇪", "🇳🇬", "🇳🇺", "🇳🇫", "🇰🇵", "🇲🇰", "🇲🇵", "🇳🇴", "🇴🇲", "🇵🇰", "🇵🇼", "🇵🇸", "🇵🇦", "🇵🇬", "🇵🇾", "🇵🇪", "🇵🇭", "🇵🇳", "🇵🇱", "🇵🇹", "🇵🇷", "🇶🇦", "🇷🇪", "🇷🇴", "🇷🇺", "🇷🇼", "🇼🇸", "🇸🇲", "🇸🇹", "🇸🇦", "🇸🇳", "🇷🇸", "🇸🇨", "🇸🇱", "🇸🇬", "🇸🇽", "🇸🇰", "🇸🇮", "🇬🇸", "🇸🇧", "🇸🇴", "🇿🇦", "🇰🇷", "🇸🇸", "🇪🇸", "🇱🇰", "🇧🇱", "🇸🇭", "🇰🇳", "🇱🇨", "🇵🇲", "🇻🇨", "🇸🇩", "🇸🇷", "🇸🇪", "🇨🇭", "🇸🇾", "🇹🇼", "🇹🇯", "🇹🇿", "🇹🇭", "🇹🇱", "🇹🇬", "🇹🇰", "🇹🇴", "🇹🇹", "🇹🇳", "🇹🇷", "🇹🇲", "🇹🇨", "🇹🇻", "🇺🇬", "🇺🇦", "🇦🇪", "🇬🇧", "🏴", "🏴", "🏴", "🇺🇸", "🇺🇾", "🇻🇮", "🇺🇿", "🇻🇺", "🇻🇦", "🇻🇪", "🇻🇳", "🇼🇫", "🇪🇭", "🇾🇪", "🇿🇲", "🇿🇼"
|
||||
|
|
|
@ -31,6 +31,9 @@ import java.util.zip.ZipException;
|
|||
|
||||
public class FileLoadOperation {
|
||||
|
||||
private final static int FINISH_CODE_DEFAULT = 0;
|
||||
private final static int FINISH_CODE_FILE_ALREADY_EXIST = 1;
|
||||
|
||||
FileLoadOperationStream stream;
|
||||
boolean streamPriority;
|
||||
long streamOffset;
|
||||
|
@ -1075,7 +1078,7 @@ public class FileLoadOperation {
|
|||
Utilities.stageQueue.postRunnable(() -> {
|
||||
if (totalBytesCount != 0 && (isPreloadVideoOperation && preloaded[0] || downloadedBytes == totalBytesCount)) {
|
||||
try {
|
||||
onFinishLoadingFile(false);
|
||||
onFinishLoadingFile(false, FINISH_CODE_FILE_ALREADY_EXIST);
|
||||
} catch (Exception e) {
|
||||
onFail(true, 0);
|
||||
}
|
||||
|
@ -1086,7 +1089,7 @@ public class FileLoadOperation {
|
|||
} else {
|
||||
started = true;
|
||||
try {
|
||||
onFinishLoadingFile(false);
|
||||
onFinishLoadingFile(false, FINISH_CODE_FILE_ALREADY_EXIST);
|
||||
if (pathSaveData != null) {
|
||||
delegate.saveFilePath(pathSaveData, null);
|
||||
}
|
||||
|
@ -1299,7 +1302,7 @@ public class FileLoadOperation {
|
|||
}
|
||||
}
|
||||
|
||||
private void onFinishLoadingFile(final boolean increment) {
|
||||
private void onFinishLoadingFile(final boolean increment, int finishCode) {
|
||||
if (state != stateDownloading) {
|
||||
return;
|
||||
}
|
||||
|
@ -1309,7 +1312,11 @@ public class FileLoadOperation {
|
|||
if (isPreloadVideoOperation) {
|
||||
preloadFinished = true;
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
FileLog.d("finished preloading file to " + cacheFileTemp + " loaded " + totalPreloadedBytes + " of " + totalBytesCount);
|
||||
if (finishCode == FINISH_CODE_FILE_ALREADY_EXIST) {
|
||||
FileLog.d("file already exist " + cacheFileTemp);
|
||||
} else {
|
||||
FileLog.d("finished preloading file to " + cacheFileTemp + " loaded " + totalPreloadedBytes + " of " + totalBytesCount);
|
||||
}
|
||||
}
|
||||
if (fileMetadata != null) {
|
||||
if (cacheFileTemp != null) {
|
||||
|
@ -1397,7 +1404,7 @@ public class FileLoadOperation {
|
|||
state = stateDownloading;
|
||||
Utilities.stageQueue.postRunnable(() -> {
|
||||
try {
|
||||
onFinishLoadingFile(increment);
|
||||
onFinishLoadingFile(increment, FINISH_CODE_DEFAULT);
|
||||
} catch (Exception e) {
|
||||
onFail(false, 0);
|
||||
}
|
||||
|
@ -1575,7 +1582,7 @@ public class FileLoadOperation {
|
|||
bytes = null;
|
||||
}
|
||||
if (bytes == null || bytes.limit() == 0) {
|
||||
onFinishLoadingFile(true);
|
||||
onFinishLoadingFile(true, FINISH_CODE_DEFAULT);
|
||||
return false;
|
||||
}
|
||||
int currentBytesSize = bytes.limit();
|
||||
|
@ -1767,7 +1774,7 @@ public class FileLoadOperation {
|
|||
}
|
||||
|
||||
if (finishedDownloading) {
|
||||
onFinishLoadingFile(true);
|
||||
onFinishLoadingFile(true, FINISH_CODE_DEFAULT);
|
||||
} else if (state != stateCanceled) {
|
||||
startDownloadRequest();
|
||||
}
|
||||
|
@ -1807,7 +1814,7 @@ public class FileLoadOperation {
|
|||
} else if (error.text.contains("OFFSET_INVALID")) {
|
||||
if (downloadedBytes % currentDownloadChunkSize == 0) {
|
||||
try {
|
||||
onFinishLoadingFile(true);
|
||||
onFinishLoadingFile(true, FINISH_CODE_DEFAULT);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
onFail(false, 0);
|
||||
|
@ -1946,7 +1953,7 @@ public class FileLoadOperation {
|
|||
tries--;
|
||||
}
|
||||
if (!found && requestInfos.isEmpty()) {
|
||||
onFinishLoadingFile(false);
|
||||
onFinishLoadingFile(false, FINISH_CODE_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
downloadOffset = nextPreloadDownloadOffset;
|
||||
|
|
|
@ -222,12 +222,14 @@ public class FileLoader extends BaseController {
|
|||
if (dir == null && type != FileLoader.MEDIA_DIR_CACHE) {
|
||||
dir = mediaDirs.get(FileLoader.MEDIA_DIR_CACHE);
|
||||
}
|
||||
try {
|
||||
if (dir != null && !dir.isDirectory()) {
|
||||
dir.mkdirs();
|
||||
if (BuildVars.NO_SCOPED_STORAGE) {
|
||||
try {
|
||||
if (dir != null && !dir.isDirectory()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//don't promt
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//don't promt
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
|
|
@ -3962,50 +3962,60 @@ public class ImageLoader {
|
|||
TLRPC.PhotoSize photoSize = findPhotoCachedSize(message);
|
||||
|
||||
if (photoSize != null && photoSize.bytes != null && photoSize.bytes.length != 0) {
|
||||
TLRPC.PhotoSize newPhotoSize;
|
||||
if (photoSize.location == null || photoSize.location instanceof TLRPC.TL_fileLocationUnavailable) {
|
||||
photoSize.location = new TLRPC.TL_fileLocationToBeDeprecated();
|
||||
photoSize.location.volume_id = Integer.MIN_VALUE;
|
||||
photoSize.location.local_id = SharedConfig.getLastLocalId();
|
||||
}
|
||||
File file = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(photoSize, true);
|
||||
boolean isEncrypted = false;
|
||||
if (MessageObject.shouldEncryptPhotoOrVideo(message)) {
|
||||
file = new File(file.getAbsolutePath() + ".enc");
|
||||
isEncrypted = true;
|
||||
}
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
if (isEncrypted) {
|
||||
File keyPath = new File(FileLoader.getInternalCacheDir(), file.getName() + ".key");
|
||||
RandomAccessFile keyFile = new RandomAccessFile(keyPath, "rws");
|
||||
long len = keyFile.length();
|
||||
byte[] encryptKey = new byte[32];
|
||||
byte[] encryptIv = new byte[16];
|
||||
if (len > 0 && len % 48 == 0) {
|
||||
keyFile.read(encryptKey, 0, 32);
|
||||
keyFile.read(encryptIv, 0, 16);
|
||||
} else {
|
||||
Utilities.random.nextBytes(encryptKey);
|
||||
Utilities.random.nextBytes(encryptIv);
|
||||
keyFile.write(encryptKey);
|
||||
keyFile.write(encryptIv);
|
||||
}
|
||||
keyFile.close();
|
||||
Utilities.aesCtrDecryptionByteArray(photoSize.bytes, encryptKey, encryptIv, 0, photoSize.bytes.length, 0);
|
||||
}
|
||||
RandomAccessFile writeFile = new RandomAccessFile(file, "rws");
|
||||
writeFile.write(photoSize.bytes);
|
||||
writeFile.close();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
if (photoSize.h <= 50 && photoSize.w <= 50) {
|
||||
newPhotoSize = new TLRPC.TL_photoStrippedSize();
|
||||
newPhotoSize.location = photoSize.location;
|
||||
newPhotoSize.bytes = photoSize.bytes;
|
||||
newPhotoSize.h = photoSize.h;
|
||||
newPhotoSize.w = photoSize.w;
|
||||
} else {
|
||||
File file = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(photoSize, true);
|
||||
boolean isEncrypted = false;
|
||||
if (MessageObject.shouldEncryptPhotoOrVideo(message)) {
|
||||
file = new File(file.getAbsolutePath() + ".enc");
|
||||
isEncrypted = true;
|
||||
}
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
if (isEncrypted) {
|
||||
File keyPath = new File(FileLoader.getInternalCacheDir(), file.getName() + ".key");
|
||||
RandomAccessFile keyFile = new RandomAccessFile(keyPath, "rws");
|
||||
long len = keyFile.length();
|
||||
byte[] encryptKey = new byte[32];
|
||||
byte[] encryptIv = new byte[16];
|
||||
if (len > 0 && len % 48 == 0) {
|
||||
keyFile.read(encryptKey, 0, 32);
|
||||
keyFile.read(encryptIv, 0, 16);
|
||||
} else {
|
||||
Utilities.random.nextBytes(encryptKey);
|
||||
Utilities.random.nextBytes(encryptIv);
|
||||
keyFile.write(encryptKey);
|
||||
keyFile.write(encryptIv);
|
||||
}
|
||||
keyFile.close();
|
||||
Utilities.aesCtrDecryptionByteArray(photoSize.bytes, encryptKey, encryptIv, 0, photoSize.bytes.length, 0);
|
||||
}
|
||||
RandomAccessFile writeFile = new RandomAccessFile(file, "rws");
|
||||
writeFile.write(photoSize.bytes);
|
||||
writeFile.close();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
newPhotoSize = new TLRPC.TL_photoSize_layer127();
|
||||
newPhotoSize.w = photoSize.w;
|
||||
newPhotoSize.h = photoSize.h;
|
||||
newPhotoSize.location = photoSize.location;
|
||||
newPhotoSize.size = photoSize.size;
|
||||
newPhotoSize.type = photoSize.type;
|
||||
}
|
||||
TLRPC.TL_photoSize newPhotoSize = new TLRPC.TL_photoSize_layer127();
|
||||
newPhotoSize.w = photoSize.w;
|
||||
newPhotoSize.h = photoSize.h;
|
||||
newPhotoSize.location = photoSize.location;
|
||||
newPhotoSize.size = photoSize.size;
|
||||
newPhotoSize.type = photoSize.type;
|
||||
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
for (int a = 0, count = message.media.photo.sizes.size(); a < count; a++) {
|
||||
|
|
|
@ -123,12 +123,14 @@ public class LiteMode {
|
|||
}
|
||||
|
||||
private static int preprocessFlag(int flag) {
|
||||
if (flag == FLAG_ANIMATED_EMOJI_KEYBOARD) {
|
||||
return UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM : FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM;
|
||||
} else if (flag == FLAG_ANIMATED_EMOJI_REACTIONS) {
|
||||
return UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM : FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM;
|
||||
} else if (flag == FLAG_ANIMATED_EMOJI_CHAT) {
|
||||
return UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_CHAT_PREMIUM : FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM;
|
||||
if ((flag & FLAG_ANIMATED_EMOJI_KEYBOARD) > 0) {
|
||||
flag = flag & ~FLAG_ANIMATED_EMOJI_KEYBOARD | (UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM : FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM);
|
||||
}
|
||||
if ((flag & FLAG_ANIMATED_EMOJI_REACTIONS) > 0) {
|
||||
flag = flag & ~FLAG_ANIMATED_EMOJI_REACTIONS | (UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM : FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM);
|
||||
}
|
||||
if ((flag & FLAG_ANIMATED_EMOJI_CHAT) > 0) {
|
||||
flag = flag & ~FLAG_ANIMATED_EMOJI_CHAT | (UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_CHAT_PREMIUM : FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ import org.telegram.ui.Components.EmbedBottomSheet;
|
|||
import org.telegram.ui.Components.PhotoFilterView;
|
||||
import org.telegram.ui.Components.PipRoundVideoView;
|
||||
import org.telegram.ui.Components.VideoPlayer;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.PhotoViewer;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -1629,7 +1630,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
lastAccelerometerDetected = System.currentTimeMillis();
|
||||
}
|
||||
if (proximityTouched && (raisedToBack == minCount || accelerometerVertical || System.currentTimeMillis() - lastAccelerometerDetected < 60) && !NotificationsController.audioManager.isWiredHeadsetOn() && !NotificationsController.audioManager.isBluetoothA2dpOn() && !VoIPService.isAnyKindOfCallActive()) {
|
||||
if (SharedConfig.raiseToSpeak && playingMessageObject == null && recordStartRunnable == null && recordingAudio == null && !PhotoViewer.getInstance().isVisible() && ApplicationLoader.isScreenOn && !inputFieldHasText && allowStartRecord && raiseChat != null && !callInProgress) {
|
||||
if (SharedConfig.enabledRaiseTo(true) && playingMessageObject == null && recordStartRunnable == null && recordingAudio == null && !PhotoViewer.getInstance().isVisible() && ApplicationLoader.isScreenOn && !inputFieldHasText && allowStartRecord && raiseChat != null && !callInProgress) {
|
||||
if (!raiseToEarRecord) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("start record");
|
||||
|
@ -1648,7 +1649,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
proximityWakeLock.acquire();
|
||||
}
|
||||
}
|
||||
} else if (playingMessageObject != null && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
|
||||
} else if (SharedConfig.enabledRaiseTo(false) && playingMessageObject != null && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
|
||||
if (!useFrontSpeaker) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("start listen");
|
||||
|
@ -1666,7 +1667,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
raisedToTopSign = 0;
|
||||
countLess = 0;
|
||||
} else if (proximityTouched && ((accelerometerSensor == null || linearSensor == null) && gravitySensor == null || ignoreAccelerometerGestures()) && !VoIPService.isAnyKindOfCallActive()) {
|
||||
if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
|
||||
if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo()) && SharedConfig.enabledRaiseTo(false)) {
|
||||
if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn() && !NotificationsController.audioManager.isBluetoothA2dpOn()) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("start listen by proximity only");
|
||||
|
@ -1723,7 +1724,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
}
|
||||
|
||||
public void startRecordingIfFromSpeaker() {
|
||||
if (!useFrontSpeaker || raiseChat == null || !allowStartRecord || !SharedConfig.raiseToSpeak) {
|
||||
if (!useFrontSpeaker || raiseChat == null || !allowStartRecord || !SharedConfig.enabledRaiseTo(true)) {
|
||||
return;
|
||||
}
|
||||
raiseToEarRecord = true;
|
||||
|
@ -1787,7 +1788,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
return;
|
||||
}
|
||||
raiseChat = chatActivity;
|
||||
if (!SharedConfig.raiseToSpeak && (playingMessageObject == null || !playingMessageObject.isVoice() && !playingMessageObject.isRoundVideo())) {
|
||||
if (!SharedConfig.enabledRaiseTo(true) && (playingMessageObject == null || !playingMessageObject.isVoice() && !playingMessageObject.isRoundVideo())) {
|
||||
return;
|
||||
}
|
||||
if (!sensorsStarted) {
|
||||
|
@ -1925,7 +1926,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
stopProgressTimer();
|
||||
lastProgress = 0;
|
||||
isPaused = false;
|
||||
if (!useFrontSpeaker && !SharedConfig.raiseToSpeak) {
|
||||
if (!useFrontSpeaker && !SharedConfig.enabledRaiseTo(true)) {
|
||||
ChatActivity chat = raiseChat;
|
||||
stopRaiseToEarSensors(raiseChat, false);
|
||||
raiseChat = chat;
|
||||
|
@ -2229,12 +2230,12 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
long group2 = o2.messageOwner.grouped_id;
|
||||
if (mid1 < 0 && mid2 < 0) {
|
||||
if (group1 != 0 && group1 == group2) {
|
||||
return Integer.compare(mid1, mid2);
|
||||
return -Integer.compare(mid1, mid2);
|
||||
}
|
||||
return Integer.compare(mid2, mid1);
|
||||
} else {
|
||||
if (group1 != 0 && group1 == group2) {
|
||||
return Integer.compare(mid2, mid1);
|
||||
return -Integer.compare(mid2, mid1);
|
||||
}
|
||||
return Integer.compare(mid1, mid2);
|
||||
}
|
||||
|
@ -2462,7 +2463,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
if (neededAudioFocus == 3) {
|
||||
result = NotificationsController.audioManager.requestAudioFocus(this, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN);
|
||||
} else {
|
||||
result = NotificationsController.audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, neededAudioFocus == 2 ? AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK : AudioManager.AUDIOFOCUS_GAIN);
|
||||
result = NotificationsController.audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, neededAudioFocus == 2 && !SharedConfig.pauseMusicOnMedia ? AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK : AudioManager.AUDIOFOCUS_GAIN);
|
||||
}
|
||||
if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
||||
audioFocus = AUDIO_FOCUSED;
|
||||
|
@ -2770,7 +2771,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
lastProgress = 0;
|
||||
MessageObject oldMessageObject = playingMessageObject;
|
||||
playingMessageObject = messageObject;
|
||||
if (!SharedConfig.raiseToSpeak) {
|
||||
if (!SharedConfig.enabledRaiseTo(true)) {
|
||||
startRaiseToEarSensors(raiseChat);
|
||||
}
|
||||
startProgressTimer(playingMessageObject);
|
||||
|
@ -2935,7 +2936,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
if (isPaused) {
|
||||
resumeAudio(messageObject);
|
||||
}
|
||||
if (!SharedConfig.raiseToSpeak) {
|
||||
if (!SharedConfig.enabledRaiseTo(true)) {
|
||||
startRaiseToEarSensors(raiseChat);
|
||||
}
|
||||
return true;
|
||||
|
@ -3321,10 +3322,10 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
isPaused = false;
|
||||
lastProgress = 0;
|
||||
playingMessageObject = messageObject;
|
||||
if (!SharedConfig.raiseToSpeak) {
|
||||
if (!SharedConfig.enabledRaiseTo(true)) {
|
||||
startRaiseToEarSensors(raiseChat);
|
||||
}
|
||||
if (!ApplicationLoader.mainInterfacePaused && proximityWakeLock != null && !proximityWakeLock.isHeld() && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
|
||||
if (!ApplicationLoader.mainInterfacePaused && proximityWakeLock != null && !proximityWakeLock.isHeld() && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo()) && SharedConfig.enabledRaiseTo(false)) {
|
||||
if (ignoreAccelerometerGestures()) {
|
||||
proximityWakeLock.acquire();
|
||||
}
|
||||
|
@ -3442,7 +3443,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
stopProgressTimer();
|
||||
try {
|
||||
if (audioPlayer != null) {
|
||||
if (!playingMessageObject.isVoice() && (playingMessageObject.getDuration() * (1f - playingMessageObject.audioProgress) > 1)) {
|
||||
if (!playingMessageObject.isVoice() && (playingMessageObject.getDuration() * (1f - playingMessageObject.audioProgress) > 1) && LaunchActivity.isResumed) {
|
||||
if (audioVolumeAnimator != null) {
|
||||
audioVolumeAnimator.removeAllUpdateListeners();
|
||||
audioVolumeAnimator.cancel();
|
||||
|
|
|
@ -34,6 +34,7 @@ import android.text.TextUtils;
|
|||
import android.text.style.CharacterStyle;
|
||||
import android.text.style.URLSpan;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.SparseArray;
|
||||
|
||||
|
@ -722,6 +723,9 @@ public class MediaDataController extends BaseController {
|
|||
if (reactionsList == null || reactionsCacheGenerated || !LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS)) {
|
||||
return;
|
||||
}
|
||||
if (currentAccount != UserConfig.selectedAccount) {
|
||||
return;
|
||||
}
|
||||
reactionsCacheGenerated = true;
|
||||
ArrayList<TLRPC.TL_availableReaction> arrayList = new ArrayList<>(reactionsList);
|
||||
int N = Math.min(arrayList.size(), 10);
|
||||
|
@ -2355,7 +2359,9 @@ public class MediaDataController extends BaseController {
|
|||
|
||||
processLoadedDiceStickers(getUserConfig().genericAnimationsStickerPack, false, stickerSet, false, (int) (System.currentTimeMillis() / 1000));
|
||||
for (int i = 0; i < stickerSet.documents.size(); i++) {
|
||||
preloadImage(ImageLocation.getForDocument(stickerSet.documents.get(i)));
|
||||
if (currentAccount == UserConfig.selectedAccount) {
|
||||
preloadImage(ImageLocation.getForDocument(stickerSet.documents.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
@ -4294,48 +4300,20 @@ public class MediaDataController extends BaseController {
|
|||
ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit().putString("directShareHash2", SharedConfig.directShareHash).commit();
|
||||
}
|
||||
|
||||
List<ShortcutInfoCompat> currentShortcuts = ShortcutManagerCompat.getDynamicShortcuts(ApplicationLoader.applicationContext);
|
||||
ArrayList<String> shortcutsToUpdate = new ArrayList<>();
|
||||
ArrayList<String> newShortcutsIds = new ArrayList<>();
|
||||
ArrayList<String> shortcutsToDelete = new ArrayList<>();
|
||||
ShortcutManagerCompat.removeAllDynamicShortcuts(ApplicationLoader.applicationContext);
|
||||
|
||||
if (currentShortcuts != null && !currentShortcuts.isEmpty()) {
|
||||
newShortcutsIds.add("compose");
|
||||
for (int a = 0; a < hintsFinal.size(); a++) {
|
||||
TLRPC.TL_topPeer hint = hintsFinal.get(a);
|
||||
newShortcutsIds.add("did3_" + MessageObject.getPeerId(hint.peer));
|
||||
}
|
||||
for (int a = 0; a < currentShortcuts.size(); a++) {
|
||||
String id = currentShortcuts.get(a).getId();
|
||||
if (!newShortcutsIds.remove(id)) {
|
||||
shortcutsToDelete.add(id);
|
||||
}
|
||||
shortcutsToUpdate.add(id);
|
||||
}
|
||||
if (newShortcutsIds.isEmpty() && shortcutsToDelete.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Intent intent = new Intent(ApplicationLoader.applicationContext, LaunchActivity.class);
|
||||
intent.setAction("new_dialog");
|
||||
ArrayList<ShortcutInfoCompat> arrayList = new ArrayList<>();
|
||||
arrayList.add(new ShortcutInfoCompat.Builder(ApplicationLoader.applicationContext, "compose")
|
||||
ShortcutManagerCompat.pushDynamicShortcut(ApplicationLoader.applicationContext, new ShortcutInfoCompat.Builder(ApplicationLoader.applicationContext, "compose")
|
||||
.setShortLabel(LocaleController.getString("NewConversationShortcut", R.string.NewConversationShortcut))
|
||||
.setLongLabel(LocaleController.getString("NewConversationShortcut", R.string.NewConversationShortcut))
|
||||
.setIcon(IconCompat.createWithResource(ApplicationLoader.applicationContext, R.drawable.shortcut_compose))
|
||||
.setRank(0)
|
||||
.setIntent(intent)
|
||||
.build());
|
||||
if (shortcutsToUpdate.contains("compose")) {
|
||||
ShortcutManagerCompat.updateShortcuts(ApplicationLoader.applicationContext, arrayList);
|
||||
} else {
|
||||
ShortcutManagerCompat.addDynamicShortcuts(ApplicationLoader.applicationContext, arrayList);
|
||||
}
|
||||
arrayList.clear();
|
||||
|
||||
if (!shortcutsToDelete.isEmpty()) {
|
||||
ShortcutManagerCompat.removeDynamicShortcuts(ApplicationLoader.applicationContext, shortcutsToDelete);
|
||||
}
|
||||
|
||||
HashSet<String> category = new HashSet<>(1);
|
||||
category.add(SHORTCUT_CATEGORY);
|
||||
|
@ -4419,6 +4397,7 @@ public class MediaDataController extends BaseController {
|
|||
ShortcutInfoCompat.Builder builder = new ShortcutInfoCompat.Builder(ApplicationLoader.applicationContext, id)
|
||||
.setShortLabel(name)
|
||||
.setLongLabel(name)
|
||||
.setRank(1 + a)
|
||||
.setIntent(shortcutIntent);
|
||||
if (SharedConfig.directShare) {
|
||||
builder.setCategories(category);
|
||||
|
@ -4428,13 +4407,7 @@ public class MediaDataController extends BaseController {
|
|||
} else {
|
||||
builder.setIcon(IconCompat.createWithResource(ApplicationLoader.applicationContext, R.drawable.shortcut_user));
|
||||
}
|
||||
arrayList.add(builder.build());
|
||||
if (shortcutsToUpdate.contains(id)) {
|
||||
ShortcutManagerCompat.updateShortcuts(ApplicationLoader.applicationContext, arrayList);
|
||||
} else {
|
||||
ShortcutManagerCompat.addDynamicShortcuts(ApplicationLoader.applicationContext, arrayList);
|
||||
}
|
||||
arrayList.clear();
|
||||
ShortcutManagerCompat.pushDynamicShortcut(ApplicationLoader.applicationContext, builder.build());
|
||||
}
|
||||
} catch (Throwable ignore) {
|
||||
|
||||
|
@ -6627,37 +6600,74 @@ public class MediaDataController extends BaseController {
|
|||
//---------------- DRAFT END ----------------
|
||||
|
||||
private HashMap<String, TLRPC.BotInfo> botInfos = new HashMap<>();
|
||||
private LongSparseArray<TLRPC.Message> botKeyboards = new LongSparseArray<>();
|
||||
private SparseLongArray botKeyboardsByMids = new SparseLongArray();
|
||||
private LongSparseArray<ArrayList<TLRPC.Message>> botDialogKeyboards = new LongSparseArray<>();
|
||||
private HashMap<MessagesStorage.TopicKey, TLRPC.Message> botKeyboards = new HashMap<>();
|
||||
private LongSparseArray<MessagesStorage.TopicKey> botKeyboardsByMids = new LongSparseArray();
|
||||
|
||||
public void clearBotKeyboard(long dialogId, ArrayList<Integer> messages) {
|
||||
public void clearBotKeyboard(MessagesStorage.TopicKey topicKey, ArrayList<Integer> messages) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
if (messages != null) {
|
||||
for (int a = 0; a < messages.size(); a++) {
|
||||
long did1 = botKeyboardsByMids.get(messages.get(a));
|
||||
if (did1 != 0) {
|
||||
botKeyboards.remove(did1);
|
||||
botKeyboardsByMids.delete(messages.get(a));
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, null, did1);
|
||||
final int id = messages.get(a);
|
||||
MessagesStorage.TopicKey foundTopicKey = botKeyboardsByMids.get(id);
|
||||
if (foundTopicKey != null) {
|
||||
botKeyboards.remove(foundTopicKey);
|
||||
ArrayList<TLRPC.Message> dialogMessages = botDialogKeyboards.get(foundTopicKey.dialogId);
|
||||
if (dialogMessages != null) {
|
||||
for (int i = 0; i < dialogMessages.size(); ++i) {
|
||||
TLRPC.Message msg = dialogMessages.get(i);
|
||||
if (msg == null || msg.id == id) {
|
||||
dialogMessages.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (dialogMessages.isEmpty()) {
|
||||
botDialogKeyboards.remove(foundTopicKey.dialogId);
|
||||
}
|
||||
}
|
||||
botKeyboardsByMids.remove(id);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, null, foundTopicKey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
botKeyboards.remove(dialogId);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, null, dialogId);
|
||||
} else if (topicKey != null) {
|
||||
botKeyboards.remove(topicKey);
|
||||
botDialogKeyboards.remove(topicKey.dialogId);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, null, topicKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void loadBotKeyboard(long dialogId) {
|
||||
TLRPC.Message keyboard = botKeyboards.get(dialogId);
|
||||
public void clearBotKeyboard(long dialogId) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
ArrayList<TLRPC.Message> dialogMessages = botDialogKeyboards.get(dialogId);
|
||||
if (dialogMessages != null) {
|
||||
for (int i = 0; i < dialogMessages.size(); ++i) {
|
||||
TLRPC.Message msg = dialogMessages.get(i);
|
||||
int topicId = MessageObject.getTopicId(msg, ChatObject.isForum(currentAccount, dialogId));
|
||||
MessagesStorage.TopicKey topicKey = MessagesStorage.TopicKey.of(dialogId, topicId);
|
||||
botKeyboards.remove(topicKey);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, null, topicKey);
|
||||
}
|
||||
}
|
||||
botDialogKeyboards.remove(dialogId);
|
||||
});
|
||||
}
|
||||
|
||||
public void loadBotKeyboard(MessagesStorage.TopicKey topicKey) {
|
||||
TLRPC.Message keyboard = botKeyboards.get(topicKey);
|
||||
if (keyboard != null) {
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, keyboard, dialogId);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, keyboard, topicKey);
|
||||
return;
|
||||
}
|
||||
getMessagesStorage().getStorageQueue().postRunnable(() -> {
|
||||
try {
|
||||
TLRPC.Message botKeyboard = null;
|
||||
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT info FROM bot_keyboard WHERE uid = %d", dialogId));
|
||||
SQLiteCursor cursor;
|
||||
if (topicKey.topicId != 0) {
|
||||
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT info FROM bot_keyboard_topics WHERE uid = %d AND tid = %d", topicKey.dialogId, topicKey.topicId));
|
||||
} else {
|
||||
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT info FROM bot_keyboard WHERE uid = %d", topicKey.dialogId));
|
||||
}
|
||||
if (cursor.next()) {
|
||||
NativeByteBuffer data;
|
||||
|
||||
|
@ -6673,7 +6683,7 @@ public class MediaDataController extends BaseController {
|
|||
|
||||
if (botKeyboard != null) {
|
||||
TLRPC.Message botKeyboardFinal = botKeyboard;
|
||||
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, botKeyboardFinal, dialogId));
|
||||
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, botKeyboardFinal, topicKey));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -6719,13 +6729,18 @@ public class MediaDataController extends BaseController {
|
|||
});
|
||||
}
|
||||
|
||||
public void putBotKeyboard(long dialogId, TLRPC.Message message) {
|
||||
if (message == null) {
|
||||
public void putBotKeyboard(MessagesStorage.TopicKey topicKey, TLRPC.Message message) {
|
||||
if (topicKey == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int mid = 0;
|
||||
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT mid FROM bot_keyboard WHERE uid = %d", dialogId));
|
||||
SQLiteCursor cursor;
|
||||
if (topicKey.topicId != 0) {
|
||||
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT mid FROM bot_keyboard_topics WHERE uid = %d AND tid = %d", topicKey.dialogId, topicKey.topicId));
|
||||
} else {
|
||||
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT mid FROM bot_keyboard WHERE uid = %d", topicKey.dialogId));
|
||||
}
|
||||
if (cursor.next()) {
|
||||
mid = cursor.intValue(0);
|
||||
}
|
||||
|
@ -6734,28 +6749,46 @@ public class MediaDataController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO bot_keyboard VALUES(?, ?, ?)");
|
||||
SQLitePreparedStatement state;
|
||||
if (topicKey.topicId != 0) {
|
||||
state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO bot_keyboard_topics VALUES(?, ?, ?, ?)");
|
||||
} else {
|
||||
state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO bot_keyboard VALUES(?, ?, ?)");
|
||||
}
|
||||
state.requery();
|
||||
NativeByteBuffer data = new NativeByteBuffer(message.getObjectSize());
|
||||
message.serializeToStream(data);
|
||||
state.bindLong(1, dialogId);
|
||||
state.bindInteger(2, message.id);
|
||||
state.bindByteBuffer(3, data);
|
||||
if (topicKey.topicId != 0) {
|
||||
state.bindLong(1, topicKey.dialogId);
|
||||
state.bindInteger(2, topicKey.topicId);
|
||||
state.bindInteger(3, message.id);
|
||||
state.bindByteBuffer(4, data);
|
||||
} else {
|
||||
state.bindLong(1, topicKey.dialogId);
|
||||
state.bindInteger(2, message.id);
|
||||
state.bindByteBuffer(3, data);
|
||||
}
|
||||
state.step();
|
||||
data.reuse();
|
||||
state.dispose();
|
||||
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
TLRPC.Message old = botKeyboards.get(dialogId);
|
||||
botKeyboards.put(dialogId, message);
|
||||
TLRPC.Message old = botKeyboards.get(topicKey);
|
||||
botKeyboards.put(topicKey, message);
|
||||
ArrayList<TLRPC.Message> messages = botDialogKeyboards.get(topicKey.dialogId);
|
||||
if (messages == null) {
|
||||
messages = new ArrayList<>();
|
||||
}
|
||||
messages.add(message);
|
||||
botDialogKeyboards.put(topicKey.dialogId, messages);
|
||||
long channelId = MessageObject.getChannelId(message);
|
||||
if (channelId == 0) {
|
||||
if (old != null) {
|
||||
botKeyboardsByMids.delete(old.id);
|
||||
}
|
||||
botKeyboardsByMids.put(message.id, dialogId);
|
||||
botKeyboardsByMids.put(message.id, topicKey);
|
||||
}
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, message, dialogId);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, message, topicKey);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
|
|
@ -56,7 +56,6 @@ import org.telegram.ui.Components.URLSpanNoUnderlineBold;
|
|||
import org.telegram.ui.Components.URLSpanReplacement;
|
||||
import org.telegram.ui.Components.URLSpanUserMention;
|
||||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
|
@ -345,6 +344,10 @@ public class MessageObject {
|
|||
message.messageOwner.action instanceof TLRPC.TL_messageActionTopicEdit;
|
||||
}
|
||||
|
||||
public static boolean canCreateStripedThubms() {
|
||||
return SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_HIGH;
|
||||
}
|
||||
|
||||
public int getEmojiOnlyCount() {
|
||||
return emojiOnlyCount;
|
||||
}
|
||||
|
@ -1277,7 +1280,7 @@ public class MessageObject {
|
|||
}
|
||||
|
||||
public void createStrippedThumb() {
|
||||
if (photoThumbs == null || SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_HIGH && !hasExtendedMediaPreview()) {
|
||||
if (photoThumbs == null || !canCreateStripedThubms() && !hasExtendedMediaPreview()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
@ -3083,24 +3086,6 @@ public class MessageObject {
|
|||
}
|
||||
wantedBotKeyboardWidth = Math.max(wantedBotKeyboardWidth, (maxButtonSize + AndroidUtilities.dp(12)) * size + AndroidUtilities.dp(5) * (size - 1));
|
||||
}
|
||||
} else if (messageOwner.reactions != null) {
|
||||
int size = messageOwner.reactions.results.size();
|
||||
for (int a = 0; a < size; a++) {
|
||||
TLRPC.ReactionCount reactionCount = messageOwner.reactions.results.get(a);
|
||||
int maxButtonSize = 0;
|
||||
botButtonsLayout.append(0).append(a);
|
||||
CharSequence text = Emoji.replaceEmoji(String.format("%d %s", reactionCount.count, reactionCount.reaction), Theme.chat_msgBotButtonPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false);
|
||||
StaticLayout staticLayout = new StaticLayout(text, Theme.chat_msgBotButtonPaint, AndroidUtilities.dp(2000), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
if (staticLayout.getLineCount() > 0) {
|
||||
float width = staticLayout.getLineWidth(0);
|
||||
float left = staticLayout.getLineLeft(0);
|
||||
if (left < width) {
|
||||
width -= left;
|
||||
}
|
||||
maxButtonSize = Math.max(maxButtonSize, (int) Math.ceil(width) + AndroidUtilities.dp(4));
|
||||
}
|
||||
wantedBotKeyboardWidth = Math.max(wantedBotKeyboardWidth, (maxButtonSize + AndroidUtilities.dp(12)) * size + AndroidUtilities.dp(5) * (size - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4085,7 +4070,7 @@ public class MessageObject {
|
|||
}
|
||||
for (int a = 0, N = document.thumbs.size(); a < N; a++) {
|
||||
TLRPC.PhotoSize photoSize = document.thumbs.get(a);
|
||||
if (photoSize != null && !(photoSize instanceof TLRPC.TL_photoSizeEmpty) && !(photoSize.location instanceof TLRPC.TL_fileLocationUnavailable)) {
|
||||
if (photoSize != null && !(photoSize instanceof TLRPC.TL_photoSizeEmpty) && (!(photoSize.location instanceof TLRPC.TL_fileLocationUnavailable) || photoSize.bytes != null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1158,8 +1158,8 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
mainPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig" + currentAccount, Activity.MODE_PRIVATE);
|
||||
emojiPreferences = ApplicationLoader.applicationContext.getSharedPreferences("emoji" + currentAccount, Activity.MODE_PRIVATE);
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
enableJoined = notificationsPreferences.getBoolean("EnableContactJoined", true);
|
||||
remoteConfigLoaded = mainPreferences.getBoolean("remoteConfigLoaded", false);
|
||||
secretWebpagePreview = mainPreferences.getInt("secretWebpage2", 2);
|
||||
maxGroupCount = mainPreferences.getInt("maxGroupCount", 200);
|
||||
|
@ -1196,14 +1196,13 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
promoPsaMessage = mainPreferences.getString("promo_psa_message", null);
|
||||
promoPsaType = mainPreferences.getString("promo_psa_type", null);
|
||||
proxyDialogAddress = mainPreferences.getString("proxyDialogAddress", null);
|
||||
nextTosCheckTime = notificationsPreferences.getInt("nextTosCheckTime", 0);
|
||||
venueSearchBot = mainPreferences.getString("venueSearchBot", "foursquare");
|
||||
gifSearchBot = mainPreferences.getString("gifSearchBot", "gif");
|
||||
imageSearchBot = mainPreferences.getString("imageSearchBot", "pic");
|
||||
blockedCountry = mainPreferences.getBoolean("blockedCountry", false);
|
||||
suggestedLangCode = mainPreferences.getString("suggestedLangCode", "en");
|
||||
animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f);
|
||||
qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", false);
|
||||
qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", true);
|
||||
saveGifsWithStickers = mainPreferences.getBoolean("saveGifsWithStickers", false);
|
||||
filtersEnabled = mainPreferences.getBoolean("filtersEnabled", false);
|
||||
getfileExperimentalParams = mainPreferences.getBoolean("getfileExperimentalParams", false);
|
||||
|
@ -1261,9 +1260,16 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
giftTextFieldIcon = mainPreferences.getBoolean("giftTextFieldIcon", false);
|
||||
checkResetLangpack = mainPreferences.getInt("checkResetLangpack", 0);
|
||||
BuildVars.GOOGLE_AUTH_CLIENT_ID = mainPreferences.getString("googleAuthClientId", BuildVars.GOOGLE_AUTH_CLIENT_ID);
|
||||
|
||||
dcDomainName = mainPreferences.getString("dcDomainName2", ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? "tapv3.stel.com" : "apv3.stel.com");
|
||||
webFileDatacenterId = mainPreferences.getInt("webFileDatacenterId", ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? 2 : 4);
|
||||
if (mainPreferences.contains("dcDomainName2")) {
|
||||
dcDomainName = mainPreferences.getString("dcDomainName2", "apv3.stel.com");
|
||||
} else {
|
||||
dcDomainName = ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? "tapv3.stel.com" : "apv3.stel.com";
|
||||
}
|
||||
if (mainPreferences.contains("webFileDatacenterId")) {
|
||||
webFileDatacenterId = mainPreferences.getInt("webFileDatacenterId", 4);
|
||||
} else {
|
||||
webFileDatacenterId = ConnectionsManager.native_isTestBackend(currentAccount) != 0 ? 2 : 4;
|
||||
}
|
||||
|
||||
Set<String> currencySet = mainPreferences.getStringSet("directPaymentsCurrency", null);
|
||||
if (currencySet != null) {
|
||||
|
@ -1392,7 +1398,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
AndroidUtilities.runOnUIThread(this::loadAppConfig, 2000);
|
||||
}
|
||||
|
@ -1400,10 +1405,15 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
topicsController = new TopicsController(num);
|
||||
cacheByChatsController = new CacheByChatsController(num);
|
||||
translateController = new TranslateController(this);
|
||||
|
||||
Utilities.globalQueue.postRunnable(() -> {
|
||||
enableJoined = notificationsPreferences.getBoolean("EnableContactJoined", true);
|
||||
nextTosCheckTime = notificationsPreferences.getInt("nextTosCheckTime", 0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void sendLoadPeersRequest(TLObject req, ArrayList<TLObject> requests, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<DialogFilter> filtersToSave, SparseArray<DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashMap<Integer, HashSet<Long>> filterUserRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
private void sendLoadPeersRequest(TLObject req, ArrayList<TLObject> requests, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<DialogFilter> filtersToSave, SparseArray<DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||
if (response instanceof TLRPC.TL_messages_chats) {
|
||||
TLRPC.TL_messages_chats res = (TLRPC.TL_messages_chats) response;
|
||||
|
@ -1425,12 +1435,12 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
}
|
||||
requests.remove(req);
|
||||
if (requests.isEmpty()) {
|
||||
getMessagesStorage().processLoadedFilterPeers(pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
getMessagesStorage().processLoadedFilterPeers(pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void loadFilterPeers(HashMap<Long, TLRPC.InputPeer> dialogsToLoadMap, HashMap<Long, TLRPC.InputPeer> usersToLoadMap, HashMap<Long, TLRPC.InputPeer> chatsToLoadMap, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<DialogFilter> filtersToSave, SparseArray<DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashMap<Integer, HashSet<Long>> filterUserRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
protected void loadFilterPeers(HashMap<Long, TLRPC.InputPeer> dialogsToLoadMap, HashMap<Long, TLRPC.InputPeer> usersToLoadMap, HashMap<Long, TLRPC.InputPeer> chatsToLoadMap, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<DialogFilter> filtersToSave, SparseArray<DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
Utilities.stageQueue.postRunnable(() -> {
|
||||
ArrayList<TLObject> requests = new ArrayList<>();
|
||||
TLRPC.TL_users_getUsers req = null;
|
||||
|
@ -1441,12 +1451,12 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
}
|
||||
req.id.add(getInputUser(entry.getValue()));
|
||||
if (req.id.size() == 100) {
|
||||
sendLoadPeersRequest(req, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
req = null;
|
||||
}
|
||||
}
|
||||
if (req != null) {
|
||||
sendLoadPeersRequest(req, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
}
|
||||
TLRPC.TL_messages_getChats req2 = null;
|
||||
TLRPC.TL_channels_getChannels req3 = null;
|
||||
|
@ -1459,7 +1469,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
}
|
||||
req2.id.add(entry.getKey());
|
||||
if (req2.id.size() == 100) {
|
||||
sendLoadPeersRequest(req2, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req2, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
req2 = null;
|
||||
}
|
||||
} else if (inputPeer.channel_id != 0) {
|
||||
|
@ -1469,16 +1479,16 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
}
|
||||
req3.id.add(getInputChannel(inputPeer));
|
||||
if (req3.id.size() == 100) {
|
||||
sendLoadPeersRequest(req3, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req3, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
req3 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (req2 != null) {
|
||||
sendLoadPeersRequest(req2, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req2, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
}
|
||||
if (req3 != null) {
|
||||
sendLoadPeersRequest(req3, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req3, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
}
|
||||
|
||||
TLRPC.TL_messages_getPeerDialogs req4 = null;
|
||||
|
@ -1491,12 +1501,12 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
inputDialogPeer.peer = entry.getValue();
|
||||
req4.peers.add(inputDialogPeer);
|
||||
if (req4.peers.size() == 100) {
|
||||
sendLoadPeersRequest(req4, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req4, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
req4 = null;
|
||||
}
|
||||
}
|
||||
if (req4 != null) {
|
||||
sendLoadPeersRequest(req4, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
sendLoadPeersRequest(req4, requests, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -7930,13 +7940,29 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
}
|
||||
boolean isInitialLoading = offset_date == 0 && max_id == 0;
|
||||
boolean reload;
|
||||
LongSparseArray<TLRPC.User> usersDict = new LongSparseArray<>();
|
||||
LongSparseArray<TLRPC.Chat> chatsDict = new LongSparseArray<>();
|
||||
for (int a = 0; a < messagesRes.users.size(); a++) {
|
||||
TLRPC.User u = messagesRes.users.get(a);
|
||||
usersDict.put(u.id, u);
|
||||
}
|
||||
for (int a = 0; a < messagesRes.chats.size(); a++) {
|
||||
TLRPC.Chat c = messagesRes.chats.get(a);
|
||||
chatsDict.put(c.id, c);
|
||||
}
|
||||
if (mode == 1) {
|
||||
reload = ((SystemClock.elapsedRealtime() - lastScheduledServerQueryTime.get(dialogId, 0L)) > 60 * 1000);
|
||||
} else {
|
||||
reload = resCount == 0 && (!isInitialLoading || (SystemClock.elapsedRealtime() - lastServerQueryTime.get(dialogId, 0L)) > 60 * 1000 || (isCache && isTopic));
|
||||
if (mode == 0 && isCache && dialogId < 0 && !dialogs_dict.containsKey(dialogId) && (SystemClock.elapsedRealtime() - lastServerQueryTime.get(dialogId, 0L)) > 24 * 60 * 60 * 1000) {
|
||||
messagesRes.messages.clear();
|
||||
reload = true;
|
||||
if (isCache && dialogId < 0) {
|
||||
TLRPC.Chat chat = getChat(-dialogId);
|
||||
if (chat == null) {
|
||||
chat = chatsDict.get(-dialogId);
|
||||
}
|
||||
if (chat != null && mode == 0 && ChatObject.isNotInChat(chat) && (SystemClock.elapsedRealtime() - lastServerQueryTime.get(dialogId, 0L)) > 24 * 60 * 60 * 1000) {
|
||||
messagesRes.messages.clear();
|
||||
reload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DialogObject.isEncryptedDialog(dialogId) && isCache && reload) {
|
||||
|
@ -7965,19 +7991,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
return;
|
||||
}
|
||||
}
|
||||
LongSparseArray<TLRPC.User> usersDict = new LongSparseArray<>();
|
||||
LongSparseArray<TLRPC.Chat> chatsDict = new LongSparseArray<>();
|
||||
for (int a = 0; a < messagesRes.users.size(); a++) {
|
||||
TLRPC.User u = messagesRes.users.get(a);
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
FileLog.d("processLoadedMessages(): +usersDict put " + u.id + " " + u);
|
||||
}
|
||||
usersDict.put(u.id, u);
|
||||
}
|
||||
for (int a = 0; a < messagesRes.chats.size(); a++) {
|
||||
TLRPC.Chat c = messagesRes.chats.get(a);
|
||||
chatsDict.put(c.id, c);
|
||||
}
|
||||
int size = messagesRes.messages.size();
|
||||
if (!isCache) {
|
||||
Integer inboxValue = dialogs_read_inbox_max.get(dialogId);
|
||||
|
@ -8028,15 +8041,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
ArrayList<MessageObject> objects = new ArrayList<>();
|
||||
ArrayList<Integer> messagesToReload = new ArrayList<>();
|
||||
HashMap<String, ArrayList<MessageObject>> webpagesToReload = new HashMap<>();
|
||||
TLRPC.InputChannel inputChannel = null;
|
||||
long fileProcessTime = 0;
|
||||
for (int a = 0; a < size; a++) {
|
||||
TLRPC.Message message = messagesRes.messages.get(a);
|
||||
message.dialog_id = dialogId;
|
||||
long checkFileTime = SystemClock.elapsedRealtime();
|
||||
MessageObject messageObject = new MessageObject(currentAccount, message, usersDict, chatsDict, true, false);
|
||||
messageObject.createStrippedThumb();
|
||||
fileProcessTime += (SystemClock.elapsedRealtime() - checkFileTime);
|
||||
messageObject.scheduled = mode == 1;
|
||||
objects.add(messageObject);
|
||||
if (isCache) {
|
||||
|
@ -8061,10 +8070,14 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
getFileLoader().checkMediaExistance(objects);
|
||||
if (MessageObject.canCreateStripedThubms()) {
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
objects.get(i).createStrippedThumb();
|
||||
}
|
||||
}
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("process time = " + (SystemClock.elapsedRealtime() - startProcessTime) + " file time = " + fileProcessTime + " for dialog = " + dialogId);
|
||||
FileLog.d("process time=" + (SystemClock.elapsedRealtime() - startProcessTime) + " count=" + objects.size() + " for dialog " + dialogId);
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
putUsers(messagesRes.users, isCache);
|
||||
|
|
|
@ -15,6 +15,7 @@ import android.text.SpannableStringBuilder;
|
|||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
|
@ -94,7 +95,7 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
public final static int LAST_DB_VERSION = 114;
|
||||
public final static int LAST_DB_VERSION = 115;
|
||||
private boolean databaseMigrationInProgress;
|
||||
public boolean showClearDatabaseAlert;
|
||||
private LongSparseIntArray dialogIsForum = new LongSparseIntArray();
|
||||
|
@ -411,14 +412,9 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
}
|
||||
if (!restored) {
|
||||
cleanupInternal(true);
|
||||
for (int a = 0; a < 2; a++) {
|
||||
getUserConfig().setDialogsLoadOffset(a, 0, 0, 0, 0, 0, 0);
|
||||
getUserConfig().setTotalDialogsCount(a, 0);
|
||||
}
|
||||
getUserConfig().saveConfig(false);
|
||||
openDatabase(1);
|
||||
}
|
||||
reset();
|
||||
return restored;
|
||||
}
|
||||
|
||||
|
@ -440,6 +436,7 @@ public class MessagesStorage extends BaseController {
|
|||
"params",
|
||||
"media_v4",
|
||||
"bot_keyboard",
|
||||
"bot_keyboard_topics",
|
||||
"chat_settings_v2",
|
||||
"user_settings",
|
||||
"chat_pinned_v2",
|
||||
|
@ -554,6 +551,9 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast("CREATE TABLE bot_keyboard(uid INTEGER PRIMARY KEY, mid INTEGER, info BLOB)").stepThis().dispose();
|
||||
database.executeFast("CREATE INDEX IF NOT EXISTS bot_keyboard_idx_mid_v2 ON bot_keyboard(mid, uid);").stepThis().dispose();
|
||||
|
||||
database.executeFast("CREATE TABLE bot_keyboard_topics(uid INTEGER, tid INTEGER, mid INTEGER, info BLOB, PRIMARY KEY(uid, tid))").stepThis().dispose();
|
||||
database.executeFast("CREATE INDEX IF NOT EXISTS bot_keyboard_topics_idx_mid_v2 ON bot_keyboard_topics(mid, uid, tid);").stepThis().dispose();
|
||||
|
||||
database.executeFast("CREATE TABLE chat_settings_v2(uid INTEGER PRIMARY KEY, info BLOB, pinned INTEGER, online INTEGER, inviter INTEGER, links INTEGER)").stepThis().dispose();
|
||||
database.executeFast("CREATE INDEX IF NOT EXISTS chat_settings_pinned_idx ON chat_settings_v2(uid, pinned) WHERE pinned != 0;").stepThis().dispose();
|
||||
|
||||
|
@ -1299,10 +1299,11 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast("DELETE FROM messages_v2 WHERE uid = " + did + " AND mid != " + last_mid_i + " AND mid != " + last_mid).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_holes WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard_topics WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_counts_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_v4 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_holes_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
MediaDataController.getInstance(currentAccount).clearBotKeyboard(did, null);
|
||||
MediaDataController.getInstance(currentAccount).clearBotKeyboard(did);
|
||||
if (messageId != -1) {
|
||||
MessagesStorage.createFirstHoles(did, state5, state6, messageId, 0);
|
||||
}
|
||||
|
@ -2767,6 +2768,28 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
private ArrayList<Long> toPeerIds(ArrayList<TLRPC.InputPeer> inputPeers) {
|
||||
ArrayList<Long> array = new ArrayList<Long>();
|
||||
if (inputPeers == null) {
|
||||
return array;
|
||||
}
|
||||
final int count = inputPeers.size();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
TLRPC.InputPeer peer = inputPeers.get(i);
|
||||
if (peer == null) {
|
||||
continue;
|
||||
}
|
||||
long id;
|
||||
if (peer.user_id != 0) {
|
||||
id = peer.user_id;
|
||||
} else {
|
||||
id = -(peer.chat_id != 0 ? peer.chat_id : peer.channel_id);
|
||||
}
|
||||
array.add(id);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public void checkLoadedRemoteFilters(TLRPC.Vector vector) {
|
||||
storageQueue.postRunnable(() -> {
|
||||
try {
|
||||
|
@ -2776,14 +2799,15 @@ public class MessagesStorage extends BaseController {
|
|||
filtersToDelete.put(filter.id, filter);
|
||||
}
|
||||
ArrayList<Integer> filtersOrder = new ArrayList<>();
|
||||
|
||||
ArrayList<Long> usersToLoad = new ArrayList<>();
|
||||
HashMap<Long, TLRPC.InputPeer> usersToLoadMap = new HashMap<>();
|
||||
ArrayList<Long> chatsToLoad = new ArrayList<>();
|
||||
HashMap<Long, TLRPC.InputPeer> chatsToLoadMap = new HashMap<>();
|
||||
ArrayList<Long> dialogsToLoad = new ArrayList<>();
|
||||
HashMap<Long, TLRPC.InputPeer> dialogsToLoadMap = new HashMap<>();
|
||||
|
||||
ArrayList<MessagesController.DialogFilter> filtersToSave = new ArrayList<>();
|
||||
HashMap<Integer, HashSet<Long>> filterUserRemovals = new HashMap<>();
|
||||
HashMap<Integer, HashSet<Long>> filterDialogRemovals = new HashMap<>();
|
||||
HashSet<Integer> filtersUnreadCounterReset = new HashSet<>();
|
||||
for (int a = 0, N = vector.objects.size(); a < N; a++) {
|
||||
|
@ -2867,7 +2891,6 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int c = 0, N2 = filter.pinnedDialogs.size(); c < N2; c++) {
|
||||
long did = filter.pinnedDialogs.keyAt(c);
|
||||
if (DialogObject.isEncryptedDialog(did)) {
|
||||
|
@ -2876,83 +2899,73 @@ public class MessagesStorage extends BaseController {
|
|||
existingDialogsIds.add(did);
|
||||
existingIds.remove(did);
|
||||
}
|
||||
for (int c = 0; c < 2; c++) {
|
||||
ArrayList<TLRPC.InputPeer> fromArray = c == 0 ? newFilter.include_peers : newFilter.exclude_peers;
|
||||
ArrayList<Long> toArray = c == 0 ? filter.alwaysShow : filter.neverShow;
|
||||
|
||||
if (c == 0) {
|
||||
filter.pinnedDialogs.clear();
|
||||
for (int b = 0, N2 = newFilter.pinned_peers.size(); b < N2; b++) {
|
||||
TLRPC.InputPeer peer = newFilter.pinned_peers.get(b);
|
||||
Long id;
|
||||
if (peer.user_id != 0) {
|
||||
id = peer.user_id;
|
||||
} else {
|
||||
id = -(peer.chat_id != 0 ? peer.chat_id : peer.channel_id);
|
||||
}
|
||||
if (!filter.alwaysShow.contains(id)) {
|
||||
filter.alwaysShow.add(id);
|
||||
}
|
||||
int index = filter.pinnedDialogs.size();
|
||||
if (secretChatsMap != null) {
|
||||
Long did;
|
||||
while ((did = secretChatsMap.remove(index)) != null) {
|
||||
filter.pinnedDialogs.put(did, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
filter.pinnedDialogs.put(id, index);
|
||||
existingIds.remove(id);
|
||||
if (!existingDialogsIds.remove(id)) {
|
||||
changed = true;
|
||||
if (!dialogsToLoadMap.containsKey(id)) {
|
||||
dialogsToLoad.add(id);
|
||||
dialogsToLoadMap.put(id, peer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (secretChatsMap != null) {
|
||||
for (LinkedHashMap.Entry<Integer, Long> entry : secretChatsMap.entrySet()) {
|
||||
filter.pinnedDialogs.put(entry.getValue(), filter.pinnedDialogs.size());
|
||||
}
|
||||
filter.pinnedDialogs.clear();
|
||||
for (int b = 0, N2 = newFilter.pinned_peers.size(); b < N2; b++) {
|
||||
TLRPC.InputPeer peer = newFilter.pinned_peers.get(b);
|
||||
Long id;
|
||||
if (peer.user_id != 0) {
|
||||
id = peer.user_id;
|
||||
} else {
|
||||
id = -(peer.chat_id != 0 ? peer.chat_id : peer.channel_id);
|
||||
}
|
||||
int index = filter.pinnedDialogs.size();
|
||||
if (secretChatsMap != null) {
|
||||
Long did;
|
||||
while ((did = secretChatsMap.remove(index)) != null) {
|
||||
filter.pinnedDialogs.put(did, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
for (int b = 0, N2 = fromArray.size(); b < N2; b++) {
|
||||
TLRPC.InputPeer peer = fromArray.get(b);
|
||||
if (peer.user_id != 0) {
|
||||
Long uid = peer.user_id;
|
||||
if (!existingIds.remove(uid)) {
|
||||
changed = true;
|
||||
if (!toArray.contains(uid)) {
|
||||
toArray.add(uid);
|
||||
}
|
||||
if (!usersToLoadMap.containsKey(uid)) {
|
||||
usersToLoad.add(uid);
|
||||
usersToLoadMap.put(uid, peer);
|
||||
unreadChanged = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Long chatId = peer.chat_id != 0 ? peer.chat_id : peer.channel_id;
|
||||
Long dialogId = -chatId;
|
||||
if (!existingIds.remove(dialogId)) {
|
||||
changed = true;
|
||||
if (!toArray.contains(dialogId)) {
|
||||
toArray.add(dialogId);
|
||||
}
|
||||
if (!chatsToLoadMap.containsKey(chatId)) {
|
||||
chatsToLoad.add(chatId);
|
||||
chatsToLoadMap.put(chatId, peer);
|
||||
unreadChanged = true;
|
||||
}
|
||||
}
|
||||
filter.pinnedDialogs.put(id, index);
|
||||
existingIds.remove(id);
|
||||
if (!existingDialogsIds.remove(id)) {
|
||||
changed = true;
|
||||
if (!dialogsToLoadMap.containsKey(id)) {
|
||||
dialogsToLoad.add(id);
|
||||
dialogsToLoadMap.put(id, peer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!existingIds.isEmpty()) {
|
||||
filterUserRemovals.put(filter.id, existingIds);
|
||||
unreadChanged = true;
|
||||
changed = true;
|
||||
if (secretChatsMap != null) {
|
||||
for (LinkedHashMap.Entry<Integer, Long> entry : secretChatsMap.entrySet()) {
|
||||
filter.pinnedDialogs.put(entry.getValue(), filter.pinnedDialogs.size());
|
||||
}
|
||||
}
|
||||
|
||||
for (int c = 0; c < 2; c++) {
|
||||
ArrayList<Long> fromArray = toPeerIds(c == 0 ? newFilter.include_peers : newFilter.exclude_peers);
|
||||
ArrayList<Long> toArray = c == 0 ? filter.alwaysShow : filter.neverShow;
|
||||
|
||||
if (c == 0) {
|
||||
// put pinned_peers into include_peers (alwaysShow)
|
||||
ArrayList<Long> pinnedArray = toPeerIds(newFilter.pinned_peers);
|
||||
for (int i = 0; i < pinnedArray.size(); ++i) {
|
||||
fromArray.remove(pinnedArray.get(i));
|
||||
}
|
||||
fromArray.addAll(0, pinnedArray);
|
||||
}
|
||||
|
||||
final int fromArrayCount = fromArray.size();
|
||||
boolean isDifferent = fromArray.size() != toArray.size();
|
||||
if (!isDifferent) {
|
||||
for (int i = 0; i < fromArrayCount; ++i) {
|
||||
if (!toArray.contains(fromArray.get(i))) {
|
||||
isDifferent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isDifferent) {
|
||||
unreadChanged = true;
|
||||
changed = true;
|
||||
if (c == 0) {
|
||||
filter.alwaysShow = fromArray;
|
||||
} else {
|
||||
filter.neverShow = fromArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!existingDialogsIds.isEmpty()) {
|
||||
filterDialogRemovals.put(filter.id, existingDialogsIds);
|
||||
|
@ -3048,9 +3061,9 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
|
||||
if (usersToLoadMap.isEmpty() && chatsToLoadMap.isEmpty() && dialogsToLoadMap.isEmpty()) {
|
||||
processLoadedFilterPeersInternal(dialogs, null, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
processLoadedFilterPeersInternal(dialogs, null, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
} else {
|
||||
getMessagesController().loadFilterPeers(dialogsToLoadMap, usersToLoadMap, chatsToLoadMap, dialogs, new TLRPC.TL_messages_dialogs(), users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset);
|
||||
getMessagesController().loadFilterPeers(dialogsToLoadMap, usersToLoadMap, chatsToLoadMap, dialogs, new TLRPC.TL_messages_dialogs(), users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
checkSQLException(e);
|
||||
|
@ -3058,7 +3071,7 @@ public class MessagesStorage extends BaseController {
|
|||
});
|
||||
}
|
||||
|
||||
private void processLoadedFilterPeersInternal(TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<MessagesController.DialogFilter> filtersToSave, SparseArray<MessagesController.DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashMap<Integer, HashSet<Long>> filterUserRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
private void processLoadedFilterPeersInternal(TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<MessagesController.DialogFilter> filtersToSave, SparseArray<MessagesController.DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
boolean anythingChanged = false;
|
||||
putUsersAndChats(users, chats, true, false);
|
||||
for (int a = 0, N = filtersToDelete.size(); a < N; a++) {
|
||||
|
@ -3072,16 +3085,6 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
filter.pendingUnreadCount = -1;
|
||||
}
|
||||
for (HashMap.Entry<Integer, HashSet<Long>> entry : filterUserRemovals.entrySet()) {
|
||||
MessagesController.DialogFilter filter = dialogFiltersMap.get(entry.getKey());
|
||||
if (filter == null) {
|
||||
continue;
|
||||
}
|
||||
HashSet<Long> set = entry.getValue();
|
||||
filter.alwaysShow.removeAll(set);
|
||||
filter.neverShow.removeAll(set);
|
||||
anythingChanged = true;
|
||||
}
|
||||
for (HashMap.Entry<Integer, HashSet<Long>> entry : filterDialogRemovals.entrySet()) {
|
||||
MessagesController.DialogFilter filter = dialogFiltersMap.get(entry.getKey());
|
||||
if (filter == null) {
|
||||
|
@ -3123,8 +3126,8 @@ public class MessagesStorage extends BaseController {
|
|||
getMessagesController().processLoadedDialogFilters(new ArrayList<>(dialogFilters), pinnedDialogs, pinnedRemoteDialogs, users, chats, null, remote);
|
||||
}
|
||||
|
||||
protected void processLoadedFilterPeers(TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<MessagesController.DialogFilter> filtersToSave, SparseArray<MessagesController.DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashMap<Integer, HashSet<Long>> filterUserRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
storageQueue.postRunnable(() -> processLoadedFilterPeersInternal(pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filterUserRemovals, filtersUnreadCounterReset));
|
||||
protected void processLoadedFilterPeers(TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<MessagesController.DialogFilter> filtersToSave, SparseArray<MessagesController.DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashSet<Integer> filtersUnreadCounterReset) {
|
||||
storageQueue.postRunnable(() -> processLoadedFilterPeersInternal(pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset));
|
||||
}
|
||||
|
||||
private void deleteDialogFilterInternal(MessagesController.DialogFilter filter) {
|
||||
|
@ -3804,10 +3807,11 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast("DELETE FROM messages_v2 WHERE uid = " + did + " AND mid != " + last_mid_i + " AND mid != " + last_mid).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_holes WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard_topics WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_counts_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_v4 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_holes_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
getMediaDataController().clearBotKeyboard(did, null);
|
||||
getMediaDataController().clearBotKeyboard(did);
|
||||
|
||||
state5 = database.executeFast("REPLACE INTO messages_holes VALUES(?, ?, ?)");
|
||||
state6 = database.executeFast("REPLACE INTO media_holes_v2 VALUES(?, ?, ?, ?)");
|
||||
|
@ -3828,11 +3832,12 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast("UPDATE dialogs SET unread_count = 0, unread_count_i = 0 WHERE did = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard_topics WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_counts_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_v4 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_holes WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_holes_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
getMediaDataController().clearBotKeyboard(did, null);
|
||||
getMediaDataController().clearBotKeyboard(did);
|
||||
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.needReloadRecentDialogsSearch));
|
||||
resetAllUnreadCounters(false);
|
||||
updateWidgets(did);
|
||||
|
@ -3981,6 +3986,7 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast("DELETE FROM messages_v2 WHERE uid IN " + ids).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM polls_v2 WHERE 1").stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard WHERE uid IN " + ids).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard_topics WHERE uid IN " + ids).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_v4 WHERE uid IN " + ids).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_holes WHERE uid IN " + ids).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_holes_v2 WHERE uid IN " + ids).stepThis().dispose();
|
||||
|
@ -9693,6 +9699,7 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast("DELETE FROM chat_pinned_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_v2 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM bot_keyboard_topics WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("UPDATE media_counts_v2 SET old = 1 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_v4 WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_holes WHERE uid = " + did).stepThis().dispose();
|
||||
|
@ -9705,7 +9712,7 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast("DELETE FROM messages_topics WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages_holes_topics WHERE uid = " + did).stepThis().dispose();
|
||||
|
||||
getMediaDataController().clearBotKeyboard(did, null);
|
||||
getMediaDataController().clearBotKeyboard(did);
|
||||
|
||||
TLRPC.TL_messages_dialogs dialogs = new TLRPC.TL_messages_dialogs();
|
||||
dialogs.chats.addAll(difference.chats);
|
||||
|
@ -10229,7 +10236,7 @@ public class MessagesStorage extends BaseController {
|
|||
LongSparseIntArray newMentionsCounts = new LongSparseIntArray();
|
||||
LongSparseIntArray mentionCounts = new LongSparseIntArray();
|
||||
SparseArray<LongSparseIntArray> mediaCounts = null;
|
||||
LongSparseArray<TLRPC.Message> botKeyboards = new LongSparseArray<>();
|
||||
HashMap<TopicKey, TLRPC.Message> botKeyboards = new HashMap<>();
|
||||
|
||||
LongSparseArray<ArrayList<Integer>> dialogMessagesMediaIdsMap = null;
|
||||
LongSparseArray<SparseIntArray> dialogsMediaTypesChange = null;
|
||||
|
@ -10403,15 +10410,20 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
}
|
||||
if (isValidKeyboardToSave(message)) {
|
||||
TLRPC.Message oldMessage = botKeyboards.get(message.dialog_id);
|
||||
TopicKey topicKey = TopicKey.of(message.dialog_id, topicId);
|
||||
TLRPC.Message oldMessage = botKeyboards.get(topicKey);
|
||||
if (oldMessage == null || oldMessage.id < message.id) {
|
||||
botKeyboards.put(message.dialog_id, message);
|
||||
botKeyboards.put(topicKey, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int a = 0; a < botKeyboards.size(); a++) {
|
||||
getMediaDataController().putBotKeyboard(botKeyboards.keyAt(a), botKeyboards.valueAt(a));
|
||||
if (botKeyboards != null && !botKeyboards.isEmpty()) {
|
||||
Iterator<TopicKey> iterator = botKeyboards.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TopicKey topicKey = iterator.next();
|
||||
getMediaDataController().putBotKeyboard(topicKey, botKeyboards.get(topicKey));
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaIdsMap != null) {
|
||||
|
@ -12210,6 +12222,7 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast(String.format(Locale.US, "DELETE FROM messages_topics WHERE mid IN(%s) AND uid = %d", ids, did)).stepThis().dispose();
|
||||
database.executeFast(String.format(Locale.US, "DELETE FROM polls_v2 WHERE mid IN(%s) AND uid = %d", ids, did)).stepThis().dispose();
|
||||
database.executeFast(String.format(Locale.US, "DELETE FROM bot_keyboard WHERE mid IN(%s) AND uid = %d", ids, did)).stepThis().dispose();
|
||||
database.executeFast(String.format(Locale.US, "DELETE FROM bot_keyboard_topics WHERE mid IN(%s) AND uid = %d", ids, did)).stepThis().dispose();
|
||||
if (unknownMessages.isEmpty()) {
|
||||
cursor = database.queryFinalized(String.format(Locale.US, "SELECT uid, type FROM media_v4 WHERE mid IN(%s) AND uid = %d", ids, did));
|
||||
SparseArray<LongSparseArray<Integer>> mediaCounts = null;
|
||||
|
@ -12344,7 +12357,7 @@ public class MessagesStorage extends BaseController {
|
|||
database.executeFast(String.format(Locale.US, "UPDATE media_counts_topics SET old = 1 WHERE uid = %d", dialogId)).stepThis().dispose();
|
||||
}
|
||||
}
|
||||
getMediaDataController().clearBotKeyboard(0, messages);
|
||||
getMediaDataController().clearBotKeyboard(null, messages);
|
||||
|
||||
if (dialogsToUpdate.size() != 0) {
|
||||
resetAllUnreadCounters(false);
|
||||
|
@ -13378,7 +13391,7 @@ public class MessagesStorage extends BaseController {
|
|||
state_webpage = null;
|
||||
state_tasks = null;
|
||||
int minDeleteTime = Integer.MAX_VALUE;
|
||||
TLRPC.Message botKeyboard = null;
|
||||
HashMap<TopicKey, TLRPC.Message> botKeyboards = null;
|
||||
long channelId = 0;
|
||||
for (int a = 0; a < count; a++) {
|
||||
TLRPC.Message message = messages.messages.get(a);
|
||||
|
@ -13656,8 +13669,13 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
|
||||
if (load_type == 0 && isValidKeyboardToSave(message)) {
|
||||
if (botKeyboard == null || botKeyboard.id < message.id) {
|
||||
botKeyboard = message;
|
||||
TopicKey topicKey = TopicKey.of(dialogId, MessageObject.getTopicId(message, isForum(dialogId)));
|
||||
TLRPC.Message currentBotKeyboard = botKeyboards == null ? null : botKeyboards.get(topicKey);
|
||||
if (currentBotKeyboard == null || currentBotKeyboard.id < message.id) {
|
||||
if (botKeyboards == null) {
|
||||
botKeyboards = new HashMap<>();
|
||||
}
|
||||
botKeyboards.put(topicKey, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13680,8 +13698,12 @@ public class MessagesStorage extends BaseController {
|
|||
state_polls.dispose();
|
||||
state_polls = null;
|
||||
}
|
||||
if (botKeyboard != null) {
|
||||
getMediaDataController().putBotKeyboard(dialogId, botKeyboard);
|
||||
if (botKeyboards != null) {
|
||||
Iterator<TopicKey> iterator = botKeyboards.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TopicKey topicKey = iterator.next();
|
||||
getMediaDataController().putBotKeyboard(topicKey, botKeyboards.get(topicKey));
|
||||
}
|
||||
}
|
||||
deleteFromDownloadQueue(idsToDelete, false);
|
||||
AndroidUtilities.runOnUIThread(() -> getFileLoader().cancelLoadFiles(namesToDelete));
|
||||
|
@ -14362,7 +14384,8 @@ public class MessagesStorage extends BaseController {
|
|||
messageDate = Math.max(message.date, messageDate);
|
||||
|
||||
if (isValidKeyboardToSave(message)) {
|
||||
getMediaDataController().putBotKeyboard(dialog.id, message);
|
||||
TopicKey topicKey = TopicKey.of(dialog.id, MessageObject.getTopicId(message, isForum(dialog.id)));
|
||||
getMediaDataController().putBotKeyboard(topicKey, message);
|
||||
}
|
||||
|
||||
fixUnsupportedMedia(message);
|
||||
|
@ -15646,5 +15669,13 @@ public class MessagesStorage extends BaseController {
|
|||
public int hashCode() {
|
||||
return Objects.hash(dialogId, topicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TopicKey{" +
|
||||
"dialogId=" + dialogId +
|
||||
", topicId=" + topicId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1019,7 +1019,7 @@ public class SecretChatHelper extends BaseController {
|
|||
}
|
||||
byte[] thumb = ((TLRPC.TL_decryptedMessageMediaDocument) decryptedMessage.media).thumb;
|
||||
TLRPC.PhotoSize photoSize;
|
||||
if (thumb != null && thumb.length != 0 && thumb.length <= 6000 && decryptedMessage.media.thumb_w <= 100 && decryptedMessage.media.thumb_h <= 100) {
|
||||
if (thumb != null && thumb.length != 0 && thumb.length <= 20000) {
|
||||
photoSize = new TLRPC.TL_photoCachedSize();
|
||||
photoSize.bytes = thumb;
|
||||
photoSize.w = decryptedMessage.media.thumb_w;
|
||||
|
|
|
@ -1580,17 +1580,25 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
if (newDocument.mime_type == null) {
|
||||
newDocument.mime_type = "";
|
||||
}
|
||||
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
|
||||
if (thumb instanceof TLRPC.TL_photoSize || thumb instanceof TLRPC.TL_photoSizeProgressive) {
|
||||
File file = FileLoader.getInstance(currentAccount).getPathToAttach(thumb, true);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
int len = (int) file.length();
|
||||
byte[] arr = new byte[(int) file.length()];
|
||||
RandomAccessFile reader = new RandomAccessFile(file, "r");
|
||||
reader.readFully(arr);
|
||||
|
||||
TLRPC.PhotoSize newThumb = new TLRPC.TL_photoCachedSize();
|
||||
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 10);
|
||||
if (thumb instanceof TLRPC.TL_photoSize || thumb instanceof TLRPC.TL_photoSizeProgressive || thumb instanceof TLRPC.TL_photoStrippedSize) {
|
||||
File file = FileLoader.getInstance(currentAccount).getPathToAttach(thumb, true);
|
||||
if (thumb instanceof TLRPC.TL_photoStrippedSize || file.exists()) {
|
||||
try {
|
||||
byte[] arr;
|
||||
TLRPC.PhotoSize newThumb;
|
||||
if (thumb instanceof TLRPC.TL_photoStrippedSize) {
|
||||
newThumb = new TLRPC.TL_photoStrippedSize();
|
||||
arr = thumb.bytes;
|
||||
} else {
|
||||
newThumb = new TLRPC.TL_photoCachedSize();
|
||||
int len = (int) file.length();
|
||||
arr = new byte[(int) file.length()];
|
||||
RandomAccessFile reader = new RandomAccessFile(file, "r");
|
||||
reader.readFully(arr);
|
||||
}
|
||||
|
||||
TLRPC.TL_fileLocation_layer82 fileLocation = new TLRPC.TL_fileLocation_layer82();
|
||||
fileLocation.dc_id = thumb.location.dc_id;
|
||||
fileLocation.volume_id = thumb.location.volume_id;
|
||||
|
@ -4538,10 +4546,16 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
reqSend.media.caption = caption;
|
||||
TLRPC.PhotoSize thumb = getThumbForSecretChat(document.thumbs);
|
||||
if (thumb != null) {
|
||||
ImageLoader.fillPhotoSizeWithBytes(thumb);
|
||||
((TLRPC.TL_decryptedMessageMediaDocument) reqSend.media).thumb = thumb.bytes;
|
||||
reqSend.media.thumb_h = thumb.h;
|
||||
reqSend.media.thumb_w = thumb.w;
|
||||
if (thumb instanceof TLRPC.TL_photoStrippedSize) {
|
||||
((TLRPC.TL_decryptedMessageMediaDocument) reqSend.media).thumb = thumb.bytes;
|
||||
reqSend.media.thumb_h = thumb.h;
|
||||
reqSend.media.thumb_w = thumb.w;
|
||||
} else {
|
||||
ImageLoader.fillPhotoSizeWithBytes(thumb);
|
||||
((TLRPC.TL_decryptedMessageMediaDocument) reqSend.media).thumb = thumb.bytes;
|
||||
reqSend.media.thumb_h = thumb.h;
|
||||
reqSend.media.thumb_w = thumb.w;
|
||||
}
|
||||
} else {
|
||||
((TLRPC.TL_decryptedMessageMediaDocument) reqSend.media).thumb = new byte[0];
|
||||
reqSend.media.thumb_h = 0;
|
||||
|
@ -4726,9 +4740,12 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
}
|
||||
for (int a = 0, N = arrayList.size(); a < N; a++) {
|
||||
TLRPC.PhotoSize size = arrayList.get(a);
|
||||
if (size == null || size instanceof TLRPC.TL_photoStrippedSize || size instanceof TLRPC.TL_photoPathSize || size instanceof TLRPC.TL_photoSizeEmpty || size.location == null) {
|
||||
if (size == null || size instanceof TLRPC.TL_photoPathSize || size instanceof TLRPC.TL_photoSizeEmpty || size.location == null) {
|
||||
continue;
|
||||
}
|
||||
if (size instanceof TLRPC.TL_photoStrippedSize) {
|
||||
return size;
|
||||
}
|
||||
TLRPC.TL_photoSize photoSize = new TLRPC.TL_photoSize_layer127();
|
||||
photoSize.type = size.type;
|
||||
photoSize.w = size.w;
|
||||
|
|
|
@ -111,6 +111,7 @@ public class SharedConfig {
|
|||
public static boolean disableVoiceAudioEffects;
|
||||
public static boolean forceDisableTabletMode;
|
||||
public static boolean updateStickersOrderOnSend = true;
|
||||
public static boolean bigCameraForRound;
|
||||
private static int lastLocalId = -210000;
|
||||
|
||||
public static String storageCacheDir;
|
||||
|
@ -127,6 +128,7 @@ public class SharedConfig {
|
|||
public static int mapPreviewType = 2;
|
||||
public static boolean chatBubbles = Build.VERSION.SDK_INT >= 30;
|
||||
public static boolean raiseToSpeak = false;
|
||||
public static boolean raiseToListen = true;
|
||||
public static boolean recordViaSco = false;
|
||||
public static boolean customTabs = true;
|
||||
public static boolean directShare = true;
|
||||
|
@ -138,6 +140,7 @@ public class SharedConfig {
|
|||
public static boolean streamMkv = false;
|
||||
public static boolean saveStreamMedia = true;
|
||||
public static boolean pauseMusicOnRecord = false;
|
||||
public static boolean pauseMusicOnMedia = true;
|
||||
public static boolean noiseSupression;
|
||||
public static final boolean noStatusBar = true;
|
||||
public static boolean debugWebView;
|
||||
|
@ -448,6 +451,7 @@ public class SharedConfig {
|
|||
preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
SaveToGallerySettingsHelper.load(preferences);
|
||||
mapPreviewType = preferences.getInt("mapPreviewType", 2);
|
||||
raiseToListen = preferences.getBoolean("raise_to_listen", true);
|
||||
raiseToSpeak = preferences.getBoolean("raise_to_speak", false);
|
||||
recordViaSco = preferences.getBoolean("record_via_sco", false);
|
||||
customTabs = preferences.getBoolean("custom_tabs", true);
|
||||
|
@ -456,7 +460,7 @@ public class SharedConfig {
|
|||
playOrderReversed = !shuffleMusic && preferences.getBoolean("playOrderReversed", false);
|
||||
inappCamera = preferences.getBoolean("inappCamera", true);
|
||||
hasCameraCache = preferences.contains("cameraCache");
|
||||
roundCamera16to9 = true;//preferences.getBoolean("roundCamera16to9", false);
|
||||
roundCamera16to9 = true;
|
||||
repeatMode = preferences.getInt("repeatMode", 0);
|
||||
fontSize = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16);
|
||||
fontSizeIsDefault = !preferences.contains("fons_size");
|
||||
|
@ -467,6 +471,7 @@ public class SharedConfig {
|
|||
streamMedia = preferences.getBoolean("streamMedia", true);
|
||||
saveStreamMedia = preferences.getBoolean("saveStreamMedia", true);
|
||||
pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", false);
|
||||
pauseMusicOnMedia = preferences.getBoolean("pauseMusicOnMedia", true);
|
||||
forceDisableTabletMode = preferences.getBoolean("forceDisableTabletMode", false);
|
||||
streamAllVideo = preferences.getBoolean("streamAllVideo", BuildVars.DEBUG_VERSION);
|
||||
streamMkv = preferences.getBoolean("streamMkv", false);
|
||||
|
@ -504,6 +509,7 @@ public class SharedConfig {
|
|||
hasEmailLogin = preferences.getBoolean("hasEmailLogin", false);
|
||||
isFloatingDebugActive = preferences.getBoolean("floatingDebugActive", false);
|
||||
updateStickersOrderOnSend = preferences.getBoolean("updateStickersOrderOnSend", true);
|
||||
bigCameraForRound = preferences.getBoolean("bigCameraForRound", false);
|
||||
|
||||
preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
showNotificationsForAllAccounts = preferences.getBoolean("AllAccounts", true);
|
||||
|
@ -949,7 +955,7 @@ public class SharedConfig {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toogleRaiseToSpeak() {
|
||||
public static void toggleRaiseToSpeak() {
|
||||
raiseToSpeak = !raiseToSpeak;
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
@ -957,6 +963,18 @@ public class SharedConfig {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleRaiseToListen() {
|
||||
raiseToListen = !raiseToListen;
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("raise_to_listen", raiseToListen);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static boolean enabledRaiseTo(boolean speak) {
|
||||
return raiseToListen && (!speak || raiseToSpeak);
|
||||
}
|
||||
|
||||
public static void toggleCustomTabs() {
|
||||
customTabs = !customTabs;
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
|
@ -1031,6 +1049,14 @@ public class SharedConfig {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public static void togglePauseMusicOnMedia() {
|
||||
pauseMusicOnMedia = !pauseMusicOnMedia;
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("pauseMusicOnMedia", pauseMusicOnMedia);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleChatBlur() {
|
||||
LiteMode.toggleFlag(LiteMode.FLAG_CHAT_BLUR);
|
||||
}
|
||||
|
@ -1475,6 +1501,15 @@ public class SharedConfig {
|
|||
return getDevicePerformanceClass() <= PERFORMANCE_CLASS_AVERAGE;
|
||||
}
|
||||
|
||||
public static void toggleRoundCamera() {
|
||||
bigCameraForRound = !bigCameraForRound;
|
||||
ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putBoolean("bigCameraForRound", bigCameraForRound)
|
||||
.apply();
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public static int getLegacyDevicePerformanceClass() {
|
||||
if (legacyDevicePerformanceClass == -1) {
|
||||
|
|
|
@ -3231,6 +3231,9 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
}
|
||||
|
||||
public void declineIncomingCall(int reason, final Runnable onDone) {
|
||||
if (groupCall != null) {
|
||||
stopScreenCapture();
|
||||
}
|
||||
stopRinging();
|
||||
callDiscardReason = reason;
|
||||
if (currentState == STATE_REQUESTING) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.telegram.messenger.FileLoader;
|
|||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.ImageLoader;
|
||||
import org.telegram.messenger.MessageObject;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.SvgHelper;
|
||||
import org.telegram.messenger.Utilities;
|
||||
|
||||
|
@ -71,7 +70,7 @@ public class TLRPC {
|
|||
public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800;
|
||||
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
|
||||
|
||||
public static final int LAYER = 155;
|
||||
public static final int LAYER = 156;
|
||||
|
||||
public static class TL_stats_megagroupStats extends TLObject {
|
||||
public static int constructor = 0xef7ff916;
|
||||
|
@ -6839,6 +6838,8 @@ public class TLRPC {
|
|||
public byte[] nonce;
|
||||
public String receipt;
|
||||
public int push_timeout;
|
||||
public int reset_available_period;
|
||||
public int reset_pending_date;
|
||||
public boolean verifiedFirebase; //custom
|
||||
|
||||
public static auth_SentCodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
|
@ -6850,7 +6851,7 @@ public class TLRPC {
|
|||
case 0x5353e5a7:
|
||||
result = new TL_auth_sentCodeTypeCall();
|
||||
break;
|
||||
case 0x5a159841:
|
||||
case 0xf450f59b:
|
||||
result = new TL_auth_sentCodeTypeEmailCode();
|
||||
break;
|
||||
case 0xa5491dea:
|
||||
|
@ -6911,7 +6912,7 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_auth_sentCodeTypeEmailCode extends auth_SentCodeType {
|
||||
public static int constructor = 0x5a159841;
|
||||
public static int constructor = 0xf450f59b;
|
||||
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
|
@ -6920,8 +6921,11 @@ public class TLRPC {
|
|||
google_signin_allowed = (flags & 2) != 0;
|
||||
email_pattern = stream.readString(exception);
|
||||
length = stream.readInt32(exception);
|
||||
if ((flags & 4) != 0) {
|
||||
next_phone_login_date = stream.readInt32(exception);
|
||||
if ((flags & 8) != 0) {
|
||||
reset_available_period = stream.readInt32(exception);
|
||||
}
|
||||
if ((flags & 16) != 0) {
|
||||
reset_pending_date = stream.readInt32(exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6932,8 +6936,11 @@ public class TLRPC {
|
|||
stream.writeInt32(flags);
|
||||
stream.writeString(email_pattern);
|
||||
stream.writeInt32(length);
|
||||
if ((flags & 4) != 0) {
|
||||
stream.writeInt32(next_phone_login_date);
|
||||
if ((flags & 8) != 0) {
|
||||
stream.writeInt32(reset_available_period);
|
||||
}
|
||||
if ((flags & 16) != 0) {
|
||||
stream.writeInt32(reset_pending_date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11449,6 +11456,7 @@ public class TLRPC {
|
|||
public int flags;
|
||||
public boolean resize;
|
||||
public boolean single_use;
|
||||
public boolean is_persistent;
|
||||
public boolean selective;
|
||||
public String placeholder;
|
||||
public ArrayList<TL_keyboardButtonRow> rows = new ArrayList<>();
|
||||
|
@ -11495,6 +11503,7 @@ public class TLRPC {
|
|||
resize = (flags & 1) != 0;
|
||||
single_use = (flags & 2) != 0;
|
||||
selective = (flags & 4) != 0;
|
||||
is_persistent = (flags & 16) != 0;
|
||||
int magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
|
@ -11520,6 +11529,7 @@ public class TLRPC {
|
|||
flags = resize ? (flags | 1) : (flags &~ 1);
|
||||
flags = single_use ? (flags | 2) : (flags &~ 2);
|
||||
flags = selective ? (flags | 4) : (flags &~ 4);
|
||||
flags = is_persistent ? (flags | 16) : (flags &~ 16);
|
||||
stream.writeInt32(flags);
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = rows.size();
|
||||
|
@ -50878,6 +50888,23 @@ public class TLRPC {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_auth_resetLoginEmail extends TLObject {
|
||||
public static int constructor = 0x7e960193;
|
||||
|
||||
public String phone_number;
|
||||
public String phone_code_hash;
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return auth_SentCode.TLdeserialize(stream, constructor, exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeString(phone_number);
|
||||
stream.writeString(phone_code_hash);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_auth_resetAuthorizations extends TLObject {
|
||||
public static int constructor = 0x9fab0d1a;
|
||||
|
||||
|
|
|
@ -1416,7 +1416,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
if (delayedAnimationResumed) {
|
||||
delayedOpenAnimationRunnable.run();
|
||||
} else {
|
||||
AndroidUtilities.runOnUIThread(delayedOpenAnimationRunnable, 100);
|
||||
AndroidUtilities.runOnUIThread(delayedOpenAnimationRunnable, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1842,7 +1842,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
|
||||
@Override
|
||||
public void bringToFront(int i) {
|
||||
if (fragmentsStack.isEmpty()) {
|
||||
if (fragmentsStack.isEmpty() || !fragmentsStack.isEmpty() && fragmentsStack.size() - 1 == i && fragmentsStack.get(i).fragmentView != null) {
|
||||
return;
|
||||
}
|
||||
for (int a = 0; a < i; a++) {
|
||||
|
|
|
@ -568,7 +568,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
|
|||
}
|
||||
};
|
||||
containerView.setOrientation(LinearLayout.VERTICAL);
|
||||
if (blurredBackground || progressViewStyle == ALERT_TYPE_SPINNER) {
|
||||
if ((blurredBackground || progressViewStyle == ALERT_TYPE_SPINNER) && progressViewStyle != ALERT_TYPE_LOADING) {
|
||||
containerView.setBackgroundDrawable(null);
|
||||
containerView.setPadding(0, 0, 0, 0);
|
||||
if (blurredBackground && !blurredNativeBackground) {
|
||||
|
|
|
@ -1211,7 +1211,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements
|
|||
itemInternals.add(new ItemInternal(VIEW_TYPE_SHADOW));
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_HEADER));
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_CONTACTS_FLICKER));
|
||||
} else if (onlineContacts != null) {
|
||||
} else if (onlineContacts != null && !onlineContacts.isEmpty()) {
|
||||
if (dialogsCount == 0) {
|
||||
isEmpty = true;
|
||||
itemInternals.add(new ItemInternal(requestPeerType == null ? VIEW_TYPE_EMPTY : VIEW_TYPE_REQUIRED_EMPTY));
|
||||
|
@ -1223,11 +1223,11 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements
|
|||
}
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_SHADOW));
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_HEADER));
|
||||
for (int k = 0; k < onlineContacts.size(); k++) {
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_USER, onlineContacts.get(k)));
|
||||
}
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_LAST_EMPTY));
|
||||
}
|
||||
for (int k = 0; k < onlineContacts.size(); k++) {
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_USER, onlineContacts.get(k)));
|
||||
}
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_LAST_EMPTY));
|
||||
stopUpdate = true;
|
||||
} else if (hasHints) {
|
||||
int count = MessagesController.getInstance(currentAccount).hintDialogs.size();
|
||||
|
@ -1258,18 +1258,20 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter implements
|
|||
itemInternals.add(new ItemInternal(VIEW_TYPE_DIALOG, array.get(k)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!forceShowEmptyCell && dialogsType != 7 && dialogsType != 8 && !MessagesController.getInstance(currentAccount).isDialogsEndReached(folderId)) {
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_FLICKER));
|
||||
} else if (dialogsCount == 0) {
|
||||
isEmpty = true;
|
||||
itemInternals.add(new ItemInternal(requestPeerType == null ? VIEW_TYPE_EMPTY : VIEW_TYPE_REQUIRED_EMPTY));
|
||||
} else {
|
||||
if (folderId == 0 && dialogsCount > 10 && dialogsType == DialogsActivity.DIALOGS_TYPE_DEFAULT) {
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_NEW_CHAT_HINT));
|
||||
if (!forceShowEmptyCell && dialogsType != 7 && dialogsType != 8 && !MessagesController.getInstance(currentAccount).isDialogsEndReached(folderId)) {
|
||||
if (dialogsCount != 0) {
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_FLICKER));
|
||||
}
|
||||
} else if (dialogsCount == 0) {
|
||||
isEmpty = true;
|
||||
itemInternals.add(new ItemInternal(requestPeerType == null ? VIEW_TYPE_EMPTY : VIEW_TYPE_REQUIRED_EMPTY));
|
||||
} else {
|
||||
if (folderId == 0 && dialogsCount > 10 && dialogsType == DialogsActivity.DIALOGS_TYPE_DEFAULT) {
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_NEW_CHAT_HINT));
|
||||
}
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_LAST_EMPTY));
|
||||
}
|
||||
itemInternals.add(new ItemInternal(VIEW_TYPE_LAST_EMPTY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1139,7 +1139,7 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD
|
|||
|
||||
if (isButtonLayout(messageObject)) {
|
||||
canvas.save();
|
||||
float x = (previousWidth - giftRectSize) / 2f + AndroidUtilities.dp(8), y = textY + textHeight + giftRectSize * 0.075f + imageSize + AndroidUtilities.dp(4);
|
||||
float x = (previousWidth - giftRectSize) / 2f + AndroidUtilities.dp(8), y = textY + textHeight + giftRectSize * 0.075f + (messageObject.type == MessageObject.TYPE_SUGGEST_PHOTO ? imageSize : stickerSize) + AndroidUtilities.dp(4);
|
||||
if (messageObject.type == MessageObject.TYPE_SUGGEST_PHOTO) {
|
||||
y += +AndroidUtilities.dp(16);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class TextDetailSettingsCell extends FrameLayout {
|
|||
}
|
||||
}
|
||||
|
||||
public void setTextAndValue(String text, CharSequence value, boolean divider) {
|
||||
public void setTextAndValue(CharSequence text, CharSequence value, boolean divider) {
|
||||
textView.setText(text);
|
||||
valueTextView.setText(value);
|
||||
needDivider = divider;
|
||||
|
|
|
@ -2168,7 +2168,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
getNotificationCenter().addObserver(this, NotificationCenter.screenshotTook);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.encryptedChatUpdated);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.messagesReadEncrypted);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.botKeyboardDidLoad);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.updateMentionsCount);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.newDraftReceived);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.chatOnlineCountDidLoad);
|
||||
|
@ -2186,6 +2185,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
getNotificationCenter().addObserver(this, NotificationCenter.didLoadPinnedMessages);
|
||||
}
|
||||
}
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.botKeyboardDidLoad);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.removeAllMessagesFromDialog);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.messagesReadContent);
|
||||
getNotificationCenter().addObserver(this, NotificationCenter.chatSearchResultsAvailable);
|
||||
|
@ -2286,7 +2286,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
getMessagesController().setLastCreatedDialogId(dialog_id, chatMode == MODE_SCHEDULED, true);
|
||||
if (chatMode == 0) {
|
||||
if (currentEncryptedChat == null) {
|
||||
getMediaDataController().loadBotKeyboard(dialog_id);
|
||||
getMediaDataController().loadBotKeyboard(MessagesStorage.TopicKey.of(dialog_id, getTopicId()));
|
||||
}
|
||||
getMessagesController().loadPeerSettings(currentUser, currentChat);
|
||||
|
||||
|
@ -2338,21 +2338,27 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
if (chatMode != MODE_PINNED && !forceHistoryEmpty) {
|
||||
waitingForLoad.add(lastLoadIndex);
|
||||
int initialMessagesSize;
|
||||
if (SharedConfig.deviceIsHigh()) {
|
||||
initialMessagesSize = (isThreadChat() && !isTopic) ? 30 : 25;
|
||||
} else {
|
||||
initialMessagesSize = (isThreadChat() && !isTopic) ? 20 : 15;
|
||||
}
|
||||
if (startLoadFromDate != 0) {
|
||||
getMessagesController().loadMessages(dialog_id, mergeDialogId, false, 30, 0, startLoadFromDate, true, 0, classGuid, 4, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++, isTopic);
|
||||
} else if (startLoadFromMessageId != 0 && (!isThreadChat() || startLoadFromMessageId == highlightMessageId || isTopic)) {
|
||||
startLoadFromMessageIdSaved = startLoadFromMessageId;
|
||||
if (migrated_to != 0) {
|
||||
mergeDialogId = migrated_to;
|
||||
getMessagesController().loadMessages(mergeDialogId, 0, loadInfo, loadingFromOldPosition ? 50 : (AndroidUtilities.isTablet() || (isThreadChat() && !isTopic) ? 30 : 20), startLoadFromMessageId, 0, true, 0, classGuid, 3, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++, isTopic);
|
||||
getMessagesController().loadMessages(mergeDialogId, 0, loadInfo, initialMessagesSize, startLoadFromMessageId, 0, true, 0, classGuid, 3, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++, isTopic);
|
||||
} else {
|
||||
getMessagesController().loadMessages(dialog_id, mergeDialogId, loadInfo, loadingFromOldPosition ? 50 : (AndroidUtilities.isTablet() || (isThreadChat() && !isTopic) ? 30 : 20), startLoadFromMessageId, 0, true, 0, classGuid, 3, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++, isTopic);
|
||||
getMessagesController().loadMessages(dialog_id, mergeDialogId, loadInfo, initialMessagesSize, startLoadFromMessageId, 0, true, 0, classGuid, 3, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++, isTopic);
|
||||
}
|
||||
} else {
|
||||
if (historyPreloaded) {
|
||||
lastLoadIndex++;
|
||||
} else {
|
||||
getMessagesController().loadMessages(dialog_id, mergeDialogId, loadInfo, AndroidUtilities.isTablet() || (isThreadChat() && !isTopic) ? 30 : 20, startLoadFromMessageId, 0, true, 0, classGuid, 2, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++, isTopic);
|
||||
getMessagesController().loadMessages(dialog_id, mergeDialogId, loadInfo, initialMessagesSize, startLoadFromMessageId, 0, true, 0, classGuid, 2, 0, chatMode, threadMessageId, replyMaxReadId, lastLoadIndex++, isTopic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5443,7 +5449,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
forceNextPinnedMessageId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING) {
|
||||
|
@ -7359,6 +7364,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
updateTopPanel(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCloseClick() {
|
||||
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dialog_show_translate_count" + getDialogId(), 140).commit();
|
||||
updateTopPanel(true);
|
||||
}
|
||||
};
|
||||
topChatPanelView.addView(translateButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.LEFT | Gravity.BOTTOM, 0, 0, 0, 2));
|
||||
}
|
||||
|
@ -10183,7 +10194,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
SparseArray<MessageObject> attachedMessaesTmp = new SparseArray<>();
|
||||
|
||||
private void checkAutoDownloadMessages(boolean scrollUp) {
|
||||
if (chatListView == null || !chatListViewAttached) {
|
||||
if (chatListView == null || !chatListViewAttached || SharedConfig.deviceIsLow()) {
|
||||
return;
|
||||
}
|
||||
preloadingMessagesTmp.clear();
|
||||
|
@ -10265,30 +10276,30 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
|
||||
private void checkAutoDownloadMessage(MessageObject object) {
|
||||
if (object.mediaExists) {
|
||||
return;
|
||||
}
|
||||
TLRPC.Message message = object.messageOwner;
|
||||
int canDownload = getDownloadController().canDownloadMedia(message);
|
||||
if (canDownload == 0) {
|
||||
return;
|
||||
}
|
||||
TLRPC.Document document = object.getDocument();
|
||||
TLRPC.PhotoSize photo = document == null ? FileLoader.getClosestPhotoSizeWithSize(object.photoThumbs, AndroidUtilities.getPhotoSize()) : null;
|
||||
if (document == null && photo == null) {
|
||||
return;
|
||||
}
|
||||
if (canDownload == 2 || canDownload == 1 && object.isVideo()) {
|
||||
// if (document != null && currentEncryptedChat == null && !object.shouldEncryptPhotoOrVideo() && object.canStreamVideo()) {
|
||||
// getFileLoader().loadFile(document, object, FileLoader.PRIORITY_LOW, 10);
|
||||
// if (object.mediaExists) {
|
||||
// return;
|
||||
// }
|
||||
// TLRPC.Message message = object.messageOwner;
|
||||
// int canDownload = getDownloadController().canDownloadMedia(message);
|
||||
// if (canDownload == 0) {
|
||||
// return;
|
||||
// }
|
||||
// TLRPC.Document document = object.getDocument();
|
||||
// TLRPC.PhotoSize photo = document == null ? FileLoader.getClosestPhotoSizeWithSize(object.photoThumbs, AndroidUtilities.getPhotoSize()) : null;
|
||||
// if (document == null && photo == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (canDownload == 2 || canDownload == 1 && object.isVideo()) {
|
||||
//// if (document != null && currentEncryptedChat == null && !object.shouldEncryptPhotoOrVideo() && object.canStreamVideo()) {
|
||||
//// getFileLoader().loadFile(document, object, FileLoader.PRIORITY_LOW, 10);
|
||||
//// }
|
||||
// } else {
|
||||
// if (document != null) {
|
||||
// getFileLoader().loadFile(document, object, FileLoader.PRIORITY_LOW, MessageObject.isVideoDocument(document) && object.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
||||
// } else {
|
||||
// getFileLoader().loadFile(ImageLocation.getForObject(photo, object.photoThumbsObject), object, null, FileLoader.PRIORITY_LOW, object.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
||||
// }
|
||||
} else {
|
||||
if (document != null) {
|
||||
getFileLoader().loadFile(document, object, FileLoader.PRIORITY_LOW, MessageObject.isVideoDocument(document) && object.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
||||
} else {
|
||||
getFileLoader().loadFile(ImageLocation.getForObject(photo, object.photoThumbsObject), object, null, FileLoader.PRIORITY_LOW, object.shouldEncryptPhotoOrVideo() ? 2 : 0);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void clearMessagesPreloading() {
|
||||
|
@ -10830,7 +10841,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
if (botButtons.messageOwner.reply_markup instanceof TLRPC.TL_replyKeyboardForceReply) {
|
||||
SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
|
||||
if (preferences.getInt("answered_" + dialog_id, 0) != botButtons.getId() && (replyingMessageObject == null || chatActivityEnterView.getFieldText() == null)) {
|
||||
String tk = isTopic ? dialog_id + "_" + getTopicId() : "" + dialog_id;
|
||||
if (preferences.getInt("answered_" + tk, 0) != botButtons.getId() && (replyingMessageObject == null || chatActivityEnterView.getFieldText() == null)) {
|
||||
botReplyButtons = botButtons;
|
||||
chatActivityEnterView.setButtons(botButtons);
|
||||
showFieldPanelForReply(botButtons);
|
||||
|
@ -11305,7 +11317,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
if (replyingMessageObject != null && replyingMessageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyKeyboardForceReply) {
|
||||
SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
|
||||
preferences.edit().putInt("answered_" + dialog_id, replyingMessageObject.getId()).commit();
|
||||
String tk = isTopic ? dialog_id + "_" + getTopicId() : "" + dialog_id;
|
||||
preferences.edit().putInt("answered_" + tk, replyingMessageObject.getId()).commit();
|
||||
}
|
||||
if (foundWebPage != null) {
|
||||
foundWebPage = null;
|
||||
|
@ -14390,7 +14403,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
replyButtonAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (replyButtonAnimation != null && replyButtonAnimation.equals(animation)) {
|
||||
if (replyButtonAnimation != null && replyButtonAnimation.equals(animation) && replyButton != null) {
|
||||
if (newVisibilityFinal == View.GONE) {
|
||||
replyButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -15501,12 +15514,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
firstLoading = false;
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
getNotificationCenter().runDelayedNotifications();
|
||||
resumeDelayedFragmentAnimation();
|
||||
AndroidUtilities.cancelRunOnUIThread(fragmentTransitionRunnable);
|
||||
fragmentTransitionRunnable.run();
|
||||
});
|
||||
}
|
||||
|
||||
if (isThreadChat() && !isTopic && (load_type == 2 || load_type == 3) && !isCache) {
|
||||
|
@ -16253,6 +16260,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
chatWasReset = false;
|
||||
|
||||
if (isFirstLoading) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
resumeDelayedFragmentAnimation();
|
||||
|
||||
AndroidUtilities.cancelRunOnUIThread(fragmentTransitionRunnable);
|
||||
fragmentTransitionRunnable.run();
|
||||
getNotificationCenter().runDelayedNotifications();
|
||||
});
|
||||
}
|
||||
} else if (id == NotificationCenter.invalidateMotionBackground) {
|
||||
if (chatListView != null) {
|
||||
chatListView.invalidateViews();
|
||||
|
@ -17745,7 +17762,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
updateBotButtons();
|
||||
}
|
||||
} else if (id == NotificationCenter.botKeyboardDidLoad) {
|
||||
if (dialog_id == (Long) args[1]) {
|
||||
MessagesStorage.TopicKey topicKey = (MessagesStorage.TopicKey) args[1];
|
||||
if (dialog_id == topicKey.dialogId && getTopicId() == topicKey.topicId) {
|
||||
TLRPC.Message message = (TLRPC.Message) args[0];
|
||||
if (message != null && !userBlocked) {
|
||||
botButtons = new MessageObject(currentAccount, message, false, false);
|
||||
|
@ -21803,7 +21821,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shownRestartTopic;
|
||||
private boolean shownRestartTopic, shownTranslateTopic;
|
||||
private void updateTopPanel(boolean animated) {
|
||||
if (chatMode != 0) {
|
||||
return;
|
||||
|
@ -21841,6 +21859,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (showRestartTopic) {
|
||||
shownRestartTopic = true;
|
||||
}
|
||||
if (showTranslate) {
|
||||
shownTranslateTopic = true;
|
||||
}
|
||||
boolean showRestartTopic1 = (showRestartTopic || shownRestartTopic) && !(showReport || showBlock || showGeo);
|
||||
if (show || showReport || showBlock || showGeo || showTranslate || showRestartTopic1) {
|
||||
createTopPanel();
|
||||
|
@ -21849,18 +21870,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
|
||||
if (reportSpamButton != null) {
|
||||
reportSpamButton.setVisibility(showReport || showBlock || showGeo ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (restartTopicButton != null) {
|
||||
restartTopicButton.setVisibility(showRestartTopic1 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (showTranslate) {
|
||||
createTranslateButton();
|
||||
if (translateButton != null) {
|
||||
translateButton.updateText();
|
||||
}
|
||||
}
|
||||
if ((shownTranslateTopic || shownRestartTopic) && !show) {
|
||||
showReport = showGeo = showShare = showBlock = showAdd = showArchive = showAddMembersToGroup = false;
|
||||
show = true;
|
||||
}
|
||||
if (reportSpamButton != null) {
|
||||
reportSpamButton.setVisibility(showReport || showBlock || showGeo ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (restartTopicButton != null) {
|
||||
restartTopicButton.setVisibility(showRestartTopic1 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (translateButton != null) {
|
||||
translateButton.setVisibility(showTranslate ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
@ -21871,9 +21896,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (!showRestartTopic) {
|
||||
shownRestartTopic = false;
|
||||
}
|
||||
|
||||
if (showRestartTopic || showTranslate) {
|
||||
show = true;
|
||||
if (!showTranslate) {
|
||||
shownTranslateTopic = false;
|
||||
}
|
||||
|
||||
addToContactsButtonArchive = false;
|
||||
|
@ -26055,7 +26079,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
if (ContentPreviewViewer.getInstance().isVisible()) {
|
||||
if (selectionReactionsOverlay != null && !selectionReactionsOverlay.onBackPressed()) {
|
||||
return false;
|
||||
} else if (ContentPreviewViewer.getInstance().isVisible()) {
|
||||
ContentPreviewViewer.getInstance().closeWithMenu();
|
||||
return false;
|
||||
} else if (forwardingPreviewView != null && forwardingPreviewView.isShowing()) {
|
||||
|
|
|
@ -281,7 +281,7 @@ public class ChatRightsEditActivity extends BaseFragment {
|
|||
defaultBannedRights.send_voices = defaultBannedRights.send_roundvideos = false;
|
||||
}
|
||||
|
||||
if (!defaultBannedRights.change_info) {
|
||||
if (!defaultBannedRights.change_info && !isChannel) {
|
||||
adminRights.change_info = true;
|
||||
}
|
||||
if (!defaultBannedRights.pin_messages) {
|
||||
|
@ -1477,7 +1477,7 @@ public class ChatRightsEditActivity extends BaseFragment {
|
|||
return false;
|
||||
}
|
||||
if (position == changeInfoRow) {
|
||||
return myAdminRights.change_info && (defaultBannedRights == null || defaultBannedRights.change_info);
|
||||
return myAdminRights.change_info && (defaultBannedRights == null || defaultBannedRights.change_info || isChannel);
|
||||
} else if (position == postMessagesRow) {
|
||||
return myAdminRights.post_messages;
|
||||
} else if (position == editMesagesRow) {
|
||||
|
@ -1725,7 +1725,7 @@ public class ChatRightsEditActivity extends BaseFragment {
|
|||
} else if (position == changeInfoRow) {
|
||||
if (currentType == TYPE_ADMIN || currentType == TYPE_ADD_BOT) {
|
||||
if (isChannel) {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("EditAdminChangeChannelInfo", R.string.EditAdminChangeChannelInfo), asAdminValue && adminRights.change_info || !defaultBannedRights.change_info, true);
|
||||
checkCell.setTextAndCheck(LocaleController.getString("EditAdminChangeChannelInfo", R.string.EditAdminChangeChannelInfo), asAdminValue && adminRights.change_info, true);
|
||||
} else {
|
||||
checkCell.setTextAndCheck(LocaleController.getString("EditAdminChangeGroupInfo", R.string.EditAdminChangeGroupInfo), asAdminValue && adminRights.change_info || !defaultBannedRights.change_info, true);
|
||||
}
|
||||
|
|
|
@ -1133,15 +1133,9 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable,
|
|||
if (renderingBitmap == null && nextRenderingBitmap == null) {
|
||||
scheduleNextGetFrame();
|
||||
} else if (nextRenderingBitmap != null && (renderingBitmap == null || (Math.abs(now - lastFrameTime) >= invalidateAfter && !skipFrameUpdate))) {
|
||||
//if (precache) {
|
||||
backgroundBitmap = renderingBitmap;
|
||||
// }
|
||||
renderingBitmap = nextRenderingBitmap;
|
||||
renderingBitmapTime = nextRenderingBitmapTime;
|
||||
for (int i = 0; i < backgroundShader.length; i++) {
|
||||
// if (precache) {
|
||||
backgroundShader[i] = renderingShader[i];
|
||||
// }
|
||||
renderingShader[i] = nextRenderingShader[i];
|
||||
nextRenderingShader[i] = null;
|
||||
}
|
||||
|
|
|
@ -2454,7 +2454,11 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
giftButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
|
||||
}
|
||||
attachLayout.addView(giftButton, 0, LayoutHelper.createFrame(48, 48, Gravity.CENTER_VERTICAL | Gravity.RIGHT));
|
||||
giftButton.setOnClickListener(v -> new GiftPremiumBottomSheet(getParentFragment(), getParentFragment().getCurrentUser()).show());
|
||||
giftButton.setOnClickListener(v -> {
|
||||
MessagesController.getInstance(currentAccount).getMainSettings().edit().putBoolean("show_gift_for_" + parentFragment.getDialogId(), false).apply();
|
||||
AndroidUtilities.updateViewVisibilityAnimated(giftButton, false);
|
||||
new GiftPremiumBottomSheet(getParentFragment(), getParentFragment().getCurrentUser()).show();
|
||||
});
|
||||
}
|
||||
|
||||
private void createBotButton() {
|
||||
|
@ -4864,7 +4868,9 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
botMessageObject = botButtonsMessageObject;
|
||||
}
|
||||
replyingMessageObject = messageObject;
|
||||
setButtons(replyingMessageObject, true);
|
||||
if (!(parentFragment != null && parentFragment.isTopic && parentFragment.getThreadMessage() == replyingMessageObject)) {
|
||||
setButtons(replyingMessageObject, true);
|
||||
}
|
||||
} else if (replyingMessageObject == botButtonsMessageObject) {
|
||||
replyingMessageObject = null;
|
||||
setButtons(botMessageObject, false);
|
||||
|
@ -7412,7 +7418,8 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
boolean visible = !MessagesController.getInstance(currentAccount).premiumLocked && MessagesController.getInstance(currentAccount).giftAttachMenuIcon &&
|
||||
MessagesController.getInstance(currentAccount).giftTextFieldIcon && getParentFragment() != null && getParentFragment().getCurrentUser() != null &&
|
||||
!BuildVars.IS_BILLING_UNAVAILABLE && !getParentFragment().getCurrentUser().self && !getParentFragment().getCurrentUser().premium &&
|
||||
getParentFragment().getCurrentUserInfo() != null && !getParentFragment().getCurrentUserInfo().premium_gifts.isEmpty() && !isInScheduleMode();
|
||||
getParentFragment().getCurrentUserInfo() != null && !getParentFragment().getCurrentUserInfo().premium_gifts.isEmpty() && !isInScheduleMode() &&
|
||||
MessagesController.getInstance(currentAccount).getMainSettings().getBoolean("show_gift_for_" + parentFragment.getDialogId(), true);
|
||||
|
||||
if (!visible && giftButton == null) {
|
||||
return;
|
||||
|
@ -7671,7 +7678,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
boolean wasVisible = botButton != null && botButton.getVisibility() == VISIBLE;
|
||||
if (hasBotWebView || hasBotCommands || botReplyMarkup != null) {
|
||||
if (botReplyMarkup != null) {
|
||||
if (isPopupShowing() && currentPopupContentType == POPUP_CONTENT_BOT_KEYBOARD) {
|
||||
if (isPopupShowing() && currentPopupContentType == POPUP_CONTENT_BOT_KEYBOARD && botReplyMarkup.is_persistent) {
|
||||
if (botButton != null && botButton.getVisibility() != GONE) {
|
||||
botButton.setVisibility(GONE);
|
||||
}
|
||||
|
@ -7782,9 +7789,10 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
botKeyboardView.setVisibility(GONE);
|
||||
botKeyboardViewVisible = false;
|
||||
botKeyboardView.setDelegate(button -> {
|
||||
MessageObject object = replyingMessageObject != null ? replyingMessageObject : (DialogObject.isChatDialog(dialog_id) ? botButtonsMessageObject : null);
|
||||
boolean open = didPressedBotButton(button, object, replyingMessageObject != null ? replyingMessageObject : botButtonsMessageObject);
|
||||
if (replyingMessageObject != null) {
|
||||
boolean replyingIsTopicStarter = replyingMessageObject != null && parentFragment != null && parentFragment.isTopic && parentFragment.getTopicId() == replyingMessageObject.getId();
|
||||
MessageObject object = replyingMessageObject != null && !replyingIsTopicStarter ? replyingMessageObject : (DialogObject.isChatDialog(dialog_id) ? botButtonsMessageObject : null);
|
||||
boolean open = didPressedBotButton(button, object, replyingMessageObject != null && !replyingIsTopicStarter ? replyingMessageObject : botButtonsMessageObject);
|
||||
if (replyingMessageObject != null && !replyingIsTopicStarter) {
|
||||
openKeyboardInternal();
|
||||
setButtons(botMessageObject, false);
|
||||
} else if (botButtonsMessageObject != null && botButtonsMessageObject.messageOwner.reply_markup.single_use) {
|
||||
|
@ -7794,7 +7802,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
showPopup(0, 0);
|
||||
}
|
||||
SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
|
||||
preferences.edit().putInt("answered_" + dialog_id, botButtonsMessageObject.getId()).commit();
|
||||
preferences.edit().putInt("answered_" + getTopicKeyString(), botButtonsMessageObject.getId()).commit();
|
||||
}
|
||||
if (delegate != null) {
|
||||
delegate.onMessageSend(null, true, 0);
|
||||
|
@ -7810,8 +7818,11 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
if (botReplyMarkup != null) {
|
||||
SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
|
||||
boolean showPopup = true;
|
||||
if (botButtonsMessageObject != replyingMessageObject && botReplyMarkup.single_use) {
|
||||
if (preferences.getInt("answered_" + dialog_id, 0) == messageObject.getId()) {
|
||||
if (botButtonsMessageObject != replyingMessageObject) {
|
||||
if (messageObject != null && (
|
||||
botReplyMarkup.single_use && preferences.getInt("answered_" + getTopicKeyString(), 0) == messageObject.getId() ||
|
||||
!botReplyMarkup.is_persistent && preferences.getInt("closed_botkeyboard_" + getTopicKeyString(), 0) == messageObject.getId()
|
||||
)) {
|
||||
showPopup = false;
|
||||
}
|
||||
}
|
||||
|
@ -8529,6 +8540,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
botKeyboardView.setVisibility(VISIBLE);
|
||||
currentView = botKeyboardView;
|
||||
animatingContentType = POPUP_CONTENT_BOT_KEYBOARD;
|
||||
MessagesController.getMainSettings(currentAccount).edit().remove("closed_botkeyboard_" + getTopicKeyString()).apply();
|
||||
}
|
||||
currentPopupContentType = contentType;
|
||||
|
||||
|
@ -8682,6 +8694,9 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
}
|
||||
botKeyboardViewVisible = false;
|
||||
}
|
||||
if (contentType == POPUP_CONTENT_BOT_KEYBOARD && botButtonsMessageObject != null) {
|
||||
MessagesController.getMainSettings(currentAccount).edit().putInt("closed_botkeyboard_" + getTopicKeyString(), botButtonsMessageObject.getId()).apply();
|
||||
}
|
||||
updateBotButton(true);
|
||||
}
|
||||
|
||||
|
@ -8695,6 +8710,13 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
checkBotMenu();
|
||||
}
|
||||
|
||||
private String getTopicKeyString() {
|
||||
if (parentFragment != null && parentFragment.isTopic) {
|
||||
return dialog_id + "_" + parentFragment.getTopicId();
|
||||
}
|
||||
return "" + dialog_id;
|
||||
}
|
||||
|
||||
private void setEmojiButtonImage(boolean byOpen, boolean animated) {
|
||||
if (emojiButton == null) {
|
||||
return;
|
||||
|
@ -8757,8 +8779,11 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
|
||||
public boolean hidePopup(boolean byBackButton, boolean forceAnimate) {
|
||||
if (isPopupShowing()) {
|
||||
if (currentPopupContentType == POPUP_CONTENT_BOT_KEYBOARD && byBackButton && botButtonsMessageObject != null) {
|
||||
return false;
|
||||
if (currentPopupContentType == POPUP_CONTENT_BOT_KEYBOARD && botReplyMarkup != null && byBackButton && botButtonsMessageObject != null) {
|
||||
if (botReplyMarkup.is_persistent) {
|
||||
return false;
|
||||
}
|
||||
MessagesController.getMainSettings(currentAccount).edit().putInt("closed_botkeyboard_" + getTopicKeyString(), botButtonsMessageObject.getId()).apply();
|
||||
}
|
||||
if (byBackButton && searchingType != 0 || forceAnimate) {
|
||||
setSearchingTypeInternal(0, true);
|
||||
|
|
|
@ -1080,6 +1080,7 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
|
|||
sb.append("\n");
|
||||
sb.append(subtitleTextView.getText());
|
||||
info.setContentDescription(sb);
|
||||
setContentDescription(sb);
|
||||
if (info.isClickable() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("OpenProfile", R.string.OpenProfile)));
|
||||
}
|
||||
|
|
|
@ -571,6 +571,7 @@ public class EditTextCaption extends EditTextBoldCursor {
|
|||
stringBuilder.append(getText().subSequence(end, getText().length()));
|
||||
}
|
||||
setText(stringBuilder);
|
||||
setSelection(start, start);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
|
||||
|
|
|
@ -174,9 +174,9 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
|||
private float panTranslationY;
|
||||
private float animationTranslationY;
|
||||
|
||||
private float[] mMVPMatrix = new float[16];
|
||||
private float[] mSTMatrix = new float[16];
|
||||
private float[] moldSTMatrix = new float[16];
|
||||
private final float[] mMVPMatrix = new float[16];
|
||||
private final float[] mSTMatrix = new float[16];
|
||||
private final float[] moldSTMatrix = new float[16];
|
||||
private static final String VERTEX_SHADER =
|
||||
"uniform mat4 uMVPMatrix;\n" +
|
||||
"uniform mat4 uSTMatrix;\n" +
|
||||
|
@ -229,6 +229,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
|||
|
||||
private static final int[] ALLOW_BIG_CAMERA_WHITELIST = {
|
||||
285904780, // XIAOMI (Redmi Note 7)
|
||||
-1394191079 // samsung a31
|
||||
};
|
||||
|
||||
|
||||
|
@ -1038,6 +1039,26 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
|||
}
|
||||
|
||||
private boolean allowBigSizeCamera() {
|
||||
if (SharedConfig.bigCameraForRound) {
|
||||
return true;
|
||||
}
|
||||
if (SharedConfig.deviceIsAboveAverage()) {
|
||||
return true;
|
||||
}
|
||||
int devicePerformanceClass = Math.max(SharedConfig.getDevicePerformanceClass(), SharedConfig.getLegacyDevicePerformanceClass());
|
||||
if (devicePerformanceClass == SharedConfig.PERFORMANCE_CLASS_HIGH) {
|
||||
return true;
|
||||
}
|
||||
int hash = (Build.MANUFACTURER + " " + Build.DEVICE).toUpperCase().hashCode();
|
||||
for (int i = 0; i < ALLOW_BIG_CAMERA_WHITELIST.length; ++i) {
|
||||
if (ALLOW_BIG_CAMERA_WHITELIST[i] == hash) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean allowBigSizeCameraDebug() {
|
||||
int devicePerformanceClass = Math.max(SharedConfig.getDevicePerformanceClass(), SharedConfig.getLegacyDevicePerformanceClass());
|
||||
if (devicePerformanceClass == SharedConfig.PERFORMANCE_CLASS_HIGH) {
|
||||
return true;
|
||||
|
@ -1340,7 +1361,6 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
|||
finish();
|
||||
return false;
|
||||
}
|
||||
GL gl = eglContext.getGL();
|
||||
|
||||
float tX = 1.0f / scaleX / 2.0f;
|
||||
float tY = 1.0f / scaleY / 2.0f;
|
||||
|
@ -2090,16 +2110,25 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
|||
}
|
||||
videoLast = timestampNanos;
|
||||
|
||||
GLES20.glUseProgram(drawProgram);
|
||||
GLES20.glUniformMatrix4fv(vertexMatrixHandle, 1, false, mMVPMatrix, 0);
|
||||
FloatBuffer textureBuffer = InstantCameraView.this.textureBuffer;
|
||||
FloatBuffer vertexBuffer = InstantCameraView.this.vertexBuffer;
|
||||
FloatBuffer oldTextureBuffer = oldTextureTextureBuffer;
|
||||
if (textureBuffer == null || vertexBuffer == null) {
|
||||
FileLog.d("handleVideoFrameAvailable skip frame " + textureBuffer + " " + vertexBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
GLES20.glUseProgram(drawProgram);
|
||||
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
||||
GLES20.glVertexAttribPointer(positionHandle, 3, GLES20.GL_FLOAT, false, 12, vertexBuffer);
|
||||
GLES20.glEnableVertexAttribArray(positionHandle);
|
||||
GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT, false, 8, textureBuffer);
|
||||
GLES20.glEnableVertexAttribArray(textureHandle);
|
||||
GLES20.glUniformMatrix4fv(vertexMatrixHandle, 1, false, mMVPMatrix, 0);
|
||||
|
||||
GLES20.glUniform2f(resolutionHandle, videoWidth, videoHeight);
|
||||
|
||||
if (oldCameraTexture[0] != 0 && oldTextureTextureBuffer != null) {
|
||||
if (oldCameraTexture[0] != 0 && oldTextureBuffer != null) {
|
||||
if (!blendEnabled) {
|
||||
GLES20.glEnable(GLES20.GL_BLEND);
|
||||
blendEnabled = true;
|
||||
|
@ -2107,7 +2136,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
|||
if (oldTexturePreviewSize != null) {
|
||||
GLES20.glUniform2f(previewSizeHandle, oldTexturePreviewSize.getWidth(), oldTexturePreviewSize.getHeight());
|
||||
}
|
||||
GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT, false, 8, oldTextureTextureBuffer);
|
||||
GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT, false, 8, oldTextureBuffer);
|
||||
|
||||
GLES20.glUniformMatrix4fv(textureMatrixHandle, 1, false, moldSTMatrix, 0);
|
||||
GLES20.glUniform1f(alphaHandle, 1.0f);
|
||||
|
@ -2115,14 +2144,10 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
|
|||
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
|
||||
if (previewSize != null) {
|
||||
GLES20.glUniform2f(previewSizeHandle, previewSize.getWidth(), previewSize.getHeight());
|
||||
}
|
||||
|
||||
GLES20.glVertexAttribPointer(positionHandle, 3, GLES20.GL_FLOAT, false, 12, vertexBuffer);
|
||||
GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT, false, 8, textureBuffer);
|
||||
|
||||
GLES20.glUniformMatrix4fv(textureMatrixHandle, 1, false, mSTMatrix, 0);
|
||||
GLES20.glUniform1f(alphaHandle, cameraTextureAlpha);
|
||||
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, cameraTexture[0]);
|
||||
|
|
|
@ -902,17 +902,33 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
|
|||
}
|
||||
ImageLocation location = ImageLocation.getForPhoto(sizeFull, photo);
|
||||
if (location != null) {
|
||||
if (prevImageLocation != null && prevImageLocation.photoId == location.photoId) {
|
||||
if (prevImageLocation != null && prevImageLocation.photoId == location.photoId && !isProfileFragment && dialogId != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
||||
thumbsFileNames.add(null);
|
||||
videoFileNames.add(null);
|
||||
|
||||
imagesLocations.add(prevImageLocation);
|
||||
ImageLocation thumbLocation = prevThumbLocation;
|
||||
if (thumbLocation == null) {
|
||||
thumbLocation = ImageLocation.getForPhoto(sizeThumb, photo);
|
||||
}
|
||||
thumbsLocations.add(thumbLocation);
|
||||
vectorAvatars.add(prevVectorAvatarThumbDrawable);
|
||||
videoLocations.add(null);
|
||||
|
||||
if (!photo.video_sizes.isEmpty()) {
|
||||
final TLRPC.VideoSize videoSize = FileLoader.getClosestVideoSizeWithSize(photo.video_sizes, 1000);
|
||||
final TLRPC.VideoSize vectorMarkupVideoSize = FileLoader.getVectorMarkupVideoSize(photo);
|
||||
if (vectorMarkupVideoSize != null) {
|
||||
vectorAvatars.add(new VectorAvatarThumbDrawable(vectorMarkupVideoSize, user != null && user.premium, VectorAvatarThumbDrawable.TYPE_PROFILE));
|
||||
videoLocations.add(null);
|
||||
videoFileNames.add(null);
|
||||
} else {
|
||||
vectorAvatars.add(null);
|
||||
videoLocations.add(ImageLocation.getForPhoto(videoSize, photo));
|
||||
videoFileNames.add(FileLoader.getAttachFileName(videoSize));
|
||||
}
|
||||
} else {
|
||||
vectorAvatars.add(prevVectorAvatarThumbDrawable);
|
||||
videoLocations.add(null);
|
||||
videoFileNames.add(null);
|
||||
}
|
||||
photos.add(null);
|
||||
imagesLocationsSizes.add(-1);
|
||||
imagesUploadProgress.add(null);
|
||||
|
|
|
@ -303,7 +303,7 @@ public class ChatSelectionReactionMenuOverlay extends FrameLayout {
|
|||
|
||||
boolean visible = false;
|
||||
|
||||
if (parentFragment.getCurrentChatInfo() != null && parentFragment.getCurrentChatInfo().available_reactions instanceof TLRPC.TL_chatReactionsNone) {
|
||||
if (parentFragment.isSecretChat() || parentFragment.getCurrentChatInfo() != null && parentFragment.getCurrentChatInfo().available_reactions instanceof TLRPC.TL_chatReactionsNone) {
|
||||
visible = false;
|
||||
} else if (!messages.isEmpty()) {
|
||||
visible = true;
|
||||
|
@ -373,6 +373,14 @@ public class ChatSelectionReactionMenuOverlay extends FrameLayout {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
if (reactionsContainerLayout != null && reactionsContainerLayout.getReactionsWindow() != null) {
|
||||
reactionsContainerLayout.dismissWindow();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setHiddenByScroll(boolean hiddenByScroll) {
|
||||
this.hiddenByScroll = hiddenByScroll;
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ public class CustomEmojiReactionsWindow {
|
|||
});
|
||||
}
|
||||
|
||||
private void dismiss() {
|
||||
public void dismiss() {
|
||||
if (dismissed) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -494,6 +494,14 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
|||
}
|
||||
}
|
||||
|
||||
public void dismissWindow() {
|
||||
reactionsWindow.dismiss();
|
||||
}
|
||||
|
||||
public CustomEmojiReactionsWindow getReactionsWindow() {
|
||||
return reactionsWindow;
|
||||
}
|
||||
|
||||
private void showCustomEmojiReactionDialog() {
|
||||
if (reactionsWindow != null) {
|
||||
return;
|
||||
|
@ -1363,7 +1371,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
|||
if (currentReaction.emojicon != null) {
|
||||
TLRPC.TL_availableReaction defaultReaction = MediaDataController.getInstance(currentAccount).getReactionsMap().get(currentReaction.emojicon);
|
||||
if (defaultReaction != null) {
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(defaultReaction.activate_animation, Theme.key_windowBackgroundWhiteGrayIcon, 1.0f);
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(defaultReaction.activate_animation, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f);
|
||||
if (!LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS)) {
|
||||
if (SharedConfig.getDevicePerformanceClass() <= SharedConfig.PERFORMANCE_CLASS_LOW) {
|
||||
loopImageView.getImageReceiver().setImage(ImageLocation.getForDocument(defaultReaction.select_animation), "60_60_firstframe", null, null, hasEnterAnimation ? null : svgThumb, 0, "tgs", currentReaction, 0);
|
||||
|
|
|
@ -2022,6 +2022,10 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
|
|||
|
||||
}
|
||||
|
||||
protected boolean doSend(LongSparseArray<TLRPC.Dialog> dids, TLRPC.TL_forumTopic topic) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getCurrentTop() {
|
||||
if (gridView.getChildCount() != 0) {
|
||||
View child = gridView.getChildAt(0);
|
||||
|
|
|
@ -86,7 +86,13 @@ public class TranslateButton extends FrameLayout {
|
|||
menuView.setImageResource(R.drawable.msg_mini_customize);
|
||||
menuView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_addContact, resourcesProvider), PorterDuff.Mode.MULTIPLY));
|
||||
menuView.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_chat_addContact, resourcesProvider) & 0x19ffffff, Theme.RIPPLE_MASK_ROUNDRECT_6DP));
|
||||
menuView.setOnClickListener(e -> onMenuClick());
|
||||
menuView.setOnClickListener(e -> {
|
||||
if (UserConfig.getInstance(currentAccount).isPremium()) {
|
||||
onMenuClick();
|
||||
} else {
|
||||
onCloseClick();
|
||||
}
|
||||
});
|
||||
addView(menuView, LayoutHelper.createFrame(32, 32, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 8, 0));
|
||||
}
|
||||
|
||||
|
@ -94,6 +100,10 @@ public class TranslateButton extends FrameLayout {
|
|||
|
||||
}
|
||||
|
||||
protected void onCloseClick() {
|
||||
|
||||
}
|
||||
|
||||
protected void onMenuClick() {
|
||||
TranslateController translateController = MessagesController.getInstance(currentAccount).getTranslateController();
|
||||
|
||||
|
@ -303,7 +313,6 @@ public class TranslateButton extends FrameLayout {
|
|||
}
|
||||
textView.setText(TextUtils.concat(translateIcon, " ", text));
|
||||
}
|
||||
|
||||
menuView.setVisibility(UserConfig.getInstance(currentAccount).isPremium() ? VISIBLE : GONE);
|
||||
menuView.setImageResource(UserConfig.getInstance(currentAccount).isPremium() ? R.drawable.msg_mini_customize : R.drawable.msg_close);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,6 +124,12 @@ public class SpoilersTextView extends TextView {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
invalidateSpoilers();
|
||||
}
|
||||
|
||||
private void invalidateSpoilers() {
|
||||
if (spoilers == null) return; // Check for a super constructor
|
||||
spoilersPool.addAll(spoilers);
|
||||
|
|
|
@ -394,7 +394,7 @@ public class ContentPreviewViewer {
|
|||
ActionBarPopupWindow.ActionBarPopupWindowLayout previewMenu = new ActionBarPopupWindow.ActionBarPopupWindowLayout(containerView.getContext(), R.drawable.popup_fixed_alert2, resourcesProvider);
|
||||
|
||||
View.OnClickListener onItemClickListener = v -> {
|
||||
if (parentActivity == null) {
|
||||
if (parentActivity == null || delegate == null) {
|
||||
return;
|
||||
}
|
||||
int which = (int) v.getTag();
|
||||
|
|
|
@ -1082,7 +1082,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
if (parentLayout != null && filterTabsView != null && !filterTabsView.isEditing() && !searching && !rightSlidingDialogContainer.hasFragment() &&
|
||||
!parentLayout.checkTransitionAnimation() && !parentLayout.isInPreviewMode() && !parentLayout.isPreviewOpenAnimationInProgress() && !parentLayout.getDrawerLayoutContainer().isDrawerOpened() &&
|
||||
(ev == null || startedTracking || ev.getY() > actionBar.getMeasuredHeight() + actionBar.getTranslationY()) && SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS) {
|
||||
(ev == null || startedTracking || ev.getY() > actionBar.getMeasuredHeight() + actionBar.getTranslationY()) && (SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS || SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_ARCHIVE && viewPages[0] != null && (viewPages[0].dialogsAdapter.getDialogsType() == 7 || viewPages[0].dialogsAdapter.getDialogsType() == 8))) {
|
||||
if (ev != null) {
|
||||
if (velocityTracker == null) {
|
||||
velocityTracker = VelocityTracker.obtain();
|
||||
|
@ -2001,7 +2001,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
swipeFolderBack = false;
|
||||
return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
|
||||
} else {
|
||||
if ((filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS) || !allowSwipeDuringCurrentTouch || ((dialogId == getUserConfig().clientUserId || dialogId == 777000) && SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_ARCHIVE) || getMessagesController().isPromoDialog(dialogId, false) && getMessagesController().promoDialogType != MessagesController.PROMO_TYPE_PSA) {
|
||||
int currentDialogsType = initialDialogsType;
|
||||
try {
|
||||
currentDialogsType = parentPage.dialogsAdapter.getDialogsType();
|
||||
} catch (Exception ignore) {}
|
||||
if ((filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS) || !allowSwipeDuringCurrentTouch || ((dialogId == getUserConfig().clientUserId || dialogId == 777000 || currentDialogsType == 7 || currentDialogsType == 8) && SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_ARCHIVE) || getMessagesController().isPromoDialog(dialogId, false) && getMessagesController().promoDialogType != MessagesController.PROMO_TYPE_PSA) {
|
||||
return 0;
|
||||
}
|
||||
boolean canSwipeBack = folderId == 0 && (SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_MUTE || SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_READ || SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_PIN || SharedConfig.getChatSwipeAction(currentAccount) == SwipeGestureSettingsView.SWIPE_GESTURE_DELETE) && !rightSlidingDialogContainer.hasFragment();
|
||||
|
@ -2133,6 +2137,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
cell.checkCurrentDialogIndex(true);
|
||||
cell.animateArchiveAvatar();
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(() -> setDialogsListFrozen(false), 300);
|
||||
}
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
boolean hintShowed = preferences.getBoolean("archivehint_l", false) || SharedConfig.archiveHidden;
|
||||
|
@ -2992,8 +2997,29 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
|
||||
linearLayout.setMinimumWidth(AndroidUtilities.dp(200));
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
scrimPopupWindowItems = new ActionBarMenuSubItem[3];
|
||||
for (int a = 0, N = (tabView.getId() == filterTabsView.getDefaultTabId() ? 2 : 3); a < N; a++) {
|
||||
scrimPopupWindowItems = new ActionBarMenuSubItem[4];
|
||||
|
||||
|
||||
boolean defaultTab = tabView.getId() == filterTabsView.getDefaultTabId();
|
||||
boolean hasUnread = false;
|
||||
|
||||
|
||||
ArrayList<TLRPC.Dialog> dialogs = new ArrayList<>(defaultTab ? getMessagesController().getDialogs(folderId) : getMessagesController().getAllDialogs());
|
||||
if (!defaultTab) {
|
||||
MessagesController.DialogFilter filter = getMessagesController().dialogFilters.get(tabView.getId());
|
||||
for (int i = 0; i < dialogs.size(); i++) {
|
||||
if (!filter.includesDialog(getAccountInstance(), dialogs.get(i).id)) {
|
||||
dialogs.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < dialogs.size(); i++) {
|
||||
if (dialogs.get(i).unread_mark || dialogs.get(i).unread_count > 0) {
|
||||
hasUnread = true;
|
||||
}
|
||||
}
|
||||
for (int a = 0, N = 2 + (!defaultTab ? 1 : 0) + (hasUnread ? 1 : 0); a < N; a++) {
|
||||
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity(), a == 0, a == N - 1);
|
||||
if (a == 0) {
|
||||
if (getMessagesController().dialogFilters.size() <= 1) {
|
||||
|
@ -3001,28 +3027,33 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
cell.setTextAndIcon(LocaleController.getString("FilterReorder", R.string.FilterReorder), R.drawable.tabs_reorder);
|
||||
} else if (a == 1) {
|
||||
if (N == 2) {
|
||||
if (defaultTab) {
|
||||
cell.setTextAndIcon(LocaleController.getString("FilterEditAll", R.string.FilterEditAll), R.drawable.msg_edit);
|
||||
} else {
|
||||
cell.setTextAndIcon(LocaleController.getString("FilterEdit", R.string.FilterEdit), R.drawable.msg_edit);
|
||||
}
|
||||
} else if (a == 2 && hasUnread) {
|
||||
cell.setTextAndIcon(LocaleController.getString("MarkAllAsRead", R.string.MarkAllAsRead), R.drawable.msg_markread);
|
||||
} else {
|
||||
cell.setTextAndIcon(LocaleController.getString("FilterDeleteItem", R.string.FilterDeleteItem), R.drawable.msg_delete);
|
||||
}
|
||||
scrimPopupWindowItems[a] = cell;
|
||||
linearLayout.addView(cell);
|
||||
final int i = a;
|
||||
boolean finalHasUnread = hasUnread;
|
||||
cell.setOnClickListener(v1 -> {
|
||||
if (i == 0) {
|
||||
resetScroll();
|
||||
filterTabsView.setIsEditing(true);
|
||||
showDoneItem(true);
|
||||
} else if (i == 1) {
|
||||
if (N == 2) {
|
||||
if (defaultTab) {
|
||||
presentFragment(new FiltersSetupActivity());
|
||||
} else {
|
||||
presentFragment(new FilterCreateActivity(dialogFilter));
|
||||
}
|
||||
} else if (i == 2 && finalHasUnread) {
|
||||
markDialogsAsRead(dialogs);
|
||||
} else if (i == 2) {
|
||||
showDeleteAlert(dialogFilter);
|
||||
}
|
||||
|
@ -7727,6 +7758,28 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
getMessagesController().markDialogAsUnread(did, null, 0);
|
||||
}
|
||||
|
||||
private void markDialogsAsRead(ArrayList<TLRPC.Dialog> dialogs) {
|
||||
debugLastUpdateAction = 2;
|
||||
int selectedDialogIndex = -1;
|
||||
|
||||
setDialogsListFrozen(true);
|
||||
checkAnimationFinished();
|
||||
for (int i = 0; i < dialogs.size(); i++) {
|
||||
long did = dialogs.get(i).id;
|
||||
TLRPC.Dialog dialog = dialogs.get(i);
|
||||
if (getMessagesController().isForum(did)) {
|
||||
getMessagesController().markAllTopicsAsRead(did);
|
||||
}
|
||||
getMessagesController().markMentionsAsRead(did, 0);
|
||||
getMessagesController().markDialogAsRead(did, dialog.top_message, dialog.top_message, dialog.last_message_date, false, 0, 0, true, 0);
|
||||
}
|
||||
if (selectedDialogIndex >= 0) {
|
||||
frozenDialogsList.remove(selectedDialogIndex);
|
||||
viewPages[0].dialogsItemAnimator.prepareForRemove();
|
||||
viewPages[0].updateList(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void performDeleteOrClearDialogAction(int action, long selectedDialog, TLRPC.Chat chat, boolean isBot, boolean revoke) {
|
||||
if (action == clear) {
|
||||
getMessagesController().deleteDialog(selectedDialog, 1, revoke);
|
||||
|
@ -8062,7 +8115,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
} else {
|
||||
blockItem.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (filterTabsView == null || filterTabsView.getVisibility() != View.VISIBLE || filterTabsView.currentTabIsDefault()) {
|
||||
boolean cantRemoveFromFolder = filterTabsView == null || filterTabsView.getVisibility() != View.VISIBLE || filterTabsView.currentTabIsDefault();
|
||||
if (!cantRemoveFromFolder) {
|
||||
try {
|
||||
final int dialogsCount = getDialogsArray(currentAccount, viewPages[0].dialogsAdapter.getDialogsType(), folderId, dialogsListFrozen).size();
|
||||
cantRemoveFromFolder = count >= dialogsCount;
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
if (cantRemoveFromFolder) {
|
||||
removeFromFolderItem.setVisibility(View.GONE);
|
||||
} else {
|
||||
removeFromFolderItem.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -4811,7 +4811,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
|
|||
containerView.invalidate();
|
||||
}
|
||||
};
|
||||
avatarsViewPager.setImagesLayerNum(8192);
|
||||
avatarsViewPager.setImagesLayerNum(Integer.MAX_VALUE);
|
||||
avatarsViewPager.setInvalidateWithParent(true);
|
||||
avatarPagerIndicator.setProfileGalleryView(avatarsViewPager);
|
||||
avatarPreviewContainer = new FrameLayout(context) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.content.Context;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Canvas;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
|
@ -408,6 +409,23 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
|
|||
Collections.sort(unofficialLanguages, comparator);
|
||||
}
|
||||
|
||||
private static boolean patching = false;
|
||||
|
||||
@Override
|
||||
public void onBecomeFullyVisible() {
|
||||
super.onBecomeFullyVisible();
|
||||
boolean shouldPatch = getMessagesController().checkResetLangpack > 0 && !MessagesController.getGlobalMainSettings().getBoolean("langpack_patched", false) && !patching;
|
||||
if (shouldPatch) {
|
||||
patching = true;
|
||||
LocaleController.getInstance().reloadCurrentRemoteLocale(currentAccount, null, true, () -> {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
MessagesController.getGlobalMainSettings().edit().putBoolean("langpack_patched", true).apply();
|
||||
updateLanguage();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -431,7 +449,10 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
|
|||
|
||||
private void updateLanguage() {
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitleAnimated(LocaleController.getString("Language", R.string.Language), true, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
String newTitle = LocaleController.getString("Language", R.string.Language);
|
||||
if (!TextUtils.equals(actionBar.getTitle(), newTitle)) {
|
||||
actionBar.setTitleAnimated(newTitle, true, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
}
|
||||
}
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyItemRangeChanged(0, listAdapter.getItemCount());
|
||||
|
|
|
@ -73,7 +73,6 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.arch.core.util.Function;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.pm.ShortcutInfoCompat;
|
||||
|
@ -2486,6 +2485,12 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
open_settings = 4;
|
||||
} else if (url.contains("change_number")) {
|
||||
open_settings = 5;
|
||||
} else if (url.contains("?enablelogs")) {
|
||||
open_settings = 7;
|
||||
} else if (url.contains("?sendlogs")) {
|
||||
open_settings = 8;
|
||||
} else if (url.contains("?disablelogs")) {
|
||||
open_settings = 9;
|
||||
} else {
|
||||
open_settings = 1;
|
||||
}
|
||||
|
@ -2809,6 +2814,27 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
dids.add(MessagesStorage.TopicKey.of(dialogId, 0));
|
||||
didSelectDialogs(null, dids, null, false, null);
|
||||
}
|
||||
} else if (open_settings == 7 || open_settings == 8 || open_settings == 9) {
|
||||
CharSequence bulletinText = null;
|
||||
boolean can = BuildVars.DEBUG_PRIVATE_VERSION; // TODO: check source
|
||||
if (!can) {
|
||||
bulletinText = "Locked in release.";
|
||||
} else if (open_settings == 7) {
|
||||
bulletinText = "Logs enabled.";
|
||||
ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE).edit().putBoolean("logsEnabled", BuildVars.LOGS_ENABLED = true).commit();
|
||||
} else if (open_settings == 8) {
|
||||
ProfileActivity.sendLogs(LaunchActivity.this, false);
|
||||
} else if (open_settings == 9) {
|
||||
bulletinText = "Logs disabled.";
|
||||
ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE).edit().putBoolean("logsEnabled", BuildVars.LOGS_ENABLED = false).commit();
|
||||
}
|
||||
|
||||
if (bulletinText != null) {
|
||||
BaseFragment fragment = actionBarLayout.getLastFragment();
|
||||
if (fragment != null) {
|
||||
BulletinFactory.of(fragment).createSimpleBulletin(R.raw.info, bulletinText).show();
|
||||
}
|
||||
}
|
||||
} else if (open_settings != 0) {
|
||||
BaseFragment fragment;
|
||||
boolean closePrevious = false;
|
||||
|
@ -5408,21 +5434,6 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(@Nullable Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
|
||||
if (actionBarLayout != null) {
|
||||
actionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
||||
}
|
||||
if (rightActionBarLayout != null) {
|
||||
rightActionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
||||
}
|
||||
if (layersActionBarLayout != null) {
|
||||
layersActionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
|
|
@ -54,6 +54,7 @@ import android.text.TextUtils;
|
|||
import android.text.TextWatcher;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.style.ReplacementSpan;
|
||||
import android.util.Base64;
|
||||
|
@ -100,6 +101,7 @@ import org.telegram.messenger.AndroidUtilities;
|
|||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.AuthTokensHelper;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.CallReceiver;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.Emoji;
|
||||
import org.telegram.messenger.FileLog;
|
||||
|
@ -1447,6 +1449,10 @@ public class LoginActivity extends BaseFragment {
|
|||
public void setPage(@ViewNumber int page, boolean animated, Bundle params, boolean back) {
|
||||
boolean needFloatingButton = page == VIEW_PHONE_INPUT || page == VIEW_REGISTER || page == VIEW_PASSWORD ||
|
||||
page == VIEW_NEW_PASSWORD_STAGE_1 || page == VIEW_NEW_PASSWORD_STAGE_2 || page == VIEW_ADD_EMAIL;
|
||||
if (page == currentViewNum) {
|
||||
animated = false;
|
||||
}
|
||||
|
||||
if (needFloatingButton) {
|
||||
if (page == VIEW_PHONE_INPUT) {
|
||||
checkPermissions = true;
|
||||
|
@ -1770,6 +1776,8 @@ public class LoginActivity extends BaseFragment {
|
|||
params.putString("emailPattern", res.type.email_pattern);
|
||||
params.putInt("length", res.type.length);
|
||||
params.putInt("nextPhoneLoginDate", res.type.next_phone_login_date);
|
||||
params.putInt("resetAvailablePeriod", res.type.reset_available_period);
|
||||
params.putInt("resetPendingDate", res.type.reset_pending_date);
|
||||
setPage(VIEW_CODE_EMAIL, animate, params, false);
|
||||
}
|
||||
}
|
||||
|
@ -2987,6 +2995,8 @@ public class LoginActivity extends BaseFragment {
|
|||
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidCode", R.string.InvalidCode));
|
||||
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
|
||||
onBackPressed(true);
|
||||
setPage(VIEW_PHONE_INPUT, true, null, true);
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", R.string.CodeExpired));
|
||||
} else if (error.text.startsWith("FLOOD_WAIT")) {
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", R.string.FloodWait));
|
||||
|
@ -3897,6 +3907,9 @@ public class LoginActivity extends BaseFragment {
|
|||
} else if (currentType == AUTH_TYPE_FLASH_CALL) {
|
||||
AndroidUtilities.setWaitingForCall(true);
|
||||
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReceiveCall);
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
CallReceiver.checkLastReceivedCall();
|
||||
});
|
||||
}
|
||||
|
||||
currentParams = params;
|
||||
|
@ -4653,6 +4666,7 @@ public class LoginActivity extends BaseFragment {
|
|||
AndroidUtilities.endIncomingCall();
|
||||
}
|
||||
onNextPressed(num);
|
||||
CallReceiver.clearLastCall();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5433,7 +5447,7 @@ public class LoginActivity extends BaseFragment {
|
|||
requestPhone = currentParams.getString("phoneFormated");
|
||||
phoneHash = currentParams.getString("phoneHash");
|
||||
|
||||
int v = params.getBoolean("googleSignInAllowed") ? VISIBLE : GONE;
|
||||
int v = params.getBoolean("googleSignInAllowed") && PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices() ? VISIBLE : GONE;
|
||||
loginOrView.setVisibility(v);
|
||||
signInWithGoogleView.setVisibility(v);
|
||||
|
||||
|
@ -5545,6 +5559,8 @@ public class LoginActivity extends BaseFragment {
|
|||
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidCode", R.string.InvalidCode));
|
||||
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
|
||||
onBackPressed(true);
|
||||
setPage(VIEW_PHONE_INPUT, true, null, true);
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", R.string.CodeExpired));
|
||||
} else if (error.text.startsWith("FLOOD_WAIT")) {
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("FloodWait", R.string.FloodWait));
|
||||
|
@ -5598,14 +5614,19 @@ public class LoginActivity extends BaseFragment {
|
|||
private TextView signInWithGoogleView;
|
||||
private FrameLayout resendFrameLayout;
|
||||
private TextView resendCodeView;
|
||||
private FrameLayout cantAccessEmailFrameLayout;
|
||||
private TextView cantAccessEmailView;
|
||||
private TextView emailResetInView;
|
||||
private TextView wrongCodeView;
|
||||
private LoginOrView loginOrView;
|
||||
private RLottieImageView inboxImageView;
|
||||
|
||||
private boolean resetRequestPending;
|
||||
private Bundle currentParams;
|
||||
private boolean nextPressed;
|
||||
private GoogleSignInAccount googleAccount;
|
||||
|
||||
private int resetAvailablePeriod, resetPendingDate;
|
||||
private String phone, emailPhone, email;
|
||||
private String requestPhone, phoneHash;
|
||||
private boolean isFromSetup;
|
||||
|
@ -5623,9 +5644,11 @@ public class LoginActivity extends BaseFragment {
|
|||
|
||||
if (errorViewSwitcher.getCurrentView() != resendFrameLayout) {
|
||||
errorViewSwitcher.showNext();
|
||||
AndroidUtilities.updateViewVisibilityAnimated(cantAccessEmailFrameLayout, resendCodeView.getVisibility() != VISIBLE && activityMode != MODE_CHANGE_LOGIN_EMAIL && !isSetup, 1f, true);
|
||||
}
|
||||
};
|
||||
private Runnable resendCodeTimeout = () -> showResendCodeView(true);
|
||||
private Runnable updateResetPendingDateCallback = this::updateResetPendingDate;
|
||||
|
||||
public LoginActivityEmailCodeView(Context context, boolean setup) {
|
||||
super(context);
|
||||
|
@ -5718,6 +5741,83 @@ public class LoginActivity extends BaseFragment {
|
|||
googleClient.signOut().addOnCompleteListener(command -> getParentActivity().startActivityForResult(googleClient.getSignInIntent(), BasePermissionsActivity.REQUEST_CODE_SIGN_IN_WITH_GOOGLE));
|
||||
});
|
||||
|
||||
cantAccessEmailFrameLayout = new FrameLayout(context);
|
||||
AndroidUtilities.updateViewVisibilityAnimated(cantAccessEmailFrameLayout, activityMode != MODE_CHANGE_LOGIN_EMAIL && !isSetup, 1f, false);
|
||||
|
||||
cantAccessEmailView = new TextView(context) {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100), MeasureSpec.AT_MOST));
|
||||
}
|
||||
};
|
||||
cantAccessEmailView.setText(LocaleController.getString(R.string.LoginCantAccessThisEmail));
|
||||
cantAccessEmailView.setGravity(Gravity.CENTER);
|
||||
cantAccessEmailView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
cantAccessEmailView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16));
|
||||
cantAccessEmailView.setMaxLines(2);
|
||||
cantAccessEmailView.setOnClickListener(v -> {
|
||||
String rawPattern = currentParams.getString("emailPattern");
|
||||
SpannableStringBuilder email = new SpannableStringBuilder(rawPattern);
|
||||
int startIndex = rawPattern.indexOf('*'), endIndex = rawPattern.lastIndexOf('*');
|
||||
if (startIndex != endIndex && startIndex != -1 && endIndex != -1) {
|
||||
TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun();
|
||||
run.flags |= TextStyleSpan.FLAG_STYLE_SPOILER;
|
||||
run.start = startIndex;
|
||||
run.end = endIndex + 1;
|
||||
email.setSpan(new TextStyleSpan(run), startIndex, endIndex + 1, 0);
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(LocaleController.getString(R.string.LoginEmailResetTitle))
|
||||
.setMessage(AndroidUtilities.formatSpannable(AndroidUtilities.replaceTags(LocaleController.getString(R.string.LoginEmailResetMessage)), email, getTimePattern(resetAvailablePeriod)))
|
||||
.setPositiveButton(LocaleController.getString(R.string.LoginEmailResetButton), (dialog, which) -> {
|
||||
Bundle params = new Bundle();
|
||||
params.putString("phone", phone);
|
||||
params.putString("ephone", emailPhone);
|
||||
params.putString("phoneFormated", requestPhone);
|
||||
|
||||
TLRPC.TL_auth_resetLoginEmail req = new TLRPC.TL_auth_resetLoginEmail();
|
||||
req.phone_number = requestPhone;
|
||||
req.phone_code_hash = phoneHash;
|
||||
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
||||
if (response instanceof TLRPC.TL_auth_sentCode) {
|
||||
TLRPC.TL_auth_sentCode sentCode = (TLRPC.TL_auth_sentCode) response;
|
||||
if (sentCode.type instanceof TLRPC.TL_auth_sentCodeTypeEmailCode) {
|
||||
sentCode.type.email_pattern = currentParams.getString("emailPattern");
|
||||
resetRequestPending = true;
|
||||
}
|
||||
fillNextCodeParams(params, sentCode);
|
||||
} else if (error != null && error.text != null) {
|
||||
if (error.text.contains("PHONE_CODE_EXPIRED")) {
|
||||
onBackPressed(true);
|
||||
setPage(VIEW_PHONE_INPUT, true, null, true);
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", R.string.CodeExpired));
|
||||
} else {
|
||||
AlertsCreator.processError(currentAccount, error, LoginActivity.this, req);
|
||||
}
|
||||
}
|
||||
}), ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagWithoutLogin);
|
||||
})
|
||||
.setNegativeButton(LocaleController.getString(R.string.Cancel), null)
|
||||
.show();
|
||||
});
|
||||
cantAccessEmailFrameLayout.addView(cantAccessEmailView);
|
||||
|
||||
emailResetInView = new TextView(context) {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(Math.max(MeasureSpec.getSize(heightMeasureSpec), AndroidUtilities.dp(100)), MeasureSpec.AT_MOST));
|
||||
}
|
||||
};
|
||||
emailResetInView.setGravity(Gravity.CENTER);
|
||||
emailResetInView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
emailResetInView.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
||||
emailResetInView.setMaxLines(3);
|
||||
emailResetInView.setOnClickListener(v -> requestEmailReset());
|
||||
emailResetInView.setPadding(0, AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16));
|
||||
emailResetInView.setVisibility(GONE);
|
||||
cantAccessEmailFrameLayout.addView(emailResetInView);
|
||||
|
||||
resendCodeView = new TextView(context);
|
||||
resendCodeView.setGravity(Gravity.CENTER);
|
||||
resendCodeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
|
@ -5780,20 +5880,59 @@ public class LoginActivity extends BaseFragment {
|
|||
wrongCodeView.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
|
||||
wrongCodeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
wrongCodeView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP);
|
||||
wrongCodeView.setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4));
|
||||
wrongCodeView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16), AndroidUtilities.dp(16));
|
||||
errorViewSwitcher.addView(wrongCodeView);
|
||||
|
||||
FrameLayout bottomContainer = new FrameLayout(context);
|
||||
if (setup) {
|
||||
bottomContainer.addView(errorViewSwitcher, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM, 0, 0, 0, 32));
|
||||
} else {
|
||||
bottomContainer.addView(errorViewSwitcher, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 0, 8, 0, 0));
|
||||
bottomContainer.addView(errorViewSwitcher, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP));
|
||||
bottomContainer.addView(cantAccessEmailFrameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP));
|
||||
bottomContainer.addView(loginOrView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.CENTER, 0, 0, 0, 16));
|
||||
bottomContainer.addView(signInWithGoogleView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM, 0, 0, 0, 16));
|
||||
}
|
||||
addView(bottomContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 0, 1f));
|
||||
}
|
||||
|
||||
private boolean requestingEmailReset;
|
||||
private void requestEmailReset() {
|
||||
if (requestingEmailReset) {
|
||||
return;
|
||||
}
|
||||
requestingEmailReset = true;
|
||||
|
||||
Bundle params = new Bundle();
|
||||
params.putString("phone", phone);
|
||||
params.putString("ephone", emailPhone);
|
||||
params.putString("phoneFormated", requestPhone);
|
||||
|
||||
TLRPC.TL_auth_resetLoginEmail req = new TLRPC.TL_auth_resetLoginEmail();
|
||||
req.phone_number = requestPhone;
|
||||
req.phone_code_hash = phoneHash;
|
||||
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
||||
requestingEmailReset = false;
|
||||
if (response instanceof TLRPC.TL_auth_sentCode) {
|
||||
TLRPC.TL_auth_sentCode sentCode = (TLRPC.TL_auth_sentCode) response;
|
||||
fillNextCodeParams(params, sentCode);
|
||||
} else if (error != null && error.text != null) {
|
||||
if (error.text.contains("TASK_ALREADY_EXISTS")) {
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle(LocaleController.getString(R.string.LoginEmailResetPremiumRequiredTitle))
|
||||
.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString(R.string.LoginEmailResetPremiumRequiredMessage, LocaleController.addNbsp(PhoneFormat.getInstance().format("+" + requestPhone)))))
|
||||
.setPositiveButton(LocaleController.getString(R.string.OK), null)
|
||||
.show();
|
||||
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
|
||||
onBackPressed(true);
|
||||
setPage(VIEW_PHONE_INPUT, true, null, true);
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", R.string.CodeExpired));
|
||||
} else {
|
||||
AlertsCreator.processError(currentAccount, error, LoginActivity.this, req);
|
||||
}
|
||||
}
|
||||
}), ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagWithoutLogin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateColors() {
|
||||
titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
|
@ -5801,6 +5940,8 @@ public class LoginActivity extends BaseFragment {
|
|||
signInWithGoogleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
|
||||
loginOrView.updateColors();
|
||||
resendCodeView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
|
||||
cantAccessEmailView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
|
||||
emailResetInView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
|
||||
wrongCodeView.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
|
||||
|
||||
codeFieldContainer.invalidate();
|
||||
|
@ -5815,6 +5956,7 @@ public class LoginActivity extends BaseFragment {
|
|||
|
||||
private void showResendCodeView(boolean show) {
|
||||
AndroidUtilities.updateViewVisibilityAnimated(resendCodeView, show);
|
||||
AndroidUtilities.updateViewVisibilityAnimated(cantAccessEmailFrameLayout, !show && activityMode != MODE_CHANGE_LOGIN_EMAIL && !isSetup);
|
||||
|
||||
if (loginOrView.getVisibility() != GONE) {
|
||||
loginOrView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.CENTER, 0, 0, 0, show ? 8 : 16));
|
||||
|
@ -5851,11 +5993,23 @@ public class LoginActivity extends BaseFragment {
|
|||
isFromSetup = currentParams.getBoolean("setup");
|
||||
length = currentParams.getInt("length");
|
||||
email = currentParams.getString("email");
|
||||
resetAvailablePeriod = currentParams.getInt("resetAvailablePeriod");
|
||||
resetPendingDate = currentParams.getInt("resetPendingDate");
|
||||
|
||||
if (activityMode == MODE_CHANGE_LOGIN_EMAIL) {
|
||||
confirmTextView.setText(LocaleController.formatString(R.string.CheckYourNewEmailSubtitle, email));
|
||||
AndroidUtilities.updateViewVisibilityAnimated(cantAccessEmailFrameLayout, false, 1f, false);
|
||||
} else if (isSetup) {
|
||||
confirmTextView.setText(LocaleController.formatString(R.string.VerificationCodeSubtitle, email));
|
||||
AndroidUtilities.updateViewVisibilityAnimated(cantAccessEmailFrameLayout, false, 1f, false);
|
||||
} else {
|
||||
AndroidUtilities.updateViewVisibilityAnimated(cantAccessEmailFrameLayout, true, 1f, false);
|
||||
|
||||
cantAccessEmailView.setVisibility(resetPendingDate == 0 ? VISIBLE : GONE);
|
||||
emailResetInView.setVisibility(resetPendingDate != 0 ? VISIBLE : GONE);
|
||||
if (resetPendingDate != 0) {
|
||||
updateResetPendingDate();
|
||||
}
|
||||
}
|
||||
|
||||
codeFieldContainer.setNumbersCount(length, AUTH_TYPE_MESSAGE);
|
||||
|
@ -5900,7 +6054,7 @@ public class LoginActivity extends BaseFragment {
|
|||
confirmTextView.setText(AndroidUtilities.formatSpannable(LocaleController.getString(R.string.CheckYourEmailSubtitle), confirmText));
|
||||
}
|
||||
|
||||
int v = params.getBoolean("googleSignInAllowed") ? VISIBLE : GONE;
|
||||
int v = params.getBoolean("googleSignInAllowed") && PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices() ? VISIBLE : GONE;
|
||||
loginOrView.setVisibility(v);
|
||||
signInWithGoogleView.setVisibility(v);
|
||||
|
||||
|
@ -5910,6 +6064,81 @@ public class LoginActivity extends BaseFragment {
|
|||
if (!restore && params.containsKey("nextType")) {
|
||||
AndroidUtilities.runOnUIThread(resendCodeTimeout, params.getInt("timeout"));
|
||||
}
|
||||
|
||||
if (resetPendingDate != 0) {
|
||||
AndroidUtilities.runOnUIThread(updateResetPendingDateCallback, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHide() {
|
||||
super.onHide();
|
||||
|
||||
if (resetPendingDate != 0) {
|
||||
AndroidUtilities.cancelRunOnUIThread(updateResetPendingDateCallback);
|
||||
}
|
||||
}
|
||||
|
||||
private String getTimePatternForTimer(int timeRemaining) {
|
||||
int days = timeRemaining / 86400;
|
||||
int hours = (timeRemaining % 86400) / 3600;
|
||||
int minutes = ((timeRemaining % 86400) % 3600) / 60;
|
||||
int seconds = ((timeRemaining % 86400) % 3600) % 60;
|
||||
|
||||
String time;
|
||||
if (days != 0) {
|
||||
time = LocaleController.formatString(R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Days", days));
|
||||
} else {
|
||||
String timer = (hours != 0 ? String.format(Locale.ROOT, "%02d:", hours) : "") + String.format(Locale.ROOT, "%02d:", minutes) + String.format(Locale.ROOT, "%02d", seconds);
|
||||
time = LocaleController.formatString(R.string.LoginEmailResetInSinglePattern, timer);
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
private String getTimePattern(int timeRemaining) {
|
||||
int days = timeRemaining / 86400;
|
||||
int hours = (timeRemaining % 86400) / 3600;
|
||||
int minutes = ((timeRemaining % 86400) % 3600) / 60;
|
||||
|
||||
if (days == 0 && hours == 0) {
|
||||
minutes = Math.max(1, minutes);
|
||||
}
|
||||
|
||||
String time;
|
||||
if (days != 0 && hours != 0) {
|
||||
time = LocaleController.formatString(R.string.LoginEmailResetInDoublePattern, LocaleController.formatPluralString("Days", days), LocaleController.formatPluralString("Hours", hours));
|
||||
} else if (hours != 0 && minutes != 0) {
|
||||
time = LocaleController.formatString(R.string.LoginEmailResetInDoublePattern, LocaleController.formatPluralString("Hours", hours), LocaleController.formatPluralString("Minutes", minutes));
|
||||
} else if (days != 0) {
|
||||
time = LocaleController.formatString(R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Days", days));
|
||||
} else if (hours != 0) {
|
||||
time = LocaleController.formatString(R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Hours", days));
|
||||
} else {
|
||||
time = LocaleController.formatString(R.string.LoginEmailResetInSinglePattern, LocaleController.formatPluralString("Minutes", minutes));
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
private void updateResetPendingDate() {
|
||||
int timeRemaining = (int) (resetPendingDate - System.currentTimeMillis() / 1000L);
|
||||
if (resetPendingDate <= 0 || timeRemaining <= 0) {
|
||||
emailResetInView.setVisibility(VISIBLE);
|
||||
emailResetInView.setText(LocaleController.getString(R.string.LoginEmailResetPleaseWait));
|
||||
AndroidUtilities.runOnUIThread(this::requestEmailReset, 1000);
|
||||
return;
|
||||
}
|
||||
String str = LocaleController.formatString(R.string.LoginEmailResetInTime, getTimePatternForTimer(timeRemaining));
|
||||
SpannableStringBuilder ssb = SpannableStringBuilder.valueOf(str);
|
||||
int startIndex = str.indexOf('*'), endIndex = str.lastIndexOf('*');
|
||||
if (startIndex != endIndex && startIndex != -1 && endIndex != -1) {
|
||||
ssb.replace(endIndex, endIndex + 1, "");
|
||||
ssb.replace(startIndex, startIndex + 1, "");
|
||||
ssb.setSpan(new ForegroundColorSpan(getThemedColor(Theme.key_windowBackgroundWhiteBlueText4)), startIndex, endIndex - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
emailResetInView.setText(ssb);
|
||||
|
||||
AndroidUtilities.runOnUIThread(updateResetPendingDateCallback, 1000);
|
||||
}
|
||||
|
||||
private void onPasscodeError(boolean clear) {
|
||||
|
@ -6134,6 +6363,7 @@ public class LoginActivity extends BaseFragment {
|
|||
}
|
||||
if (errorViewSwitcher.getCurrentView() == resendFrameLayout) {
|
||||
errorViewSwitcher.showNext();
|
||||
AndroidUtilities.updateViewVisibilityAnimated(cantAccessEmailFrameLayout, false, 1f, true);
|
||||
}
|
||||
codeFieldContainer.codeField[0].requestFocus();
|
||||
AndroidUtilities.shakeViewSpring(codeFieldContainer, 10f, () -> {
|
||||
|
@ -6154,6 +6384,10 @@ public class LoginActivity extends BaseFragment {
|
|||
@Override
|
||||
public void onShow() {
|
||||
super.onShow();
|
||||
if (resetRequestPending) {
|
||||
resetRequestPending = false;
|
||||
return;
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
inboxImageView.getAnimatedDrawable().setCurrentFrame(0, false);
|
||||
inboxImageView.playAnimation();
|
||||
|
@ -7420,6 +7654,8 @@ public class LoginActivity extends BaseFragment {
|
|||
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidCode", R.string.InvalidCode));
|
||||
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
|
||||
onBackPressed(true);
|
||||
setPage(VIEW_PHONE_INPUT, true, null, true);
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("CodeExpired", R.string.CodeExpired));
|
||||
} else if (error.text.contains("FIRSTNAME_INVALID")) {
|
||||
needShowAlert(LocaleController.getString(R.string.RestorePasswordNoEmailTitle), LocaleController.getString("InvalidFirstName", R.string.InvalidFirstName));
|
||||
|
|
|
@ -183,6 +183,7 @@ import org.telegram.ui.Components.FragmentContextView;
|
|||
import org.telegram.ui.Components.HintView;
|
||||
import org.telegram.ui.Components.IdenticonDrawable;
|
||||
import org.telegram.ui.Components.ImageUpdater;
|
||||
import org.telegram.ui.Components.InstantCameraView;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.LinkSpanDrawable;
|
||||
import org.telegram.ui.Components.Premium.GiftPremiumBottomSheet;
|
||||
|
@ -3347,7 +3348,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
BuildVars.DEBUG_PRIVATE_VERSION ? LocaleController.getString(SharedConfig.isFloatingDebugActive ? R.string.FloatingDebugDisable : R.string.FloatingDebugEnable) : null,
|
||||
BuildVars.DEBUG_PRIVATE_VERSION ? "Force remove premium suggestions" : null,
|
||||
BuildVars.DEBUG_PRIVATE_VERSION ? "Share device info" : null,
|
||||
BuildVars.DEBUG_PRIVATE_VERSION ? "Force performance class" : null
|
||||
BuildVars.DEBUG_PRIVATE_VERSION ? "Force performance class" : null,
|
||||
BuildVars.DEBUG_PRIVATE_VERSION && !InstantCameraView.allowBigSizeCameraDebug() ? (!SharedConfig.bigCameraForRound ? "Force big camera for round" : "Disable big camera for round") : null
|
||||
};
|
||||
|
||||
builder.setItems(items, (dialog, which) -> {
|
||||
|
@ -3552,6 +3554,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
});
|
||||
builder2.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
builder2.show();
|
||||
} else if (which == 21) {
|
||||
SharedConfig.toggleRoundCamera();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
|
|
|
@ -4121,7 +4121,7 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
|
|||
if (categoriesListView != null || getContext() == null) {
|
||||
return;
|
||||
}
|
||||
if (type != TYPE_REACTIONS && type != TYPE_EMOJI_STATUS && type != TYPE_AVATAR_CONSTRUCTOR) {
|
||||
if (type != TYPE_REACTIONS && type != TYPE_SET_DEFAULT_REACTION && type != TYPE_EMOJI_STATUS && type != TYPE_AVATAR_CONSTRUCTOR) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -667,31 +667,39 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
|
|||
if (currentType == MediaDataController.TYPE_IMAGE) {
|
||||
featuredRow = rowCount++;
|
||||
masksRow = -1;
|
||||
if (mediaDataController.getArchivedStickersCount(currentType) != 0) {
|
||||
boolean inserted = archivedRow == -1;
|
||||
archivedRow = rowCount++;
|
||||
if (listAdapter != null && inserted) {
|
||||
listAdapter.notifyItemRangeInserted(archivedRow, 1);
|
||||
}
|
||||
}
|
||||
archivedInfoRow = -1;
|
||||
emojiPacksRow = rowCount++;
|
||||
} else {
|
||||
featuredRow = -1;
|
||||
masksRow = -1;
|
||||
emojiPacksRow = -1;
|
||||
}
|
||||
|
||||
if (mediaDataController.getArchivedStickersCount(currentType) != 0 && currentType != MediaDataController.TYPE_EMOJIPACKS) {
|
||||
boolean inserted = archivedRow == -1;
|
||||
if (mediaDataController.getArchivedStickersCount(currentType) != 0 && currentType != MediaDataController.TYPE_EMOJIPACKS) {
|
||||
boolean inserted = archivedRow == -1;
|
||||
|
||||
archivedRow = rowCount++;
|
||||
archivedInfoRow = currentType == MediaDataController.TYPE_MASK ? rowCount++ : -1;
|
||||
archivedRow = rowCount++;
|
||||
archivedInfoRow = currentType == MediaDataController.TYPE_MASK ? rowCount++ : -1;
|
||||
|
||||
if (listAdapter != null && inserted) {
|
||||
listAdapter.notifyItemRangeInserted(archivedRow, archivedInfoRow != -1 ? 2 : 1);
|
||||
}
|
||||
} else {
|
||||
int oldArchivedRow = archivedRow;
|
||||
int oldArchivedInfoRow = archivedInfoRow;
|
||||
if (listAdapter != null && inserted) {
|
||||
listAdapter.notifyItemRangeInserted(archivedRow, archivedInfoRow != -1 ? 2 : 1);
|
||||
}
|
||||
} else {
|
||||
int oldArchivedRow = archivedRow;
|
||||
int oldArchivedInfoRow = archivedInfoRow;
|
||||
|
||||
archivedRow = -1;
|
||||
archivedInfoRow = -1;
|
||||
archivedRow = -1;
|
||||
archivedInfoRow = -1;
|
||||
|
||||
if (listAdapter != null && oldArchivedRow != -1) {
|
||||
listAdapter.notifyItemRangeRemoved(oldArchivedRow, oldArchivedInfoRow != -1 ? 2 : 1);
|
||||
if (listAdapter != null && oldArchivedRow != -1) {
|
||||
listAdapter.notifyItemRangeRemoved(oldArchivedRow, oldArchivedInfoRow != -1 ? 2 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.LiteMode;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MediaDataController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
|
@ -87,6 +85,7 @@ import org.telegram.ui.Cells.ThemePreviewMessagesCell;
|
|||
import org.telegram.ui.Cells.ThemeTypeCell;
|
||||
import org.telegram.ui.Cells.ThemesHorizontalListCell;
|
||||
import org.telegram.ui.Components.AlertsCreator;
|
||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.RLottieDrawable;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
|
@ -137,6 +136,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
private int customTabsRow;
|
||||
private int directShareRow;
|
||||
private int raiseToSpeakRow;
|
||||
private int raiseToListenRow;
|
||||
private int sendByEnterRow;
|
||||
private int saveToGalleryOption1Row;
|
||||
private int saveToGalleryOption2Row;
|
||||
|
@ -180,6 +180,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
private int themeInfoRow;
|
||||
private int chatBlurRow;
|
||||
private int pauseOnRecordRow;
|
||||
private int pauseOnMediaRow;
|
||||
|
||||
private int swipeGestureHeaderRow;
|
||||
private int swipeGestureRow;
|
||||
|
@ -485,6 +486,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
|
||||
int prevThemeAccentListRow = themeAccentListRow;
|
||||
int prevEditThemeRow = editThemeRow;
|
||||
int prevRaiseToSpeakRow = raiseToSpeakRow;
|
||||
|
||||
rowCount = 0;
|
||||
contactsReimportRow = -1;
|
||||
|
@ -521,6 +523,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
chatListInfoRow = -1;
|
||||
chatBlurRow = -1;
|
||||
pauseOnRecordRow = -1;
|
||||
pauseOnMediaRow = -1;
|
||||
stickersRow = -1;
|
||||
stickersInfoRow = -1;
|
||||
liteModeRow = -1;
|
||||
|
@ -533,6 +536,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
directShareRow = -1;
|
||||
enableAnimationsRow = -1;
|
||||
raiseToSpeakRow = -1;
|
||||
raiseToListenRow = -1;
|
||||
sendByEnterRow = -1;
|
||||
saveToGalleryOption1Row = -1;
|
||||
saveToGalleryOption2Row = -1;
|
||||
|
@ -633,8 +637,12 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
customTabsRow = rowCount++;
|
||||
directShareRow = rowCount++;
|
||||
// enableAnimationsRow = rowCount++;
|
||||
raiseToSpeakRow = rowCount++;
|
||||
raiseToListenRow = rowCount++;
|
||||
if (SharedConfig.raiseToListen) {
|
||||
raiseToSpeakRow = rowCount++;
|
||||
}
|
||||
sendByEnterRow = rowCount++;
|
||||
pauseOnMediaRow = rowCount++;
|
||||
pauseOnRecordRow = rowCount++;
|
||||
bluetoothScoRow = rowCount++;
|
||||
// if (SharedConfig.canBlurChat()) {
|
||||
|
@ -705,6 +713,12 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
} else if (prevEditThemeRow != -1 && editThemeRow == -1) {
|
||||
listAdapter.notifyItemRemoved(prevEditThemeRow);
|
||||
}
|
||||
|
||||
if (prevRaiseToSpeakRow == -1 && raiseToSpeakRow != -1) {
|
||||
listAdapter.notifyItemInserted(raiseToSpeakRow);
|
||||
} else if (prevRaiseToSpeakRow != -1 && raiseToSpeakRow == -1) {
|
||||
listAdapter.notifyItemRemoved(prevRaiseToSpeakRow);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int start = nightTypeInfoRow + 1;
|
||||
|
@ -1028,15 +1042,34 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
((TextCheckCell) view).setChecked(!send);
|
||||
}
|
||||
} else if (position == raiseToSpeakRow) {
|
||||
SharedConfig.toogleRaiseToSpeak();
|
||||
SharedConfig.toggleRaiseToSpeak();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(SharedConfig.raiseToSpeak);
|
||||
}
|
||||
} else if (position == raiseToListenRow) {
|
||||
SharedConfig.toggleRaiseToListen();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(SharedConfig.raiseToListen);
|
||||
}
|
||||
if (!SharedConfig.raiseToListen && raiseToSpeakRow != -1) {
|
||||
for (int i = 0; i < listView.getChildCount(); ++i) {
|
||||
View child = listView.getChildAt(i);
|
||||
if (child instanceof TextCheckCell && listView.getChildAdapterPosition(child) == raiseToSpeakRow) {
|
||||
((TextCheckCell) child).setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateRows(false);
|
||||
} else if (position == pauseOnRecordRow) {
|
||||
SharedConfig.togglePauseMusicOnRecord();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(SharedConfig.pauseMusicOnRecord);
|
||||
}
|
||||
} else if (position == pauseOnMediaRow) {
|
||||
SharedConfig.togglePauseMusicOnMedia();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(SharedConfig.pauseMusicOnMedia);
|
||||
}
|
||||
} else if (position == distanceRow) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
|
@ -1274,6 +1307,14 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
presentFragment(new LiteModeSettingsActivity());
|
||||
}
|
||||
});
|
||||
if (currentType == THEME_TYPE_BASIC) {
|
||||
DefaultItemAnimator itemAnimator = new DefaultItemAnimator();
|
||||
itemAnimator.setDurations(350);
|
||||
itemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
itemAnimator.setDelayAnimations(false);
|
||||
itemAnimator.setSupportsChangeAnimations(false);
|
||||
listView.setItemAnimator(itemAnimator);
|
||||
}
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
@ -2254,8 +2295,12 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
textCheckCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), true);
|
||||
} else if (position == raiseToSpeakRow) {
|
||||
textCheckCell.setTextAndCheck(LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), SharedConfig.raiseToSpeak, true);
|
||||
} else if (position == raiseToListenRow) {
|
||||
textCheckCell.setTextAndCheck(LocaleController.getString("RaiseToListen", R.string.RaiseToListen), SharedConfig.raiseToListen, true);
|
||||
} else if (position == pauseOnRecordRow) {
|
||||
textCheckCell.setTextAndCheck(LocaleController.getString(R.string.PauseMusicOnRecord), SharedConfig.pauseMusicOnRecord, true);
|
||||
} else if (position == pauseOnMediaRow) {
|
||||
textCheckCell.setTextAndCheck(LocaleController.getString(R.string.PauseMusicOnMedia), SharedConfig.pauseMusicOnMedia, true);
|
||||
} else if (position == customTabsRow) {
|
||||
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("ChromeCustomTabs", R.string.ChromeCustomTabs), LocaleController.getString("ChromeCustomTabsInfo", R.string.ChromeCustomTabsInfo), SharedConfig.customTabs, false, true);
|
||||
} else if (position == directShareRow) {
|
||||
|
@ -2377,8 +2422,8 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
|
|||
} else if (position == automaticBrightnessRow) {
|
||||
return TYPE_BRIGHTNESS;
|
||||
} else if (position == scheduleLocationRow || position == enableAnimationsRow || position == sendByEnterRow ||
|
||||
position == raiseToSpeakRow || position == pauseOnRecordRow || position == customTabsRow ||
|
||||
position == directShareRow || position == chatBlurRow) {
|
||||
position == raiseToSpeakRow || position == raiseToListenRow || position == pauseOnRecordRow || position == customTabsRow ||
|
||||
position == directShareRow || position == chatBlurRow || position == pauseOnMediaRow) {
|
||||
return TYPE_TEXT_CHECK;
|
||||
} else if (position == textSizeRow) {
|
||||
return TYPE_TEXT_SIZE;
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.os.Build;
|
|||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.voip.Instance;
|
||||
import org.telegram.messenger.voip.VoIPService;
|
||||
|
||||
|
@ -175,6 +176,20 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||
info2 = info;
|
||||
}
|
||||
}
|
||||
if (info2 == null) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
MediaCodecInfo info = infos.get(i);
|
||||
if (info == null || !info.isEncoder()) {
|
||||
continue;
|
||||
}
|
||||
if (MediaCodecUtils.codecSupportsType(info, type)) {
|
||||
stringBuilder.append(info.getName()).append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
FileLog.e("can't create video encoder " + type.mimeType() + ", supported codecs" + stringBuilder);
|
||||
}
|
||||
return info2;
|
||||
}
|
||||
|
||||
|
|
|
@ -2287,6 +2287,7 @@
|
|||
<string name="HidAccount">The account was hidden by the user</string>
|
||||
<string name="AutoplayMedia">Auto-play media</string>
|
||||
<string name="RaiseToSpeak">Raise to Speak</string>
|
||||
<string name="RaiseToListen">Raise to Listen</string>
|
||||
<string name="SaveToGallerySettings">Save to Gallery</string>
|
||||
<string name="SoundMuted">Sound muted</string>
|
||||
<string name="EditName">Edit name</string>
|
||||
|
@ -6358,4 +6359,16 @@
|
|||
<string name="AccDescrLiteBatteryLevelAnnounce">%s%%</string>
|
||||
<string name="AccDescrRateTranscriptionUp">Rate up</string>
|
||||
<string name="AccDescrRateTranscriptionDown">Rate down</string>
|
||||
<string name="PauseMusicOnMedia">Pause music while playing media</string>
|
||||
<string name="ProxyBottomSheetChecking">Checking</string>
|
||||
<string name="LoginCantAccessThisEmail">Can\'t access this email?</string>
|
||||
<string name="LoginEmailResetInTime">Email will be reset in %1$s.\n*Reset now via SMS*</string>
|
||||
<string name="LoginEmailResetInSinglePattern">%1$s</string>
|
||||
<string name="LoginEmailResetInDoublePattern">%1$s and %2$s</string>
|
||||
<string name="LoginEmailResetTitle">Reset Email</string>
|
||||
<string name="LoginEmailResetMessage">You can change your login email if you are logged into Telegram from another device. Otherwise, if you don\'t have access to email %1$s, you can reset this email with an **SMS** code in **%2$s**.</string>
|
||||
<string name="LoginEmailResetButton">Reset Login Email</string>
|
||||
<string name="LoginEmailResetPremiumRequiredTitle">Telegram Premium Required</string>
|
||||
<string name="LoginEmailResetPremiumRequiredMessage">Due to the high cost of SMS in your country, you need a **Telegram Premium** account to immediately reset this email via an SMS code.\n\nYou can ask a friend to gift a Premium subscription for your account **%1$s**</string>
|
||||
<string name="LoginEmailResetPleaseWait">Resetting email, please wait...</string>
|
||||
</resources>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
#Sat Mar 12 05:53:50 MSK 2016
|
||||
APP_VERSION_CODE=3213
|
||||
APP_VERSION_NAME=9.5.3
|
||||
APP_VERSION_CODE=3227
|
||||
APP_VERSION_NAME=9.5.4
|
||||
APP_PACKAGE=org.telegram.messenger
|
||||
RELEASE_KEY_PASSWORD=android
|
||||
RELEASE_KEY_ALIAS=androidkey
|
||||
|
|
Loading…
Reference in a new issue