Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit ed8e8d4

Browse files
authored
[IB-1891} Load first tab in viewDidAppear (#384)
1 parent 8f8779b commit ed8e8d4

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

Client/Frontend/Browser/BrowserViewController.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,6 @@ class BrowserViewController: UIViewController {
575575

576576
updateTabCountUsingTabManager(tabManager, animated: false)
577577
clipboardBarDisplayHandler?.checkIfShouldDisplayBar()
578-
//Cliqz: Open new tab and show update info page first time after update
579-
#if CLIQZ
580-
self.showCliqzUpdateInfoPageFirstTime()
581-
#endif
582-
//Cliqz: end
583578
}
584579

585580
fileprivate func crashedLastLaunch() -> Bool {
@@ -635,6 +630,11 @@ class BrowserViewController: UIViewController {
635630
}
636631
showQueuedAlertIfAvailable()
637632

633+
//Cliqz: Open new tab and show update info page first time after update
634+
#if CLIQZ
635+
self.showCliqzUpdateInfoPageFirstTime()
636+
#endif
637+
//Cliqz: end
638638
}
639639

640640
// THe logic for shouldShowWhatsNewTab is as follows: If we do not have the LatestAppVersionProfileKey in
@@ -2287,7 +2287,14 @@ extension BrowserViewController: UIAdaptivePresentationControllerDelegate {
22872287
}
22882288

22892289
extension BrowserViewController: IntroViewControllerDelegate {
2290+
/// Needs documentation: What does the return value mean?
22902291
@discardableResult func presentIntroViewController(_ force: Bool = false, animated: Bool = true) -> Bool {
2292+
//Cliqz: This is temporary. We should remove this once we have an Intro.
2293+
if let deeplink = self.profile.prefs.stringForKey("AdjustDeeplinkKey"), let url = URL(string: deeplink) {
2294+
self.launchFxAFromDeeplinkURL(url)
2295+
return true
2296+
}
2297+
22912298
// Cliqz: Don't show onboarding for Cliqz for now
22922299
#if CLIQZ
22932300
// Setup Default Blocking Settings
@@ -2299,12 +2306,6 @@ extension BrowserViewController: IntroViewControllerDelegate {
22992306
#endif
23002307
// End Cliqz
23012308

2302-
//Cliqz: This is temporary. We should remove this once we have an Intro.
2303-
if let deeplink = self.profile.prefs.stringForKey("AdjustDeeplinkKey"), let url = URL(string: deeplink) {
2304-
self.launchFxAFromDeeplinkURL(url)
2305-
return true
2306-
}
2307-
23082309
if force || profile.prefs.intForKey(PrefsKeys.IntroSeen) == nil {
23092310
#if PAID
23102311
let introViewController = LumenIntroViewController()

Cliqz/Extensions/BrowserViewController/BrowserViewController+CliqzMigration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ extension BrowserViewController {
3131
}
3232

3333
private func isUpdateInfoPageSeen() -> Bool {
34-
if let _ = LocalDataStore.value(forKey: BrowserViewController.updateSeenKey) {
34+
if let updateSeen = LocalDataStore.integer(forKey: BrowserViewController.updateSeenKey), updateSeen == 1 {
3535
return true
3636
}
3737
return false
3838
}
3939

4040
private func markUpdateInfoPageSeen() {
41-
LocalDataStore.set(value: true, forKey: BrowserViewController.updateSeenKey)
41+
LocalDataStore.set(integer: 1, forKey: BrowserViewController.updateSeenKey)
4242
}
4343

4444
}

Cliqz/Services/LocalDataStore.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,19 @@ class LocalDataStore {
1515
defaults.set(value, forKey: forKey)
1616
defaults.synchronize()
1717
}
18+
19+
class func set(integer: Int, forKey: String) {
20+
defaults.set(integer, forKey: forKey)
21+
defaults.synchronize()
22+
}
1823

1924
class func value(forKey: String) -> Any? {
2025
return defaults.value(forKey: forKey) as Any?
2126
}
27+
28+
class func integer(forKey: String) -> Int? {
29+
return defaults.integer(forKey: forKey)
30+
}
2231

2332
class func removeObject(forKey: String) {
2433
defaults.removeObject(forKey: forKey)

0 commit comments

Comments
 (0)