mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 22:45:18 +01:00
Bug fixes
This commit is contained in:
parent
e2a6511fbf
commit
f92df091ef
10 changed files with 88 additions and 69 deletions
|
@ -83,7 +83,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 19
|
targetSdkVersion 19
|
||||||
versionCode 288
|
versionCode 289
|
||||||
versionName "1.6.1"
|
versionName "1.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -927,7 +927,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
|
|
||||||
if (updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 < currentTime) {
|
if (updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 < currentTime) {
|
||||||
FileLog.e("tmessages", "UPDATES WAIT TIMEOUT - CHECK QUEUE");
|
FileLog.e("tmessages", "UPDATES WAIT TIMEOUT - CHECK QUEUE");
|
||||||
processUpdatesQueue(false);
|
processUpdatesQueue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!printingUsers.isEmpty() || lastPrintingStringCount != printingUsers.size()) {
|
if (!printingUsers.isEmpty() || lastPrintingStringCount != printingUsers.size()) {
|
||||||
|
@ -3197,6 +3197,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
MessagesStorage.lastPtsValue = res.pts;
|
MessagesStorage.lastPtsValue = res.pts;
|
||||||
MessagesStorage.lastSeqValue = res.seq;
|
MessagesStorage.lastSeqValue = res.seq;
|
||||||
MessagesStorage.lastQtsValue = res.qts;
|
MessagesStorage.lastQtsValue = res.qts;
|
||||||
|
processUpdatesQueue(2);
|
||||||
MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue);
|
MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue);
|
||||||
} else {
|
} else {
|
||||||
if (error.code != 401) {
|
if (error.code != 401) {
|
||||||
|
@ -3215,7 +3216,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processUpdatesQueue(boolean getDifference) {
|
private void processUpdatesQueue(int state) {
|
||||||
if (!updatesQueue.isEmpty()) {
|
if (!updatesQueue.isEmpty()) {
|
||||||
Collections.sort(updatesQueue, new Comparator<TLRPC.Updates>() {
|
Collections.sort(updatesQueue, new Comparator<TLRPC.Updates>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -3231,6 +3232,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
boolean anyProceed = false;
|
boolean anyProceed = false;
|
||||||
|
if (state == 2) {
|
||||||
|
TLRPC.Updates updates = updatesQueue.get(0);
|
||||||
|
MessagesStorage.lastSeqValue = getUpdateSeq(updates);
|
||||||
|
}
|
||||||
for (int a = 0; a < updatesQueue.size(); a++) {
|
for (int a = 0; a < updatesQueue.size(); a++) {
|
||||||
TLRPC.Updates updates = updatesQueue.get(a);
|
TLRPC.Updates updates = updatesQueue.get(a);
|
||||||
int seq = getUpdateSeq(updates);
|
int seq = getUpdateSeq(updates);
|
||||||
|
@ -3261,7 +3266,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
updatesQueue.clear();
|
updatesQueue.clear();
|
||||||
FileLog.e("tmessages", "UPDATES QUEUE PROCEED - OK");
|
FileLog.e("tmessages", "UPDATES QUEUE PROCEED - OK");
|
||||||
updatesStartWaitTime = 0;
|
updatesStartWaitTime = 0;
|
||||||
if (getDifference) {
|
if (state == 1) {
|
||||||
final int stateCopy = ConnectionsManager.getInstance().getConnectionState();
|
final int stateCopy = ConnectionsManager.getInstance().getConnectionState();
|
||||||
Utilities.RunOnUIThread(new Runnable() {
|
Utilities.RunOnUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -3271,7 +3276,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getDifference) {
|
if (state == 1) {
|
||||||
final int stateCopy = ConnectionsManager.getInstance().getConnectionState();
|
final int stateCopy = ConnectionsManager.getInstance().getConnectionState();
|
||||||
Utilities.RunOnUIThread(new Runnable() {
|
Utilities.RunOnUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -3469,7 +3474,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
MessagesStorage.lastPtsValue = res.state.pts;
|
MessagesStorage.lastPtsValue = res.state.pts;
|
||||||
MessagesStorage.lastQtsValue = res.state.qts;
|
MessagesStorage.lastQtsValue = res.state.qts;
|
||||||
ConnectionsManager.getInstance().setConnectionState(0);
|
ConnectionsManager.getInstance().setConnectionState(0);
|
||||||
processUpdatesQueue(true);
|
processUpdatesQueue(1);
|
||||||
} else if (res instanceof TLRPC.TL_updates_differenceSlice) {
|
} else if (res instanceof TLRPC.TL_updates_differenceSlice) {
|
||||||
MessagesStorage.lastDateValue = res.intermediate_state.date;
|
MessagesStorage.lastDateValue = res.intermediate_state.date;
|
||||||
MessagesStorage.lastPtsValue = res.intermediate_state.pts;
|
MessagesStorage.lastPtsValue = res.intermediate_state.pts;
|
||||||
|
@ -3480,7 +3485,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
MessagesStorage.lastSeqValue = res.seq;
|
MessagesStorage.lastSeqValue = res.seq;
|
||||||
MessagesStorage.lastDateValue = res.date;
|
MessagesStorage.lastDateValue = res.date;
|
||||||
ConnectionsManager.getInstance().setConnectionState(0);
|
ConnectionsManager.getInstance().setConnectionState(0);
|
||||||
processUpdatesQueue(true);
|
processUpdatesQueue(1);
|
||||||
}
|
}
|
||||||
MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue);
|
MessagesStorage.getInstance().saveDiffParams(MessagesStorage.lastSeqValue, MessagesStorage.lastPtsValue, MessagesStorage.lastDateValue, MessagesStorage.lastQtsValue);
|
||||||
FileLog.e("tmessages", "received difference with date = " + MessagesStorage.lastDateValue + " pts = " + MessagesStorage.lastPtsValue + " seq = " + MessagesStorage.lastSeqValue);
|
FileLog.e("tmessages", "received difference with date = " + MessagesStorage.lastDateValue + " pts = " + MessagesStorage.lastPtsValue + " seq = " + MessagesStorage.lastSeqValue);
|
||||||
|
@ -3692,7 +3697,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
if (needGetDiff && !fromQueue) {
|
if (needGetDiff && !fromQueue) {
|
||||||
getDifference();
|
getDifference();
|
||||||
} else if (!fromQueue && !updatesQueue.isEmpty()) {
|
} else if (!fromQueue && !updatesQueue.isEmpty()) {
|
||||||
processUpdatesQueue(false);
|
processUpdatesQueue(0);
|
||||||
}
|
}
|
||||||
if (needReceivedQueue) {
|
if (needReceivedQueue) {
|
||||||
TLRPC.TL_messages_receivedQueue req = new TLRPC.TL_messages_receivedQueue();
|
TLRPC.TL_messages_receivedQueue req = new TLRPC.TL_messages_receivedQueue();
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class MessagesStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanUp() {
|
public void cleanUp(final boolean isLogin) {
|
||||||
storageQueue.cleanupQueue();
|
storageQueue.cleanupQueue();
|
||||||
storageQueue.postRunnable(new Runnable() {
|
storageQueue.postRunnable(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -219,6 +219,14 @@ public class MessagesStorage {
|
||||||
}
|
}
|
||||||
storageQueue.cleanupQueue();
|
storageQueue.cleanupQueue();
|
||||||
openDatabase();
|
openDatabase();
|
||||||
|
if (isLogin) {
|
||||||
|
Utilities.stageQueue.postRunnable(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MessagesController.getInstance().getDifference();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,11 +305,13 @@ public class NotificationsController {
|
||||||
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
|
||||||
intent.setFlags(32768);
|
intent.setFlags(32768);
|
||||||
if ((int)dialog_id != 0) {
|
if ((int)dialog_id != 0) {
|
||||||
|
if (pushDialogs.size() == 1) {
|
||||||
if (chat_id != 0) {
|
if (chat_id != 0) {
|
||||||
intent.putExtra("chatId", chat_id);
|
intent.putExtra("chatId", chat_id);
|
||||||
} else if (user_id != 0) {
|
} else if (user_id != 0) {
|
||||||
intent.putExtra("userId", user_id);
|
intent.putExtra("userId", user_id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (pushDialogs.size() == 1) {
|
if (pushDialogs.size() == 1) {
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
if (chat.photo != null && chat.photo.photo_small != null && chat.photo.photo_small.volume_id != 0 && chat.photo.photo_small.local_id != 0) {
|
if (chat.photo != null && chat.photo.photo_small != null && chat.photo.photo_small.volume_id != 0 && chat.photo.photo_small.local_id != 0) {
|
||||||
|
@ -322,7 +324,9 @@ public class NotificationsController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
intent.putExtra("encId", (int)(dialog_id >> 32));
|
if (pushDialogs.size() == 1) {
|
||||||
|
intent.putExtra("encId", (int) (dialog_id >> 32));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
||||||
|
|
||||||
|
@ -350,7 +354,6 @@ public class NotificationsController {
|
||||||
.setContentTitle(name)
|
.setContentTitle(name)
|
||||||
.setSmallIcon(R.drawable.notification)
|
.setSmallIcon(R.drawable.notification)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setContentText(detailText)
|
|
||||||
.setContentIntent(contentIntent);
|
.setContentIntent(contentIntent);
|
||||||
|
|
||||||
String lastMessage = null;
|
String lastMessage = null;
|
||||||
|
@ -366,8 +369,10 @@ public class NotificationsController {
|
||||||
message = message.replace(name + ": ", "").replace(name + " ", "");
|
message = message.replace(name + ": ", "").replace(name + " ", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mBuilder.setContentText(message);
|
||||||
mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
|
mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
|
||||||
} else {
|
} else {
|
||||||
|
mBuilder.setContentText(detailText);
|
||||||
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
|
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
|
||||||
inboxStyle.setBigContentTitle(name);
|
inboxStyle.setBigContentTitle(name);
|
||||||
int count = Math.min(10, pushMessages.size());
|
int count = Math.min(10, pushMessages.size());
|
||||||
|
@ -417,6 +422,8 @@ public class NotificationsController {
|
||||||
}
|
}
|
||||||
if (needVibrate) {
|
if (needVibrate) {
|
||||||
mBuilder.setVibrate(new long[]{0, 100, 0, 100});
|
mBuilder.setVibrate(new long[]{0, 100, 0, 100});
|
||||||
|
} else {
|
||||||
|
mBuilder.setVibrate(new long[]{0, 0});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mBuilder.setVibrate(new long[]{0, 0});
|
mBuilder.setVibrate(new long[]{0, 0});
|
||||||
|
@ -485,7 +492,7 @@ public class NotificationsController {
|
||||||
remove = true;
|
remove = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (messageObject.messageOwner.id <= max_id) {
|
if (messageObject.messageOwner.id <= max_id || max_id < 0) {
|
||||||
remove = true;
|
remove = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -569,7 +576,8 @@ public class NotificationsController {
|
||||||
int notify_override = preferences.getInt("notify2_" + dialog_id, 0);
|
int notify_override = preferences.getInt("notify2_" + dialog_id, 0);
|
||||||
boolean isChat = (int)dialog_id < 0;
|
boolean isChat = (int)dialog_id < 0;
|
||||||
Integer currentCount = pushDialogs.get(dialog_id);
|
Integer currentCount = pushDialogs.get(dialog_id);
|
||||||
if (!(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0)) {
|
boolean canAddValue = !(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0);
|
||||||
|
|
||||||
Integer newCount = entry.getValue();
|
Integer newCount = entry.getValue();
|
||||||
if (replace) {
|
if (replace) {
|
||||||
if (currentCount != null) {
|
if (currentCount != null) {
|
||||||
|
@ -577,11 +585,11 @@ public class NotificationsController {
|
||||||
}
|
}
|
||||||
if (newCount == 0) {
|
if (newCount == 0) {
|
||||||
pushDialogs.remove(dialog_id);
|
pushDialogs.remove(dialog_id);
|
||||||
} else {
|
} else if (canAddValue) {
|
||||||
total_unread_count += newCount;
|
total_unread_count += newCount;
|
||||||
pushDialogs.put(dialog_id, newCount);
|
pushDialogs.put(dialog_id, newCount);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (canAddValue) {
|
||||||
if (currentCount == null) {
|
if (currentCount == null) {
|
||||||
currentCount = 0;
|
currentCount = 0;
|
||||||
}
|
}
|
||||||
|
@ -590,11 +598,10 @@ public class NotificationsController {
|
||||||
pushDialogs.put(dialog_id, currentCount);
|
pushDialogs.put(dialog_id, currentCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (old_unread_count != total_unread_count) {
|
if (old_unread_count != total_unread_count) {
|
||||||
showOrUpdateNotification(notifyCheck);
|
showOrUpdateNotification(notifyCheck);
|
||||||
notifyCheck = false;
|
|
||||||
}
|
}
|
||||||
|
notifyCheck = false;
|
||||||
if (preferences.getBoolean("badgeNumber", true)) {
|
if (preferences.getBoolean("badgeNumber", true)) {
|
||||||
setBadge(ApplicationLoader.applicationContext, total_unread_count);
|
setBadge(ApplicationLoader.applicationContext, total_unread_count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1105,8 +1105,13 @@ public class FileLoader {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
float scaleFactor = Math.max(photoW / maxWidth, photoH / maxHeight);
|
float scaleFactor = Math.max(photoW / maxWidth, photoH / maxHeight);
|
||||||
|
int w = (int)(photoW / scaleFactor);
|
||||||
|
int h = (int)(photoH / scaleFactor);
|
||||||
|
if (h == 0 || w == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, (int)(photoW / scaleFactor), (int)(photoH / scaleFactor), true);
|
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, h, w, true);
|
||||||
|
|
||||||
TLRPC.TL_fileLocation location = new TLRPC.TL_fileLocation();
|
TLRPC.TL_fileLocation location = new TLRPC.TL_fileLocation();
|
||||||
location.volume_id = Integer.MIN_VALUE;
|
location.volume_id = Integer.MIN_VALUE;
|
||||||
|
|
|
@ -85,7 +85,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||||
currentConnectionState = ConnectionsManager.getInstance().getConnectionState();
|
currentConnectionState = ConnectionsManager.getInstance().getConnectionState();
|
||||||
|
|
||||||
NotificationCenter.getInstance().addObserver(this, 1234);
|
NotificationCenter.getInstance().addObserver(this, 1234);
|
||||||
NotificationCenter.getInstance().addObserver(this, 658);
|
|
||||||
NotificationCenter.getInstance().addObserver(this, 701);
|
NotificationCenter.getInstance().addObserver(this, 701);
|
||||||
NotificationCenter.getInstance().addObserver(this, 702);
|
NotificationCenter.getInstance().addObserver(this, 702);
|
||||||
NotificationCenter.getInstance().addObserver(this, 703);
|
NotificationCenter.getInstance().addObserver(this, 703);
|
||||||
|
@ -149,6 +148,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||||
Integer push_chat_id = 0;
|
Integer push_chat_id = 0;
|
||||||
Integer push_enc_id = 0;
|
Integer push_enc_id = 0;
|
||||||
Integer open_settings = 0;
|
Integer open_settings = 0;
|
||||||
|
boolean showDialogsList = false;
|
||||||
|
|
||||||
photoPathsArray = null;
|
photoPathsArray = null;
|
||||||
videoPath = null;
|
videoPath = null;
|
||||||
|
@ -379,6 +379,8 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||||
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
||||||
push_enc_id = encId;
|
push_enc_id = encId;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
showDialogsList = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,6 +410,11 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||||
if (presentFragment(fragment, false, true)) {
|
if (presentFragment(fragment, false, true)) {
|
||||||
pushOpened = true;
|
pushOpened = true;
|
||||||
}
|
}
|
||||||
|
} else if (showDialogsList) {
|
||||||
|
for (int a = 1; a < fragmentsStack.size(); a++) {
|
||||||
|
removeFragmentFromStack(fragmentsStack.get(a));
|
||||||
|
a--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (videoPath != null || photoPathsArray != null || sendingText != null || documentsPathsArray != null || contactsToSend != null) {
|
if (videoPath != null || photoPathsArray != null || sendingText != null || documentsPathsArray != null || contactsToSend != null) {
|
||||||
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
||||||
|
@ -522,7 +529,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||||
}
|
}
|
||||||
finished = true;
|
finished = true;
|
||||||
NotificationCenter.getInstance().removeObserver(this, 1234);
|
NotificationCenter.getInstance().removeObserver(this, 1234);
|
||||||
NotificationCenter.getInstance().removeObserver(this, 658);
|
|
||||||
NotificationCenter.getInstance().removeObserver(this, 701);
|
NotificationCenter.getInstance().removeObserver(this, 701);
|
||||||
NotificationCenter.getInstance().removeObserver(this, 702);
|
NotificationCenter.getInstance().removeObserver(this, 702);
|
||||||
NotificationCenter.getInstance().removeObserver(this, 703);
|
NotificationCenter.getInstance().removeObserver(this, 703);
|
||||||
|
@ -546,30 +552,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||||
startActivity(intent2);
|
startActivity(intent2);
|
||||||
onFinish();
|
onFinish();
|
||||||
finish();
|
finish();
|
||||||
} else if (id == 658) {
|
|
||||||
if (PhotoViewer.getInstance().isVisible()) {
|
|
||||||
PhotoViewer.getInstance().closePhoto(false);
|
|
||||||
}
|
|
||||||
Integer push_chat_id = (Integer)args[0];
|
|
||||||
Integer push_user_id = (Integer)args[1];
|
|
||||||
Integer push_enc_id = (Integer)args[2];
|
|
||||||
|
|
||||||
if (push_user_id != 0) {
|
|
||||||
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
|
||||||
Bundle args2 = new Bundle();
|
|
||||||
args2.putInt("user_id", push_user_id);
|
|
||||||
presentFragment(new ChatActivity(args2), false, true);
|
|
||||||
} else if (push_chat_id != 0) {
|
|
||||||
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
|
||||||
Bundle args2 = new Bundle();
|
|
||||||
args2.putInt("chat_id", push_chat_id);
|
|
||||||
presentFragment(new ChatActivity(args2), false, true);
|
|
||||||
} else if (push_enc_id != 0) {
|
|
||||||
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
|
|
||||||
Bundle args2 = new Bundle();
|
|
||||||
args2.putInt("enc_id", push_enc_id);
|
|
||||||
presentFragment(new ChatActivity(args2), false, true);
|
|
||||||
}
|
|
||||||
} else if (id == 702) {
|
} else if (id == 702) {
|
||||||
if (args[0] != this) {
|
if (args[0] != this) {
|
||||||
onFinish();
|
onFinish();
|
||||||
|
|
|
@ -150,10 +150,10 @@ public class LoginActivityRegisterView extends SlideView {
|
||||||
final TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
|
final TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
|
||||||
TLRPC.TL_userSelf user = (TLRPC.TL_userSelf)res.user;
|
TLRPC.TL_userSelf user = (TLRPC.TL_userSelf)res.user;
|
||||||
UserConfig.clearConfig();
|
UserConfig.clearConfig();
|
||||||
MessagesStorage.getInstance().cleanUp();
|
|
||||||
MessagesController.getInstance().cleanUp();
|
MessagesController.getInstance().cleanUp();
|
||||||
UserConfig.setCurrentUser(user);
|
UserConfig.setCurrentUser(user);
|
||||||
UserConfig.saveConfig(true);
|
UserConfig.saveConfig(true);
|
||||||
|
MessagesStorage.getInstance().cleanUp(true);
|
||||||
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
|
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
|
||||||
users.add(user);
|
users.add(user);
|
||||||
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
|
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
|
||||||
|
|
|
@ -260,10 +260,10 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
|
||||||
TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
|
TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
|
||||||
destroyTimer();
|
destroyTimer();
|
||||||
UserConfig.clearConfig();
|
UserConfig.clearConfig();
|
||||||
MessagesStorage.getInstance().cleanUp();
|
|
||||||
MessagesController.getInstance().cleanUp();
|
MessagesController.getInstance().cleanUp();
|
||||||
UserConfig.setCurrentUser(res.user);
|
UserConfig.setCurrentUser(res.user);
|
||||||
UserConfig.saveConfig(true);
|
UserConfig.saveConfig(true);
|
||||||
|
MessagesStorage.getInstance().cleanUp(true);
|
||||||
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
|
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
|
||||||
users.add(res.user);
|
users.add(res.user);
|
||||||
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
|
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
|
||||||
|
|
|
@ -413,6 +413,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
imagesByIdsTemp.clear();
|
imagesByIdsTemp.clear();
|
||||||
needSearchImageInArr = false;
|
needSearchImageInArr = false;
|
||||||
currentIndex = -1;
|
currentIndex = -1;
|
||||||
|
if (foundIndex >= imagesArr.size()) {
|
||||||
|
foundIndex = imagesArr.size() - 1;
|
||||||
|
}
|
||||||
setImageIndex(foundIndex, true);
|
setImageIndex(foundIndex, true);
|
||||||
} else {
|
} else {
|
||||||
if (!cacheEndReached || !arr.isEmpty() && added != 0) {
|
if (!cacheEndReached || !arr.isEmpty() && added != 0) {
|
||||||
|
@ -1384,6 +1387,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
NotificationCenter.getInstance().addObserver(this, MessagesController.mediaDidLoaded);
|
NotificationCenter.getInstance().addObserver(this, MessagesController.mediaDidLoaded);
|
||||||
NotificationCenter.getInstance().addObserver(this, MessagesController.userPhotosLoaded);
|
NotificationCenter.getInstance().addObserver(this, MessagesController.userPhotosLoaded);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (windowView.getParent() != null) {
|
||||||
|
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
wm.removeView(windowView);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
|
||||||
placeProvider = provider;
|
placeProvider = provider;
|
||||||
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
wm.addView(windowView, windowLayoutParams);
|
wm.addView(windowView, windowLayoutParams);
|
||||||
|
@ -1702,8 +1714,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
|
||||||
if (windowView.getParent() != null) {
|
if (windowView.getParent() != null) {
|
||||||
|
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
wm.removeViewImmediate(windowView);
|
wm.removeViewImmediate(windowView);
|
||||||
}
|
}
|
||||||
windowView = null;
|
windowView = null;
|
||||||
|
@ -1730,8 +1742,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
public void run() {
|
public void run() {
|
||||||
animatingImageView.setImageBitmap(null);
|
animatingImageView.setImageBitmap(null);
|
||||||
try {
|
try {
|
||||||
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
|
||||||
if (windowView.getParent() != null) {
|
if (windowView.getParent() != null) {
|
||||||
|
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
wm.removeView(windowView);
|
wm.removeView(windowView);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -962,7 +962,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||||
MessagesController.getInstance().unregistedPush();
|
MessagesController.getInstance().unregistedPush();
|
||||||
MessagesController.getInstance().logOut();
|
MessagesController.getInstance().logOut();
|
||||||
UserConfig.clearConfig();
|
UserConfig.clearConfig();
|
||||||
MessagesStorage.getInstance().cleanUp();
|
MessagesStorage.getInstance().cleanUp(false);
|
||||||
MessagesController.getInstance().cleanUp();
|
MessagesController.getInstance().cleanUp();
|
||||||
ContactsController.getInstance().deleteAllAppAccounts();
|
ContactsController.getInstance().deleteAllAppAccounts();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue