Skip to content

Commit

Permalink
Update to 5.13.0 (1819)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Dec 31, 2019
1 parent 471ed12 commit cc1dc35
Show file tree
Hide file tree
Showing 24 changed files with 175 additions and 120 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ android {
}
}

defaultConfig.versionCode = 1818
defaultConfig.versionCode = 1819

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down
8 changes: 6 additions & 2 deletions TMessagesProj/jni/tgnet/ConnectionsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1440,10 +1440,11 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
TL_bad_server_salt *response = (TL_bad_server_salt *) message;
int64_t resultMid = response->bad_msg_id;
if (resultMid != 0) {
bool beginHandshake = false;
for (requestsIter iter = runningRequests.begin(); iter != runningRequests.end(); iter++) {
Request *request = iter->get();
if (request->datacenterId == datacenter->datacenterId && typeid(*request->rawRequest) == typeid(TL_auth_bindTempAuthKey) && request->respondsToMessageId(response->bad_msg_id)) {
datacenter->beginHandshake(HandshakeTypeCurrent, false);
if (!beginHandshake && request->datacenterId == datacenter->datacenterId && typeid(*request->rawRequest) == typeid(TL_auth_bindTempAuthKey) && request->respondsToMessageId(response->bad_msg_id)) {
beginHandshake = true;
}
if ((request->connectionType & ConnectionTypeDownload) == 0) {
continue;
Expand All @@ -1454,6 +1455,9 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
request->failedBySalt = true;
}
}
if (beginHandshake) {
datacenter->beginHandshake(HandshakeTypeCurrent, false);
}
}

datacenter->clearServerSalts(media);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1818;
public static int BUILD_VERSION = 1819;
public static String BUILD_VERSION_STRING = "5.13.0";
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 @@ -24,7 +24,7 @@ public class EmojiData {
0x2197, 0x2198, 0x2199, 0x2196, 0x2195, 0x2194, 0x21AA, 0x21A9, 0x2934, 0x2935,
0x2139, 0x2714, 0x2716, 0x2611, 0x26AA, 0x26AB, 0x25AA, 0x25AB, 0x2B1B, 0x2B1C,
0x25FC, 0x25FB, 0x25FE, 0x25FD, 0x2660, 0x2663, 0x2665, 0x2666, 0x263A, 0x2639,
0x270C, 0x261D, 0x2764
0x270C, 0x261D, 0x2764, 0x2603
};

public static final char[] dataChars = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ public void onSensorChanged(SensorEvent event) {
countLess = 0;
} else if (proximityTouched) {
if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
if (!useFrontSpeaker && NotificationsController.audioManager.isWiredHeadsetOn()) {
if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn()) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("start listen by proximity only");
}
Expand Down Expand Up @@ -3521,7 +3521,9 @@ private boolean startVideoConvertFromQueue() {
if (!videoConvertQueue.isEmpty()) {
MessageObject messageObject = videoConvertQueue.get(0);
synchronized (videoConvertSync) {
messageObject.videoEditedInfo.canceled = false;
if (messageObject != null && messageObject.videoEditedInfo != null) {
messageObject.videoEditedInfo.canceled = false;
}
}
Intent intent = new Intent(ApplicationLoader.applicationContext, VideoEncodingService.class);
intent.putExtra("path", messageObject.messageOwner.attachPath);
Expand Down Expand Up @@ -3675,19 +3677,20 @@ public static void runConversion(final MessageObject obj) {


private boolean convertVideo(final MessageObject messageObject) {
if (messageObject == null || messageObject.videoEditedInfo == null) {
VideoEditedInfo info = messageObject.videoEditedInfo;
if (messageObject == null || info == null) {
return false;
}
String videoPath = messageObject.videoEditedInfo.originalPath;
long startTime = messageObject.videoEditedInfo.startTime;
long endTime = messageObject.videoEditedInfo.endTime;
int resultWidth = messageObject.videoEditedInfo.resultWidth;
int resultHeight = messageObject.videoEditedInfo.resultHeight;
int rotationValue = messageObject.videoEditedInfo.rotationValue;
int originalWidth = messageObject.videoEditedInfo.originalWidth;
int originalHeight = messageObject.videoEditedInfo.originalHeight;
int framerate = messageObject.videoEditedInfo.framerate;
int bitrate = messageObject.videoEditedInfo.bitrate;
String videoPath = info.originalPath;
long startTime = info.startTime;
long endTime = info.endTime;
int resultWidth = info.resultWidth;
int resultHeight = info.resultHeight;
int rotationValue = info.rotationValue;
int originalWidth = info.originalWidth;
int originalHeight = info.originalHeight;
int framerate = info.framerate;
int bitrate = info.bitrate;
int rotateRender = 0;
boolean isSecret = ((int) messageObject.getDialogId()) == 0;
final File cacheFile = new File(messageObject.messageOwner.attachPath);
Expand All @@ -3705,9 +3708,9 @@ private boolean convertVideo(final MessageObject messageObject) {
} else if (endTime > 0) {
duration = endTime;
} else if (startTime > 0) {
duration = messageObject.videoEditedInfo.originalDuration - startTime;
duration = info.originalDuration - startTime;
} else {
duration = messageObject.videoEditedInfo.originalDuration;
duration = info.originalDuration;
}

if (framerate == 0) {
Expand All @@ -3734,7 +3737,7 @@ private boolean convertVideo(final MessageObject messageObject) {
}

boolean needCompress = resultWidth != originalWidth || resultHeight != originalHeight || rotateRender != 0
|| messageObject.videoEditedInfo.roundVideo || Build.VERSION.SDK_INT >= 18 && startTime != -1;
|| info.roundVideo || Build.VERSION.SDK_INT >= 18 && startTime != -1;


SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("videoconvert", Activity.MODE_PRIVATE);
Expand All @@ -3747,17 +3750,19 @@ private boolean convertVideo(final MessageObject messageObject) {

@Override
public boolean checkConversionCanceled() {
return messageObject.videoEditedInfo.canceled;
return info.canceled;
}

@Override
public void didWriteData(long availableSize, float progress) {
if (messageObject.videoEditedInfo.canceled) return;
if (info.canceled) {
return;
}
if (availableSize < 0) {
availableSize = cacheFile.length();
}

if (!messageObject.videoEditedInfo.needUpdateProgress && lastAvailableSize == availableSize) {
if (!info.needUpdateProgress && lastAvailableSize == availableSize) {
return;
}

Expand All @@ -3766,7 +3771,7 @@ public void didWriteData(long availableSize, float progress) {
}
};

messageObject.videoEditedInfo.videoConvertFirstWrite = true;
info.videoConvertFirstWrite = true;

MediaCodecVideoConvertor videoConvertor = new MediaCodecVideoConvertor();
boolean error = videoConvertor.convertVideo(videoPath, cacheFile,
Expand All @@ -3778,10 +3783,10 @@ public void didWriteData(long availableSize, float progress) {
callback);


boolean canceled = messageObject.videoEditedInfo.canceled;
boolean canceled = info.canceled;
if (!canceled) {
synchronized (videoConvertSync) {
canceled = messageObject.videoEditedInfo.canceled;
canceled = info.canceled;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3081,7 +3081,7 @@ public void generateCaption() {
}
}

private static void addUrlsByPattern(boolean isOut, CharSequence charSequence, boolean botCommands, int patternType, int duration) {
public static void addUrlsByPattern(boolean isOut, CharSequence charSequence, boolean botCommands, int patternType, int duration) {
try {
Matcher matcher;
if (patternType == 3 || patternType == 4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,13 +841,14 @@ public void didReceivedNotification(int id, int account, Object... args) {
TLRPC.TL_account_uploadWallPaper req = new TLRPC.TL_account_uploadWallPaper();
req.file = file;
req.mime_type = "image/jpeg";
Theme.OverrideWallpaperInfo overrideWallpaperInfo = uploadingWallpaperInfo;
final TLRPC.TL_wallPaperSettings settings = new TLRPC.TL_wallPaperSettings();
settings.blur = uploadingWallpaperInfo.isBlurred;
settings.motion = uploadingWallpaperInfo.isMotion;
settings.blur = overrideWallpaperInfo.isBlurred;
settings.motion = overrideWallpaperInfo.isMotion;
req.settings = settings;
getConnectionsManager().sendRequest(req, (response, error) -> {
TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) response;
File path = new File(ApplicationLoader.getFilesDirFixed(), uploadingWallpaperInfo.originalFileName);
File path = new File(ApplicationLoader.getFilesDirFixed(), overrideWallpaperInfo.originalFileName);
if (wallPaper != null) {
try {
AndroidUtilities.copyFile(path, FileLoader.getPathToAttach(wallPaper.document, true));
Expand All @@ -859,8 +860,8 @@ public void didReceivedNotification(int id, int account, Object... args) {
if (uploadingWallpaper != null && wallPaper != null) {
wallPaper.settings = settings;
wallPaper.flags |= 4;
uploadingWallpaperInfo.slug = wallPaper.slug;
uploadingWallpaperInfo.saveOverrideWallpaper();
overrideWallpaperInfo.slug = wallPaper.slug;
overrideWallpaperInfo.saveOverrideWallpaper();
ArrayList<TLRPC.WallPaper> wallpapers = new ArrayList<>();
wallpapers.add(wallPaper);
getMessagesStorage().putWallpapers(wallpapers, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public static void openUrl(final Context context, Uri uri, final boolean allowCu

builder.setToolbarColor(Theme.getColor(Theme.key_actionBarBrowser));
builder.setShowTitle(true);
builder.setActionButton(BitmapFactory.decodeResource(context.getResources(), R.drawable.abc_ic_menu_share_mtrl_alpha), LocaleController.getString("ShareFile", R.string.ShareFile), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, share, 0), false);
builder.setActionButton(BitmapFactory.decodeResource(context.getResources(), R.drawable.abc_ic_menu_share_mtrl_alpha), LocaleController.getString("ShareFile", R.string.ShareFile), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, share, 0), true);
CustomTabsIntent intent = builder.build();
intent.setUseNewTask();
intent.launchUrl(context, uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,51 +177,9 @@ private boolean convertVideoInternal(String videoPath, File cacheFile,
outputFormat.setInteger(MediaFormat.KEY_FRAME_RATE, framerate);
outputFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 2);

if (Build.VERSION.SDK_INT >= 23) {
int profile;
int level;

if (Math.min(resultHeight, resultWidth) >= 1080) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileHigh;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel41;
} else if (Math.min(resultHeight, resultWidth) >= 720) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileHigh;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel4;
} else if (Math.min(resultHeight, resultWidth) >= 480) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileBaseline;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel31;
} else {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileBaseline;
level = MediaCodecInfo.CodecProfileLevel.AVCLevel3;
}

MediaCodecInfo.CodecCapabilities capabilities = MediaCodecInfo.CodecCapabilities.createFromProfileLevel(MediaController.VIDEO_MIME_TYPE, profile, level);

if (capabilities == null && profile == MediaCodecInfo.CodecProfileLevel.AVCProfileHigh) {
profile = MediaCodecInfo.CodecProfileLevel.AVCProfileBaseline;
capabilities = MediaCodecInfo.CodecCapabilities.createFromProfileLevel(MediaController.VIDEO_MIME_TYPE, profile, level);
}
if (capabilities.getEncoderCapabilities() != null) {
outputFormat.setInteger(MediaFormat.KEY_PROFILE, profile);
outputFormat.setInteger(MediaFormat.KEY_LEVEL, level);

int maxBitrate = capabilities.getVideoCapabilities().getBitrateRange().getUpper();
if (bitrate > maxBitrate) {
bitrate = maxBitrate;
outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
}

int maxFramerate = capabilities.getVideoCapabilities().getSupportedFrameRates().getUpper();
if (framerate > maxFramerate) {
framerate = maxFramerate;
outputFormat.setInteger(MediaFormat.KEY_FRAME_RATE, framerate);
}
}
} else {
if (Math.min(resultHeight, resultWidth) <= 480) {
if (bitrate > 921600) bitrate = 921600;
outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
}
if (Build.VERSION.SDK_INT < 23 && Math.min(resultHeight, resultWidth) <= 480) {
if (bitrate > 921600) bitrate = 921600;
outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
}

if (Build.VERSION.SDK_INT < 18) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import android.widget.ImageView;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
import org.telegram.ui.Components.FireworksEffect;
Expand Down Expand Up @@ -172,7 +171,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
snowflakesEffect = new SnowflakesEffect();
titleTextView.invalidate();
invalidate();
} else if (BuildVars.DEBUG_PRIVATE_VERSION) {
} else {
snowflakesEffect = null;
fireworksEffect = new FireworksEffect();
titleTextView.invalidate();
Expand Down
10 changes: 7 additions & 3 deletions TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -3760,7 +3760,7 @@ public void run() {
OverrideWallpaperInfo overrideWallpaper = new OverrideWallpaperInfo();
overrideWallpaper.color = preferences.getInt("selectedColor", 0);
overrideWallpaper.slug = preferences.getString("selectedBackgroundSlug", "");
if (id == -1 && TextUtils.isEmpty(overrideWallpaper.slug)) {
if (id >= -100 && id <= -1 && TextUtils.isEmpty(overrideWallpaper.slug)) {
overrideWallpaper.slug = COLOR_BACKGROUND_SLUG;
overrideWallpaper.fileName = "";
overrideWallpaper.originalFileName = "";
Expand Down Expand Up @@ -4714,7 +4714,7 @@ public static void onUpdateThemeAccents() {
}

public static boolean deleteThemeAccent(ThemeInfo theme, ThemeAccent accent, boolean save) {
if (accent == null) {
if (accent == null || theme == null || theme.themeAccents == null) {
return false;
}
boolean current = accent.id == theme.currentAccentId;
Expand Down Expand Up @@ -5335,7 +5335,7 @@ public static void checkCurrentRemoteTheme(boolean force) {
boolean changed = false;
if (response instanceof TLRPC.TL_theme) {
TLRPC.TL_theme theme = (TLRPC.TL_theme) response;
if (theme.settings != null) {
if (accent != null && theme.settings != null) {
if (!ThemeInfo.accentEquals(accent, theme.settings)) {
File file = accent.getPathToWallpaper();
if (file != null) {
Expand All @@ -5347,6 +5347,7 @@ public static void checkCurrentRemoteTheme(boolean force) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, currentTheme, currentNightTheme == currentTheme, null, -1);
}
PatternsLoader.createLoader(true);
changed = true;
}
accent.patternMotion = theme.settings.wallpaper != null && theme.settings.wallpaper.settings != null && theme.settings.wallpaper.settings.motion;
} else if (theme.document != null && theme.document.id != info.document.id) {
Expand Down Expand Up @@ -6835,6 +6836,9 @@ public static int getDefaultAccentColor(String key) {
Integer color = currentColorsNoAccent.get(key);
if (color != null) {
ThemeAccent accent = currentTheme.getAccent(false);
if (accent == null) {
return 0;
}
float[] hsvTemp1 = getTempHsv(1);
float[] hsvTemp2 = getTempHsv(2);
Color.colorToHSV(currentTheme.accentBaseColor, hsvTemp1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,9 @@ private void showPermissionAlert(boolean byButton) {
}

private void updateColors() {
if (colors == null || imageView == null) {
return;
}
colors[0] = 0x333333;
colors[1] = Theme.getColor(Theme.key_windowBackgroundWhiteBlackText);

Expand Down
Loading

1 comment on commit cc1dc35

@AlexandrKozlovskiy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hapy New Year to everybody. Why problem with accepting of telegram calls by blind users wasn't fixed and why my pullrequest was ignored?
#1541

Please sign in to comment.