Update to 8.2.7

This commit is contained in:
xaxtix 2021-11-15 15:52:32 +03:00
parent 3b971647e2
commit 23b70a3882
13 changed files with 72 additions and 21 deletions

View file

@ -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']

View file

@ -49,6 +49,7 @@
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission android:name="com.sec.android.provider.badge.permission.READ"/>
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/>
@ -66,6 +67,7 @@
<uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS"/>
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ"/>
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE"/>
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" /> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace" />

View file

@ -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";

View file

@ -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);

View file

@ -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();

View file

@ -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) {

View file

@ -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 {

View file

@ -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);

View file

@ -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();

View file

@ -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();
});

View file

@ -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;
}
}
};

View file

@ -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();
}

View file

@ -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();