removed unused 'disable foreground' button

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/Config.java                         |  1 
src/main/java/eu/siacs/conversations/services/NotificationService.java   | 19 
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java |  5 
3 files changed, 25 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/Config.java 🔗

@@ -47,7 +47,6 @@ public final class Config {
 	public static final boolean FORCE_ORBOT = false; // always use TOR
 	public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false;
 	public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification
-	public static final boolean SHOW_DISABLE_FOREGROUND = false; //if set to true the foreground notification has a button to disable it
 
 	public static final boolean ALWAYS_NOTIFY_BY_DEFAULT = false;
 

src/main/java/eu/siacs/conversations/services/NotificationService.java 🔗

@@ -614,13 +614,6 @@ public class NotificationService {
 		return PendingIntent.getService(mXmppConnectionService, (conversation.getUuid().hashCode() % NOTIFICATION_ID_MULTIPLIER) + 16 * NOTIFICATION_ID_MULTIPLIER, intent, PendingIntent.FLAG_UPDATE_CURRENT);
 	}
 
-	private PendingIntent createDisableForeground() {
-		final Intent intent = new Intent(mXmppConnectionService,
-				XmppConnectionService.class);
-		intent.setAction(XmppConnectionService.ACTION_DISABLE_FOREGROUND);
-		return PendingIntent.getService(mXmppConnectionService, 34, intent, 0);
-	}
-
 	private PendingIntent createTryAgainIntent() {
 		final Intent intent = new Intent(mXmppConnectionService, XmppConnectionService.class);
 		intent.setAction(XmppConnectionService.ACTION_TRY_AGAIN);
@@ -701,18 +694,6 @@ public class NotificationService {
 		mBuilder.setWhen(0);
 		mBuilder.setPriority(Config.SHOW_CONNECTED_ACCOUNTS ? NotificationCompat.PRIORITY_DEFAULT : NotificationCompat.PRIORITY_MIN);
 		mBuilder.setSmallIcon(R.drawable.ic_link_white_24dp);
-		if (Config.SHOW_DISABLE_FOREGROUND) {
-			final int cancelIcon;
-			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-				mBuilder.setCategory(Notification.CATEGORY_SERVICE);
-				cancelIcon = R.drawable.ic_cancel_white_24dp;
-			} else {
-				cancelIcon = R.drawable.ic_action_cancel;
-			}
-			mBuilder.addAction(cancelIcon,
-					mXmppConnectionService.getString(R.string.disable_foreground_service),
-					createDisableForeground());
-		}
 		return mBuilder.build();
 	}
 

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -155,7 +155,6 @@ public class XmppConnectionService extends Service {
 	public static final String ACTION_REPLY_TO_CONVERSATION = "reply_to_conversations";
 	public static final String ACTION_MARK_AS_READ = "mark_as_read";
 	public static final String ACTION_CLEAR_NOTIFICATION = "clear_notification";
-	public static final String ACTION_DISABLE_FOREGROUND = "disable_foreground";
 	public static final String ACTION_DISMISS_ERROR_NOTIFICATIONS = "dismiss_error";
 	public static final String ACTION_TRY_AGAIN = "try_again";
 	public static final String ACTION_IDLE_PING = "idle_ping";
@@ -667,10 +666,6 @@ public class XmppConnectionService extends Service {
 						mNotificationService.clear();
 					}
 					break;
-				case ACTION_DISABLE_FOREGROUND:
-					getPreferences().edit().putBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE, false).commit();
-					toggleForegroundService();
-					break;
 				case ACTION_DISMISS_ERROR_NOTIFICATIONS:
 					dismissErrorNotifications();
 					break;