diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 327ce9a7e..ce6e342c6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -20,8 +20,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 = 2756; - public static String BUILD_VERSION_STRING = "8.9.2"; + public static int BUILD_VERSION = 2757; + public static String BUILD_VERSION_STRING = "8.9.3"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/GoogleLocationProvider.java b/TMessagesProj/src/main/java/org/telegram/messenger/GoogleLocationProvider.java index 40f86462b..42f9adfb0 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/GoogleLocationProvider.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/GoogleLocationProvider.java @@ -39,7 +39,12 @@ public class GoogleLocationProvider implements ILocationServiceProvider { @Override public void getLastLocation(Consumer callback) { - locationProviderClient.getLastLocation().addOnCompleteListener(task -> callback.accept(task.getResult())); + locationProviderClient.getLastLocation().addOnCompleteListener(task -> { + if (task.getException() != null) { + return; + } + callback.accept(task.getResult()); + }); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java index 1a6b61790..fd66e6eac 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java @@ -6682,7 +6682,7 @@ public class MediaDataController extends BaseController { } }); String aliasFinal = alias; - if (allowAnimated) { + if (allowAnimated && SharedConfig.suggestAnimatedEmoji) { fillWithAnimatedEmoji(result, null, () -> { if (sync != null) { callback.run(result, aliasFinal); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index eba58634d..50e86949d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -3883,6 +3883,7 @@ public class MessagesController extends BaseController implements NotificationCe TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox(); update.channel_id = dialog.peer.channel_id; update.max_id = dialog.read_inbox_max_id; + update.still_unread_count = dialog.unread_count; arrayList.add(update); } else { TLRPC.TL_updateReadHistoryInbox update = new TLRPC.TL_updateReadHistoryInbox(); @@ -4026,6 +4027,7 @@ public class MessagesController extends BaseController implements NotificationCe TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox(); update.channel_id = chatId; update.max_id = res.full_chat.read_inbox_max_id; + update.still_unread_count = res.full_chat.unread_count; arrayList.add(update); processUpdateArray(arrayList, null, null, false, 0); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 89f78da6f..6732a1a26 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -5755,7 +5755,7 @@ public class MessagesStorage extends BaseController { int messageId = inbox.get(key); boolean canCountByMessageId = true; - if (stillUnreadMessagesCount != null && stillUnreadMessagesCount.get(key, -1) != -1) { + if (stillUnreadMessagesCount != null && stillUnreadMessagesCount.get(key, -2) != -2) { SQLiteCursor checkHolesCursor = database.queryFinalized(String.format(Locale.US, "SELECT start, end FROM messages_holes WHERE uid = %d AND end > %d", key, messageId)); while (checkHolesCursor.next()) { canCountByMessageId = false; @@ -5771,8 +5771,8 @@ public class MessagesStorage extends BaseController { } cursor.dispose(); } else { - int unread = stillUnreadMessagesCount.get(key); - if (unread > 0) { + int unread = stillUnreadMessagesCount.get(key, -1); + if (unread >= 0) { dialogsToUpdate.put(key, unread); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java b/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java index cb2c07d88..35430cc76 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java @@ -305,6 +305,7 @@ public class PushListenerController { TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox(); update.channel_id = channel_id; update.max_id = max_id; + update.still_unread_count = -1; updates.add(update); } else { TLRPC.TL_updateReadHistoryInbox update = new TLRPC.TL_updateReadHistoryInbox(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java index e3c487950..9935d0492 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java @@ -22,7 +22,6 @@ import android.graphics.Shader; import android.graphics.drawable.Animatable; import android.graphics.drawable.BitmapDrawable; import android.os.Build; -import android.util.Log; import android.view.View; import org.telegram.messenger.AndroidUtilities; @@ -34,7 +33,6 @@ import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.utils.BitmapsCache; import org.telegram.tgnet.TLRPC; -import org.telegram.ui.ActionBar.Theme; import java.io.File; import java.util.ArrayList; @@ -971,6 +969,8 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable, long cacheGenerateTimestamp; Bitmap generatingCacheBitmap; long cacheGenerateNativePtr; + int tryCount; + int lastMetadata; @Override public void prepareForGenerateCache() { @@ -994,9 +994,16 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable, generatingCacheBitmap = Bitmap.createBitmap(metaData[0], metaData[1], Bitmap.Config.ARGB_8888); } getVideoFrame(cacheGenerateNativePtr, generatingCacheBitmap, metaData, generatingCacheBitmap.getRowBytes(), false, startTime, endTime); - if (cacheGenerateTimestamp != 0 && metaData[3] == 0 || cacheGenerateTimestamp > metaData[3]) { + if (cacheGenerateTimestamp != 0 && (metaData[3] == 0 || cacheGenerateTimestamp > metaData[3])) { return 0; } + if (lastMetadata == metaData[3]) { + tryCount++; + if (tryCount > 5) { + return 0; + } + } + lastMetadata = metaData[3]; bitmap.eraseColor(Color.TRANSPARENT); canvas.save(); float s = (float) renderingWidth / generatingCacheBitmap.getWidth(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java index fa4670717..652e8dd20 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java @@ -20,7 +20,6 @@ import android.os.Handler; import android.os.Looper; import android.os.SystemClock; import android.text.TextUtils; -import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.View; @@ -34,7 +33,6 @@ import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.R; import org.telegram.messenger.Utilities; import org.telegram.messenger.utils.BitmapsCache; -import org.telegram.ui.ActionBar.Theme; import java.io.File; import java.io.FileInputStream; @@ -892,7 +890,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma return false; } if (generatingCache) { -// return false; + return false; } if (!newColorUpdates.isEmpty()) { pendingColorUpdates.putAll(newColorUpdates); diff --git a/TMessagesProj_AppHuawei/src/main/java/org/telegram/messenger/HuaweiLocationProvider.java b/TMessagesProj_AppHuawei/src/main/java/org/telegram/messenger/HuaweiLocationProvider.java index 17f7756b4..1a014395c 100644 --- a/TMessagesProj_AppHuawei/src/main/java/org/telegram/messenger/HuaweiLocationProvider.java +++ b/TMessagesProj_AppHuawei/src/main/java/org/telegram/messenger/HuaweiLocationProvider.java @@ -32,17 +32,22 @@ public class HuaweiLocationProvider implements ILocationServiceProvider { @Override public ILocationRequest onCreateLocationRequest() { - return new GoogleLocationRequest(LocationRequest.create()); + return new HuaweiLocationRequest(LocationRequest.create()); } @Override public void getLastLocation(Consumer callback) { - locationProviderClient.getLastLocation().addOnCompleteListener(task -> callback.accept(task.getResult())); + locationProviderClient.getLastLocation().addOnCompleteListener(task -> { + if (task.getException() != null) { + return; + } + callback.accept(task.getResult()); + }); } @Override public void requestLocationUpdates(ILocationRequest request, ILocationListener locationListener) { - locationProviderClient.requestLocationUpdates(((GoogleLocationRequest) request).request, new LocationCallback() { + locationProviderClient.requestLocationUpdates(((HuaweiLocationRequest) request).request, new LocationCallback() { @Override public void onLocationResult(@NonNull LocationResult locationResult) { locationListener.onLocationChanged(locationResult.getLastLocation()); @@ -62,7 +67,7 @@ public class HuaweiLocationProvider implements ILocationServiceProvider { @Override public void checkLocationSettings(ILocationRequest request, Consumer callback) { - LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(((GoogleLocationRequest) request).request); + LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(((HuaweiLocationRequest) request).request); settingsClient.checkLocationSettings(builder.build()).addOnCompleteListener(task -> { try { @@ -83,7 +88,7 @@ public class HuaweiLocationProvider implements ILocationServiceProvider { @Override public IMapApiClient onCreateLocationServicesAPI(Context context, IAPIConnectionCallbacks connectionCallbacks, IAPIOnConnectionFailedListener failedListener) { - return new GoogleApiClientImpl(new HuaweiApiClient.Builder(ApplicationLoader.applicationContext) + return new HuaweiApiClientImpl(new HuaweiApiClient.Builder(ApplicationLoader.applicationContext) .addConnectionCallbacks(new HuaweiApiClient.ConnectionCallbacks() { @Override public void onConnected() { @@ -101,13 +106,13 @@ public class HuaweiLocationProvider implements ILocationServiceProvider { @Override public boolean checkServices() { - return PushListenerController.GooglePushListenerServiceProvider.INSTANCE.hasServices(); + return HuaweiPushListenerProvider.INSTANCE.hasServices(); } - public final static class GoogleLocationRequest implements ILocationRequest { + public final static class HuaweiLocationRequest implements ILocationRequest { private LocationRequest request; - private GoogleLocationRequest(LocationRequest request) { + private HuaweiLocationRequest(LocationRequest request) { this.request = request; } @@ -143,10 +148,10 @@ public class HuaweiLocationProvider implements ILocationServiceProvider { } } - public final static class GoogleApiClientImpl implements IMapApiClient { + public final static class HuaweiApiClientImpl implements IMapApiClient { private HuaweiApiClient apiClient; - private GoogleApiClientImpl(HuaweiApiClient apiClient) { + private HuaweiApiClientImpl(HuaweiApiClient apiClient) { this.apiClient = apiClient; }