Skip to content

Commit

Permalink
Update to 7.7.1 (2291)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Apr 16, 2021
1 parent 8bf056e commit c4ada53
Show file tree
Hide file tree
Showing 67 changed files with 7,577 additions and 4,971 deletions.
6 changes: 3 additions & 3 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {

compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation 'com.google.firebase:firebase-messaging:21.1.0'
implementation 'com.google.firebase:firebase-config:20.0.4'
implementation 'com.google.firebase:firebase-datatransport:17.0.11'
implementation 'com.google.firebase:firebase-appindexing:19.2.0'
Expand Down Expand Up @@ -300,7 +300,7 @@ android {
}
}

defaultConfig.versionCode = 2284
defaultConfig.versionCode = 2291

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand All @@ -319,7 +319,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionName "7.7.0"
versionName "7.7.1"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

Expand Down
11,771 changes: 7,123 additions & 4,648 deletions TMessagesProj/jni/sqlite/sqlite3.c

Large diffs are not rendered by default.

61 changes: 44 additions & 17 deletions TMessagesProj/jni/sqlite/sqlite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.34.0"
#define SQLITE_VERSION_NUMBER 3034000
#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
#define SQLITE_VERSION "3.35.4"
#define SQLITE_VERSION_NUMBER 3035004
#define SQLITE_SOURCE_ID "2021-04-02 15:20:15 5d4c65779dab868b285519b19e4cf9d451d50c6048f06f653aa701ec212df45e"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down Expand Up @@ -2115,7 +2115,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether triggers are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the trigger setting is not reported back. </dd>
** which case the trigger setting is not reported back.
**
** <p>Originally this option disabled all triggers. ^(However, since
** SQLite version 3.35.0, TEMP triggers are still allowed even if
** this option is off. So, in other words, this option now only disables
** triggers in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
**
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
Expand All @@ -2126,7 +2132,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether views are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the view setting is not reported back. </dd>
** which case the view setting is not reported back.
**
** <p>Originally this option disabled all views. ^(However, since
** SQLite version 3.35.0, TEMP views are still allowed even if
** this option is off. So, in other words, this option now only disables
** views in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
**
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
Expand Down Expand Up @@ -3499,6 +3511,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** that uses dot-files in place of posix advisory locking.
** <tr><td> file:data.db?mode=readonly <td>
** An error. "readonly" is not a valid option for the "mode" parameter.
** Use "ro" instead: "file:data.db?mode=ro".
** </table>
**
** ^URI hexadecimal escape sequences (%HH) are supported within the path and
Expand Down Expand Up @@ -3697,7 +3710,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
** If the Y parameter to sqlite3_free_filename(Y) is anything other
** than a NULL pointer or a pointer previously acquired from
** sqlite3_create_filename(), then bad things such as heap
** corruption or segfaults may occur. The value Y should be
** corruption or segfaults may occur. The value Y should not be
** used again after sqlite3_free_filename(Y) has been called. This means
** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
** then the corresponding [sqlite3_module.xClose() method should also be
Expand Down Expand Up @@ -7765,7 +7778,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_PRNG_SEED 28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
#define SQLITE_TESTCTRL_SEEK_COUNT 30
#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
#define SQLITE_TESTCTRL_TRACEFLAGS 31
#define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */

/*
** CAPI3REF: SQL Keyword Checking
Expand Down Expand Up @@ -10438,6 +10452,14 @@ SQLITE_API int sqlite3session_patchset(
*/
SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);

/*
** CAPI3REF: Query for the amount of heap memory used by a session object.
**
** This API returns the total amount of heap memory in bytes currently
** used by the session object passed as the only argument.
*/
SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);

/*
** CAPI3REF: Create An Iterator To Traverse A Changeset
** CONSTRUCTOR: sqlite3_changeset_iter
Expand Down Expand Up @@ -10540,18 +10562,23 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
** is not the case, this function returns [SQLITE_MISUSE].
**
** If argument pzTab is not NULL, then *pzTab is set to point to a
** nul-terminated utf-8 encoded string containing the name of the table
** affected by the current change. The buffer remains valid until either
** sqlite3changeset_next() is called on the iterator or until the
** conflict-handler function returns. If pnCol is not NULL, then *pnCol is
** set to the number of columns in the table affected by the change. If
** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
** outputs are set through these pointers:
**
** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
** depending on the type of change that the iterator currently points to;
**
** *pnCol is set to the number of columns in the table affected by the change; and
**
** *pzTab is set to point to a nul-terminated utf-8 encoded string containing
** the name of the table affected by the current change. The buffer remains
** valid until either sqlite3changeset_next() is called on the iterator
** or until the conflict-handler function returns.
**
** If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** is an indirect change, or false (0) otherwise. See the documentation for
** [sqlite3session_indirect()] for a description of direct and indirect
** changes. Finally, if pOp is not NULL, then *pOp is set to one of
** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the
** type of change that the iterator currently points to.
** changes.
**
** If no error occurs, SQLITE_OK is returned. If an error does occur, an
** SQLite error code is returned. The values of the output variables may not
Expand Down
23 changes: 17 additions & 6 deletions TMessagesProj/jni/tgnet/ConnectionsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
} else if (typeInfo == typeid(TL_rpc_result)) {
TL_rpc_result *response = (TL_rpc_result *) message;
int64_t resultMid = response->req_msg_id;
if (resultMid == lastInvokeAfterMessageId) {
lastInvokeAfterMessageId = 0;
}

bool hasResult = response->result.get() != nullptr;
bool ignoreResult = false;
Expand Down Expand Up @@ -1270,13 +1273,21 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
}
} else if ((request->requestFlags & RequestFlagFailOnServerErrors) == 0 || processEvenFailed) {
if (error->error_code == 500 || error->error_code < 0) {
discardResponse = true;
if (isWorkerBusy) {
request->minStartTime = 0;
static std::string waitFailed = "MSG_WAIT_FAILED";
if (error->error_message.find(waitFailed) != std::string::npos) {
request->minStartTime = (int32_t) (getCurrentTimeMonotonicMillis() / 1000 + 1);
request->startTime = 0;
request->startTimeMillis = 0;
request->requestFlags &=~ RequestFlagInvokeAfter;
} else {
request->minStartTime = request->startTime + (request->serverFailureCount > 10 ? 10 : request->serverFailureCount);
if (isWorkerBusy) {
request->minStartTime = 0;
} else {
request->minStartTime = request->startTime + (request->serverFailureCount > 10 ? 10 : request->serverFailureCount);
}
request->serverFailureCount++;
}
request->serverFailureCount++;
discardResponse = true;
} else if (error->error_code == 420) {
int32_t waitTime = 2;
static std::string floodWait = "FLOOD_WAIT_";
Expand Down Expand Up @@ -2618,7 +2629,7 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
int64_t maxRequestId = 0;
if (lastInvokeAfterMessageId != 0) {
int64_t timeMessage = (int64_t) (lastInvokeAfterMessageId / 4294967296.0);
if (getCurrentTime() - timeMessage <= 30) {
if (getCurrentTime() - timeMessage <= 5) {
maxRequestId = lastInvokeAfterMessageId;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2284;
public static int BUILD_VERSION = 2291;
public static String BUILD_VERSION_STRING = "7.7.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.graphics.drawable.Drawable;
import android.view.View;

import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.Components.AnimatedFileDrawable;
import org.telegram.ui.Components.LoadingStickerDrawable;
Expand All @@ -31,12 +32,11 @@

import androidx.annotation.Keep;

import com.google.android.exoplayer2.util.Log;

public class ImageReceiver implements NotificationCenter.NotificationCenterDelegate {

public interface ImageReceiverDelegate {
void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb, boolean memCache);

default void onAnimationReady(ImageReceiver imageReceiver) {
}
}
Expand Down Expand Up @@ -195,6 +195,8 @@ private void clear() {
private Drawable currentMediaDrawable;
private BitmapShader mediaShader;

private boolean useRoundForThumb;

private Drawable staticThumbDrawable;

private String currentExt;
Expand Down Expand Up @@ -313,6 +315,39 @@ public void setImage(ImageLocation imageLocation, String imageFilter, ImageLocat
setImage(imageLocation, imageFilter, thumbLocation, thumbFilter, null, size, ext, parentObject, cacheType);
}

public void setForUserOrChat(TLObject object, Drawable avatarDrawable) {
setForUserOrChat(object, avatarDrawable, null);
}

public void setForUserOrChat(TLObject object, Drawable avatarDrawable, Object parentObject) {
if (parentObject == null) {
parentObject = object;
}
setUseRoundForThumbDrawable(true);
BitmapDrawable strippedBitmap = null;
boolean hasStripped = false;
if (object instanceof TLRPC.User) {
TLRPC.User user = (TLRPC.User) object;
if (user.photo != null) {
strippedBitmap = user.photo.strippedBitmap;
hasStripped = user.photo.stripped_thumb != null;
}
} else if (object instanceof TLRPC.Chat) {
TLRPC.Chat chat = (TLRPC.Chat) object;
if (chat.photo != null) {
strippedBitmap = chat.photo.strippedBitmap;
hasStripped = chat.photo.stripped_thumb != null;
}
}
if (strippedBitmap != null) {
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", strippedBitmap, null, parentObject, 0);
} else if (hasStripped) {
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, parentObject, 0);
} else {
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, null, parentObject, 0);
}
}

public void setImage(ImageLocation fileLocation, String fileFilter, ImageLocation thumbLocation, String thumbFilter, Drawable thumb, Object parentObject, int cacheType) {
setImage(null, null, fileLocation, fileFilter, thumbLocation, thumbFilter, thumb, 0, null, parentObject, cacheType);
}
Expand Down Expand Up @@ -503,6 +538,9 @@ public void setImage(ImageLocation mediaLocation, String mediaFilter, ImageLocat
imageShader = null;
thumbShader = null;
mediaShader = null;
if (useRoundForThumb && staticThumbDrawable != null) {
updateDrawableRadius(staticThumbDrawable);
}
currentAlpha = 1.0f;

if (staticThumbDrawable instanceof SvgHelper.SvgDrawable) {
Expand All @@ -518,7 +556,7 @@ public void setImage(ImageLocation mediaLocation, String mediaFilter, ImageLocat
if (invalidateAll) {
parentView.invalidate();
} else {
parentView.invalidate((int)imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
parentView.invalidate((int) imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
}
}

Expand Down Expand Up @@ -677,7 +715,7 @@ public void setImageBitmap(Drawable bitmap) {
if (invalidateAll) {
parentView.invalidate();
} else {
parentView.invalidate((int)imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
parentView.invalidate((int) imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
}
}
if (forceCrossfade && crossfadeWithOldImage && crossfadeImage != null) {
Expand Down Expand Up @@ -777,7 +815,7 @@ private boolean setBackupImage() {

public boolean onAttachedToWindow() {
currentOpenedLayerFlags = NotificationCenter.getGlobalInstance().getCurrentHeavyOperationFlags();
currentOpenedLayerFlags &=~ currentLayerNum;
currentOpenedLayerFlags &= ~currentLayerNum;
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReplacedPhotoInMemCache);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.stopAllHeavyOperations);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.startAllHeavyOperations);
Expand Down Expand Up @@ -816,6 +854,10 @@ private void drawDrawable(Canvas canvas, Drawable drawable, int alpha, BitmapSha
}
}

public void setUseRoundForThumbDrawable(boolean value) {
useRoundForThumb = value;
}

private void drawDrawable(Canvas canvas, Drawable drawable, int alpha, BitmapShader shader, int orientation, int isPressed) {
if (drawable instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
Expand Down Expand Up @@ -902,7 +944,7 @@ private void drawDrawable(Canvas canvas, Drawable drawable, int alpha, BitmapSha

if (isRoundRect) {
try {
canvas.drawRoundRect(roundRect,roundRadius[0], roundRadius[0],roundPaint);
canvas.drawRoundRect(roundRect, roundRadius[0], roundRadius[0], roundPaint);
} catch (Exception e) {
onBitmapException(bitmapDrawable);
FileLog.e(e);
Expand Down Expand Up @@ -1142,7 +1184,7 @@ private void checkAlphaAnimation(boolean skip) {
if (invalidateAll) {
parentView.invalidate();
} else {
parentView.invalidate((int)imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
parentView.invalidate((int) imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
}
}
}
Expand Down Expand Up @@ -2079,7 +2121,7 @@ public void didReceivedNotification(int id, int account, Object... args) {
if (currentLayerNum >= layer || currentOpenedLayerFlags == 0) {
return;
}
currentOpenedLayerFlags &=~ layer;
currentOpenedLayerFlags &= ~layer;
if (currentOpenedLayerFlags == 0) {
RLottieDrawable lottieDrawable = getLottieAnimation();
if (allowStartLottieAnimation && lottieDrawable != null && lottieDrawable.isHeavyDrawable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1130,10 +1130,10 @@ public static String fixNumbers(CharSequence numbers) {
}

public String formatCurrencyString(long amount, String type) {
return formatCurrencyString(amount, true, type);
return formatCurrencyString(amount, true, true, false, type);
}

public String formatCurrencyString(long amount, boolean fixAnything, String type) {
public String formatCurrencyString(long amount, boolean fixAnything, boolean withExp, boolean editText, String type) {
type = type.toUpperCase();
String customFormat;
double doubleAmount;
Expand Down Expand Up @@ -1200,14 +1200,24 @@ public String formatCurrencyString(long amount, boolean fixAnything, String type
doubleAmount = amount / 100.0;
break;
}
String result;
if (!withExp) {
customFormat = " %.0f";
}
if (currency != null) {
NumberFormat format = NumberFormat.getCurrencyInstance(currentLocale != null ? currentLocale : systemDefaultLocale);
format.setCurrency(currency);
if (fixAnything && type.equals("IRR")) {
if (editText) {
format.setGroupingUsed(false);
}
if (!withExp || fixAnything && type.equals("IRR")) {
format.setMaximumFractionDigits(0);
}
return (discount ? "-" : "") + format.format(doubleAmount);
String result = (discount ? "-" : "") + format.format(doubleAmount);
int idx = result.indexOf(type);
if (idx >= 0 && result.charAt(idx + type.length()) != ' ') {
result = result.substring(0, idx + type.length()) + " " + result.substring(idx + type.length());
}
return result;
}
return (discount ? "-" : "") + String.format(Locale.US, type + customFormat, doubleAmount);
}
Expand Down
Loading

0 comments on commit c4ada53

Please sign in to comment.