Skip to content

Commit

Permalink
[TF][PUSH] remove one of the confusing toggles
Browse files Browse the repository at this point in the history
  • Loading branch information
thermatk committed Aug 16, 2020
1 parent f308615 commit 9c9e22b
Showing 1 changed file with 3 additions and 10 deletions.
Expand Up @@ -173,7 +173,6 @@ public boolean onFragmentCreate() {
otherSection2Row = rowCount++;

otherSectionRow = rowCount++;
notificationsServiceRow = rowCount++;
notificationsServiceConnectionRow = rowCount++;
androidAutoAlertRow = -1;
repeatRow = rowCount++;
Expand Down Expand Up @@ -549,12 +548,15 @@ public boolean supportsPredictiveItemAnimations() {
enabled = preferences.getBoolean("pushConnection", getMessagesController().backgroundConnection);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("pushConnection", !enabled);
enabled = preferences.getBoolean("pushService", getMessagesController().keepAliveService);
editor.putBoolean("pushService", !enabled);
editor.commit();
if (!enabled) {
ConnectionsManager.getInstance(currentAccount).setPushConnectionEnabled(true);
} else {
ConnectionsManager.getInstance(currentAccount).setPushConnectionEnabled(false);
}
ApplicationLoader.startPushService();
} else if (position == accountsAllRow) {
SharedPreferences preferences = MessagesController.getGlobalNotificationsSettings();
enabled = preferences.getBoolean("AllAccounts", true);
Expand All @@ -573,13 +575,6 @@ public boolean supportsPredictiveItemAnimations() {
}
}
}
} else if (position == notificationsServiceRow) {
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
enabled = preferences.getBoolean("pushService", getMessagesController().keepAliveService);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("pushService", !enabled);
editor.commit();
ApplicationLoader.startPushService();
} else if (position == callsVibrateRow) {
if (getParentActivity() == null) {
return;
Expand Down Expand Up @@ -822,8 +817,6 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
checkCell.setTextAndCheck(LocaleController.getString("PinnedMessages", R.string.PinnedMessages), preferences.getBoolean("PinnedMessages", true), false);
} else if (position == androidAutoAlertRow) {
checkCell.setTextAndCheck("Android Auto", preferences.getBoolean("EnableAutoNotifications", false), true);
} else if (position == notificationsServiceRow) {
checkCell.setTextAndValueAndCheck(LocaleController.getString("NotificationsService", R.string.NotificationsService), "You won't be notified of new messages, if you disable this", preferences.getBoolean("pushService", getMessagesController().keepAliveService), true, true);
} else if (position == notificationsServiceConnectionRow) {
checkCell.setTextAndValueAndCheck(LocaleController.getString("NotificationsServiceConnection", R.string.NotificationsServiceConnection), "You won't be notified of new messages, if you disable this", preferences.getBoolean("pushConnection", getMessagesController().backgroundConnection), true, true);
} else if (position == badgeNumberShowRow) {
Expand Down

0 comments on commit 9c9e22b

Please sign in to comment.