diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 9a84f1aee..90afb9c32 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 a393bd997..f86dfa0b1 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.android.internal.telephony.ITelephony; 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 class AndroidUtilities { }*/ public static void startAppCenter(Activity context) { - if (BuildConfig.DEBUG) { - return; - } - try { - if (BuildVars.DEBUG_VERSION) { - Distribute.setEnabledForDebuggableBuild(true); - AppCenter.start(context.getApplication(), BuildVars.DEBUG_VERSION ? BuildVars.APPCENTER_HASH_DEBUG : BuildVars.APPCENTER_HASH, Distribute.class, Crashes.class); - AppCenter.setUserId("uid=" + UserConfig.getInstance(UserConfig.selectedAccount).clientUserId); - } - } catch (Throwable e) { - FileLog.e(e); - } + } private static long lastUpdateCheckTime; public static void checkForUpdates() { - try { - if (BuildVars.DEBUG_VERSION) { - if (SystemClock.elapsedRealtime() - lastUpdateCheckTime < 60 * 60 * 1000) { - return; - } - lastUpdateCheckTime = SystemClock.elapsedRealtime(); - Distribute.checkForUpdate(); - } - } catch (Throwable e) { - FileLog.e(e); - } + } public static void addToClipboard(CharSequence str) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index c87daa365..7c40f4aff 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 b281bf712..62ce443f5 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 class SendMessagesHelper extends BaseController implements NotificationCe AndroidUtilities.cancelRunOnUIThread(locationQueryCancelRunnable); } locationQueryCancelRunnable = () -> { - if (locationQueryCancelRunnable != this) { - return; - } if (delegate != null) { if (lastKnownLocation != null) { delegate.onLocationAcquired(lastKnownLocation); @@ -5604,7 +5601,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe 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 e99cb3663..f5298047b 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 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } 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 8dd62c733..bc0edc575 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 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } 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 65c354c87..8bf352a3c 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.KeyEvent; 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 @@ public class LinkActionView extends LinearLayout { 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 class LinkActionView extends LinearLayout { 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 96f416ab4..a253da32f 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 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen resumeDelayedFragmentAnimation(); } + if (loadNext) { + loadLinks(); + } if (updateByDiffUtils && isOpened && listViewAdapter != null && listView.getChildCount() > 0) { updateRows(false); callback.fillPositions(callback.newPositionToItem); @@ -415,9 +417,6 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen } else { updateRows(true); } - if (loadNext) { - loadLinks(); - } }); }); }); @@ -453,7 +452,6 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen linksHeaderRow = -1; dividerRow = -1; - rowCount = 0; boolean otherAdmin = adminId != getAccountInstance().getUserConfig().clientUserId; @@ -467,7 +465,6 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen permanentLinkHeaderRow = rowCount++; permanentLinkRow = rowCount++; - if (!otherAdmin) { dividerRow = rowCount++; createNewLinkRow = rowCount++; @@ -496,8 +493,6 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen adminsEndRow = rowCount; } - - if (!revokedInvites.isEmpty()) { if (adminsStartRow >= 0) { revokedDivider = rowCount++; @@ -962,7 +957,6 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen 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 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen return; } - listViewAdapter.notifyItemChanged(permanentLinkRow); oldInvite.revoked = true; DiffCallback callback = saveListState(); revokedInvites.add(0, oldInvite); @@ -986,6 +979,7 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen } })); + AndroidUtilities.updateVisibleRows(listView); getConnectionsManager().bindRequestToGuid(reqId, classGuid); } else { revokeLink(invite); @@ -1255,9 +1249,7 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen 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 class ManageLinksActivity extends BaseFragment implements NotificationCen 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 class ManageLinksActivity extends BaseFragment implements NotificationCen 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 ed79ec365..1ff9796d5 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