-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix FXIOS-7646 [v120] The 3rd CFR is not displayed #17172
Bugfix FXIOS-7646 [v120] The 3rd CFR is not displayed #17172
Conversation
Client/Frontend/Browser/BrowserViewController/BrowserViewController+URLBarDelegate.swift
Outdated
Show resolved
Hide resolved
@@ -113,6 +113,7 @@ struct ContextualHintEligibilityUtility: ContextualHintEligibilityUtilityProtoco | |||
if cfrCounter <= 2, !hasOptedIn, hasTimePassed { | |||
// - Display CFR-1 | |||
profile.prefs.setInt(cfrCounter + 1, forKey: PrefsKeys.ContextualHints.shoppingOnboardingCFRsCounterKey.rawValue) | |||
profile.prefs.setTimestamp(Date.now(), forKey: PrefsKeys.FakespotLastCFRTimestamp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the tests for canPresentShoppingCFR
be adjusted to represent this new addition?
…ttps://github.com/PARAIPAN9/firefox-ios into sparaipan/fxios-7646-The-3rd-CFR-is-not-displayed
BrowserKit/Sources/ComponentLibrary/ContextualHintView/ContextualHintView.swift
Show resolved
Hide resolved
Just wanna say LGTM from my side for the comments I made |
@@ -75,6 +77,18 @@ public class ContextualHintView: UIView, ThemeApplicable { | |||
public func configure(viewModel: ContextualHintViewModel) { | |||
self.viewModel = viewModel | |||
|
|||
let actionButtonViewModel = LinkButtonViewModel( | |||
title: viewModel.actionButtonTitle, | |||
a11yIdentifier: "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please add an a11y id here?
let actionButtonViewModel = LinkButtonViewModel( | ||
title: viewModel.actionButtonTitle, | ||
a11yIdentifier: "", | ||
contentInsets: NSDirectionalEdgeInsets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contentInsets
should be defined in the UX
struct.
Client.app: Coverage: 32.6
WidgetKitExtension.appex: Coverage: 23.17
Generated by 🚫 Danger Swift against 5ece51e |
@Mergifyio backport release/v120 |
✅ Backports have been created
|
* Use one instance for the shopping CFR * Rename contextHintVC and add new unit test * Initialize shopping contextual hint in init of BVC * Fix crash that can happen when manually changing time on the device * Fix stackview layout by using UIButton configuration * Change UIButton to LinkButton * Remove configuration from actionButton * Add a11y id and move button insets to UX struct --------- Co-authored-by: Winnie Teichmann <[email protected]> (cherry picked from commit 7d43a40)
* Use one instance for the shopping CFR * Rename contextHintVC and add new unit test * Initialize shopping contextual hint in init of BVC * Fix crash that can happen when manually changing time on the device * Fix stackview layout by using UIButton configuration * Change UIButton to LinkButton * Remove configuration from actionButton * Add a11y id and move button insets to UX struct --------- Co-authored-by: Winnie Teichmann <[email protected]> (cherry picked from commit 7d43a40) Co-authored-by: PARAIPAN SORIN <[email protected]>
📜 Tickets
Jira ticket
Github issue
💡 Description
Changes in this PR:
I've noticed that the 'urlBarPresentCFR' is being called multiple times, leading to the creation of multiple 'contextualVCs.' This not only disrupts the logic but also causes memory leaks. Ensuring that we work with the same reference can help us avoid redundant calls to the 'canPresent' method in 'ContextualHintEligibilityUtility,' thereby preventing user prefs issues and memory leaks.
Additionally, after the second 'CFR' is displayed, I reset the timestamp. Otherwise, if 24 hours have passed, two 'CFRs' might appear consecutively.
📝 Checklist
You have to check all boxes before merging