Merge official 8.7.4

This commit is contained in:
luvletter2333 2022-05-08 15:01:14 +08:00
commit 37c2793e69
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
6 changed files with 87 additions and 30 deletions

View File

@ -3,15 +3,15 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
def verName = "8.7.2-preview01"
def verCode = 625
def verName = "8.7.4-preview01"
def verCode = 630
if (System.getenv("DEBUG_BUILD") == "true") {
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1").trim()
}
def officialVer = "8.7.2"
def officialCode = 2634
def officialVer = "8.7.4"
def officialCode = 2636
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -2582,7 +2582,7 @@ public class ImageLoader {
img.imageType = FileLoader.IMAGE_TYPE_LOTTIE;
} else if ("application/x-tgwallpattern".equals(imageLocation.document.mime_type)) {
img.imageType = FileLoader.IMAGE_TYPE_SVG;
} else if (BuildVars.DEBUG_PRIVATE_VERSION) {
} else {
String name = FileLoader.getDocumentFileName(imageLocation.document);
if (name.endsWith(".svg")) {
img.imageType = FileLoader.IMAGE_TYPE_SVG;
@ -2616,7 +2616,7 @@ public class ImageLoader {
img.imageType = FileLoader.IMAGE_TYPE_LOTTIE;
} else if ("application/x-tgwallpattern".equals(document.mime_type)) {
img.imageType = FileLoader.IMAGE_TYPE_SVG;
} else if (BuildVars.DEBUG_PRIVATE_VERSION) {
} else {
String name = FileLoader.getDocumentFileName(imageLocation.document);
if (name.endsWith(".svg")) {
img.imageType = FileLoader.IMAGE_TYPE_SVG;

View File

@ -89,6 +89,7 @@ import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
@ -3410,15 +3411,62 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
req.peer = new TLRPC.TL_inputPhoneCall();
req.peer.access_hash = privateCall.access_hash;
req.peer.id = privateCall.id;
File file = new File(VoIPHelper.getLogFilePath(privateCall.id, true));
String cachedFile = MediaController.copyFileToCache(Uri.fromFile(file), "log");
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("Sent debug logs, response = " + response);
}
try {
if (response instanceof TLRPC.TL_boolFalse) {
AndroidUtilities.runOnUIThread(() -> {
uploadLogFile(cachedFile);
});
} else {
File cacheFile = new File(cachedFile);
cacheFile.delete();
}
} catch (Exception e) {
FileLog.e(e);
}
});
needSendDebugLog = false;
}
}
private void uploadLogFile(String filePath) {
NotificationCenter.NotificationCenterDelegate uploadDelegate = new NotificationCenter.NotificationCenterDelegate() {
@Override
public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.fileUploaded || id == NotificationCenter.fileUploadFailed) {
final String location = (String) args[0];
if (location.equals(filePath)) {
if (id == NotificationCenter.fileUploaded) {
TLRPC.TL_phone_saveCallLog req = new TLRPC.TL_phone_saveCallLog();
final TLRPC.InputFile file = (TLRPC.InputFile) args[1];
req.file = file;
req.peer = new TLRPC.TL_inputPhoneCall();
req.peer.access_hash = privateCall.access_hash;
req.peer.id = privateCall.id;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("Sent debug file log, response = " + response);
}
});
}
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.fileUploaded);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.fileUploadFailed);
}
}
}
};
NotificationCenter.getInstance(currentAccount).addObserver(uploadDelegate, NotificationCenter.fileUploaded);
NotificationCenter.getInstance(currentAccount).addObserver(uploadDelegate, NotificationCenter.fileUploadFailed);
FileLoader.getInstance(currentAccount).uploadFile(filePath, false, true, ConnectionsManager.FileTypeFile);
}
private void initializeAccountRelatedThings() {
updateServerConfig();
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.appDidLogout);

View File

@ -52533,6 +52533,23 @@ public class TLRPC {
}
}
public static class TL_phone_saveCallLog extends TLObject {
public static int constructor = 0x41248786;
public TL_inputPhoneCall peer;
public InputFile file;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return Bool.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
peer.serializeToStream(stream);
file.serializeToStream(stream);
}
}
public static class TL_phone_sendSignalingData extends TLObject {
public static int constructor = 0xff7a9383;

View File

@ -32,20 +32,16 @@ public class AttachBotIntroTopView extends View {
public AttachBotIntroTopView(Context context) {
super(context);
imageReceiver = new ImageReceiver(this) {
@Override
protected boolean setImageBitmapByKey(Drawable drawable, String key, int type, boolean memCache, int guid) {
boolean set = super.setImageBitmapByKey(drawable, key, type, memCache, guid);
ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(150);
anim.addUpdateListener(animation -> {
imageReceiver.setAlpha((Float) animation.getAnimatedValue());
invalidate();
});
anim.start();
return set;
}
};
imageReceiver = new ImageReceiver(this);
imageReceiver.setAlpha(0);
imageReceiver.setDelegate((imageReceiver1, set, thumb, memCache) -> {
ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(150);
anim.addUpdateListener(animation -> {
imageReceiver.setAlpha((Float) animation.getAnimatedValue());
invalidate();
});
anim.start();
});
attachDrawable = ContextCompat.getDrawable(context, R.drawable.input_attach).mutate().getConstantState().newDrawable();
paint.setStyle(Paint.Style.STROKE);

View File

@ -72,7 +72,6 @@ import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MediaDataController;
@ -761,17 +760,14 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
imageView = new BackupImageView(context) {
{
imageReceiver = new ImageReceiver(this) {
@Override
protected boolean setImageBitmapByKey(Drawable drawable, String key, int type, boolean memCache, int guid) {
if (drawable instanceof RLottieDrawable) {
((RLottieDrawable) drawable).setCustomEndFrame(0);
((RLottieDrawable) drawable).stop();
((RLottieDrawable) drawable).setProgress(0, false);
}
return super.setImageBitmapByKey(drawable, key, type, memCache, guid);
imageReceiver.setDelegate((imageReceiver1, set, thumb, memCache) -> {
Drawable drawable = imageReceiver1.getDrawable();
if (drawable instanceof RLottieDrawable) {
((RLottieDrawable) drawable).setCustomEndFrame(0);
((RLottieDrawable) drawable).stop();
((RLottieDrawable) drawable).setProgress(0, false);
}
};
});
}
@Override