diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle
index 0b0ef7a7e..2f77da0b6 100644
--- a/TMessagesProj/build.gradle
+++ b/TMessagesProj/build.gradle
@@ -299,7 +299,7 @@ android {
}
}
- defaultConfig.versionCode = 2462
+ defaultConfig.versionCode = 2470
applicationVariants.all { variant ->
variant.outputs.all { output ->
@@ -318,7 +318,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
- versionName "8.2.1"
+ versionName "8.2.7"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml
index 79376604e..0d40f1db6 100644
--- a/TMessagesProj/src/main/AndroidManifest.xml
+++ b/TMessagesProj/src/main/AndroidManifest.xml
@@ -49,6 +49,7 @@
+
@@ -66,6 +67,7 @@
+
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
index 393e4c176..524e5ef94 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 = 2466;
- public static String BUILD_VERSION_STRING = "8.2.3";
+ public static int BUILD_VERSION = 2470;
+ public static String BUILD_VERSION_STRING = "8.2.7";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
index 538d91e3a..4a9cdd5da 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
@@ -3926,6 +3926,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
boolean result = true;
if (Build.VERSION.SDK_INT >= 29) {
try {
+ int selectedType = type;
ContentValues contentValues = new ContentValues();
String extension = MimeTypeMap.getFileExtensionFromUrl(sourceFile.getAbsolutePath());
String mimeType = null;
@@ -3933,7 +3934,15 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
}
Uri uriToInsert = null;
- if (type == 0) {
+ if ((type == 0 || type == 1) && mimeType != null) {
+ if (mimeType.startsWith("image")) {
+ selectedType = 0;
+ }
+ if (mimeType.startsWith("video")) {
+ selectedType = 1;
+ }
+ }
+ if (selectedType == 0) {
uriToInsert = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
File dirDest = new File(Environment.DIRECTORY_PICTURES, "Telegram");
@@ -3941,12 +3950,12 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, AndroidUtilities.generateFileName(0, extension));
contentValues.put(MediaStore.Images.Media.MIME_TYPE, mimeType);
- } else if (type == 1) {
+ } else if (selectedType == 1) {
File dirDest = new File(Environment.DIRECTORY_MOVIES, "Telegram");
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator);
uriToInsert = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
contentValues.put(MediaStore.Video.Media.DISPLAY_NAME, AndroidUtilities.generateFileName(1, extension));
- } else if (type == 2) {
+ } else if (selectedType == 2) {
File dirDest = new File(Environment.DIRECTORY_DOWNLOADS, "Telegram");
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator);
uriToInsert = MediaStore.Downloads.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
index 2a4fd184c..4c8361665 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
@@ -5967,7 +5967,6 @@ public class MessageObject {
attachPathExists = f.exists();
}
if (!attachPathExists) {
-
File file = FileLoader.getPathToMessage(messageOwner);
if (type == 3 && needDrawBluredPreview()) {
mediaExists = new File(file.getAbsolutePath() + ".enc").exists();
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 8e57276bd..f98dd1cf3 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
@@ -1865,7 +1865,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
}
if (currentMessageObject.type == 12) {
- TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(currentMessageObject.messageOwner.media.user_id);
+ long uid = currentMessageObject.messageOwner.media.user_id;
+ TLRPC.User user = null;
+ if (uid != 0) {
+ user = MessagesController.getInstance(currentAccount).getUser(uid);
+ }
if (user == null) {
imagePressed = false;
result = false;
@@ -2673,7 +2677,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
didPressButton(true, false);
}
} else if (currentMessageObject.type == 12) {
- TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(currentMessageObject.messageOwner.media.user_id);
+ long uid = currentMessageObject.messageOwner.media.user_id;
+ TLRPC.User user = null;
+ if (uid != 0) {
+ user = MessagesController.getInstance(currentAccount).getUser(uid);
+ }
delegate.didPressUserAvatar(this, user, lastTouchX, lastTouchY);
} else if (currentMessageObject.type == MessageObject.TYPE_ROUND_VIDEO) {
if (buttonState != -1) {
@@ -4419,7 +4427,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
availableTimeWidth = backgroundWidth - AndroidUtilities.dp(31);
long uid = messageObject.messageOwner.media.user_id;
- TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(uid);
+ TLRPC.User user = null;
+ if (uid != 0) {
+ user = MessagesController.getInstance(currentAccount).getUser(uid);
+ }
int maxWidth = getMaxNameWidth() - AndroidUtilities.dp(80);
if (maxWidth < 0) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java
index fdf67d6b4..9fcf5fb1a 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java
@@ -24,6 +24,7 @@ import androidx.core.graphics.ColorUtils;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AndroidUtilities;
+import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.ImageLocation;
@@ -166,7 +167,8 @@ public class SharedPhotoVideoCell2 extends View {
if (messageObject.strippedThumb != null) {
imageReceiver.setImage(null, null, null, null, messageObject.strippedThumb, 0, null, messageObject, 0);
} else {
- imageReceiver.clearImage();
+ TLRPC.PhotoSize currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 50);
+ imageReceiver.setImage(null, null, ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), "b", null, 0, null, messageObject, 0);
}
}
} else {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java
index 8624b3f78..3d77cf3a4 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java
@@ -1215,7 +1215,11 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
}
options.add(9);
} else if (type == 8) {
- TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.media.user_id);
+ long uid = selectedObject.messageOwner.media.user_id;
+ TLRPC.User user = null;
+ if (uid != 0) {
+ user = MessagesController.getInstance(currentAccount).getUser(uid);
+ }
if (user != null && user.id != UserConfig.getInstance(currentAccount).getClientUserId() && ContactsController.getInstance(currentAccount).contactsDict.get(user.id) == null) {
items.add(LocaleController.getString("AddContactTitle", R.string.AddContactTitle));
options.add(15);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
index dec3ba227..82c7b4d3d 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
@@ -19797,7 +19797,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
} else if (type == 8) {
- TLRPC.User user = getMessagesController().getUser(selectedObject.messageOwner.media.user_id);
+ long uid = selectedObject.messageOwner.media.user_id;
+ TLRPC.User user = null;
+ if (uid != 0) {
+ user = MessagesController.getInstance(currentAccount).getUser(uid);
+ }
if (user != null && user.id != getUserConfig().getClientUserId() && getContactsController().contactsDict.get(user.id) == null) {
items.add(LocaleController.getString("AddContactTitle", R.string.AddContactTitle));
options.add(15);
@@ -19925,7 +19929,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
options.add(9);
icons.add(R.drawable.msg_sticker);
} else if (type == 8) {
- TLRPC.User user = getMessagesController().getUser(selectedObject.messageOwner.media.user_id);
+ long uid = selectedObject.messageOwner.media.user_id;
+ TLRPC.User user = null;
+ if (uid != 0) {
+ user = MessagesController.getInstance(currentAccount).getUser(uid);
+ }
if (user != null && user.id != getUserConfig().getClientUserId() && getContactsController().contactsDict.get(user.id) == null) {
items.add(LocaleController.getString("AddContactTitle", R.string.AddContactTitle));
options.add(15);
@@ -23154,7 +23162,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
ArticleViewer.getInstance().open(messageObject);
}
} else if (type == 5) {
- openVCard(getMessagesController().getUser(messageObject.messageOwner.media.user_id), messageObject.messageOwner.media.vcard, messageObject.messageOwner.media.first_name, messageObject.messageOwner.media.last_name);
+ long uid = messageObject.messageOwner.media.user_id;
+ TLRPC.User user = null;
+ if (uid != 0) {
+ user = MessagesController.getInstance(currentAccount).getUser(uid);
+ }
+ openVCard(user, messageObject.messageOwner.media.vcard, messageObject.messageOwner.media.first_name, messageObject.messageOwner.media.last_name);
} else {
if (messageObject.isSponsored()) {
Bundle args = new Bundle();
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinGroupAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinGroupAlert.java
index f9ff8fd71..3826156a0 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinGroupAlert.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinGroupAlert.java
@@ -173,7 +173,7 @@ public class JoinGroupAlert extends BottomSheet {
layout.titleTextView.setText(LocaleController.getString("RequestToJoinSent", R.string.RequestToJoinSent));
String subTitle = isChannel
? LocaleController.getString("RequestToJoinChannelSentDescription", R.string.RequestToJoinChannelSentDescription)
- : LocaleController.getString("RequestToJoinSentDescription", R.string.RequestToJoinGroupSentDescription);
+ : LocaleController.getString("RequestToJoinGroupSentDescription", R.string.RequestToJoinGroupSentDescription);
layout.subtitleTextView.setText(subTitle);
Bulletin.make(fragment, layout, Bulletin.DURATION_LONG).show();
});
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/RenderView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/RenderView.java
index c842fd825..8d387e570 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/RenderView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/RenderView.java
@@ -9,6 +9,8 @@ import android.view.MotionEvent;
import android.view.TextureView;
import android.view.View;
+import com.google.android.exoplayer2.util.Log;
+
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
@@ -64,7 +66,6 @@ public class RenderView extends TextureView {
if (surface == null || internal != null) {
return;
}
-
internal = new CanvasInternal(surface);
internal.setBufferSize(width, height);
updateTransform();
@@ -263,7 +264,7 @@ public class RenderView extends TextureView {
private EGLContext eglContext;
private EGLSurface eglSurface;
private boolean initialized;
- private boolean ready;
+ private volatile boolean ready;
private int bufferWidth;
private int bufferHeight;
@@ -438,7 +439,7 @@ public class RenderView extends TextureView {
}
if (!ready) {
- queue.postRunnable(() -> ready = true, 200);
+ ready = true;
}
}
};
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java
index 78a597e7d..efae3945c 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java
@@ -81,7 +81,10 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
phone = getArguments().getString("phone");
addContact = getArguments().getBoolean("addContact", false);
needAddException = MessagesController.getNotificationsSettings(currentAccount).getBoolean("dialog_bar_exception" + user_id, false);
- TLRPC.User user = getMessagesController().getUser(user_id);
+ TLRPC.User user = null;
+ if (user_id != 0) {
+ user = getMessagesController().getUser(user_id);
+ }
return user != null && super.onFragmentCreate();
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java
index 3035a0162..b0dba751b 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java
@@ -1595,10 +1595,14 @@ public class LoginActivity extends BaseFragment {
boolean allowCall = true;
boolean allowCancelCall = true;
boolean allowReadCallLog = true;
+ boolean allowReadPhoneNumbers = true;
if (Build.VERSION.SDK_INT >= 23 && simcardAvailable) {
allowCall = getParentActivity().checkSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED;
allowCancelCall = getParentActivity().checkSelfPermission(Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED;
allowReadCallLog = Build.VERSION.SDK_INT < 28 || getParentActivity().checkSelfPermission(Manifest.permission.READ_CALL_LOG) == PackageManager.PERMISSION_GRANTED;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ allowReadPhoneNumbers = getParentActivity().checkSelfPermission(Manifest.permission.READ_PHONE_NUMBERS) == PackageManager.PERMISSION_GRANTED;
+ }
if (checkPermissions) {
permissionsItems.clear();
if (!allowCall) {
@@ -1610,6 +1614,9 @@ public class LoginActivity extends BaseFragment {
if (!allowReadCallLog) {
permissionsItems.add(Manifest.permission.READ_CALL_LOG);
}
+ if (!allowReadPhoneNumbers) {
+ permissionsItems.add(Manifest.permission.READ_PHONE_NUMBERS);
+ }
boolean ok = true;
if (!permissionsItems.isEmpty()) {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();