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-08-01 12:07:21 +05:00
import { useThemeColors } from "@notesnook/theme" ;
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 ,
2023-07-05 11:52:13 +05:00
ScrollView ,
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" ;
2023-08-01 12:07:21 +05:00
import { getElevationStyle } from "../../utils/elevation" ;
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets" ;
2022-08-26 16:19:39 +05:00
import SettingsService from "../../services/settings" ;
import { useSettingStore } from "../../stores/use-setting-store" ;
import { SIZE } from "../../utils/size" ;
import { Button } from "../ui/button" ;
import Heading from "../ui/typography/heading" ;
import Paragraph from "../ui/typography/paragraph" ;
2024-01-17 12:23:34 +05:00
import Navigation from "../../services/navigation" ;
import { eOpenLoginDialog } from "../../utils/events" ;
import { AuthMode } from "../auth" ;
import { eSendEvent } from "../../services/event-manager" ;
2024-07-27 10:19:43 +05:00
import { strings } from "@notesnook/intl" ;
2021-02-08 12:55:12 +05:00
2022-08-27 15:23:11 +05:00
const Intro = ( { navigation } ) => {
2023-08-01 12:07:21 +05:00
const { colors } = useThemeColors ( ) ;
2023-07-05 11:52:13 +05:00
const { width , height } = useWindowDimensions ( ) ;
2023-06-05 15:13:19 +05:00
const deviceMode = useSettingStore ( ( state ) => state . deviceMode ) ;
2023-07-05 11:52:13 +05:00
const insets = useGlobalSafeAreaInsets ( ) ;
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 ,
2023-08-01 12:07:21 +05:00
backgroundColor : colors . primary . accent ,
2023-06-05 15:13:19 +05:00
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 ,
2023-08-01 12:07:21 +05:00
backgroundColor : colors . secondary . background ,
2023-06-05 15:13:19 +05:00
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 ,
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
) ,
2023-08-01 12:07:21 +05:00
[ colors . primary . accent , colors . secondary . background , deviceMode , width ]
2023-06-05 15:13:19 +05:00
) ;
return (
2023-07-05 11:52:13 +05:00
< ScrollView
2023-06-05 15:13:19 +05:00
testID = "notesnook.splashscreen"
style = { {
2023-07-05 11:52:13 +05:00
width : "100%"
2023-06-05 15:13:19 +05:00
} }
>
< View
style = { {
width : deviceMode !== "mobile" ? width / 2 : "100%" ,
2023-08-01 12:07:21 +05:00
backgroundColor : colors . secondary . background ,
2023-06-05 15:13:19 +05:00
marginBottom : 20 ,
borderBottomWidth : 1 ,
2023-08-01 12:07:21 +05:00
borderBottomColor : colors . primary . border ,
2023-06-05 15:13:19 +05:00
alignSelf : deviceMode !== "mobile" ? "center" : undefined ,
borderWidth : deviceMode !== "mobile" ? 1 : null ,
2023-08-01 12:07:21 +05:00
borderColor : deviceMode !== "mobile" ? colors . primary . border : null ,
2023-06-05 15:13:19 +05:00
borderRadius : deviceMode !== "mobile" ? 20 : null ,
2023-07-05 11:52:13 +05:00
marginTop : deviceMode !== "mobile" ? 50 : null ,
paddingTop : insets . top + 10 ,
paddingBottom : insets . top + 10 ,
minHeight : height * 0.7
2023-06-05 15:13:19 +05:00
} }
>
< 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"
}
] }
2023-08-01 12:07:21 +05:00
paginationActiveColor = { colors . primary . accent }
2023-06-05 15:13:19 +05:00
paginationStyleItem = { {
width : 10 ,
height : 5 ,
marginRight : 4 ,
marginLeft : 4
} }
2023-08-01 12:07:21 +05:00
paginationDefaultColor = { colors . primary . border }
2023-06-05 15:13:19 +05:00
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-07-05 11:52:13 +05:00
justifyContent : "center" ,
minHeight : height * 0.3
2022-01-22 12:57:05 +05:00
} }
>
2023-06-05 15:13:19 +05:00
< Button
width = { 250 }
onPress = { async ( ) => {
2024-01-17 12:23:34 +05:00
eSendEvent ( eOpenLoginDialog , AuthMode . welcomeSignup ) ;
setTimeout ( ( ) => {
SettingsService . set ( {
introCompleted : true
} ) ;
Navigation . replace ( "Notes" , {
canGoBack : false
} ) ;
} , 1000 ) ;
2023-06-05 15:13:19 +05:00
} }
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"
2024-07-27 10:19:43 +05:00
title = { strings . getStarted ( ) }
2023-06-05 15:13:19 +05:00
/ >
2022-04-20 17:55:47 +05:00
< / V i e w >
2023-07-05 11:52:13 +05:00
< / S c r o l l V i e w >
2021-02-08 12:55:12 +05:00
) ;
} ;
2022-02-28 13:48:59 +05:00
export default Intro ;