bug fixes

This commit is contained in:
DrKLO 2017-12-09 03:45:38 +03:00
parent 5630ad8623
commit e9e40cb13e
7 changed files with 25 additions and 20 deletions

View file

@ -91,7 +91,7 @@ android {
}
}
defaultConfig.versionCode = 1154
defaultConfig.versionCode = 1155
sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest.xml'

View file

@ -1289,12 +1289,12 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
networkMessage->message->bytes = request->getObjectSize();
networkMessage->message->body = std::unique_ptr<TLObject>(request);
networkMessage->message->seqno = connection->generateMessageSeqNo(false);
resendRequests[networkMessage->message->msg_id] = response->answer_msg_id;
std::vector<std::unique_ptr<NetworkMessage>> array;
array.push_back(std::unique_ptr<NetworkMessage>(networkMessage));
sendMessagesToConnection(array, connection, false);
resendRequests[networkMessage->message->msg_id] = response->answer_msg_id;
} else if (confirm) {
connection->addMessageToConfirm(response->answer_msg_id);
}

View file

@ -476,7 +476,7 @@ int32_t NativeByteBuffer::readBigInt32(bool *error) {
}
int64_t NativeByteBuffer::readInt64(bool *error) {
if (_position + 4 > _limit) {
if (_position + 8 > _limit) {
if (error != nullptr) {
*error = true;
}
@ -521,7 +521,7 @@ bool NativeByteBuffer::readBool(bool *error) {
}
void NativeByteBuffer::readBytes(uint8_t *b, uint32_t length, bool *error) {
if (_position + length > _limit) {
if (length > _limit - _position) {
if (error != nullptr) {
*error = true;
}
@ -533,7 +533,7 @@ void NativeByteBuffer::readBytes(uint8_t *b, uint32_t length, bool *error) {
}
ByteArray *NativeByteBuffer::readBytes(uint32_t length, bool *error) {
if (_position + length > _limit) {
if (length > _limit - _position) {
if (error != nullptr) {
*error = true;
}

View file

@ -11,7 +11,7 @@ package org.telegram.messenger;
public class BuildVars {
public static boolean DEBUG_VERSION = false;
public static boolean DEBUG_PRIVATE_VERSION = false;
public static int BUILD_VERSION = 1154;
public static int BUILD_VERSION = 1155;
public static String BUILD_VERSION_STRING = "4.6";
public static int APP_ID = 0; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
public static String APP_HASH = ""; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id

View file

@ -808,18 +808,23 @@ public class FileLoader {
}
public static String getDocumentFileName(TLRPC.Document document) {
String fileName = null;
if (document != null) {
if (document.file_name != null) {
return document.file_name;
}
fileName = document.file_name;
} else {
for (int a = 0; a < document.attributes.size(); a++) {
TLRPC.DocumentAttribute documentAttribute = document.attributes.get(a);
if (documentAttribute instanceof TLRPC.TL_documentAttributeFilename) {
return documentAttribute.file_name;
fileName = documentAttribute.file_name;
}
}
}
return "";
}
if (fileName != null) {
fileName = fileName.replaceAll("[\u0001-\u001f<>:\"/\\\\|?*\u007f]+", "").trim();
}
return fileName != null ? fileName : "";
}
public static String getExtensionByMime(String mime) {

View file

@ -4863,7 +4863,7 @@ public class MessagesStorage {
mentionsIdsMap.put(messageId, message.dialog_id);
}
if (!MessageObject.isOut(message) && (message.id > 0 || MessageObject.isUnread(message))) {
if (!(message.action instanceof TLRPC.TL_messageActionHistoryClear) && !MessageObject.isOut(message) && (message.id > 0 || MessageObject.isUnread(message))) {
Integer currentMaxId = dialogsReadMax.get(message.dialog_id);
if (currentMaxId == null) {
SQLiteCursor cursor = database.queryFinalized("SELECT inbox_max FROM dialogs WHERE did = " + message.dialog_id);

View file

@ -193,17 +193,17 @@ public class MusicPlayerService extends Service implements NotificationCenter.No
if (MediaController.getInstance().isDownloadingCurrentMessage()) {
playbackState.setState(PlaybackState.STATE_BUFFERING, 0, 1).setActions(0);
bldr.addAction(new Notification.Action.Builder(R.drawable.ic_action_previous, null, pendingPrev).build())
.addAction(new Notification.Action.Builder(R.drawable.loading_animation2, null, null).build())
.addAction(new Notification.Action.Builder(R.drawable.ic_action_next, null, pendingNext).build());
bldr.addAction(new Notification.Action.Builder(R.drawable.ic_action_previous, "", pendingPrev).build())
.addAction(new Notification.Action.Builder(R.drawable.loading_animation2, "", null).build())
.addAction(new Notification.Action.Builder(R.drawable.ic_action_next, "", pendingNext).build());
} else {
playbackState.setState(isPlaying ? PlaybackState.STATE_PLAYING : PlaybackState.STATE_PAUSED,
MediaController.getInstance().getPlayingMessageObject().audioProgressSec * 1000L,
isPlaying ? 1 : 0)
.setActions(PlaybackState.ACTION_PLAY_PAUSE | PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PAUSE | PlaybackState.ACTION_SKIP_TO_PREVIOUS | PlaybackState.ACTION_SKIP_TO_NEXT);
bldr.addAction(new Notification.Action.Builder(R.drawable.ic_action_previous, null, pendingPrev).build())
.addAction(new Notification.Action.Builder(isPlaying ? R.drawable.ic_action_pause : R.drawable.ic_action_play, null, pendingPlaypause).build())
.addAction(new Notification.Action.Builder(R.drawable.ic_action_next, null, pendingNext).build());
bldr.addAction(new Notification.Action.Builder(R.drawable.ic_action_previous, "", pendingPrev).build())
.addAction(new Notification.Action.Builder(isPlaying ? R.drawable.ic_action_pause : R.drawable.ic_action_play, "", pendingPlaypause).build())
.addAction(new Notification.Action.Builder(R.drawable.ic_action_next, "", pendingNext).build());
}
mediaSession.setPlaybackState(playbackState.build());