mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
add new settings screen separate from porfile
This commit is contained in:
parent
622111e697
commit
3787652777
@ -622,7 +622,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.19;
|
MARKETING_VERSION = 1.21;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
@ -656,7 +656,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.19;
|
MARKETING_VERSION = 1.21;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
|
@ -28,6 +28,8 @@ const LightColors = {
|
|||||||
horizontalDivider: '#eeeeee',
|
horizontalDivider: '#eeeeee',
|
||||||
verticalDivider: '#aaaaaa',
|
verticalDivider: '#aaaaaa',
|
||||||
unreadIndicator: '#00aa00',
|
unreadIndicator: '#00aa00',
|
||||||
|
enabledIndicator: '#8fbea7',
|
||||||
|
disabledIndicator: '#eeeeee',
|
||||||
disconnectedIndicator: '#aa0000',
|
disconnectedIndicator: '#aa0000',
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,6 +61,8 @@ const DarkColors = {
|
|||||||
horizonalDivider: '#888888',
|
horizonalDivider: '#888888',
|
||||||
verticalDivider: '#aaaaaa',
|
verticalDivider: '#aaaaaa',
|
||||||
unreadIndicator: '#00aa00',
|
unreadIndicator: '#00aa00',
|
||||||
|
enabledIndicator: '#8fbea7',
|
||||||
|
disabledIndicator: '#eeeeee',
|
||||||
disconnectedIndicator: '#aa0000',
|
disconnectedIndicator: '#aa0000',
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -94,6 +98,8 @@ export const Colors = {
|
|||||||
horizonalDivider: getColor('horizontalDivider'),
|
horizonalDivider: getColor('horizontalDivider'),
|
||||||
verticalDivider: getColor('verticalDivider'),
|
verticalDivider: getColor('verticalDivider'),
|
||||||
unreadIndicator: getColor('unreadIndicator'),
|
unreadIndicator: getColor('unreadIndicator'),
|
||||||
|
enabledIndicator: getColor('enabledIndicator'),
|
||||||
|
disabledIndicator: getColor('disabledIndicator'),
|
||||||
disconnectedIndicator: getColor('disconnectedIndicator'),
|
disconnectedIndicator: getColor('disconnectedIndicator'),
|
||||||
|
|
||||||
background: '#8fbea7',
|
background: '#8fbea7',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export getLanguageId(language) {
|
export function getLanguageId(language) {
|
||||||
if (language === 'english') {
|
if (language === 'english') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ export const Strings = [
|
|||||||
enableNotifications: 'Enable Notifications',
|
enableNotifications: 'Enable Notifications',
|
||||||
sealedTopics: 'Sealed Topics',
|
sealedTopics: 'Sealed Topics',
|
||||||
colorMode: 'Color Mode',
|
colorMode: 'Color Mode',
|
||||||
clockMode: 'Hour Format',
|
hourMode: 'Hour Format',
|
||||||
language: 'Language',
|
language: 'Language',
|
||||||
logout: 'Logout',
|
logout: 'Logout',
|
||||||
changeLogin: 'Change Login',
|
changeLogin: 'Change Login',
|
||||||
@ -41,7 +41,7 @@ export const Strings = [
|
|||||||
enableNotifications: 'Activer les Notifications',
|
enableNotifications: 'Activer les Notifications',
|
||||||
sealedTopics: 'Sujets Sécurisés',
|
sealedTopics: 'Sujets Sécurisés',
|
||||||
colorMode: 'Mode de Couleur',
|
colorMode: 'Mode de Couleur',
|
||||||
clockMode: 'Format d\'Heure',
|
hourMode: 'Format d\'Heure',
|
||||||
language: 'Langue',
|
language: 'Langue',
|
||||||
logout: 'Se Déconnecter',
|
logout: 'Se Déconnecter',
|
||||||
changeLogin: 'Changer le Mot de Passe',
|
changeLogin: 'Changer le Mot de Passe',
|
||||||
@ -61,7 +61,7 @@ export const Strings = [
|
|||||||
enableNotifications: 'Permitir Notificaciones',
|
enableNotifications: 'Permitir Notificaciones',
|
||||||
sealedTopics: 'Temas Protegidos',
|
sealedTopics: 'Temas Protegidos',
|
||||||
colorMode: 'Modo de Color',
|
colorMode: 'Modo de Color',
|
||||||
clockMode: 'Formato de Hora',
|
hourMode: 'Formato de Hora',
|
||||||
language: 'Idioma',
|
language: 'Idioma',
|
||||||
logout: 'Cerrar Sesión',
|
logout: 'Cerrar Sesión',
|
||||||
changeLogin: 'Cambiar la contraseña',
|
changeLogin: 'Cambiar la contraseña',
|
||||||
@ -72,7 +72,7 @@ export const Strings = [
|
|||||||
support: 'Ayuda',
|
support: 'Ayuda',
|
||||||
blocked: 'Oculto',
|
blocked: 'Oculto',
|
||||||
actions: 'Métodos',
|
actions: 'Métodos',
|
||||||
display: 'Pantalla'
|
display: 'Pantalla',
|
||||||
settings: 'Configuración',
|
settings: 'Configuración',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ export const Strings = [
|
|||||||
enableNotifications: 'Benachrichtigungen aktivieren',
|
enableNotifications: 'Benachrichtigungen aktivieren',
|
||||||
sealedTopics: 'Gesicherte Themen',
|
sealedTopics: 'Gesicherte Themen',
|
||||||
colorMode: 'Farmodus',
|
colorMode: 'Farmodus',
|
||||||
clockMode: 'Stundenformat',
|
hourMode: 'Stundenformat',
|
||||||
language: 'Sprache',
|
language: 'Sprache',
|
||||||
logout: 'Ausloggen',
|
logout: 'Ausloggen',
|
||||||
changeLogin: 'Kennwort Aktualisieren',
|
changeLogin: 'Kennwort Aktualisieren',
|
||||||
@ -97,3 +97,4 @@ export const Strings = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export default Strings;
|
||||||
|
@ -17,6 +17,7 @@ import { ContactHeader, ContactBody, Contact } from './contact/Contact';
|
|||||||
import { Details } from './details/Details';
|
import { Details } from './details/Details';
|
||||||
import { Conversation, ConversationHeader, ConversationBody } from './conversation/Conversation';
|
import { Conversation, ConversationHeader, ConversationBody } from './conversation/Conversation';
|
||||||
import { Welcome } from './welcome/Welcome';
|
import { Welcome } from './welcome/Welcome';
|
||||||
|
import { Settings } from './settings/Settings';
|
||||||
import { Channels } from './channels/Channels';
|
import { Channels } from './channels/Channels';
|
||||||
import { CommonActions } from '@react-navigation/native';
|
import { CommonActions } from '@react-navigation/native';
|
||||||
import { ConversationContext } from 'context/ConversationContext';
|
import { ConversationContext } from 'context/ConversationContext';
|
||||||
@ -31,6 +32,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
|
|
||||||
const ConversationStack = createStackNavigator();
|
const ConversationStack = createStackNavigator();
|
||||||
const ProfileStack = createStackNavigator();
|
const ProfileStack = createStackNavigator();
|
||||||
|
const SettingsStack = createStackNavigator();
|
||||||
const ContactStack = createStackNavigator();
|
const ContactStack = createStackNavigator();
|
||||||
const ProfileDrawer = createDrawerNavigator();
|
const ProfileDrawer = createDrawerNavigator();
|
||||||
const ContactDrawer = createDrawerNavigator();
|
const ContactDrawer = createDrawerNavigator();
|
||||||
@ -94,6 +96,21 @@ function ConversationStackScreen({ dmChannel, shareChannel, shareIntent, setShar
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SettingsStackScreen() {
|
||||||
|
const stackParams = { headerStyle: { backgroundColor: Colors.titleBackground }, headerBackTitleVisible: false };
|
||||||
|
const screenParams = { headerShown: false, headerTintColor: Colors.primary };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeAreaView edges={['left', 'right']} style={styles.body}>
|
||||||
|
<SettingsStack.Navigator screenOptions={({ route }) => (screenParams)}>
|
||||||
|
<SettingsStack.Screen name="settings" options={stackParams}>
|
||||||
|
{(props) => <Settings />}
|
||||||
|
</SettingsStack.Screen>
|
||||||
|
</SettingsStack.Navigator>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function ProfileStackScreen() {
|
function ProfileStackScreen() {
|
||||||
const stackParams = { headerStyle: { backgroundColor: Colors.titleBackground }, headerBackTitleVisible: false };
|
const stackParams = { headerStyle: { backgroundColor: Colors.titleBackground }, headerBackTitleVisible: false };
|
||||||
const screenParams = { headerShown: true, headerTintColor: Colors.primary };
|
const screenParams = { headerShown: true, headerTintColor: Colors.primary };
|
||||||
@ -435,6 +452,9 @@ export function Session({ sharing, clearSharing }) {
|
|||||||
if (route.name === 'Conversation') {
|
if (route.name === 'Conversation') {
|
||||||
return <Ionicons name={'message1'} size={size} color={color} />;
|
return <Ionicons name={'message1'} size={size} color={color} />;
|
||||||
}
|
}
|
||||||
|
if (route.name === 'Settings') {
|
||||||
|
return <Ionicons name={'setting'} size={size} color={color} />;
|
||||||
|
}
|
||||||
if (route.name === 'Contacts') {
|
if (route.name === 'Contacts') {
|
||||||
return <CardsIcon size={size} color={color} />;
|
return <CardsIcon size={size} color={color} />;
|
||||||
}
|
}
|
||||||
@ -444,8 +464,9 @@ export function Session({ sharing, clearSharing }) {
|
|||||||
tabBarInactiveTintColor: Colors.disabled,
|
tabBarInactiveTintColor: Colors.disabled,
|
||||||
})}>
|
})}>
|
||||||
<Tab.Screen name="Conversation" children={()=><ConversationStackScreen dmChannel={dmChannel} shareChannel={shareChannel} shareIntent={shareIntent} setShareIntent={setShareIntent} />} />
|
<Tab.Screen name="Conversation" children={()=><ConversationStackScreen dmChannel={dmChannel} shareChannel={shareChannel} shareIntent={shareIntent} setShareIntent={setShareIntent} />} />
|
||||||
<Tab.Screen name="Profile" component={ProfileStackScreen} />
|
|
||||||
<Tab.Screen name="Contacts" children={()=><ContactStackScreen addChannel={addChannel} />} />
|
<Tab.Screen name="Contacts" children={()=><ContactStackScreen addChannel={addChannel} />} />
|
||||||
|
<Tab.Screen name="Profile" component={ProfileStackScreen} />
|
||||||
|
<Tab.Screen name="Settings" component={SettingsStackScreen} />
|
||||||
</Tab.Navigator>
|
</Tab.Navigator>
|
||||||
)}
|
)}
|
||||||
<StatusBar barStyle="dark-content" backgroundColor={Colors.formBackground} />
|
<StatusBar barStyle="dark-content" backgroundColor={Colors.formBackground} />
|
||||||
|
@ -68,6 +68,7 @@ export const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
tabBar: {
|
tabBar: {
|
||||||
backgroundColor: Colors.primary,
|
backgroundColor: Colors.primary,
|
||||||
|
maxHeight: 72,
|
||||||
},
|
},
|
||||||
home: {
|
home: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
68
app/mobile/src/session/settings/Settings.jsx
Normal file
68
app/mobile/src/session/settings/Settings.jsx
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import { ScrollView, View, Text, Switch, TouchableOpacity } from 'react-native';
|
||||||
|
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
|
||||||
|
import { styles } from './Settings.styled';
|
||||||
|
import { useSettings } from './useSettings.hook';
|
||||||
|
import MatIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import Colors from 'constants/Colors';
|
||||||
|
import Strings from 'constants/Strings';
|
||||||
|
|
||||||
|
export function Settings() {
|
||||||
|
|
||||||
|
const { state, actions } = useSettings();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeAreaView edges={['left', 'right', 'top', 'bottom']} style={styles.container}>
|
||||||
|
<ScrollView style={styles.content}>
|
||||||
|
|
||||||
|
<Text style={styles.label}>Settings</Text>
|
||||||
|
<View style={styles.group}>
|
||||||
|
<TouchableOpacity style={styles.entry} activeOpacity={1}>
|
||||||
|
<View style={styles.icon}>
|
||||||
|
<MatIcons name="bell-outline" size={20} color={Colors.linkText} />
|
||||||
|
</View>
|
||||||
|
<View style={styles.option}>
|
||||||
|
<Text style={styles.optionLink}>{ Strings[state.lang].enableNotifications }</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.control}>
|
||||||
|
<Switch style={styles.notifications} trackColor={styles.track}/>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
<View style={styles.divider} />
|
||||||
|
<View style={styles.entry}>
|
||||||
|
<View style={styles.icon}>
|
||||||
|
<MatIcons name="lock-outline" size={20} color={Colors.linkText} />
|
||||||
|
</View>
|
||||||
|
<View style={styles.option}>
|
||||||
|
<Text style={styles.optionLink}>{ Strings[state.lang].sealedTopics }</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.control} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Text style={styles.label}>Display</Text>
|
||||||
|
<View style={styles.group}>
|
||||||
|
<TouchableOpacity style={styles.entry} activeOpacity={1}>
|
||||||
|
<View style={styles.icon}>
|
||||||
|
<MatIcons name="progress-clock" size={20} color={Colors.linkText} />
|
||||||
|
</View>
|
||||||
|
<View style={styles.option}>
|
||||||
|
<Text style={styles.optionLink}>{ Strings[state.lang].hourMode }</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.control} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
<View style={styles.divider} />
|
||||||
|
<TouchableOpacity style={styles.entry}>
|
||||||
|
<View style={styles.icon}>
|
||||||
|
<MatIcons name="earth" size={20} color={Colors.linkText} />
|
||||||
|
</View>
|
||||||
|
<View style={styles.option}>
|
||||||
|
<Text style={styles.optionLink}>{ Strings[state.lang].language }</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.control} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
}
|
70
app/mobile/src/session/settings/Settings.styled.js
Normal file
70
app/mobile/src/session/settings/Settings.styled.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
import { Colors } from 'constants/Colors';
|
||||||
|
|
||||||
|
export const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
backgroundColor: Colors.screenBase,
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
paddingLeft: 16,
|
||||||
|
paddingRight: 16,
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
color: Colors.text,
|
||||||
|
padding: 4,
|
||||||
|
},
|
||||||
|
group: {
|
||||||
|
backgroundColor: Colors.areaBase,
|
||||||
|
width: '100%',
|
||||||
|
borderRadius: 8,
|
||||||
|
marginBottom: 8,
|
||||||
|
},
|
||||||
|
divider: {
|
||||||
|
width: '100%',
|
||||||
|
height: 2,
|
||||||
|
backgroundColor: Colors.screenBase,
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
width: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
flexDirection: 'row',
|
||||||
|
padding: 4,
|
||||||
|
height: 40,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
flex: 2,
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
option: {
|
||||||
|
flex: 10,
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
control: {
|
||||||
|
flex: 2,
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
optionText: {
|
||||||
|
fontSize: 16,
|
||||||
|
paddingRight: 8,
|
||||||
|
color: Colors.text,
|
||||||
|
},
|
||||||
|
optionLink: {
|
||||||
|
fontSize: 16,
|
||||||
|
paddingRight: 8,
|
||||||
|
color: Colors.linkText,
|
||||||
|
},
|
||||||
|
track: {
|
||||||
|
false: Colors.disabledIndicator,
|
||||||
|
true: Colors.enabledIndicator,
|
||||||
|
},
|
||||||
|
notifications: {
|
||||||
|
transform: [{ scaleX: .6 }, { scaleY: .6 }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
19
app/mobile/src/session/settings/useSettings.hook.js
Normal file
19
app/mobile/src/session/settings/useSettings.hook.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { useState, useEffect, useRef, useContext } from 'react';
|
||||||
|
|
||||||
|
export function useSettings() {
|
||||||
|
|
||||||
|
const [state, setState] = useState({
|
||||||
|
lang: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const updateState = (value) => {
|
||||||
|
setState((s) => ({ ...s, ...value }));
|
||||||
|
}
|
||||||
|
|
||||||
|
const actions = {
|
||||||
|
};
|
||||||
|
|
||||||
|
return { state, actions };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user