Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYi0526 committed Mar 9, 2024
2 parents 13bbc37 + 774ee4d commit 1e592cf
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 6 deletions.
4 changes: 2 additions & 2 deletions TMessagesProj/jni/tgnet/ConnectionsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3786,12 +3786,12 @@ void ConnectionsManager::checkProxyInternal(ProxyCheckInfo *proxyCheckInfo) {
Datacenter *datacenter = getDatacenterWithId(DEFAULT_DATACENTER_ID);
Connection *connection = datacenter->getProxyConnection((uint8_t) freeConnectionNum, true, false);
if (connection != nullptr) {
connection->setOverrideProxy(proxyCheckInfo->address, proxyCheckInfo->port, proxyCheckInfo->username, proxyCheckInfo->password, proxyCheckInfo->secret);
if (proxyCheckInfo->address != "ping.neko") connection->setOverrideProxy(proxyCheckInfo->address, proxyCheckInfo->port, proxyCheckInfo->username, proxyCheckInfo->password, proxyCheckInfo->secret);
connection->suspendConnection();
proxyCheckInfo->connectionNum = freeConnectionNum;
auto request = new TL_ping();
request->ping_id = proxyCheckInfo->pingId;
proxyCheckInfo->requestToken = sendRequest(request, nullptr, nullptr, nullptr, RequestFlagEnableUnauthorized | RequestFlagWithoutLogin, DEFAULT_DATACENTER_ID, connectionType, true, 0);
proxyCheckInfo->requestToken = sendRequest(request, nullptr, nullptr, nullptr, RequestFlagEnableUnauthorized | RequestFlagWithoutLogin, proxyCheckInfo->address != "ping.neko" ? DEFAULT_DATACENTER_ID : proxyCheckInfo->port, connectionType, true, 0);
proxyActiveChecks.push_back(std::unique_ptr<ProxyCheckInfo>(proxyCheckInfo));
} else if (PFS_ENABLED) {
if (datacenter->isHandshaking(false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,9 @@ public boolean onFragmentCreate() {
hasQuickReplies = false;
if (currentUser != null && chatMode == 0 && !currentUser.bot) {
QuickRepliesController.getInstance(currentAccount).load();
// hasQuickReplies = QuickRepliesController.getInstance(currentAccount).hasReplies();
if (NaConfig.INSTANCE.getShowQuickReplyInBotCommands().Bool()) {
hasQuickReplies = QuickRepliesController.getInstance(currentAccount).hasReplies();
}
}
} else if (encId != 0) {
currentEncryptedChat = getMessagesController().getEncryptedChat(encId);
Expand Down
16 changes: 14 additions & 2 deletions TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2774,7 +2774,15 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool
FileLog.e(e);
}
} else if (url.startsWith("tg:upgrade") || url.startsWith("tg://upgrade") || url.startsWith("tg:update") || url.startsWith("tg://update")) {
checkAppUpdate(true, null);
boolean updateAlways = false;
try {
url = url.replace("tg:upgrade", "tg://telegram.org").replace("tg://upgrade", "tg://telegram.org").replace("tg:update", "tg://telegram.org").replace("tg://update", "tg://telegram.org");
data = Uri.parse(url);
updateAlways = data.getQueryParameter("always") != null && "true".equals(data.getQueryParameter("always"));
} catch (Exception e) {
FileLog.e(e);
}
checkAppUpdate(true, null, updateAlways);
} else if (url.startsWith("tg:neko") || url.startsWith("tg://neko")) {
url = url.replace("tg:neko", "tg://t.me/nasettings").replace("tg://neko", "tg://t.me/nasettings");
data = Uri.parse(url);
Expand Down Expand Up @@ -5482,6 +5490,10 @@ private List<TLRPC.TL_contact> findContacts(String userName, String userPhone, b
}

public void checkAppUpdate(boolean force, Browser.Progress progress) {
checkAppUpdate(force, progress, false);
}

public void checkAppUpdate(boolean force, Browser.Progress progress, boolean updateAlways) {
// if (BuildVars.isFdroid || BuildVars.isPlay) return;
// if (NekoXConfig.autoUpdateReleaseChannel == 0) return;
// if (!force && System.currentTimeMillis() < NekoConfig.lastUpdateCheckTime.Long() + 48 * 60 * 60 * 1000L) return;
Expand Down Expand Up @@ -5551,7 +5563,7 @@ public void checkAppUpdate(boolean force, Browser.Progress progress) {
progress.end();
}
});
});
}, updateAlways);
if (progress != null) {
progress.init();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public static UpdateHelper getInstance() {
return InstanceHolder.instance;
}

private boolean updateAlways = false;

@Override
protected void onError(String text, Delegate delegate) {
delegate.onTLResponse(null, text);
Expand Down Expand Up @@ -67,7 +69,10 @@ private Update getShouldUpdateVersion(List<JSONObject> responses) {
for (var string : responses) {
try {
int version_code = string.getInt("version_code");
if (version_code > maxVersion) {
if (version_code > maxVersion || updateAlways) {
if (updateAlways) {
updateAlways = false;
}
maxVersion = version_code;
ref = new Update(
string.getBoolean("can_not_skip"),
Expand Down Expand Up @@ -166,10 +171,15 @@ protected void onLoadSuccess(ArrayList<JSONObject> responses, Delegate delegate)
}

public void checkNewVersionAvailable(Delegate delegate) {
checkNewVersionAvailable(delegate, false);
}

public void checkNewVersionAvailable(Delegate delegate, boolean updateAlways_) {
if (NekoXConfig.autoUpdateReleaseChannel == 0) {
delegate.onTLResponse(null, null);
return;
}
updateAlways = updateAlways_;
load(delegate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public class NekoChatSettingsActivity extends BaseNekoXSettingsActivity implemen
private final AbstractConfigCell doNotUnarchiveBySwipeRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDoNotUnarchiveBySwipe()));
private final AbstractConfigCell disableMarkdownRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableMarkdown()));
private final AbstractConfigCell disableClickCommandToSendRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableClickCommandToSend(), LocaleController.getString(R.string.DisableClickCommandToSendHint)));
private final AbstractConfigCell showQuickReplyInBotCommandsRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowQuickReplyInBotCommands()));
private final AbstractConfigCell dividerInteractions = cellGroup.appendCell(new ConfigCellDivider());

// Sticker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,12 @@ object NaConfig {
ConfigItem.configTypeBool,
false
)
val showQuickReplyInBotCommands =
addConfig(
"ShowQuickReplyInBotCommands",
ConfigItem.configTypeBool,
false
)

private fun addConfig(
k: String,
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@
<string name="DisableDialogsFloatingButton">禁用主页浮动按钮</string>
<string name="DisableFlagSecure">Disable Flag Secure</string>
<string name="CenterActionBarTitle">标题居中</string>
<string name="ShowQuickReplyInBotCommands">在输入框中显示快速回复按钮</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@
<string name="DisableDialogsFloatingButton">Disable Dialogs Floating Button</string>
<string name="DisableFlagSecure">Disable Flag Secure</string>
<string name="CenterActionBarTitle">Center title in action bar</string>
<string name="ShowQuickReplyInBotCommands">Show Quick Reply In Bot Commands</string>
</resources>

0 comments on commit 1e592cf

Please sign in to comment.