Skip to content

Commit

Permalink
Update to 8.2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
xaxtix committed Nov 15, 2021
1 parent 3b97164 commit 23b70a3
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 21 deletions.
4 changes: 2 additions & 2 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ android {
}
}

defaultConfig.versionCode = 2462
defaultConfig.versionCode = 2470

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand All @@ -318,7 +318,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionName "8.2.1"
versionName "8.2.7"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

Expand Down
2 changes: 2 additions & 0 deletions TMessagesProj/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand All @@ -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" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3926,27 +3926,36 @@ public static void saveFile(String fullPath, Context context, final int type, fi
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;
if (extension != null) {
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");
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dirDest + File.separator);
}
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5967,7 +5967,6 @@ public void checkMediaExistance() {
attachPathExists = f.exists();
}
if (!attachPathExists) {

File file = FileLoader.getPathToMessage(messageOwner);
if (type == 3 && needDrawBluredPreview()) {
mediaExists = new File(file.getAbsolutePath() + ".enc").exists();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,11 @@ private boolean checkPhotoImageMotionEvent(MotionEvent event) {
}
}
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;
Expand Down Expand Up @@ -2673,7 +2677,11 @@ private void didClickedImage() {
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) {
Expand Down Expand Up @@ -4419,7 +4427,10 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand Down Expand Up @@ -166,7 +167,8 @@ public void setMessageObject(MessageObject messageObject, int parentColumnsCount
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,11 @@ public void onAutoDeleteHistory(int ttl, int action) {
}
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);
Expand Down
19 changes: 16 additions & 3 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19797,7 +19797,11 @@ private void createMenu(View v, boolean single, boolean listView, float x, float
}
}
} 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);
Expand Down Expand Up @@ -19925,7 +19929,11 @@ private void createMenu(View v, boolean single, boolean listView, float x, float
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);
Expand Down Expand Up @@ -23154,7 +23162,12 @@ public void didPressInstantButton(ChatMessageCell cell, int type) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public JoinGroupAlert(final Context context, TLRPC.ChatInvite invite, String gro
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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
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;
Expand Down Expand Up @@ -64,7 +66,6 @@ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int hei
if (surface == null || internal != null) {
return;
}

internal = new CanvasInternal(surface);
internal.setBufferSize(width, height);
updateTransform();
Expand Down Expand Up @@ -263,7 +264,7 @@ private class CanvasInternal extends DispatchQueue {
private EGLContext eglContext;
private EGLSurface eglSurface;
private boolean initialized;
private boolean ready;
private volatile boolean ready;

private int bufferWidth;
private int bufferHeight;
Expand Down Expand Up @@ -438,7 +439,7 @@ public void run() {
}

if (!ready) {
queue.postRunnable(() -> ready = true, 200);
ready = true;
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ public boolean onFragmentCreate() {
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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1595,10 +1595,14 @@ public void onNextPressed() {
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) {
Expand All @@ -1610,6 +1614,9 @@ public void onNextPressed() {
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();
Expand Down

0 comments on commit 23b70a3

Please sign in to comment.