2022-08-31 06:33:37 +05:00
/ *
This file is part of the Notesnook project ( https : //notesnook.com/)
2023-01-16 13:44:52 +05:00
Copyright ( C ) 2023 Streetwriters ( Private ) Limited
2022-08-31 06:33:37 +05:00
This program is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
* /
2022-08-30 16:13:11 +05:00
2023-02-13 16:49:25 +05:00
import React from "react" ;
2022-08-26 16:19:39 +05:00
import {
2023-06-05 15:13:19 +05:00
Linking ,
2022-08-26 16:19:39 +05:00
TouchableOpacity ,
useWindowDimensions ,
View
} from "react-native" ;
2023-06-05 15:13:19 +05:00
import { SwiperFlatList } from "react-native-swiper-flatlist" ;
2022-08-26 16:19:39 +05:00
import Icon from "react-native-vector-icons/MaterialCommunityIcons" ;
import SettingsService from "../../services/settings" ;
import { useSettingStore } from "../../stores/use-setting-store" ;
import { useThemeStore } from "../../stores/use-theme-store" ;
2023-06-10 12:17:23 +05:00
import { getElevationStyle } from "../../utils/elevation" ;
2022-08-26 16:19:39 +05:00
import { SIZE } from "../../utils/size" ;
import { Button } from "../ui/button" ;
import Heading from "../ui/typography/heading" ;
import Paragraph from "../ui/typography/paragraph" ;
2021-02-08 12:55:12 +05:00
2022-08-27 15:23:11 +05:00
const Intro = ( { navigation } ) => {
2022-08-26 16:19:39 +05:00
const colors = useThemeStore ( ( state ) => state . colors ) ;
const isTelemetryEnabled = useSettingStore (
( state ) => state . settings . telemetry
) ;
2023-06-05 15:13:19 +05:00
const { width } = useWindowDimensions ( ) ;
const deviceMode = useSettingStore ( ( state ) => state . deviceMode ) ;
2022-01-25 15:12:10 +05:00
2023-06-05 15:13:19 +05:00
const renderItem = React . useCallback (
( { item } ) => (
2022-07-05 14:33:48 +05:00
< View
style = { {
2022-08-26 16:19:39 +05:00
justifyContent : "center" ,
2023-06-05 15:13:19 +05:00
width : deviceMode !== "mobile" ? width / 2 : width ,
paddingHorizontal :
deviceMode !== "mobile" ? ( width / 2 ) * 0.05 : width * 0.05
2022-07-05 14:33:48 +05:00
} }
>
2023-06-05 15:13:19 +05:00
< View
style = { {
flexDirection : "row"
} }
>
< View
style = { {
width : 100 ,
height : 5 ,
backgroundColor : colors . accent ,
borderRadius : 2 ,
marginRight : 7
} }
/ >
2022-07-05 14:33:48 +05:00
2023-06-05 15:13:19 +05:00
< View
style = { {
width : 20 ,
height : 5 ,
backgroundColor : colors . nav ,
borderRadius : 2
} }
/ >
< / V i e w >
2022-07-05 14:33:48 +05:00
< View
style = { {
2023-06-05 15:13:19 +05:00
marginTop : 10 ,
2022-07-05 14:33:48 +05:00
marginBottom : 20 ,
2023-06-05 15:13:19 +05:00
maxWidth : "90%" ,
width : "100%"
2022-07-05 14:33:48 +05:00
} }
>
2023-06-05 15:13:19 +05:00
{ item . headings ? . map ( ( heading ) => (
< Heading
key = { heading }
style = { {
marginBottom : 5
} }
extraBold
size = { SIZE . xxl }
>
{ heading }
< / H e a d i n g >
) ) }
{ item . body ? < Paragraph size = { SIZE . sm } > { item . body } < / P a r a g r a p h > : n u l l }
{ item . tesimonial ? (
< Paragraph
style = { {
fontStyle : "italic" ,
fontSize : SIZE . lg
} }
onPress = { ( ) => {
Linking . openURL ( item . link ) ;
} }
>
{ item . tesimonial } — { item . user }
< / P a r a g r a p h >
) : null }
2022-07-05 14:33:48 +05:00
< / V i e w >
< / V i e w >
2023-06-05 15:13:19 +05:00
) ,
[ colors . accent , colors . nav , deviceMode , width ]
) ;
return (
< View
testID = "notesnook.splashscreen"
style = { {
width : "100%" ,
height : "100%"
} }
>
< View
style = { {
flex : 0.65 ,
width : deviceMode !== "mobile" ? width / 2 : "100%" ,
backgroundColor : colors . nav ,
marginBottom : 20 ,
borderBottomWidth : 1 ,
borderBottomColor : colors . border ,
alignSelf : deviceMode !== "mobile" ? "center" : undefined ,
borderWidth : deviceMode !== "mobile" ? 1 : null ,
borderColor : deviceMode !== "mobile" ? colors . border : null ,
borderRadius : deviceMode !== "mobile" ? 20 : null ,
marginTop : deviceMode !== "mobile" ? 50 : null
} }
>
< SwiperFlatList
autoplay
autoplayDelay = { 10 }
autoplayLoop = { true }
index = { 0 }
useReactNativeGestureHandler = { true }
showPagination
data = { [
{
headings : [ "Open source." , "End to end encrypted." , "Private." ] ,
body : "Write notes with freedom, no spying, no tracking."
} ,
{
headings : [
"Privacy for everyone" ,
"— not just the" ,
"privileged few"
] ,
body : "Your privacy matters to us, no matter who you are. In a world where everyone is trying to spy on you, Notesnook encrypts all your data before it leaves your device. With Notesnook no one can ever sell your data again."
} ,
{
tesimonial :
"You simply cannot get any better of a note taking app than @notesnook. The UI is clean and slick, it is feature rich, encrypted, reasonably priced (esp. for students & educators) & open source" ,
link : "https://twitter.com/andrewsayer/status/1637817220113002503" ,
user : "@andrewsayer on Twitter"
}
] }
paginationActiveColor = { colors . accent }
paginationStyleItem = { {
width : 10 ,
height : 5 ,
marginRight : 4 ,
marginLeft : 4
} }
paginationDefaultColor = { colors . border }
renderItem = { renderItem }
/ >
< / V i e w >
2022-07-05 14:33:48 +05:00
2022-04-20 17:55:47 +05:00
< View
2021-04-19 11:26:19 +05:00
style = { {
2022-08-26 16:19:39 +05:00
width : "100%" ,
2023-06-05 15:13:19 +05:00
flex : 0.3 ,
justifyContent : "center"
2022-01-22 12:57:05 +05:00
} }
>
2023-06-05 15:13:19 +05:00
< Button
width = { 250 }
onPress = { async ( ) => {
navigation . navigate ( "AppLock" , {
welcome : true
} ) ;
} }
style = { {
paddingHorizontal : 24 ,
alignSelf : "center" ,
2023-06-10 12:17:23 +05:00
... getElevationStyle ( 5 ) ,
2023-06-05 15:13:19 +05:00
borderRadius : 100
} }
fontSize = { SIZE . md }
type = "accent"
title = "Get started"
/ >
2022-07-05 14:33:48 +05:00
< TouchableOpacity
activeOpacity = { 1 }
2021-02-08 12:55:12 +05:00
style = { {
2022-08-26 16:19:39 +05:00
flexDirection : "row" ,
alignSelf : "center" ,
width : "90%" ,
2022-07-05 14:33:48 +05:00
marginBottom : 12 ,
paddingHorizontal : 12 ,
2022-08-26 16:19:39 +05:00
justifyContent : "center" ,
2022-07-05 14:33:48 +05:00
padding : 12 ,
maxWidth : 500
} }
2022-10-12 14:29:18 +05:00
onPress = { ( ) => {
SettingsService . set ( { telemetry : ! isTelemetryEnabled } ) ;
2022-01-22 12:57:05 +05:00
} }
>
2022-07-05 14:33:48 +05:00
< Icon
2023-06-05 15:13:19 +05:00
size = { SIZE . md }
2022-08-26 16:19:39 +05:00
name = {
isTelemetryEnabled ? "checkbox-marked" : "checkbox-blank-outline"
}
2022-07-05 14:33:48 +05:00
color = { isTelemetryEnabled ? colors . accent : colors . icon }
/ >
< Paragraph
2021-04-10 08:59:08 +05:00
style = { {
2022-07-05 14:33:48 +05:00
flexShrink : 1 ,
2023-06-05 15:13:19 +05:00
marginLeft : 6
2022-01-22 12:57:05 +05:00
} }
2023-06-05 15:13:19 +05:00
size = { SIZE . xs }
2022-01-22 12:57:05 +05:00
>
2022-08-26 16:19:39 +05:00
Help improve Notesnook by sending completely anonymized { " " }
2023-06-05 15:13:19 +05:00
< Heading size = { SIZE . xs } > private analytics and bug reports . < / H e a d i n g >
2022-07-05 14:33:48 +05:00
< / P a r a g r a p h >
< / T o u c h a b l e O p a c i t y >
2022-04-20 17:55:47 +05:00
< / V i e w >
2022-07-05 14:33:48 +05:00
< / V i e w >
2021-02-08 12:55:12 +05:00
) ;
} ;
2022-02-28 13:48:59 +05:00
export default Intro ;