Skip to content
This repository has been archived by the owner. It is now read-only.

[IP-618] [Search] Onboarding for existing users #397

Merged
merged 7 commits into from Jul 22, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

fixed onboarding showing logic

  • Loading branch information
Pavel
Pavel committed Jul 22, 2019
commit 6b00ec0fc0b122ebb3b601015d26ebc15526699f
@@ -915,7 +915,7 @@ class BrowserViewController: UIViewController {
searchController!.didMove(toParentViewController: self)
*/
let shouldShowCliqzSearch = SettingsPrefs.shared.getCliqzSearchPref() || UserPreferences.instance.showSearchOnboarding
let shouldShowCliqzSearch = SettingsPrefs.shared.getCliqzSearchPref() || self.shouldShowSearchOnboarding()
if (searchController != nil && !shouldShowCliqzSearch) ||
(cliqzSearchController != nil && shouldShowCliqzSearch){
return
@@ -924,8 +924,14 @@ class BrowserViewController: UIViewController {
searchLoader = SearchLoader(profile: profile, urlBar: urlBar)
searchLoader!.addListener(HistoryListener.shared)

// TODO:PK add telemetry
if shouldShowCliqzSearch {
if self.shouldShowSearchOnboarding() {
LegacyTelemetryHelper.logOnboarding(action: "show", topic: "search")
} else {
/// Never show onboarding if Lumen was already a search engine
UserPreferences.instance.showSearchOnboarding = false
}

homePanelController?.view?.isHidden = true

cliqzSearchController = CliqzSearchViewController(profile: self.profile)
@@ -1002,6 +1008,12 @@ class BrowserViewController: UIViewController {
}
}

private func shouldShowSearchOnboarding() -> Bool {
let showOboarding = UserPreferences.instance.showSearchOnboarding
let isLumenDefault = SettingsPrefs.shared.isLumenDefaultSearchEngine
return showOboarding && !isLumenDefault
}

func hideSearchController() {
/*Cliqz: Hide cliqzSearch or firefoxSearch
if let searchController = searchController {
@@ -96,7 +96,8 @@ class JSBridge : RCTEventEmitter {

@objc(getConfig:reject:)
func getConfig(resolve: @escaping RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) {
resolve(["onboarding": UserPreferences.instance.showSearchOnboarding])
let shouldShowOnboarding = UserPreferences.instance.showSearchOnboarding && !SettingsPrefs.shared.isLumenDefaultSearchEngine
resolve(["onboarding": shouldShowOnboarding])
}

/// Call an action over the JSBridge and execute a callback with the result. Invokation of the callback is
ProTip! Use n and p to navigate between commits in a pull request.