diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 9a84f1aeeec..90afb9c32c5 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -35,8 +35,6 @@ dependencies { implementation 'com.google.android.gms:play-services-wearable:17.0.0' implementation 'com.google.android.gms:play-services-location:17.1.0' implementation 'com.google.android.gms:play-services-wallet:18.1.2' - implementation "com.microsoft.appcenter:appcenter-distribute:3.3.1" - implementation "com.microsoft.appcenter:appcenter-crashes:3.3.1" implementation 'com.googlecode.mp4parser:isoparser:1.0.6' implementation 'com.stripe:stripe-android:2.0.2' implementation files('libs/libgsaverification-client.aar') @@ -290,7 +288,7 @@ android { } } - defaultConfig.versionCode = 2243 + defaultConfig.versionCode = 2244 applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index a393bd9978d..f86dfa0b135 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -98,9 +98,6 @@ import com.google.android.gms.auth.api.phone.SmsRetriever; import com.google.android.gms.auth.api.phone.SmsRetrieverClient; import com.google.android.gms.tasks.Task; -import com.microsoft.appcenter.AppCenter; -import com.microsoft.appcenter.crashes.Crashes; -import com.microsoft.appcenter.distribute.Distribute; import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.browser.Browser; @@ -2184,33 +2181,12 @@ public void onAnimationEnd(Animator animation) { }*/ public static void startAppCenter(Activity context) { - if (BuildConfig.DEBUG) { - return; - } - try { - if (BuildVars.DEBUG_VERSION) { - Distribute.setEnabledForDebuggableBuild(true); - AppCenter.start(context.getApplication(), BuildVars.DEBUG_VERSION ? BuildVars.APPCENTER_HASH_DEBUG : BuildVars.APPCENTER_HASH, Distribute.class, Crashes.class); - AppCenter.setUserId("uid=" + UserConfig.getInstance(UserConfig.selectedAccount).clientUserId); - } - } catch (Throwable e) { - FileLog.e(e); - } + } private static long lastUpdateCheckTime; public static void checkForUpdates() { - try { - if (BuildVars.DEBUG_VERSION) { - if (SystemClock.elapsedRealtime() - lastUpdateCheckTime < 60 * 60 * 1000) { - return; - } - lastUpdateCheckTime = SystemClock.elapsedRealtime(); - Distribute.checkForUpdate(); - } - } catch (Throwable e) { - FileLog.e(e); - } + } public static void addToClipboard(CharSequence str) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index c87daa365f7..7c40f4aff2a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -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 = 2243; + public static int BUILD_VERSION = 2244; public static String BUILD_VERSION_STRING = "7.5.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index b281bf7123c..62ce443f508 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -417,9 +417,6 @@ public void start() { AndroidUtilities.cancelRunOnUIThread(locationQueryCancelRunnable); } locationQueryCancelRunnable = () -> { - if (locationQueryCancelRunnable != this) { - return; - } if (delegate != null) { if (lastKnownLocation != null) { delegate.onLocationAcquired(lastKnownLocation); @@ -5604,7 +5601,7 @@ private static boolean prepareSendingDocumentInternal(AccountInstance accountIns MimeTypeMap myMime = MimeTypeMap.getSingleton(); TLRPC.TL_documentAttributeAudio attributeAudio = null; String extension = null; - if (uri != null) { + if (uri != null && path == null) { boolean hasExt = false; if (mime != null) { extension = myMime.getExtensionFromMimeType(mime); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index e99cb3663b6..f5298047ba9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -8923,7 +8923,11 @@ private void measureTime(MessageObject messageObject) { } else if (messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.post_author != null) { signString = messageObject.messageOwner.fwd_from.post_author.replace("\n", ""); } else if (messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.imported) { - signString = LocaleController.formatImportedDate(messageObject.messageOwner.fwd_from.date) + " " + LocaleController.getString("ImportedMessage", R.string.ImportedMessage); + if (messageObject.messageOwner.fwd_from.date == messageObject.messageOwner.date) { + signString = LocaleController.getString("ImportedMessage", R.string.ImportedMessage); + } else { + signString = LocaleController.formatImportedDate(messageObject.messageOwner.fwd_from.date) + " " + LocaleController.getString("ImportedMessage", R.string.ImportedMessage); + } } else if (!messageObject.isOutOwner() && fromId > 0 && messageObject.messageOwner.post) { TLRPC.User signUser = MessagesController.getInstance(currentAccount).getUser(fromId); if (signUser != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 8dd62c73377..bc0edc57509 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -20214,7 +20214,14 @@ private void openDiscussionMessageChat(int chatId, MessageObject originalMessage } } else { if ("CHANNEL_PRIVATE".equals(error.text)) { - getNotificationCenter().postNotificationName(NotificationCenter.chatInfoCantLoad, currentChat.id, 3); + if (getParentActivity() != null) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); + builder.setMessage(LocaleController.getString("JoinByPeekChannelText", R.string.JoinByPeekChannelText)); + builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); + AlertDialog alertDialog = builder.create(); + showDialog(builder.create()); + } return; } savedNoHistory = true; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkActionView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkActionView.java index 65c354c8731..8bf352a3cf7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkActionView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkActionView.java @@ -16,6 +16,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; @@ -259,12 +260,25 @@ protected void onDraw(Canvas canvas) { canvas.drawColor(0x33000000); getPointOnScreen(frameLayout, finalContainer, point); canvas.save(); + float clipTop = ((View) frameLayout.getParent()).getY() + frameLayout.getY(); + if (clipTop < 1) { + canvas.clipRect(0, point[1] - clipTop + 1, getMeasuredWidth(), getMeasuredHeight()); + } canvas.translate(point[0], point[1]); + frameLayout.draw(canvas); canvas.restore(); } + }; + ViewTreeObserver.OnPreDrawListener preDrawListener = new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + dimView.invalidate(); + return true; + } }; + finalContainer.getViewTreeObserver().addOnPreDrawListener(preDrawListener); container.addView(dimView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); dimView.setAlpha(0); dimView.animate().alpha(1f).setDuration(150); @@ -283,6 +297,7 @@ public void onAnimationEnd(Animator animation) { if (dimView.getParent() != null) { finalContainer.removeView(dimView); } + finalContainer.getViewTreeObserver().removeOnPreDrawListener(preDrawListener); } }); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java index 96f416ab4d5..a253da32fe9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java @@ -139,7 +139,6 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen private ArrayList admins = new ArrayList<>(); - long timeDif; private boolean isPublic; @@ -407,6 +406,9 @@ private void loadLinks() { resumeDelayedFragmentAnimation(); } + if (loadNext) { + loadLinks(); + } if (updateByDiffUtils && isOpened && listViewAdapter != null && listView.getChildCount() > 0) { updateRows(false); callback.fillPositions(callback.newPositionToItem); @@ -415,9 +417,6 @@ private void loadLinks() { } else { updateRows(true); } - if (loadNext) { - loadLinks(); - } }); }); }); @@ -453,7 +452,6 @@ private void updateRows(boolean notify) { linksHeaderRow = -1; dividerRow = -1; - rowCount = 0; boolean otherAdmin = adminId != getAccountInstance().getUserConfig().clientUserId; @@ -467,7 +465,6 @@ private void updateRows(boolean notify) { permanentLinkHeaderRow = rowCount++; permanentLinkRow = rowCount++; - if (!otherAdmin) { dividerRow = rowCount++; createNewLinkRow = rowCount++; @@ -496,8 +493,6 @@ private void updateRows(boolean notify) { adminsEndRow = rowCount; } - - if (!revokedInvites.isEmpty()) { if (adminsStartRow >= 0) { revokedDivider = rowCount++; @@ -962,7 +957,6 @@ private void revokePermanent() { TLRPC.TL_chatInviteExported oldInvite = invite; invite = null; info.exported_invite = null; - listViewAdapter.notifyItemChanged(permanentLinkRow); final int reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { invite = (TLRPC.TL_chatInviteExported) response; @@ -974,7 +968,6 @@ private void revokePermanent() { return; } - listViewAdapter.notifyItemChanged(permanentLinkRow); oldInvite.revoked = true; DiffCallback callback = saveListState(); revokedInvites.add(0, oldInvite); @@ -986,6 +979,7 @@ private void revokePermanent() { } })); + AndroidUtilities.updateVisibleRows(listView); getConnectionsManager().bindRequestToGuid(reqId, classGuid); } else { revokeLink(invite); @@ -1255,9 +1249,7 @@ protected void onDraw(Canvas canvas) { if (progress <= 0) { invite.expired = true; drawState = LINK_STATE_RED; - if (listViewAdapter != null) { - listViewAdapter.notifyItemChanged(position); - } + AndroidUtilities.updateVisibleRows(listView); } else { drawState = LINK_STATE_GREEN; } @@ -1485,7 +1477,6 @@ public void revokeLink(TLRPC.TL_chatInviteExported invite) { TLRPC.TL_messages_exportedChatInviteReplaced replaced = (TLRPC.TL_messages_exportedChatInviteReplaced) response; if (!isPublic) { ManageLinksActivity.this.invite = (TLRPC.TL_chatInviteExported) replaced.new_invite; - listViewAdapter.notifyItemChanged(permanentLinkRow); } invite.revoked = true; @@ -1498,6 +1489,7 @@ public void revokeLink(TLRPC.TL_chatInviteExported invite) { updateRows(false); if (getParentActivity() == null) { + listViewAdapter.notifyDataSetChanged(); return; } callback.fillPositions(callback.newPositionToItem); diff --git a/TMessagesProj/src/main/res/drawable/chats_widget_preview.png b/TMessagesProj/src/main/res/drawable/chats_widget_preview.png index ed79ec36570..1ff9796d582 100644 Binary files a/TMessagesProj/src/main/res/drawable/chats_widget_preview.png and b/TMessagesProj/src/main/res/drawable/chats_widget_preview.png differ