1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-12 11:30:38 +01:00
This commit is contained in:
arm64v8a 2021-11-28 14:02:57 +08:00
parent 04e62a0c0a
commit 1ec3c9de1a
3 changed files with 18 additions and 7 deletions

View File

@ -14048,8 +14048,6 @@ public class MessagesController extends BaseController implements NotificationCe
}
public ArrayList<MessageObject> getSponsoredMessages(long dialogId) {
if (NekomuraConfig.hideSponsoredMessage.Bool())
return null;
SponsoredMessagesInfo info = sponsoredMessages.get(dialogId);
if (info != null && (info.loading || Math.abs(SystemClock.elapsedRealtime() - info.loadTime) <= 5 * 60 * 1000)) {
return info.messages;

View File

@ -64,6 +64,7 @@ import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.text.style.URLSpan;
import android.util.Log;
import android.util.Property;
import android.util.SparseArray;
import android.util.SparseIntArray;
@ -20394,7 +20395,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else {
if (!selectedObject.isAnimatedSticker()) {
items.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
options.add(nkbtn_savemessage);
options.add(nkbtn_stickerdl);
icons.add(R.drawable.baseline_image_24);
}
items.add(LocaleController.getString("AddToStickers", R.string.AddToStickers));
@ -23482,6 +23483,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void markSponsoredAsRead(MessageObject object) {
if (object.isSponsored() && NekomuraConfig.hideSponsoredMessage.Bool()) {
ArrayList<Integer> mids = new ArrayList<>();
mids.add(object.messageOwner.id);
AndroidUtilities.runOnUIThread(() -> NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.messagesDeleted, mids, -dialog_id, false));
}
if (!object.isSponsored() || object.viewsReloaded) {
return;
}
@ -23490,7 +23496,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
req.channel = MessagesController.getInputChannel(currentChat);
req.random_id = object.sponsoredId;
getConnectionsManager().sendRequest(req, (response, error) -> {
});
getMessagesController().markSponsoredAsRead(dialog_id, object);
}

View File

@ -29,7 +29,7 @@ object DnsFactory {
// behaviour: try all concurrently and stop when the first result returns.
"https://1.1.1.1/dns-query",
"https://1.0.0.1/dns-query",
"https://8.8.8.8/resolve",
"https://8.8.8.8/dns-query",
"https://101.101.101.101/dns-query",
"https://9.9.9.9/dns-query",
"https://185.222.222.222/dns-query",
@ -133,7 +133,11 @@ object DnsFactory {
it.resume(ret)
}
} catch (e: Exception) {
if (e is CustomException) FileLog.e(e)
if (e is CustomException) {
FileLog.e(e)
} else {
FileLog.w(e.stackTraceToString())
}
}
if (counterAll.incrementAndGet() == providers().size && counterGood.get() == 0) {
it.resume(null)
@ -222,7 +226,11 @@ object DnsFactory {
it.resume(ret)
}
} catch (e: Exception) {
if (e is CustomException) FileLog.e(e)
if (e is CustomException) {
FileLog.e(e)
} else {
FileLog.w(e.stackTraceToString())
}
}
if (counterAll.incrementAndGet() == providers().size && counterGood.get() == 0) {
//all failed