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' manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
} }
ext { ext {
abiVersionCode = 0 abiVersionCode = 9
} }
} }
} }
defaultConfig.versionCode = 1846 defaultConfig.versionCode = 1847
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { output -> 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) { void ConnectionSocket::closeSocket(int32_t reason, int32_t error) {
lastEventTime = ConnectionsManager::getInstance(instanceNum).getCurrentTimeMonotonicMillis(); lastEventTime = ConnectionsManager::getInstance(instanceNum).getCurrentTimeMonotonicMillis();
if (reason != 2) { ConnectionsManager::getInstance(instanceNum).detachConnection(this);
ConnectionsManager::getInstance(instanceNum).detachConnection(this);
}
if (socketFd >= 0) { if (socketFd >= 0) {
epoll_ctl(ConnectionsManager::getInstance(instanceNum).epolFd, EPOLL_CTL_DEL, socketFd, nullptr); epoll_ctl(ConnectionsManager::getInstance(instanceNum).epolFd, EPOLL_CTL_DEL, socketFd, nullptr);
if (close(socketFd) != 0) { if (close(socketFd) != 0) {

View file

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

View file

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

View file

@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false; 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 String BUILD_VERSION_STRING = "5.14.0";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -496,11 +496,20 @@ public class ConnectionsManager extends BaseController {
} }
public static int getInitFlags() { public static int getInitFlags() {
int flags = 0;
EmuDetector detector = EmuDetector.with(ApplicationLoader.applicationContext); EmuDetector detector = EmuDetector.with(ApplicationLoader.applicationContext);
if (detector.detect()) { 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) { public static void onBytesSent(int amount, int networkType, final int currentAccount) {

View file

@ -12407,13 +12407,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void onAnimationUpdate(ValueAnimator animation) { public void onAnimationUpdate(ValueAnimator animation) {
float translationY = (float) animation.getAnimatedValue(); float translationY = (float) animation.getAnimatedValue();
if (!wasManualScroll && unreadMessageObject != null && chatListView != null) { 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); position = chatAdapter.messagesStartRow + messages.indexOf(unreadMessageObject);
} }
View v = chatLayoutManager.findViewByPosition(position); if (position >= 0) {
float top = pinnedMessageView.getBottom() + translationY - chatListView.getTop(); View v = chatLayoutManager.findViewByPosition(position);
if (v != null && top > v.getTop() + AndroidUtilities.dp(9)) { float top = pinnedMessageView.getBottom() + translationY - chatListView.getTop();
chatListView.scrollBy(0, (int) (v.getTop() + AndroidUtilities.dp(9) - top)); if (v != null && top > v.getTop() + AndroidUtilities.dp(9)) {
chatListView.scrollBy(0, (int) (v.getTop() + AndroidUtilities.dp(9) - top));
}
} }
} }
pinnedMessageView.setTranslationY(translationY); pinnedMessageView.setTranslationY(translationY);

View file

@ -177,13 +177,15 @@ public class RecyclerAnimationScrollHelper {
} }
child.setTranslationY(0); child.setTranslationY(0);
} }
if (animationCallback != null) {
animationCallback.onEndAnimation();
}
if (finalAnimatableAdapter != null) { if (finalAnimatableAdapter != null) {
finalAnimatableAdapter.onAnimationEnd(); finalAnimatableAdapter.onAnimationEnd();
} }
if (animationCallback != null) {
animationCallback.onEndAnimation();
}
animator = null; animator = null;
} }
}); });
@ -264,7 +266,7 @@ public class RecyclerAnimationScrollHelper {
if (!animationRunning) { if (!animationRunning) {
super.notifyDataSetChanged(); super.notifyDataSetChanged();
} else { } else {
shouldNotifyDataSetChanged = false; shouldNotifyDataSetChanged = true;
} }
} }
@ -297,20 +299,8 @@ public class RecyclerAnimationScrollHelper {
public void onAnimationEnd() { public void onAnimationEnd() {
animationRunning = false; animationRunning = false;
if (shouldNotifyDataSetChanged) { if (shouldNotifyDataSetChanged || !rangeInserted.isEmpty() || !rangeRemoved.isEmpty()) {
notifyDataSetChanged(); 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); RecyclerView.ViewHolder holder = listView.findContainingViewHolder(p);
if (holder != null) { if (holder != null) {
int position = holder.getAdapterPosition(); int position = holder.getAdapterPosition();
int index = position - answerStartRow; if (position != RecyclerView.NO_POSITION) {
listAdapter.notifyItemRemoved(holder.getAdapterPosition()); int index = position - answerStartRow;
System.arraycopy(answers, index + 1, answers, index, answers.length - 1 - index); listAdapter.notifyItemRemoved(position);
System.arraycopy(answersChecks, index + 1, answersChecks, index, answersChecks.length - 1 - index); System.arraycopy(answers, index + 1, answers, index, answers.length - 1 - index);
answers[answers.length - 1] = null; System.arraycopy(answersChecks, index + 1, answersChecks, index, answersChecks.length - 1 - index);
answersChecks[answersChecks.length - 1] = false; answers[answers.length - 1] = null;
answersCount--; answersChecks[answersChecks.length - 1] = false;
if (answersCount == answers.length - 1) { answersCount--;
listAdapter.notifyItemInserted(answerStartRow + answers.length - 1); 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 @Override
@ -772,8 +774,10 @@ public class PollCreateActivity extends BaseFragment {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(editText); RecyclerView.ViewHolder holder = listView.findContainingViewHolder(editText);
if (holder != null) { if (holder != null) {
int position = holder.getAdapterPosition(); int position = holder.getAdapterPosition();
int index = position - answerStartRow; if (position != RecyclerView.NO_POSITION) {
answersChecks[index] = checked; int index = position - answerStartRow;
answersChecks[index] = checked;
}
} }
checkDoneButton(); checkDoneButton();
} }
@ -783,8 +787,10 @@ public class PollCreateActivity extends BaseFragment {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(editText); RecyclerView.ViewHolder holder = listView.findContainingViewHolder(editText);
if (holder != null) { if (holder != null) {
int position = holder.getAdapterPosition(); int position = holder.getAdapterPosition();
int index = position - answerStartRow; if (position != RecyclerView.NO_POSITION) {
return answersChecks[index]; int index = position - answerStartRow;
return answersChecks[index];
}
} }
return false; return false;
} }
@ -824,17 +830,19 @@ public class PollCreateActivity extends BaseFragment {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(cell); RecyclerView.ViewHolder holder = listView.findContainingViewHolder(cell);
if (holder != null) { if (holder != null) {
int position = holder.getAdapterPosition(); int position = holder.getAdapterPosition();
int index = position - answerStartRow; if (position != RecyclerView.NO_POSITION) {
if (index == answersCount - 1 && answersCount < 10) { int index = position - answerStartRow;
addNewField(); if (index == answersCount - 1 && answersCount < 10) {
} else { addNewField();
if (index == answersCount - 1) {
AndroidUtilities.hideKeyboard(cell.getTextView());
} else { } else {
holder = listView.findViewHolderForAdapterPosition(position + 1); if (index == answersCount - 1) {
if (holder != null && holder.itemView instanceof PollEditTextCell) { AndroidUtilities.hideKeyboard(cell.getTextView());
PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView; } else {
editTextCell.getTextView().requestFocus(); 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