Bug fixes

This commit is contained in:
DrKLO 2014-08-08 14:17:06 +04:00
parent 5d042955cd
commit 8f7652bb7e
18 changed files with 117 additions and 32 deletions

View File

@ -18,7 +18,7 @@ tasks.withType(JavaCompile) {
dependencies { dependencies {
compile 'com.android.support:support-v4:19.0.+' compile 'com.android.support:support-v4:19.0.+'
compile 'com.google.android.gms:play-services:4.1.+' compile 'com.google.android.gms:play-services:3.2.+'
compile 'net.hockeyapp.android:HockeySDK:3.0.1' compile 'net.hockeyapp.android:HockeySDK:3.0.1'
compile 'com.googlecode.mp4parser:isoparser:1.0.+' compile 'com.googlecode.mp4parser:isoparser:1.0.+'
} }
@ -83,7 +83,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 303 versionCode 307
versionName "1.7.0" versionName "1.7.0"
} }
} }

View File

@ -28,7 +28,6 @@
android:largeHeap="true"> android:largeHeap="true">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCTNmNqbWovP9ETcAob98YlrfOQEAC0CJ4" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCTNmNqbWovP9ETcAob98YlrfOQEAC0CJ4" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:name="net.hockeyapp.android.UpdateActivity" /> <activity android:name="net.hockeyapp.android.UpdateActivity" />

View File

@ -28,7 +28,6 @@
android:largeHeap="true"> android:largeHeap="true">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:name="net.hockeyapp.android.UpdateActivity" /> <activity android:name="net.hockeyapp.android.UpdateActivity" />

View File

@ -2,5 +2,5 @@
void fakeFunction() { void fakeFunction() {
printf("some androids has buggy native loader, so i should check size of libs in java to know that native library is correct. So each changed native library should has diffrent size in different app versions. This function will increase lib size for few bytes :)"); printf("some androids has buggy native loader, so i should check size of libs in java to know that native library is correct. So each changed native library should has diffrent size in different app versions. This function will increase lib size for few bytes :)");
printf("bla blablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablabla"); printf("bla blablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablabla");
} }

View File

@ -892,10 +892,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
} }
public void loadChatInfo(final int chat_id) { public void loadChatInfo(final int chat_id, Semaphore semaphore) {
currentChatInfo = null; currentChatInfo = null;
chatParticipantsId = chat_id; chatParticipantsId = chat_id;
MessagesStorage.getInstance().loadChatInfo(chat_id); MessagesStorage.getInstance().loadChatInfo(chat_id, semaphore);
} }
public void processChatInfo(final int chat_id, final TLRPC.ChatParticipants info, final ArrayList<TLRPC.User> usersArr, final boolean fromCache) { public void processChatInfo(final int chat_id, final TLRPC.ChatParticipants info, final ArrayList<TLRPC.User> usersArr, final boolean fromCache) {
@ -1605,7 +1605,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} }
} }
public void markDialogAsRead(final long dialog_id, final int max_id, final int max_positive_id, final int offset, final int max_date, final boolean was) { public void markDialogAsRead(final long dialog_id, final int max_id, final int max_positive_id, final int offset, final int max_date, final boolean was, final boolean popup) {
int lower_part = (int)dialog_id; int lower_part = (int)dialog_id;
int high_id = (int)(dialog_id >> 32); int high_id = (int)(dialog_id >> 32);
@ -1643,11 +1643,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog.unread_count = 0; dialog.unread_count = 0;
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload); NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
} }
if (!popup) {
NotificationsController.getInstance().processReadMessages(null, dialog_id, 0, max_positive_id); NotificationsController.getInstance().processReadMessages(null, dialog_id, 0, max_positive_id);
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>(); HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
dialogsToUpdate.put(dialog_id, 0); dialogsToUpdate.put(dialog_id, 0);
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true); NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
} }
}
}); });
} }
}); });
@ -1660,7 +1662,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
MessagesStorage.getInstance().processPendingRead(dialog_id, max_positive_id, max_date, true); MessagesStorage.getInstance().processPendingRead(dialog_id, max_positive_id, max_date, true);
TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response;
if (res.offset > 0) { if (res.offset > 0) {
markDialogAsRead(dialog_id, 0, max_positive_id, res.offset, max_date, was); markDialogAsRead(dialog_id, 0, max_positive_id, res.offset, max_date, was, popup);
} }
if (MessagesStorage.lastSeqValue + 1 == res.seq) { if (MessagesStorage.lastSeqValue + 1 == res.seq) {

View File

@ -755,7 +755,7 @@ public class MessagesStorage {
}); });
} }
public void loadChatInfo(final int chat_id) { public void loadChatInfo(final int chat_id, final Semaphore semaphore) {
storageQueue.postRunnable(new Runnable() { storageQueue.postRunnable(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -809,9 +809,16 @@ public class MessagesStorage {
updateChatInfo(chat_id, info, false); updateChatInfo(chat_id, info, false);
} }
} }
if (semaphore != null) {
semaphore.release();
}
MessagesController.getInstance().processChatInfo(chat_id, info, loadedUsers, true); MessagesController.getInstance().processChatInfo(chat_id, info, loadedUsers, true);
} catch (Exception e) { } catch (Exception e) {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} finally {
if (semaphore != null) {
semaphore.release();
}
} }
} }
}); });
@ -946,6 +953,9 @@ public class MessagesStorage {
ByteBufferDesc data = buffersStorage.getFreeBuffer(cursor.byteArrayLength(0)); ByteBufferDesc data = buffersStorage.getFreeBuffer(cursor.byteArrayLength(0));
if (data != null && cursor.byteBufferValue(0, data.buffer) != 0) { if (data != null && cursor.byteBufferValue(0, data.buffer) != 0) {
TLRPC.Chat chat = (TLRPC.Chat) TLClassStore.Instance().TLdeserialize(data, data.readInt32()); TLRPC.Chat chat = (TLRPC.Chat) TLClassStore.Instance().TLdeserialize(data, data.readInt32());
if (!needEncrypted && chat.id < 0) {
continue;
}
resultArrayNames.add(Utilities.generateSearchName(chat.title, null, q)); resultArrayNames.add(Utilities.generateSearchName(chat.title, null, q));
resultArray.add(chat); resultArray.add(chat);
} }

View File

@ -24,8 +24,8 @@ import java.util.zip.ZipFile;
public class NativeLoader { public class NativeLoader {
private static final long sizes[] = new long[] { private static final long sizes[] = new long[] {
799376, //armeabi 803472, //armeabi
852644, //armeabi-v7a 856740, //armeabi-v7a
1250356, //x86 1250356, //x86
0, //mips 0, //mips
}; };

View File

@ -63,12 +63,12 @@ public class FileLog {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
logQueue = new DispatchQueue("logQueue");
currentFile.createNewFile(); currentFile.createNewFile();
FileOutputStream stream = new FileOutputStream(currentFile); FileOutputStream stream = new FileOutputStream(currentFile);
streamWriter = new OutputStreamWriter(stream); streamWriter = new OutputStreamWriter(stream);
streamWriter.write("-----start log " + dateFormat.format(System.currentTimeMillis()) + "-----\n"); streamWriter.write("-----start log " + dateFormat.format(System.currentTimeMillis()) + "-----\n");
streamWriter.flush(); streamWriter.flush();
logQueue = new DispatchQueue("logQueue");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -394,7 +394,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
photoHeight = h; photoHeight = h;
backgroundWidth = w + AndroidUtilities.dp(12); backgroundWidth = w + AndroidUtilities.dp(12);
currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (w / AndroidUtilities.density), (int) (h / AndroidUtilities.density)); currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (w / AndroidUtilities.density), (int) (h / AndroidUtilities.density));
if (messageObject.photoThumbs.size() > 1) { if (messageObject.photoThumbs.size() > 1 || messageObject.type == 3 || messageObject.type == 8) {
currentPhotoFilter += "_b"; currentPhotoFilter += "_b";
} }

View File

@ -214,13 +214,24 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return false; return false;
} }
} }
MessagesController.getInstance().loadChatInfo(currentChat.id);
if (chatId > 0) { if (chatId > 0) {
dialog_id = -chatId; dialog_id = -chatId;
} else { } else {
isBraodcast = true; isBraodcast = true;
dialog_id = AndroidUtilities.makeBroadcastId(chatId); dialog_id = AndroidUtilities.makeBroadcastId(chatId);
} }
Semaphore semaphore = null;
if (isBraodcast) {
semaphore = new Semaphore(0);
}
MessagesController.getInstance().loadChatInfo(currentChat.id, semaphore);
if (isBraodcast) {
try {
semaphore.acquire();
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
} else if (userId != 0) { } else if (userId != 0) {
currentUser = MessagesController.getInstance().users.get(userId); currentUser = MessagesController.getInstance().users.get(userId);
if (currentUser == null) { if (currentUser == null) {
@ -878,7 +889,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
if (show) { if (show) {
if (pagedownButton.getVisibility() == View.GONE) { if (pagedownButton.getVisibility() == View.GONE) {
if (android.os.Build.VERSION.SDK_INT >= 12 && animated) { if (android.os.Build.VERSION.SDK_INT > 13 && animated) {
pagedownButton.setVisibility(View.VISIBLE); pagedownButton.setVisibility(View.VISIBLE);
pagedownButton.setAlpha(0); pagedownButton.setAlpha(0);
pagedownButton.animate().alpha(1).setDuration(200).start(); pagedownButton.animate().alpha(1).setDuration(200).start();
@ -888,7 +899,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} else { } else {
if (pagedownButton.getVisibility() == View.VISIBLE) { if (pagedownButton.getVisibility() == View.VISIBLE) {
if (android.os.Build.VERSION.SDK_INT >= 12 && animated) { if (android.os.Build.VERSION.SDK_INT > 13 && animated) {
pagedownButton.animate().alpha(0).setDuration(200).setListener(new Animator.AnimatorListener() { pagedownButton.animate().alpha(0).setDuration(200).setListener(new Animator.AnimatorListener() {
@Override @Override
public void onAnimationStart(Animator animation) { public void onAnimationStart(Animator animation) {
@ -1902,9 +1913,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (first && messages.size() > 0) { if (first && messages.size() > 0) {
if (last_unread_id != 0) { if (last_unread_id != 0) {
MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, last_unread_id, 0, last_unread_date, wasUnread); MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, last_unread_id, 0, last_unread_date, wasUnread, false);
} else { } else {
MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, minMessageId, 0, maxDate, wasUnread); MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, minMessageId, 0, maxDate, wasUnread, false);
} }
first = false; first = false;
} }
@ -1985,7 +1996,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
readWithMid = currentMinMsgId; readWithMid = currentMinMsgId;
} else { } else {
if (messages.size() > 0) { if (messages.size() > 0) {
MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, currentMinMsgId, 0, currentMaxDate, true); MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, currentMinMsgId, 0, currentMaxDate, true, false);
} }
} }
} }
@ -2088,7 +2099,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
readWithDate = maxDate; readWithDate = maxDate;
readWithMid = minMessageId; readWithMid = minMessageId;
} else { } else {
MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, minMessageId, 0, maxDate, true); MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, minMessageId, 0, maxDate, true, false);
} }
} }
} }
@ -2444,7 +2455,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
messageObject.messageOwner.unread = false; messageObject.messageOwner.unread = false;
} }
readWhenResume = false; readWhenResume = false;
MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, readWithMid, 0, readWithDate, true); MessagesController.getInstance().markDialogAsRead(dialog_id, messages.get(0).messageOwner.id, readWithMid, 0, readWithDate, true, false);
} }
fixLayout(true); fixLayout(true);

View File

@ -291,7 +291,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
@Override @Override
public void restoreSelfArgs(Bundle args) { public void restoreSelfArgs(Bundle args) {
MessagesController.getInstance().loadChatInfo(chat_id); MessagesController.getInstance().loadChatInfo(chat_id, null);
if (avatarUpdater != null) { if (avatarUpdater != null) {
avatarUpdater.currentPicturePath = args.getString("path"); avatarUpdater.currentPicturePath = args.getString("path");
} }

View File

@ -8,7 +8,9 @@
package org.telegram.ui; package org.telegram.ui;
import android.content.Context;
import android.location.Location; import android.location.Location;
import android.location.LocationManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -39,6 +41,8 @@ import org.telegram.ui.Views.ActionBar.ActionBarMenuItem;
import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Views.BackupImageView;
import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.ActionBar.BaseFragment;
import java.util.List;
public class LocationActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { public class LocationActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
private GoogleMap googleMap; private GoogleMap googleMap;
private TextView distanceTextView; private TextView distanceTextView;
@ -164,8 +168,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
positionMarker(location); positionMarker(location);
} }
}); });
myLocation = googleMap.getMyLocation(); myLocation = getLastLocation();
if (sendButton != null) { if (sendButton != null) {
userLocation = new Location("network"); userLocation = new Location("network");
@ -249,6 +252,19 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
return fragmentView; return fragmentView;
} }
private Location getLastLocation() {
LocationManager lm = (LocationManager) ApplicationLoader.applicationContext.getSystemService(Context.LOCATION_SERVICE);
List<String> providers = lm.getProviders(true);
Location l = null;
for (int i = providers.size() - 1; i >= 0; i--) {
l = lm.getLastKnownLocation(providers.get(i));
if (l != null) {
break;
}
}
return l;
}
private void updateUserData() { private void updateUserData() {
if (messageObject != null && avatarImageView != null) { if (messageObject != null && avatarImageView != null) {
int fromId = messageObject.messageOwner.from_id; int fromId = messageObject.messageOwner.from_id;

View File

@ -54,9 +54,12 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
private Bundle currentParams; private Bundle currentParams;
private Timer timeTimer; private Timer timeTimer;
private Timer codeTimer;
private static final Integer timerSync = 1; private static final Integer timerSync = 1;
private volatile int time = 60000; private volatile int time = 60000;
private volatile int codeTime = 15000;
private double lastCurrentTime; private double lastCurrentTime;
private double lastCodeTime;
private boolean waitingForSms = false; private boolean waitingForSms = false;
private boolean nextPressed = false; private boolean nextPressed = false;
private String lastError = ""; private String lastError = "";
@ -162,6 +165,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
codeField.requestFocus(); codeField.requestFocus();
destroyTimer(); destroyTimer();
destroyCodeTimer();
timeText.setText(String.format("%s 1:00", LocaleController.getString("CallText", R.string.CallText))); timeText.setText(String.format("%s 1:00", LocaleController.getString("CallText", R.string.CallText)));
lastCurrentTime = System.currentTimeMillis(); lastCurrentTime = System.currentTimeMillis();
problemText.setVisibility(time < 1000 ? VISIBLE : GONE); problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
@ -169,6 +173,46 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
createTimer(); createTimer();
} }
private void createCodeTimer() {
if (codeTimer != null) {
return;
}
codeTime = 15000;
codeTimer = new Timer();
lastCodeTime = System.currentTimeMillis();
codeTimer.schedule(new TimerTask() {
@Override
public void run() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - lastCodeTime;
codeTime -= diff;
lastCodeTime = currentTime;
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
if (codeTime <= 1000) {
problemText.setVisibility(VISIBLE);
destroyCodeTimer();
}
}
});
}
}, 0, 1000);
}
private void destroyCodeTimer() {
try {
synchronized(timerSync) {
if (codeTimer != null) {
codeTimer.cancel();
codeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
private void createTimer() { private void createTimer() {
if (timeTimer != null) { if (timeTimer != null) {
return; return;
@ -189,9 +233,9 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
int seconds = time / 1000 - minutes * 60; int seconds = time / 1000 - minutes * 60;
timeText.setText(String.format("%s %d:%02d", LocaleController.getString("CallText", R.string.CallText), minutes, seconds)); timeText.setText(String.format("%s %d:%02d", LocaleController.getString("CallText", R.string.CallText), minutes, seconds));
} else { } else {
problemText.setVisibility(VISIBLE);
timeText.setText(LocaleController.getString("Calling", R.string.Calling)); timeText.setText(LocaleController.getString("Calling", R.string.Calling));
destroyTimer(); destroyTimer();
createCodeTimer();
TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall(); TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall();
req.phone_number = requestPhone; req.phone_number = requestPhone;
req.phone_code_hash = phoneHash; req.phone_code_hash = phoneHash;
@ -259,6 +303,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
if (error == null) { if (error == null) {
TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response; TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
destroyTimer(); destroyTimer();
destroyCodeTimer();
UserConfig.clearConfig(); UserConfig.clearConfig();
MessagesController.getInstance().cleanUp(); MessagesController.getInstance().cleanUp();
UserConfig.setCurrentUser(res.user); UserConfig.setCurrentUser(res.user);
@ -280,6 +325,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
params.putString("code", req.phone_code); params.putString("code", req.phone_code);
delegate.setPage(2, true, params, false); delegate.setPage(2, true, params, false);
destroyTimer(); destroyTimer();
destroyCodeTimer();
} else { } else {
createTimer(); createTimer();
if (error.text.contains("PHONE_NUMBER_INVALID")) { if (error.text.contains("PHONE_NUMBER_INVALID")) {
@ -304,6 +350,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
@Override @Override
public void onBackPressed() { public void onBackPressed() {
destroyTimer(); destroyTimer();
destroyCodeTimer();
currentParams = null; currentParams = null;
AndroidUtilities.setWaitingForSms(false); AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998); NotificationCenter.getInstance().removeObserver(this, 998);
@ -316,6 +363,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
AndroidUtilities.setWaitingForSms(false); AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998); NotificationCenter.getInstance().removeObserver(this, 998);
destroyTimer(); destroyTimer();
destroyCodeTimer();
waitingForSms = false; waitingForSms = false;
} }

View File

@ -161,7 +161,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
return; return;
} }
NotificationsController.getInstance().popupMessages.remove(currentMessageNum); NotificationsController.getInstance().popupMessages.remove(currentMessageNum);
MessagesController.getInstance().markDialogAsRead(currentMessageObject.getDialogId(), currentMessageObject.messageOwner.id, Math.max(0, currentMessageObject.messageOwner.id), 0, currentMessageObject.messageOwner.date, true); MessagesController.getInstance().markDialogAsRead(currentMessageObject.getDialogId(), currentMessageObject.messageOwner.id, Math.max(0, currentMessageObject.messageOwner.id), 0, currentMessageObject.messageOwner.date, true, true);
currentMessageObject = null; currentMessageObject = null;
getNewMessage(); getNewMessage();
} }

View File

@ -308,7 +308,7 @@
<string name="NoPhotos">لا توجد صور حتى الآن</string> <string name="NoPhotos">لا توجد صور حتى الآن</string>
<!--edit video view--> <!--edit video view-->
<string name="EditVideo">Edit Video</string> <string name="EditVideo">تحرير الفيديو</string>
<string name="OriginalVideo">Original Video</string> <string name="OriginalVideo">Original Video</string>
<string name="EditedVideo">Edited Video</string> <string name="EditedVideo">Edited Video</string>