From 9a31443f90ddd5baba4a65cb9c06cff9af8a5c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=C2=A0Buczek?= Date: Thu, 23 Jan 2020 23:52:48 +0100 Subject: [PATCH] Ref #2151: At least one notification must show before we lock showing subsequent notifications. --- Client/Application/ClientPreferences.swift | 4 ++++ .../Browser/HomePanel/FavoritesViewController.swift | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Client/Application/ClientPreferences.swift b/Client/Application/ClientPreferences.swift index 7010573b37e..2406336a4a4 100644 --- a/Client/Application/ClientPreferences.swift +++ b/Client/Application/ClientPreferences.swift @@ -104,6 +104,10 @@ extension Preferences { /// Whether the iOS keyboard auto-opens on a NTP or not static let autoOpenKeyboard = Option(key: "newtabpage.auto-open-keyboard", default: false) + /// At least one notification must show before we lock showing subsequent notifications. + static let atleastOneNTPNotificationWasShowed = Option(key: "newtabpage.one-notificaiton-showed", + default: false) + /// Whether the callout to use branded image was shown. static let brandedImageShowed = Option(key: "newtabpage.branded-image-callout-showed", default: false) diff --git a/Client/Frontend/Browser/HomePanel/FavoritesViewController.swift b/Client/Frontend/Browser/HomePanel/FavoritesViewController.swift index da7ecbe04b3..0b65dfe6e41 100644 --- a/Client/Frontend/Browser/HomePanel/FavoritesViewController.swift +++ b/Client/Frontend/Browser/HomePanel/FavoritesViewController.swift @@ -181,8 +181,11 @@ class FavoritesViewController: UIViewController, Themeable { $0.removeObserver(self, name: .privacyModeChanged, object: nil) } - // Navigating away from NTP counts the current notification as showed. - Preferences.NewTabPage.brandedImageShowed.value = true + + if Preferences.NewTabPage.atleastOneNTPNotificationWasShowed.value { + // Navigating away from NTP counts the current notification as showed. + Preferences.NewTabPage.brandedImageShowed.value = true + } } override func viewDidLoad() { @@ -297,6 +300,7 @@ class FavoritesViewController: UIViewController, Themeable { } vc = notificationVC + Preferences.NewTabPage.atleastOneNTPNotificationWasShowed.value = true case .claimRewards: if !Preferences.NewTabPage.attemptToShowClaimRewardsNotification.value { return }