From 9cbbe999e133645c6edd6ea48c9e544521cc1315 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Sun, 22 Jun 2014 13:36:52 +0400 Subject: [PATCH] Bug fixes --- TMessagesProj/build.gradle | 2 +- .../org/telegram/messenger/ConnectionsManager.java | 7 +++++-- .../java/org/telegram/messenger/MediaController.java | 2 +- .../org/telegram/messenger/MessagesController.java | 2 +- .../main/java/org/telegram/ui/Cells/DialogCell.java | 2 +- .../src/main/java/org/telegram/ui/ChatActivity.java | 12 ++++++++++-- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index c6f885fbc..cfb9df094 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -81,7 +81,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 265 + versionCode 266 versionName "1.5.7" } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index ddc2a9b76..a35f25703 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -533,6 +533,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. if (request.completionBlock != null) { TLRPC.TL_error implicitError = new TLRPC.TL_error(); implicitError.code = -1000; + implicitError.text = ""; request.completionBlock.run(null, implicitError); } } @@ -542,6 +543,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. if (request.completionBlock != null) { TLRPC.TL_error implicitError = new TLRPC.TL_error(); implicitError.code = -1000; + implicitError.text = ""; request.completionBlock.run(null, implicitError); } } @@ -764,7 +766,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. invoke.device_model = "Android unknown"; } PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); - invoke.app_version = pInfo.versionName; + invoke.app_version = pInfo.versionName + " (" + pInfo.versionCode + ")"; if (invoke.app_version == null) { invoke.app_version = "App version unknown"; } @@ -1719,7 +1721,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } req.system_version = "SDK " + Build.VERSION.SDK_INT; PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); - req.app_version = pInfo.versionName; + req.app_version = pInfo.versionName + " (" + pInfo.versionCode + ")"; if (req.app_version == null) { req.app_version = "App version unknown"; } @@ -2027,6 +2029,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } implicitError = new TLRPC.TL_error(); implicitError.code = -1000; + implicitError.text = ""; } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index b3f900a2e..edd741ede 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -1024,7 +1024,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel fileDecodingQueue.postRunnable(new Runnable() { @Override public void run() { - if (playingMessageObject.audioProgress != 0) { + if (playingMessageObject != null && playingMessageObject.audioProgress != 0) { lastPlayPcm = (long)(currentTotalPcmDuration * playingMessageObject.audioProgress); seekOpusFile(playingMessageObject.audioProgress); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 3b40409d7..0522800fb 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -3093,7 +3093,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } req.system_version = "SDK " + Build.VERSION.SDK_INT; PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); - req.app_version = pInfo.versionName; + req.app_version = pInfo.versionName + " (" + pInfo.versionCode + ")"; if (req.app_version == null) { req.app_version = "App version unknown"; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index e549d4bfb..b7a742c9d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -546,7 +546,7 @@ public class DialogCell extends BaseCell { if (chat != null) { nameString = chat.title; } else if (user != null) { - if (user.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(user.id) == null) { + if (user.id / 1000 != 777 && user.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(user.id) == null) { if (ContactsController.getInstance().contactsDict.size() == 0 && (!ContactsController.getInstance().contactsLoaded || ContactsController.getInstance().isLoadingContacts())) { nameString = Utilities.formatName(user.first_name, user.last_name); } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 6ca47d322..5ef730591 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -512,7 +512,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (str.length() != 0) { str += "\n"; } - str += messageObject.messageOwner.message; + if (messageObject.messageOwner.message != null) { + str += messageObject.messageOwner.message; + } else { + str += messageObject.messageText; + } } if (str.length() != 0) { if (android.os.Build.VERSION.SDK_INT < 11) { @@ -1510,7 +1514,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (currentChat != null) { actionBarLayer.setTitle(currentChat.title); } else if (currentUser != null) { - if (currentUser.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(currentUser.id) == null && (ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts())) { + if (currentUser.id / 1000 != 777 || currentUser.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(currentUser.id) == null && (ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts())) { if (currentUser.phone != null && currentUser.phone.length() != 0) { actionBarLayer.setTitle(PhoneFormat.getInstance().format("+" + currentUser.phone)); } else { @@ -2646,6 +2650,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } if (currentEncryptedChat != null && !(currentEncryptedChat instanceof TLRPC.TL_encryptedChat) || currentUser.id / 1000 == 333 + || currentUser.id / 1000 == 777 || currentUser instanceof TLRPC.TL_userEmpty || currentUser instanceof TLRPC.TL_userDeleted || (currentUser.phone != null && currentUser.phone.length() != 0 && ContactsController.getInstance().contactsDict.get(currentUser.id) != null && @@ -2723,6 +2728,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } private void createEmojiPopup() { + if (getParentActivity() == null) { + return; + } emojiView = new EmojiView(getParentActivity()); emojiView.setListener(new EmojiView.Listener() { public void onBackspace() {