Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 3a583e8

Browse files
author
Krzysztof Jan Modras
authored
Home page design (#873)
* Background image mask * Handle disabled news * No toolbar wrapper on big screen * Hide urlbar on Home page * New Cliqz logo * Nicer Home layout * tuning design * disabling failing tests * fixing detox tests
1 parent 27f408f commit 3a583e8

File tree

16 files changed

+104
-71
lines changed

16 files changed

+104
-71
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
{
22
"images" : [
33
{
4-
"idiom" : "universal",
5-
"filename" : "[email protected]",
6-
"scale" : "1x"
7-
},
8-
{
9-
"idiom" : "universal",
10-
"filename" : "[email protected]",
11-
"scale" : "2x"
12-
},
13-
{
14-
"idiom" : "universal",
15-
"filename" : "[email protected]",
16-
"scale" : "3x"
4+
"filename" : "cliqz-white-logo.pdf",
5+
"idiom" : "universal"
176
}
187
],
198
"info" : {
20-
"version" : 1,
21-
"author" : "xcode"
9+
"author" : "xcode",
10+
"version" : 1
2211
}
23-
}
12+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "mobile-bg-vignette.png",
5+
"idiom" : "universal"
6+
},
7+
{
8+
"filename" : "mobile-bg-vignette-ipad.png",
9+
"idiom" : "ipad"
10+
}
11+
],
12+
"info" : {
13+
"author" : "xcode",
14+
"version" : 1
15+
}
16+
}
Loading
Loading

Client/Frontend/Browser/BrowserViewController.swift

+17-20
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class BrowserViewController: UIViewController {
6161
fileprivate(set) var toolbar: TabToolbar?
6262
var searchController: SearchResultsViewController?
6363
var screenshotHelper: ScreenshotHelper!
64-
fileprivate var homePanelIsInline = false
6564
var notchAreaCover: UIVisualEffectView = {
6665
return UIVisualEffectView()
6766
}()
@@ -373,7 +372,6 @@ class BrowserViewController: UIViewController {
373372
// set things up. Make sure to only update the toolbar state if the view is ready for it.
374373
if isViewLoaded {
375374
updateToolbarStateForTraitCollection(newCollection, withTransitionCoordinator: coordinator)
376-
self.homePanelIsInline = self.shouldShowFooterForTraitCollection(newCollection)
377375
self.updateViewConstraints()
378376
}
379377

@@ -445,7 +443,6 @@ class BrowserViewController: UIViewController {
445443

446444
override func viewDidLoad() {
447445
super.viewDidLoad()
448-
self.homePanelIsInline = self.shouldShowFooterForTraitCollection(self.traitCollection)
449446
NotificationCenter.default.addObserver(self, selector: #selector(appWillResignActiveNotification), name: UIApplication.willResignActiveNotification, object: nil)
450447
NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActiveNotification), name: UIApplication.didBecomeActiveNotification, object: nil)
451448
NotificationCenter.default.addObserver(self, selector: #selector(appDidEnterBackgroundNotification), name: UIApplication.didEnterBackgroundNotification, object: nil)
@@ -748,17 +745,18 @@ class BrowserViewController: UIViewController {
748745
// Remake constraints even if we're already showing the home controller.
749746
// The home controller may change sizes if we tap the URL bar while on about:home.
750747
homeViewController?.view.snp.remakeConstraints { make in
751-
make.top.equalTo(self.urlBar.snp.bottom)
748+
if self.toolbar != nil {
749+
make.top.equalTo(self.view.safeArea.top)
750+
} else {
751+
make.top.equalTo(self.urlBar.snp.bottom)
752+
}
753+
752754
make.left.right.equalTo(self.view)
753755

754756
make.bottom.equalTo(self.view.snp.bottom)
755757
}
756758

757-
if self.homePanelIsInline {
758-
self.view.bringSubviewToFront(self.footer)
759-
} else {
760-
self.view.sendSubviewToBack(self.footer)
761-
}
759+
self.view.bringSubviewToFront(self.footer)
762760

763761
alertStackView.snp.remakeConstraints { make in
764762
make.centerX.equalTo(self.view)
@@ -774,10 +772,11 @@ class BrowserViewController: UIViewController {
774772
}
775773
}
776774

777-
fileprivate func showUserAgentHome(inline: Bool) {
778-
homePanelIsInline = inline
775+
fileprivate func showHome() {
779776
if self.homeViewController == nil {
780-
let homeViewController = HomeViewNavigationController(profile: profile, toolbarHeight: self.toolbar?.bounds.height ?? 80)
777+
let homeViewController = HomeViewNavigationController(
778+
profile: profile,
779+
toolbarHeight: self.traitCollection.horizontalSizeClass == .compact ? UIConstants.BottomToolbarHeight : 0)
781780
homeViewController.homePanelDelegate = self
782781
homeViewController.view.alpha = 0.0
783782
self.homeViewController = homeViewController
@@ -802,7 +801,7 @@ class BrowserViewController: UIViewController {
802801
view.setNeedsUpdateConstraints()
803802
}
804803

805-
fileprivate func hideUserAgentHome() {
804+
fileprivate func hideHome() {
806805
guard let browserHomeViewController = self.homeViewController else {
807806
return
808807
}
@@ -828,16 +827,16 @@ class BrowserViewController: UIViewController {
828827
let isAboutHomeURL = url.flatMap { InternalURL($0)?.isAboutHomeURL } ?? false
829828
if !urlBar.inOverlayMode {
830829
guard let url = url else {
831-
hideUserAgentHome()
830+
hideHome()
832831
return
833832
}
834833
if isAboutHomeURL {
835-
showUserAgentHome(inline: true)
834+
showHome()
836835
} else if !url.absoluteString.hasPrefix("\(InternalURL.baseUrl)/\(SessionRestoreHandler.path)") {
837-
hideUserAgentHome()
836+
hideHome()
838837
}
839838
} else if isAboutHomeURL {
840-
showUserAgentHome(inline: false)
839+
showHome()
841840
}
842841
}
843842

@@ -1509,14 +1508,12 @@ extension BrowserViewController: URLBarDelegate {
15091508
if let toast = clipboardBarDisplayHandler?.clipboardToast {
15101509
toast.removeFromSuperview()
15111510
}
1512-
1513-
showUserAgentHome(inline: false)
1511+
hideHome()
15141512
}
15151513

15161514
func urlBarDidLeaveOverlayMode(_ urlBar: URLBarView) {
15171515
destroySearchController()
15181516
updateInContentHomePanel(tabManager.selectedTab?.url as URL?)
1519-
self.homePanelIsInline = self.shouldShowFooterForTraitCollection(self.traitCollection)
15201517
self.updateViewConstraints()
15211518
}
15221519

ReactNative/js/components/SpeedDial.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ const getStyles = theme => ({
1515
circle: {
1616
padding: 20,
1717
borderRadius: 60,
18-
backgroundColor: '#ffffff30',
18+
backgroundColor: '#ffffff50',
1919
},
2020
label: {
2121
marginTop: 5,
2222
color: theme.separatorColor,
2323
fontSize: 12,
24+
fontWeight: '500',
2425
},
2526
pin: {
2627
position: 'absolute',

ReactNative/js/screens/Home/components/Background.jsx

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import React, { useMemo, useState, useEffect } from 'react';
2-
import { View, StyleSheet, Platform } from 'react-native';
2+
import { View, StyleSheet, Platform, Image } from 'react-native';
33
import FastImage from 'react-native-fast-image';
44

55
const DAY_OF_MONTH = new Date().getDate();
66
const BACKGROUND_URL = `https://cdn.cliqz.com/serp/configs/config_${DAY_OF_MONTH}.json`;
77
let cachedBackgroundUrl;
88

9+
const styles = {
10+
mask: [
11+
StyleSheet.absoluteFill,
12+
{
13+
resizeMode: 'stretch',
14+
},
15+
],
16+
};
17+
918
const useBackgroundImage = () => {
1019
const [url, setUrl] = useState();
1120
useEffect(() => {
@@ -51,6 +60,12 @@ export default ({ height, children }) => {
5160
priority: FastImage.priority.normal,
5261
}}
5362
/>
63+
<Image
64+
style={styles.mask}
65+
source={{
66+
uri: 'mask',
67+
}}
68+
/>
5469
{children}
5570
</View>
5671
);

ReactNative/js/screens/Home/components/SpeedDialsRow.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const styles = StyleSheet.create({
1313
marginBottom: 0,
1414
padding: 0,
1515
flexDirection: 'row',
16-
flex: 1,
1716
width: '100%',
1817
justifyContent: 'space-evenly',
1918
},

ReactNative/js/screens/Home/components/UrlBar.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const startSearch = () => NativeModules.BrowserActions.startSearch();
1313

1414
const getStyles = theme => ({
1515
container: {
16-
height: 40,
16+
height: 47,
1717
width: '100%',
1818
paddingHorizontal: 20,
1919
borderRadius: 40,
@@ -39,8 +39,8 @@ export default () => {
3939
const styles = useStyles(getStyles);
4040

4141
return (
42-
<TouchableWithoutFeedback onPress={startSearch}>
43-
<View style={styles.container}>
42+
<TouchableWithoutFeedback onPress={startSearch} accessible={false}>
43+
<View style={styles.container} testID="urlbar">
4444
<Text style={styles.text}>{t('UrlBar.Placeholder')}</Text>
4545
<View style={styles.iconWrapper}>
4646
<NativeDrawable

ReactNative/js/screens/Home/index.jsx

+30-25
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ import NewsToolbar from './components/NewsToolbar';
1818

1919
const hideKeyboard = () => NativeModules.BrowserActions.hideKeyboard();
2020

21-
const getStyles = () => {
21+
const getStyles = toolbarHeight => {
2222
const maxWidth = Math.min(
2323
Dimensions.get('window').width,
2424
Dimensions.get('window').height,
2525
);
2626

27+
const logoHeight = 47;
28+
const newsToolbarHeight = 50;
29+
2730
return StyleSheet.create({
2831
safeArea: {
2932
flex: 1,
@@ -43,37 +46,36 @@ const getStyles = () => {
4346
flexDirection: 'column',
4447
justifyContent: 'space-evenly',
4548
},
49+
logoWrapper: {
50+
paddingTop: newsToolbarHeight + toolbarHeight,
51+
justifyContent: 'flex-end',
52+
flexGrow: 1,
53+
},
54+
logo: {
55+
height: logoHeight,
56+
},
57+
urlBarWrapper: {
58+
paddingHorizontal: 10,
59+
width: '100%',
60+
paddingVertical: logoHeight,
61+
},
62+
speedDialsContainer: {
63+
width: '100%',
64+
flexGrow: 1,
65+
},
4666
newsToolbarWrapper: {
4767
width: maxWidth,
4868
paddingHorizontal: 20,
49-
marginBottom: 20,
5069
alignSelf: 'center',
70+
height: newsToolbarHeight,
71+
justifyContent: 'center',
5172
},
5273
newsWrapper: {
5374
flex: 1,
5475
width: maxWidth,
5576
alignSelf: 'center',
5677
paddingHorizontal: 20,
5778
},
58-
speedDialsContainer: {
59-
marginBottom: 25,
60-
width: '100%',
61-
},
62-
logoWrapper: {
63-
marginTop: 40 - 8,
64-
marginBottom: 30,
65-
},
66-
logo: {
67-
height: 65,
68-
},
69-
urlBarWrapper: {
70-
paddingHorizontal: 10,
71-
marginBottom: 30,
72-
width: '100%',
73-
},
74-
footer: {
75-
height: 80,
76-
},
7779
});
7880
};
7981

@@ -89,7 +91,7 @@ export default function Home({
8991
const [showNewsToolbar, setShowNewsToolbar] = useState(true);
9092
const scrollViewElement = useRef(null);
9193
const newsElement = useRef(null);
92-
const styles = getStyles();
94+
const styles = getStyles(toolbarHeight);
9395
const [firstRow, secondRow] = useMemo(() => {
9496
const pinnedDomains = new Set([
9597
...pinnedSites.map(s => parse(s.url).domain),
@@ -122,6 +124,7 @@ export default function Home({
122124
onScroll={hideKeyboard}
123125
scrollEventThrottle={1}
124126
contentContainerStyle={styles.contentContainer}
127+
scrollEnabled={isNewsEnabled}
125128
>
126129
<Background height={height}>
127130
<View style={styles.wrapper}>
@@ -143,9 +146,11 @@ export default function Home({
143146
</View>
144147
</View>
145148

146-
<View style={styles.newsToolbarWrapper}>
147-
{showNewsToolbar && <NewsToolbar scrollToNews={scrollToNews} />}
148-
</View>
149+
{isNewsEnabled && (
150+
<View style={styles.newsToolbarWrapper}>
151+
{showNewsToolbar && <NewsToolbar scrollToNews={scrollToNews} />}
152+
</View>
153+
)}
149154
<ToolbarArea height={toolbarHeight} />
150155
</Background>
151156
{isNewsEnabled && (

UserAgent.xcodeproj/xcshareddata/xcschemes/Cliqz.xcscheme

+9
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,21 @@
170170
<Test
171171
Identifier = "BrowsingPDFTests">
172172
</Test>
173+
<Test
174+
Identifier = "ClipBoardTests/testClipboard()">
175+
</Test>
173176
<Test
174177
Identifier = "ClipBoardTests/testClipboardPasteAndGo()">
175178
</Test>
176179
<Test
177180
Identifier = "CopiedLinksTests">
178181
</Test>
182+
<Test
183+
Identifier = "DataManagementTests/testWebSiteDataEnterFirstTime()">
184+
</Test>
185+
<Test
186+
Identifier = "DataManagementTests/testWebSiteDataOptions()">
187+
</Test>
179188
<Test
180189
Identifier = "DatabaseFixtureTest">
181190
</Test>

e2e/firstTest.spec.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const passOnboarding = async () => {
1313
const doneButton$ = element(by.label('PrivacyStatementDone'));
1414
await waitFor(doneButton$).toBeVisible().withTimeout(2000);
1515
await doneButton$.tap();
16-
await waitFor(element(by.id('url'))).toBeVisible().withTimeout(2000);
16+
await waitFor(element(by.id('urlbar'))).toBeVisible().withTimeout(2000);
1717
}
1818

1919
describe('Search', function () {
@@ -22,10 +22,12 @@ describe('Search', function () {
2222
});
2323

2424
it('start search', async function () {
25-
const urlbar$ = element(by.id('url'));
25+
const fakeUrlBar$ = element(by.id('urlbar'));
26+
await expect(fakeUrlBar$).toBeVisible();
27+
await fakeUrlBar$.tap();
28+
const urlbar$ = element(by.id('address'));
2629
await expect(urlbar$).toBeVisible();
27-
await urlbar$.tap();
28-
await element(by.id('address')).typeText('www.amazon.de');
30+
await urlbar$.typeText('www.amazon.de');
2931
await waitFor(element(by.text('www.amazon.de')).atIndex(1)).toBeVisible().withTimeout(5000);
3032
});
3133
});

0 commit comments

Comments
 (0)