Update to 5.14.0 (1847)

This commit is contained in:
DrKLO 2020-01-23 15:58:50 +03:00
parent 30d603778d
commit 29aa3efe1e
10 changed files with 3144 additions and 3137 deletions

View file

@ -278,12 +278,12 @@ android {
manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
}
ext {
abiVersionCode = 0
abiVersionCode = 9
}
}
}
defaultConfig.versionCode = 1846
defaultConfig.versionCode = 1847
applicationVariants.all { variant ->
variant.outputs.all { output ->

View file

@ -533,9 +533,7 @@ int32_t ConnectionSocket::checkSocketError(int32_t *error) {
void ConnectionSocket::closeSocket(int32_t reason, int32_t error) {
lastEventTime = ConnectionsManager::getInstance(instanceNum).getCurrentTimeMonotonicMillis();
if (reason != 2) {
ConnectionsManager::getInstance(instanceNum).detachConnection(this);
}
ConnectionsManager::getInstance(instanceNum).detachConnection(this);
if (socketFd >= 0) {
epoll_ctl(ConnectionsManager::getInstance(instanceNum).epolFd, EPOLL_CTL_DEL, socketFd, nullptr);
if (close(socketFd) != 0) {

View file

@ -197,12 +197,10 @@ void ConnectionsManager::select() {
EventObject *eventObject = (EventObject *) epollEvents[a].data.ptr;
eventObject->onEvent(epollEvents[a].events);
}
for (std::vector<ConnectionSocket *>::iterator iter = activeConnections.begin(); iter != activeConnections.end();) {
if ((*iter)->checkTimeout(now)) {
iter = activeConnections.erase(iter);
} else {
iter++;
}
activeConnectionsCopy.resize(activeConnections.size());
std::copy(std::begin(activeConnections), std::end(activeConnections), std::begin(activeConnectionsCopy));
for (auto connection : activeConnectionsCopy) {
connection->checkTimeout(now);
}
Datacenter *datacenter = getDatacenterWithId(currentDatacenterId);

View file

@ -191,6 +191,7 @@ private:
bool networkSlow = false;
bool ipv6Enabled = false;
std::vector<ConnectionSocket *> activeConnections;
std::vector<ConnectionSocket *> activeConnectionsCopy;
int epolFd;
int eventFd;
int *pipeFd;

View file

@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1846;
public static int BUILD_VERSION = 1847;
public static String BUILD_VERSION_STRING = "5.14.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -496,11 +496,20 @@ public class ConnectionsManager extends BaseController {
}
public static int getInitFlags() {
int flags = 0;
EmuDetector detector = EmuDetector.with(ApplicationLoader.applicationContext);
if (detector.detect()) {
return 1024;
flags |= 1024;
}
return 0;
try {
String installer = ApplicationLoader.applicationContext.getPackageManager().getInstallerPackageName(ApplicationLoader.applicationContext.getPackageName());
if ("com.android.vending".equals(installer)) {
flags |= 2048;
}
} catch (Throwable ignore) {
}
return flags;
}
public static void onBytesSent(int amount, int networkType, final int currentAccount) {

View file

@ -9143,7 +9143,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
needSelectFromMessageId = needSelect;
}
}
loadsCount++;
long did = (Long) args[0];
int loadIndex = did == dialog_id ? 0 : 1;
@ -12407,13 +12407,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void onAnimationUpdate(ValueAnimator animation) {
float translationY = (float) animation.getAnimatedValue();
if (!wasManualScroll && unreadMessageObject != null && chatListView != null) {
if (position < 0 || position >= chatAdapter.getItemCount() || messages.get(position - chatAdapter.messagesStartRow) != unreadMessageObject) {
int msgIndex = position - chatAdapter.messagesStartRow;
if (msgIndex < 0 || msgIndex >= messages.size() || messages.get(msgIndex) != unreadMessageObject) {
position = chatAdapter.messagesStartRow + messages.indexOf(unreadMessageObject);
}
View v = chatLayoutManager.findViewByPosition(position);
float top = pinnedMessageView.getBottom() + translationY - chatListView.getTop();
if (v != null && top > v.getTop() + AndroidUtilities.dp(9)) {
chatListView.scrollBy(0, (int) (v.getTop() + AndroidUtilities.dp(9) - top));
if (position >= 0) {
View v = chatLayoutManager.findViewByPosition(position);
float top = pinnedMessageView.getBottom() + translationY - chatListView.getTop();
if (v != null && top > v.getTop() + AndroidUtilities.dp(9)) {
chatListView.scrollBy(0, (int) (v.getTop() + AndroidUtilities.dp(9) - top));
}
}
}
pinnedMessageView.setTranslationY(translationY);

View file

@ -177,13 +177,15 @@ public class RecyclerAnimationScrollHelper {
}
child.setTranslationY(0);
}
if (animationCallback != null) {
animationCallback.onEndAnimation();
}
if (finalAnimatableAdapter != null) {
finalAnimatableAdapter.onAnimationEnd();
}
if (animationCallback != null) {
animationCallback.onEndAnimation();
}
animator = null;
}
});
@ -264,7 +266,7 @@ public class RecyclerAnimationScrollHelper {
if (!animationRunning) {
super.notifyDataSetChanged();
} else {
shouldNotifyDataSetChanged = false;
shouldNotifyDataSetChanged = true;
}
}
@ -297,20 +299,8 @@ public class RecyclerAnimationScrollHelper {
public void onAnimationEnd() {
animationRunning = false;
if (shouldNotifyDataSetChanged) {
if (shouldNotifyDataSetChanged || !rangeInserted.isEmpty() || !rangeRemoved.isEmpty()) {
notifyDataSetChanged();
} else {
if (!rangeInserted.isEmpty()) {
for (int i = 0; i < rangeInserted.size(); i += 2) {
notifyItemRangeInserted(rangeInserted.get(i), rangeInserted.get(i + 1));
}
}
if (!rangeRemoved.isEmpty()) {
for (int i = 0; i < rangeRemoved.size(); i += 2) {
notifyItemRangeRemoved(rangeRemoved.get(i), rangeRemoved.get(i + 1));
}
}
}
}
}

View file

@ -712,28 +712,30 @@ public class PollCreateActivity extends BaseFragment {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(p);
if (holder != null) {
int position = holder.getAdapterPosition();
int index = position - answerStartRow;
listAdapter.notifyItemRemoved(holder.getAdapterPosition());
System.arraycopy(answers, index + 1, answers, index, answers.length - 1 - index);
System.arraycopy(answersChecks, index + 1, answersChecks, index, answersChecks.length - 1 - index);
answers[answers.length - 1] = null;
answersChecks[answersChecks.length - 1] = false;
answersCount--;
if (answersCount == answers.length - 1) {
listAdapter.notifyItemInserted(answerStartRow + answers.length - 1);
if (position != RecyclerView.NO_POSITION) {
int index = position - answerStartRow;
listAdapter.notifyItemRemoved(position);
System.arraycopy(answers, index + 1, answers, index, answers.length - 1 - index);
System.arraycopy(answersChecks, index + 1, answersChecks, index, answersChecks.length - 1 - index);
answers[answers.length - 1] = null;
answersChecks[answersChecks.length - 1] = false;
answersCount--;
if (answersCount == answers.length - 1) {
listAdapter.notifyItemInserted(answerStartRow + answers.length - 1);
}
holder = listView.findViewHolderForAdapterPosition(position - 1);
EditTextBoldCursor editText = p.getTextView();
if (holder != null && holder.itemView instanceof PollEditTextCell) {
PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
editTextCell.getTextView().requestFocus();
} else if (editText.isFocused()) {
AndroidUtilities.hideKeyboard(editText);
}
editText.clearFocus();
checkDoneButton();
updateRows();
listAdapter.notifyItemChanged(answerSectionRow);
}
holder = listView.findViewHolderForAdapterPosition(position - 1);
EditTextBoldCursor editText = p.getTextView();
if (holder != null && holder.itemView instanceof PollEditTextCell) {
PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
editTextCell.getTextView().requestFocus();
} else if (editText.isFocused()) {
AndroidUtilities.hideKeyboard(editText);
}
editText.clearFocus();
checkDoneButton();
updateRows();
listAdapter.notifyItemChanged(answerSectionRow);
}
}) {
@Override
@ -772,8 +774,10 @@ public class PollCreateActivity extends BaseFragment {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(editText);
if (holder != null) {
int position = holder.getAdapterPosition();
int index = position - answerStartRow;
answersChecks[index] = checked;
if (position != RecyclerView.NO_POSITION) {
int index = position - answerStartRow;
answersChecks[index] = checked;
}
}
checkDoneButton();
}
@ -783,8 +787,10 @@ public class PollCreateActivity extends BaseFragment {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(editText);
if (holder != null) {
int position = holder.getAdapterPosition();
int index = position - answerStartRow;
return answersChecks[index];
if (position != RecyclerView.NO_POSITION) {
int index = position - answerStartRow;
return answersChecks[index];
}
}
return false;
}
@ -824,17 +830,19 @@ public class PollCreateActivity extends BaseFragment {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(cell);
if (holder != null) {
int position = holder.getAdapterPosition();
int index = position - answerStartRow;
if (index == answersCount - 1 && answersCount < 10) {
addNewField();
} else {
if (index == answersCount - 1) {
AndroidUtilities.hideKeyboard(cell.getTextView());
if (position != RecyclerView.NO_POSITION) {
int index = position - answerStartRow;
if (index == answersCount - 1 && answersCount < 10) {
addNewField();
} else {
holder = listView.findViewHolderForAdapterPosition(position + 1);
if (holder != null && holder.itemView instanceof PollEditTextCell) {
PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
editTextCell.getTextView().requestFocus();
if (index == answersCount - 1) {
AndroidUtilities.hideKeyboard(cell.getTextView());
} else {
holder = listView.findViewHolderForAdapterPosition(position + 1);
if (holder != null && holder.itemView instanceof PollEditTextCell) {
PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
editTextCell.getTextView().requestFocus();
}
}
}
}

File diff suppressed because it is too large Load diff