Commit 8baa47c5 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

Fixing impression count for settings.

The "ImpressionsTilDismiss" should be sent only when the setting view
is closed (it was sent when going into a submenu of the settings).
The display count should only be increased when opening the settings.
Before it was increased for each data reload of the collection view.

Bug: 709286
Change-Id: I301f96241f7704aa01695fc41e841364fca1f80a
Reviewed-on: https://chromium-review.googlesource.com/563389
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarLouis Romero <lpromero@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485574}
parent d8ef1cd7
...@@ -292,6 +292,14 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id, ...@@ -292,6 +292,14 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id,
- (void)dealloc { - (void)dealloc {
[self stopBrowserStateServiceObservers]; [self stopBrowserStateServiceObservers];
if (!_signinStarted && _signinPromoViewMediator) {
PrefService* prefs = _browserState->GetPrefs();
int displayedCount =
prefs->GetInteger(prefs::kIosSettingsSigninPromoDisplayedCount);
UMA_HISTOGRAM_COUNTS_100(
"MobileSignInPromo.SettingsManager.ImpressionsTilDismiss",
displayedCount);
}
} }
- (void)stopBrowserStateServiceObservers { - (void)stopBrowserStateServiceObservers {
...@@ -315,18 +323,6 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id, ...@@ -315,18 +323,6 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id,
[self updateSearchCell]; [self updateSearchCell];
} }
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
if (!_signinStarted && _signinPromoViewMediator) {
PrefService* prefs = _browserState->GetPrefs();
int displayedCount =
prefs->GetInteger(prefs::kIosSettingsSigninPromoDisplayedCount);
UMA_HISTOGRAM_COUNTS_100(
"MobileSignInPromo.SettingsManager.ImpressionsTilDismiss",
displayedCount);
}
}
#pragma mark SettingsRootCollectionViewController #pragma mark SettingsRootCollectionViewController
- (void)loadModel { - (void)loadModel {
...@@ -351,11 +347,13 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id, ...@@ -351,11 +347,13 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id,
prefs->GetInteger(prefs::kIosSettingsSigninPromoDisplayedCount); prefs->GetInteger(prefs::kIosSettingsSigninPromoDisplayedCount);
if (experimental_flags::IsSigninPromoEnabled() && if (experimental_flags::IsSigninPromoEnabled() &&
displayedCount < kAutomaticSigninPromoViewDismissCount) { displayedCount < kAutomaticSigninPromoViewDismissCount) {
_signinPromoViewMediator = if (!_signinPromoViewMediator) {
[[SigninPromoViewMediator alloc] initWithBrowserState:_browserState]; _signinPromoViewMediator = [[SigninPromoViewMediator alloc]
_signinPromoViewMediator.consumer = self; initWithBrowserState:_browserState];
prefs->SetInteger(prefs::kIosSettingsSigninPromoDisplayedCount, _signinPromoViewMediator.consumer = self;
displayedCount + 1); prefs->SetInteger(prefs::kIosSettingsSigninPromoDisplayedCount,
displayedCount + 1);
}
} }
[model addItem:[self signInTextItem] [model addItem:[self signInTextItem]
toSectionWithIdentifier:SectionIdentifierSignIn]; toSectionWithIdentifier:SectionIdentifierSignIn];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment