Bug 1159718 - Remove notification when 'quick open' is activated in Tab Queue (r=mcomella)

This commit is contained in:
Martyn Haigh 2015-05-05 17:04:00 +01:00
Родитель 0367f94a69
Коммит 0412129907
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -201,9 +201,7 @@ public class TabQueueHelper {
public static void openQueuedUrls(final Context context, final GeckoProfile profile, final String filename, boolean shouldPerformJavaScriptCallback) {
ThreadUtils.assertNotOnUiThread();
// Remove the notification.
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(TAB_QUEUE_NOTIFICATION_ID);
removeNotification(context);
// exit early if we don't have any tabs queued
if (getTabQueueLength(context) < 1) {
@ -235,6 +233,11 @@ public class TabQueueHelper {
prefs.edit().remove(PREF_TAB_QUEUE_COUNT).apply();
}
protected static void removeNotification(Context context) {
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(TAB_QUEUE_NOTIFICATION_ID);
}
public static void processTabQueuePromptResponse(int resultCode, Context context) {
final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
final SharedPreferences.Editor editor = prefs.edit();

Просмотреть файл

@ -194,6 +194,8 @@ public class TabQueueService extends Service {
forwardIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(forwardIntent);
TabQueueHelper.removeNotification(getApplicationContext());
GeckoSharedPrefs.forApp(getApplicationContext()).edit().remove(GeckoPreferences.PREFS_TAB_QUEUE_LAST_SITE)
.remove(GeckoPreferences.PREFS_TAB_QUEUE_LAST_TIME)
.apply();