Commit 27b74b53 authored by DrKLO's avatar DrKLO

update to 2.3.6

parent c824df61
......@@ -141,7 +141,6 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
void setTimeDifference(int diff) {
boolean store = Math.abs(diff - timeDifference) > 25;
timeDifference = diff;
//_timeOffsetFromUTC = _timeDifference + (int)[[NSTimeZone localTimeZone] secondsFromGMT];
if (store) {
saveSession();
}
......@@ -596,18 +595,6 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
datacenter.connection.datacenterId = datacenter.datacenterId;
}
datacenter.connection.connect();
/*if (it == currentDatacenterId) {
boolean isConnecting = datacenter.connection.channelToken != 0;
if (isConnecting) {
_isWaitingForFirstData = true;
}
if (_isConnecting != isConnecting)
{
_isConnecting = isConnecting;
[self dispatchConnectingState];
}
}*/
}
}
for (int it : downloadTransportsToResume) {
......@@ -1092,7 +1079,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
}
for (int num : unauthorizedDatacenterIds) {
if (num != currentDatacenterId && num != movingToDatacenterId && UserConfig.clientUserId != 0/* && unavailableDatacenterIds.get(num) == null*/) {
if (num != currentDatacenterId && num != movingToDatacenterId && UserConfig.clientUserId != 0) {
boolean notFound = true;
for (Action actor : actionQueue) {
if (actor instanceof ExportAuthorizationAction) {
......@@ -1205,7 +1192,6 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
currentSize += protoMessage.bytes;
// || currentMessages.size() == 5
if (currentSize >= 3 * 1024 || a == messagesToSend.size() - 1) {
ArrayList<Integer> quickAckId = new ArrayList<Integer>();
byte[] transportData = createConnectionData(currentMessages, sessionId, quickAckId, connection);
......@@ -1450,8 +1436,9 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
saveSession();
//if (sessionId == datacenter.authSessionId && [datacenter.datacenterId isEqualToValue:currentDatacenterId])
// [TGTelegraphInstance stateUpdateRequired];
if (sessionId == datacenter.authSessionId && datacenter.datacenterId == currentDatacenterId && UserConfig.clientActivated) {
MessagesController.Instance.getDifference();
}
arr.add(newSession.unique_id);
}
} else if (message instanceof TLRPC.TL_msg_container) {
......@@ -1894,20 +1881,6 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
@Override
public void tcpConnectionConnected(TcpConnection connection) {
/*int requestClass = [transport transportRequestClass];
if ([transport datacenter].datacenterId == _currentDatacenterId && requestClass & TGRequestClassGeneric)
{
if (_isConnecting)
{
_isConnecting = false;
_isWaitingForFirstData = true;
[self dispatchConnectingState];
}
if (!_isReady)
return;
}*/
Datacenter datacenter = datacenterWithId(connection.datacenterId);
if (datacenter.authKey != null) {
processRequestQueue(connection.transportRequestClass, connection.datacenterId);
......
......@@ -402,18 +402,6 @@ public class Emoji {
if(bmps[info.page] == null) {
loadPageAsync(info.page);
}
/*drawables.add(new WeakReference<EmojiDrawable>(ed));
try {
for (int a = 0; a < drawables.size(); a++) {
WeakReference<EmojiDrawable> it = drawables.get(a);
if (it.get() == null) {
drawables.remove(a);
a--;
}
}
} catch(Throwable x) {
x.printStackTrace();
}*/
return ed;
}
......@@ -507,7 +495,8 @@ public class Emoji {
s = Spannable.Factory.getInstance().newSpannable(cs);
}
long buf = 0;
for (int i = 0; i < cs.length(); i++){
int emojiCount = 0;
for (int i = 0; i < cs.length(); i++) {
char c = cs.charAt(i);
if (c == 0xD83C || c == 0xD83D || (buf != 0 && (buf & 0xFFFFFFFF00000000L) == 0 && (c >= 0xDDE6 && c <= 0xDDFA))) {
buf <<= 16;
......@@ -518,6 +507,7 @@ public class Emoji {
Drawable d = Emoji.getEmojiDrawable(buf);
if (d != null){
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM);
emojiCount++;
if (c>= 0xDDE6 && c <= 0xDDFA) {
s.setSpan(span, i - 3, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} else {
......@@ -535,6 +525,7 @@ public class Emoji {
Drawable d = Emoji.getEmojiDrawable(buf);
if(d != null) {
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM);
emojiCount++;
s.setSpan(span, i - 1, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
buf = 0;
......@@ -544,9 +535,13 @@ public class Emoji {
Drawable d = Emoji.getEmojiDrawable(c);
if(d != null){
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM);
emojiCount++;
s.setSpan(span, i, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
if (emojiCount >= 50) {
break;
}
}
return s;
}
......
......@@ -19,10 +19,10 @@ import java.security.NoSuchAlgorithmException;
import java.util.Locale;
public class FileUploadOperation {
private final int uploadChunkSize = 1024 * 32;
private int uploadChunkSize = 1024 * 32;
private String uploadingFilePath;
public int state = 0;
private byte[] readBuffer = new byte[uploadChunkSize];
private byte[] readBuffer;
public FileUploadOperationDelegate delegate;
private long requestToken = 0;
private int currentPartNum = 0;
......@@ -103,6 +103,9 @@ public class FileUploadOperation {
File cacheFile = new File(uploadingFilePath);
stream = new FileInputStream(cacheFile);
totalFileSize = cacheFile.length();
uploadChunkSize = (int)Math.max(32, Math.ceil(totalFileSize / (1024.0f * 3000))) * 1024;
readBuffer = new byte[uploadChunkSize];
}
int readed = stream.read(readBuffer);
int toAdd = 0;
......
......@@ -25,7 +25,6 @@ import android.util.Log;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import org.json.JSONObject;
import org.telegram.TL.TLRPC;
import org.telegram.ui.ApplicationLoader;
import org.telegram.ui.LaunchActivity;
......@@ -118,8 +117,6 @@ public class GcmBroadcastReceiver extends BroadcastReceiver {
int chat_id = 0;
int user_id = 0;
TLRPC.User user = null;
TLRPC.Chat chat = null;
String custom = extras.getString("custom");
try {
if (custom != null) {
......@@ -171,7 +168,6 @@ public class GcmBroadcastReceiver extends BroadcastReceiver {
}
boolean needVibrate;
boolean needPreview = true;
String choosenSoundPath = null;
if (chat_id != 0) {
......@@ -192,6 +188,8 @@ public class GcmBroadcastReceiver extends BroadcastReceiver {
} else if (chatSound != null) {
choosenSoundPath = chatSound;
}
} else {
choosenSoundPath = globalSound;
}
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
......@@ -205,11 +203,9 @@ public class GcmBroadcastReceiver extends BroadcastReceiver {
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.setContentText(msg)
.setAutoCancel(true);
.setAutoCancel(true)
.setTicker(msg);
if (needPreview) {
mBuilder.setTicker(msg);
}
if (needVibrate) {
mBuilder.setVibrate(new long[]{0, 100, 0, 100});
}
......
......@@ -104,9 +104,6 @@ public class TcpConnection extends PyroClientAdapter {
}
public void suspendConnection(boolean task) {
if (ConnectionsManager.DEBUG_VERSION) {
Log.d("tmessages", "suspend connnection " + this);
}
if (task) {
selector.scheduleTask(new Runnable() {
@Override
......@@ -118,6 +115,9 @@ public class TcpConnection extends PyroClientAdapter {
if (connectionState == TcpConnectionState.TcpConnectionStageIdle || connectionState == TcpConnectionState.TcpConnectionStageSuspended) {
return;
}
if (ConnectionsManager.DEBUG_VERSION) {
Log.d("tmessages", "suspend connnection " + this);
}
connectionState = TcpConnectionState.TcpConnectionStageSuspended;
if (client != null) {
client.dropConnection();
......@@ -130,9 +130,12 @@ public class TcpConnection extends PyroClientAdapter {
reconnectTimer.cancel();
reconnectTimer = null;
}
if (connectionState == TcpConnectionState.TcpConnectionStageIdle) {
if (connectionState == TcpConnectionState.TcpConnectionStageIdle || connectionState == TcpConnectionState.TcpConnectionStageSuspended) {
return;
}
if (ConnectionsManager.DEBUG_VERSION) {
Log.d("tmessages", "suspend connnection " + this);
}
connectionState = TcpConnectionState.TcpConnectionStageSuspended;
if (client != null) {
client.dropConnection();
......
......@@ -2165,14 +2165,14 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
Intent pickIntent = new Intent();
pickIntent.setType("video/*");
pickIntent.setAction(Intent.ACTION_GET_CONTENT);
pickIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 1024 * 1024 * 100);
pickIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 1024 * 1024 * 1000);
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
File video = Utilities.generateVideoPath();
if (video != null) {
if(android.os.Build.VERSION.SDK_INT > 10) {
takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(video));
}
takeVideoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 1024 * 1024 * 100);
takeVideoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 1024 * 1024 * 1000);
currentPicturePath = video.getAbsolutePath();
}
Intent chooserIntent = Intent.createChooser(pickIntent, "");
......
......@@ -198,7 +198,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
((ApplicationActivity)parentActivity).presentFragment(fragment, "key_" + dialog_id, false);
} else if (i == 4 && dialog_id != 0 && currentEncryptedChat instanceof TLRPC.TL_encryptedChat) {
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
builder.setTitle(getStringEntry(R.string.TextSize));
builder.setTitle(getStringEntry(R.string.MessageLifetime));
builder.setItems(new CharSequence[]{
getStringEntry(R.string.ShortMessageLifetimeForever),
getStringEntry(R.string.ShortMessageLifetime2s),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment