-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVA 427 Add log in/out buttons to settings #212
Changes from 5 commits
d0b7de5
9f872bf
21cd378
d8fba8c
f060113
434cb94
b7f8e00
0a30d24
334c3a1
92e9f01
a848738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"expoServerPort": null, | ||
"packagerPort": 19000 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
{ | ||
"urlRandomness": "ZIWJWVY" | ||
"urlRandomness": "ZIWJWVY", | ||
"dev": true, | ||
"minify": false, | ||
"https": false, | ||
"hostType": "lan", | ||
"lanType": "ip", | ||
"scheme": null, | ||
"devClient": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,16 @@ | |
* See more about dark mode in APP_DEVELOPMENT.md | ||
*/ | ||
|
||
import { Heading, VStack, Text, ScrollView, useColorMode } from 'native-base' | ||
import React, { useState } from 'react' | ||
import { | ||
Heading, | ||
VStack, | ||
Text, | ||
ScrollView, | ||
useColorMode, | ||
Button, | ||
View, | ||
} from 'native-base' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
import Brand from '@/NativeBase/Components/Brand' | ||
import PrivacyAndTermsLinks from '@/NativeBase/Components/PrivacyAndTermsLinks' | ||
|
@@ -27,13 +35,18 @@ import SegmentedPicker, { | |
SegmentedPickerOption, | ||
} from '../Components/SegmentedPicker' | ||
import { capitaliseFirstLetter } from '@/Utils/Text' | ||
import { useAuth } from '@/Services/auth' | ||
import { navigate } from '@/Navigators/utils' | ||
import { useFeatureFlags } from '@/Services/featureFlags' | ||
|
||
const SettingsContainer = () => { | ||
const { colorMode, toggleColorMode } = useColorMode() | ||
const dispatch = useDispatch() | ||
|
||
// const onChangeSplash = ({ welcome, show }: Partial<WelcomeState>) => { | ||
// dispatch(changeWelcome({ welcome, show })) | ||
// } | ||
|
||
const dataPermissionsState = useSelector( | ||
(state: { permissions: PermissionsState }) => state.permissions.data, | ||
) | ||
|
@@ -46,6 +59,7 @@ const SettingsContainer = () => { | |
// const welcomeState = useSelector( | ||
// (state: { welcome: WelcomeState }) => state.welcome.show, | ||
// ) | ||
|
||
const [colourModeChoice, setColourModeChoice] = useState<string>( | ||
useSystemColourMode ? 'system' : colorMode ?? 'light', | ||
) | ||
|
@@ -87,19 +101,31 @@ const SettingsContainer = () => { | |
setColourModeChoice(newColourMode) | ||
} | ||
|
||
const { authenticated: isLoggedIn, login, logout } = useAuth() | ||
|
||
const handleLogin = () => { | ||
navigate('Login', {}) | ||
} | ||
|
||
const handleLogout = () => { | ||
logout() | ||
} | ||
|
||
const featureFlags = useFeatureFlags() | ||
|
||
return ( | ||
<ScrollView contentContainerStyle={{ flexGrow: 1 }}> | ||
<VStack | ||
height="100%" | ||
justifyContent="space-between" | ||
safeAreaY | ||
space={4} | ||
padding={4} | ||
> | ||
<VStack space="4"> | ||
<VStack flex={1} padding={4} space={4}> | ||
<Heading textAlign="center" size="lg" marginTop={8} fontFamily="title"> | ||
SETTINGS | ||
</Heading> | ||
|
||
<View style={{ marginTop: 48 }}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style is not need here, just marginTop={'48px'} will suffice :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank fixed now too :) |
||
<Brand /> | ||
</View> | ||
|
||
<VStack space="2"> | ||
<VStack space={4} flex={1}> | ||
<VStack space={2}> | ||
<Heading size="xs">Dark mode</Heading> | ||
<SegmentedPicker options={colourModeOptions} /> | ||
</VStack> | ||
|
@@ -130,9 +156,25 @@ const SettingsContainer = () => { | |
</Checkbox> */} | ||
</VStack> | ||
|
||
<VStack alignItems="center" space="2"> | ||
<VStack alignItems="center" space={2} width="100%" paddingBottom={4}> | ||
<Text fontSize="xs">Version {version}</Text> | ||
<PrivacyAndTermsLinks /> | ||
{featureFlags.login ? ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been fixed now, thank you :) |
||
!isLoggedIn ? ( | ||
<Button width="90%" onPress={handleLogin}> | ||
Log in | ||
</Button> | ||
) : ( | ||
<Button | ||
width="90%" | ||
backgroundColor="white" | ||
_text={{ color: 'error.100', fontWeight: 'bold' }} | ||
onPress={handleLogout} | ||
> | ||
Log out | ||
</Button> | ||
) | ||
) : null} | ||
</VStack> | ||
</VStack> | ||
</ScrollView> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
.expo
folder is created when an Expo project is started using "expo start" command. It should also automatically add it to.gitignore
but think it is a bug in SDK49 that it hasn't done so.Please delete his folder - you can safely delete it because it does not contain any information that is relevant for other developers working on the project, it is specific to your machine and it's regenerated by expo when you start your app again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, fixed now too :)