diff --git a/TMessagesProj/src/main/java/com/radolyn/ayugram/AyuConfig.java b/TMessagesProj/src/main/java/com/radolyn/ayugram/AyuConfig.java index 3608e39d7..2818a8cb6 100644 --- a/TMessagesProj/src/main/java/com/radolyn/ayugram/AyuConfig.java +++ b/TMessagesProj/src/main/java/com/radolyn/ayugram/AyuConfig.java @@ -43,7 +43,7 @@ public class AyuConfig { public static boolean markReadAfterSend; public static boolean keepAliveService; - public static boolean enableAds; + public static boolean disableAds; public static boolean localPremium; public static boolean regexFiltersEnabled; public static boolean regexFiltersInChats; @@ -73,10 +73,9 @@ public class AyuConfig { sendReadPackets = preferences.getBoolean("sendReadPackets", true); sendOnlinePackets = preferences.getBoolean("sendOnlinePackets", true); sendUploadProgress = preferences.getBoolean("sendUploadProgress", true); - sendOfflinePacketAfterOnline = preferences.getBoolean("sendOfflinePacketAfterOnline", false); - markReadAfterSend = preferences.getBoolean("markReadAfterSend", true); + markReadAfterSend = preferences.getBoolean("markReadAfterSend", true); useScheduledMessages = preferences.getBoolean("useScheduledMessages", false); // ~ Message edits & deletion history @@ -97,7 +96,7 @@ public class AyuConfig { // ~ Useful features keepAliveService = preferences.getBoolean("keepAliveService", true); - enableAds = preferences.getBoolean("enableAds", false); + disableAds = preferences.getBoolean("disableAds", true); localPremium = preferences.getBoolean("localPremium", false); regexFiltersEnabled = preferences.getBoolean("regexFiltersEnabled", false); regexFiltersInChats = preferences.getBoolean("regexFiltersInChats", false); diff --git a/TMessagesProj/src/main/java/com/radolyn/ayugram/ui/preferences/AyuGramPreferencesActivity.java b/TMessagesProj/src/main/java/com/radolyn/ayugram/ui/preferences/AyuGramPreferencesActivity.java index 9fae51130..75a6d173a 100644 --- a/TMessagesProj/src/main/java/com/radolyn/ayugram/ui/preferences/AyuGramPreferencesActivity.java +++ b/TMessagesProj/src/main/java/com/radolyn/ayugram/ui/preferences/AyuGramPreferencesActivity.java @@ -53,7 +53,7 @@ public class AyuGramPreferencesActivity extends BasePreferencesActivity implemen private int qolHeaderRow; private int keepAliveServiceRow; - private int enableAdsRow; + private int disableAdsRow; private int localPremiumRow; private int filtersRow; private int qolDividerRow; @@ -107,7 +107,7 @@ public class AyuGramPreferencesActivity extends BasePreferencesActivity implemen qolHeaderRow = newRow(); keepAliveServiceRow = newRow(); - enableAdsRow = newRow(); + disableAdsRow = newRow(); localPremiumRow = newRow(); filtersRow = newRow(); qolDividerRow = newRow(); @@ -251,20 +251,11 @@ public class AyuGramPreferencesActivity extends BasePreferencesActivity implemen } else if (position == keepAliveServiceRow) { AyuConfig.editor.putBoolean("keepAliveService", AyuConfig.keepAliveService ^= true).apply(); ((TextCheckCell) view).setChecked(AyuConfig.keepAliveService); - } else if (position == enableAdsRow) { - AyuConfig.editor.putBoolean("enableAds", AyuConfig.enableAds ^= true).apply(); - ((TextCheckCell) view).setChecked(AyuConfig.enableAds); - - if (AyuConfig.enableAds && AyuConfig.localPremium) { - toggleLocalPremium(); - } + } else if (position == disableAdsRow) { + AyuConfig.editor.putBoolean("disableAds", AyuConfig.disableAds ^= true).apply(); + ((TextCheckCell) view).setChecked(AyuConfig.disableAds); } else if (position == localPremiumRow) { toggleLocalPremium(); - - if (AyuConfig.localPremium && AyuConfig.enableAds) { - AyuConfig.editor.putBoolean("enableAds", AyuConfig.enableAds ^= true).apply(); - listAdapter.notifyItemChanged(enableAdsRow, false); - } } else if (position == filtersRow) { NotificationsCheckCell checkCell = (NotificationsCheckCell) view; if (LocaleController.isRTL && x <= AndroidUtilities.dp(76) || !LocaleController.isRTL && x >= view.getMeasuredWidth() - AndroidUtilities.dp(76)) { @@ -419,8 +410,8 @@ public class AyuGramPreferencesActivity extends BasePreferencesActivity implemen textCheckCell.setTextAndCheck(LocaleController.getString(R.string.SaveMessagesHistory), AyuConfig.saveMessagesHistory, false); } else if (position == keepAliveServiceRow) { textCheckCell.setTextAndCheck(LocaleController.getString(R.string.KeepAliveService), AyuConfig.keepAliveService, true); - } else if (position == enableAdsRow) { - textCheckCell.setTextAndCheck(LocaleController.getString(R.string.EnableAds), AyuConfig.enableAds, true); + } else if (position == disableAdsRow) { + textCheckCell.setTextAndCheck(LocaleController.getString(R.string.DisableAds), AyuConfig.disableAds, true); } else if (position == localPremiumRow) { textCheckCell.setTextAndCheck(LocaleController.getString(R.string.LocalPremium) + " β", AyuConfig.localPremium, true); } else if (position == showGhostToggleInDrawerRow) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index f189e98fe..ac0a6a880 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -18863,7 +18863,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (messageObject.sponsoredChannelPost != 0) { messageId = messageObject.sponsoredChannelPost; } - if (AyuConfig.enableAds) { + if (!AyuConfig.disableAds) { getMessagesController().ensureMessagesLoaded(dialogId, messageId, null); } else { if (!messageObject.isSponsored()) { @@ -18875,7 +18875,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } sponsoredMessagesAdded = true; - if (AyuConfig.enableAds) { + if (!AyuConfig.disableAds) { sponsoredMessagesPostsBetween = res.posts_between != null ? res.posts_between : 0; if (notPushedSponsoredMessages != null) { notPushedSponsoredMessages.clear(); @@ -19924,7 +19924,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private int getSponsoredMessagesCount() { - if (AyuConfig.enableAds) { + if (!AyuConfig.disableAds) { int sponsoredMessagesCount = 0; while (sponsoredMessagesCount < messages.size()) { if (!messages.get(sponsoredMessagesCount).isSponsored()) { @@ -19935,7 +19935,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return sponsoredMessagesCount; } - // !AyuConfig.enableAds return 0; } diff --git a/TMessagesProj/src/main/res/values/ayu.xml b/TMessagesProj/src/main/res/values/ayu.xml index d20b6ad65..1be9b9045 100644 --- a/TMessagesProj/src/main/res/values/ayu.xml +++ b/TMessagesProj/src/main/res/values/ayu.xml @@ -24,9 +24,8 @@ Save reactions Save in bot dialogs Useful features - Show «channel» label AyuGram Push Service - Enable ads + Disable ads Local Telegram Premium Customization Deleted mark