fix: enableAds -> disableAds

This commit is contained in:
ZavaruKitsu
2023-07-21 17:51:49 +00:00
parent ffbf90a0fb
commit 65a149002f
4 changed files with 14 additions and 26 deletions

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -24,9 +24,8 @@
<string name="MessageSavingSaveReactions">Save reactions</string>
<string name="MessageSavingSaveForBots">Save in bot dialogs</string>
<string name="QoLTogglesHeader">Useful features</string>
<string name="ShowFromChannel">Show «channel» label</string>
<string name="KeepAliveService">AyuGram Push Service</string>
<string name="EnableAds">Enable ads</string>
<string name="DisableAds">Disable ads</string>
<string name="LocalPremium">Local Telegram Premium</string>
<string name="CustomizationHeader">Customization</string>
<string name="DeletedMarkText">Deleted mark</string>