Update to 7.4.1 (2225)

This commit is contained in:
DrKLO 2021-01-29 10:12:33 +03:00
parent eb94e31b4c
commit fed0c139e7
10 changed files with 79 additions and 44 deletions

View file

@ -290,7 +290,7 @@ android {
} }
} }
defaultConfig.versionCode = 2223 defaultConfig.versionCode = 2225
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { output -> variant.outputs.all { output ->
@ -309,7 +309,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
versionName "7.4.0" versionName "7.4.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi'] vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View file

@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false; public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2223; public static int BUILD_VERSION = 2225;
public static String BUILD_VERSION_STRING = "7.4.0"; public static String BUILD_VERSION_STRING = "7.4.0";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -4050,6 +4050,10 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
} }
public static String getFileName(Uri uri) { public static String getFileName(Uri uri) {
if (uri == null) {
return "";
}
try {
String result = null; String result = null;
if (uri.getScheme().equals("content")) { if (uri.getScheme().equals("content")) {
try (Cursor cursor = ApplicationLoader.applicationContext.getContentResolver().query(uri, new String[]{OpenableColumns.DISPLAY_NAME}, null, null, null)) { try (Cursor cursor = ApplicationLoader.applicationContext.getContentResolver().query(uri, new String[]{OpenableColumns.DISPLAY_NAME}, null, null, null)) {
@ -4068,6 +4072,10 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
} }
} }
return result; return result;
} catch (Exception e) {
FileLog.e(e);
}
return "";
} }
@SuppressLint("DiscouragedPrivateApi") @SuppressLint("DiscouragedPrivateApi")

View file

@ -730,12 +730,15 @@ public class MessagesController extends BaseController implements NotificationCe
pendingSuggestions = new HashSet<>(); pendingSuggestions = new HashSet<>();
} }
exportUri = mainPreferences.getStringSet("exportUri", null); exportUri = mainPreferences.getStringSet("exportUri2", null);
if (exportUri != null) { if (exportUri != null) {
exportUri = new HashSet<>(exportUri); exportUri = new HashSet<>(exportUri);
} else { } else {
exportUri = new HashSet<>(); exportUri = new HashSet<>();
exportUri.add("content://com.whatsapp.provider.media/export_chat/"); exportUri.add("content://(\\d+@)?com\\.whatsapp\\.provider\\.media/export_chat/");
exportUri.add("content://(\\d+@)?com\\.whatsapp\\.w4b\\.provider\\.media/export_chat/");
exportUri.add("content://jp\\.naver\\.line\\.android\\.line\\.common\\.FileProvider/export-chat/");
exportUri.add(".*WhatsApp.*\\.txt$");
} }
exportGroupUri = mainPreferences.getStringSet("exportGroupUri", null); exportGroupUri = mainPreferences.getStringSet("exportGroupUri", null);
@ -1493,7 +1496,7 @@ public class MessagesController extends BaseController implements NotificationCe
} }
break; break;
} }
case "export_urls": { case "export_regex": {
HashSet<String> newExport = new HashSet<>(); HashSet<String> newExport = new HashSet<>();
if (value.value instanceof TLRPC.TL_jsonArray) { if (value.value instanceof TLRPC.TL_jsonArray) {
TLRPC.TL_jsonArray array = (TLRPC.TL_jsonArray) value.value; TLRPC.TL_jsonArray array = (TLRPC.TL_jsonArray) value.value;
@ -1507,7 +1510,7 @@ public class MessagesController extends BaseController implements NotificationCe
} }
if (!exportUri.equals(newExport)) { if (!exportUri.equals(newExport)) {
exportUri = newExport; exportUri = newExport;
editor.putStringSet("exportUri", exportUri); editor.putStringSet("exportUri2", exportUri);
changed = true; changed = true;
} }
break; break;

View file

@ -676,7 +676,7 @@ public class NotificationsController extends BaseController {
for (int a = 0; a < messageObjects.size(); a++) { for (int a = 0; a < messageObjects.size(); a++) {
MessageObject messageObject = messageObjects.get(a); MessageObject messageObject = messageObjects.get(a);
if (messageObject.messageOwner != null && messageObject.messageOwner.silent && (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined)) { if (messageObject.messageOwner != null && (messageObject.isImportedForward() || messageObject.messageOwner.silent && (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined))) {
continue; continue;
} }
long mid = messageObject.getId(); long mid = messageObject.getId();
@ -991,7 +991,7 @@ public class NotificationsController extends BaseController {
if (messages != null) { if (messages != null) {
for (int a = 0; a < messages.size(); a++) { for (int a = 0; a < messages.size(); a++) {
TLRPC.Message message = messages.get(a); TLRPC.Message message = messages.get(a);
if (message != null && message.silent && (message.action instanceof TLRPC.TL_messageActionContactSignUp || message.action instanceof TLRPC.TL_messageActionUserJoined)) { if (message != null && (message.fwd_from != null && message.fwd_from.imported || message.silent && (message.action instanceof TLRPC.TL_messageActionContactSignUp || message.action instanceof TLRPC.TL_messageActionUserJoined))) {
continue; continue;
} }
long mid = message.id; long mid = message.id;

View file

@ -2909,6 +2909,11 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} }
} }
} else { } else {
boolean canSendStickers = true;
if (lower_id < 0) {
TLRPC.Chat chat = getMessagesController().getChat(-lower_id);
canSendStickers = ChatObject.canSendStickers(chat);
}
if (message != null) { if (message != null) {
if (encryptedChat != null) { if (encryptedChat != null) {
newMsg = new TLRPC.TL_message_secret(); newMsg = new TLRPC.TL_message_secret();
@ -2924,7 +2929,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
webPage = null; webPage = null;
} }
} }
if (message.length() < 30 && webPage == null && (entities == null || entities.isEmpty()) && getMessagesController().diceEmojies.contains(message.replace("\ufe0f", "")) && encryptedChat == null && scheduleDate == 0) { if (canSendStickers && message.length() < 30 && webPage == null && (entities == null || entities.isEmpty()) && getMessagesController().diceEmojies.contains(message.replace("\ufe0f", "")) && encryptedChat == null && scheduleDate == 0) {
TLRPC.TL_messageMediaDice mediaDice = new TLRPC.TL_messageMediaDice(); TLRPC.TL_messageMediaDice mediaDice = new TLRPC.TL_messageMediaDice();
mediaDice.emoticon = message; mediaDice.emoticon = message;
mediaDice.value = -1; mediaDice.value = -1;
@ -3033,8 +3038,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
newMsg = new TLRPC.TL_message(); newMsg = new TLRPC.TL_message();
} }
if (lower_id < 0) { if (lower_id < 0) {
TLRPC.Chat chat = getMessagesController().getChat(-lower_id); if (!canSendStickers) {
if (chat != null && !ChatObject.canSendStickers(chat)) {
for (int a = 0, N = document.attributes.size(); a < N; a++) { for (int a = 0, N = document.attributes.size(); a < N; a++) {
if (document.attributes.get(a) instanceof TLRPC.TL_documentAttributeAnimated) { if (document.attributes.get(a) instanceof TLRPC.TL_documentAttributeAnimated) {
document.attributes.remove(a); document.attributes.remove(a);

View file

@ -1391,7 +1391,7 @@ public class DialogCell extends BaseCell {
nameLeft += w; nameLeft += w;
} }
} else if (drawScam != 0) { } else if (drawScam != 0) {
int w = AndroidUtilities.dp(6) + (drawScam == 0 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable).getIntrinsicWidth(); int w = AndroidUtilities.dp(6) + (drawScam == 1 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable).getIntrinsicWidth();
nameWidth -= w; nameWidth -= w;
if (LocaleController.isRTL) { if (LocaleController.isRTL) {
nameLeft += w; nameLeft += w;
@ -1610,7 +1610,7 @@ public class DialogCell extends BaseCell {
} else if (drawVerified) { } else if (drawVerified) {
nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - Theme.dialogs_verifiedDrawable.getIntrinsicWidth()); nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - Theme.dialogs_verifiedDrawable.getIntrinsicWidth());
} else if (drawScam != 0) { } else if (drawScam != 0) {
nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - (drawScam == 0 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable).getIntrinsicWidth()); nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - (drawScam == 1 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable).getIntrinsicWidth());
} }
if (left == 0) { if (left == 0) {
if (widthpx < nameWidth) { if (widthpx < nameWidth) {
@ -2508,8 +2508,8 @@ public class DialogCell extends BaseCell {
Theme.dialogs_verifiedDrawable.draw(canvas); Theme.dialogs_verifiedDrawable.draw(canvas);
Theme.dialogs_verifiedCheckDrawable.draw(canvas); Theme.dialogs_verifiedCheckDrawable.draw(canvas);
} else if (drawScam != 0) { } else if (drawScam != 0) {
setDrawableBounds((drawScam == 0 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable), nameMuteLeft, AndroidUtilities.dp(useForceThreeLines || SharedConfig.useThreeLinesLayout ? 12 : 15)); setDrawableBounds((drawScam == 1 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable), nameMuteLeft, AndroidUtilities.dp(useForceThreeLines || SharedConfig.useThreeLinesLayout ? 12 : 15));
(drawScam == 0 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable).draw(canvas); (drawScam == 1 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable).draw(canvas);
} }
if (drawReorder || reorderIconProgress != 0) { if (drawReorder || reorderIconProgress != 0) {

View file

@ -99,7 +99,7 @@ public class LinkActionView extends LinearLayout {
copyView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); copyView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
copyView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); copyView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
copyView.setLines(1); copyView.setLines(1);
linearLayout.addView(copyView, LayoutHelper.createLinear(0, LayoutHelper.WRAP_CONTENT, 1f, 0, 4, 0, 4, 0)); linearLayout.addView(copyView, LayoutHelper.createLinear(0, 40, 1f, 0, 4, 0, 4, 0));
shareView = new TextView(context); shareView = new TextView(context);
shareView.setGravity(Gravity.CENTER_HORIZONTAL); shareView.setGravity(Gravity.CENTER_HORIZONTAL);
@ -114,7 +114,7 @@ public class LinkActionView extends LinearLayout {
shareView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); shareView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
shareView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); shareView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
shareView.setLines(1); shareView.setLines(1);
linearLayout.addView(shareView, LayoutHelper.createLinear(0, LayoutHelper.WRAP_CONTENT, 1f, 4, 0, 4, 0)); linearLayout.addView(shareView, LayoutHelper.createLinear(0, 40, 1f, 4, 0, 4, 0));
removeView = new TextView(context); removeView = new TextView(context);

View file

@ -358,6 +358,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
private float colorChangeProgress; private float colorChangeProgress;
private long lastUpdateTime; private long lastUpdateTime;
private float[] volumeAlphas = new float[3]; private float[] volumeAlphas = new float[3];
private boolean dragging;
public VolumeSlider(Context context, TLRPC.TL_groupCallParticipant participant) { public VolumeSlider(Context context, TLRPC.TL_groupCallParticipant participant) {
super(context); super(context);
@ -446,14 +447,14 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
} else if (thumbX > getMeasuredWidth()) { } else if (thumbX > getMeasuredWidth()) {
thumbX = getMeasuredWidth(); thumbX = getMeasuredWidth();
} }
pressed = true; dragging = true;
} }
} }
if (pressed) { if (dragging) {
if (ev.getAction() == MotionEvent.ACTION_UP) { if (ev.getAction() == MotionEvent.ACTION_UP) {
onSeekBarDrag(thumbX / (double) getMeasuredWidth(), true); onSeekBarDrag(thumbX / (double) getMeasuredWidth(), true);
} }
pressed = false; dragging = false;
invalidate(); invalidate();
return true; return true;
} }
@ -473,13 +474,13 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
} else if (thumbX > getMeasuredWidth()) { } else if (thumbX > getMeasuredWidth()) {
thumbX = getMeasuredWidth(); thumbX = getMeasuredWidth();
} }
pressed = true; dragging = true;
invalidate(); invalidate();
return true; return true;
} }
} }
} else { } else {
if (pressed) { if (dragging) {
thumbX = (int) ev.getX(); thumbX = (int) ev.getX();
if (thumbX < 0) { if (thumbX < 0) {
thumbX = 0; thumbX = 0;

View file

@ -142,6 +142,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern;
public class LaunchActivity extends Activity implements ActionBarLayout.ActionBarLayoutDelegate, NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate { public class LaunchActivity extends Activity implements ActionBarLayout.ActionBarLayoutDelegate, NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate {
@ -1307,12 +1308,21 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
} else { } else {
String originalPath = uri.toString(); String originalPath = uri.toString();
if (dialogId == 0 && originalPath != null) { if (dialogId == 0 && originalPath != null) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("export path = " + originalPath);
}
Set<String> exportUris = MessagesController.getInstance(intentAccount[0]).exportUri; Set<String> exportUris = MessagesController.getInstance(intentAccount[0]).exportUri;
String fileName = FileLoader.fixFileName(MediaController.getFileName(uri));
for (String u : exportUris) { for (String u : exportUris) {
if (originalPath.startsWith(u)) { try {
Pattern pattern = Pattern.compile(u);
if (pattern.matcher(originalPath).find() || pattern.matcher(fileName).find()) {
exportingChatUri = uri; exportingChatUri = uri;
break; break;
} }
} catch (Exception e) {
FileLog.e(e);
}
} }
if (exportingChatUri == null) { if (exportingChatUri == null) {
if (originalPath.startsWith("content://com.kakao.talk") && originalPath.endsWith("KakaoTalkChats.txt")) { if (originalPath.startsWith("content://com.kakao.talk") && originalPath.endsWith("KakaoTalkChats.txt")) {
@ -1405,14 +1415,23 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
originalPath = path; originalPath = path;
} }
if (BuildVars.LOGS_ENABLED) {
FileLog.d("export path = " + originalPath);
}
if (dialogId == 0 && originalPath != null && exportingChatUri == null) { if (dialogId == 0 && originalPath != null && exportingChatUri == null) {
boolean ok = false; boolean ok = false;
String fileName = FileLoader.fixFileName(MediaController.getFileName(uri));
for (String u : exportUris) { for (String u : exportUris) {
if (originalPath.startsWith(u)) { try {
Pattern pattern = Pattern.compile(u);
if (pattern.matcher(originalPath).find() || pattern.matcher(fileName).find()) {
exportingChatUri = uri; exportingChatUri = uri;
ok = true; ok = true;
break; break;
} }
} catch (Exception e) {
FileLog.e(e);
}
} }
if (ok) { if (ok) {
continue; continue;