mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 09:00:06 +00:00
adding setup options to admin config
This commit is contained in:
parent
22b34ffdce
commit
f798dfe689
@ -2256,7 +2256,7 @@ SPEC CHECKSUMS:
|
||||
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
|
||||
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
|
||||
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
|
||||
Yoga: a9ef4f5c2cd79ad812110525ef61048be6a582a4
|
||||
Yoga: b05994d1933f507b0a28ceaa4fdb968dc18da178
|
||||
|
||||
PODFILE CHECKSUM: 9cf7373afef7b881c911fda82ff1f94eacee3e98
|
||||
|
||||
|
@ -95,7 +95,7 @@ export const styles = StyleSheet.create({
|
||||
},
|
||||
tabs: {
|
||||
flexShrink: 0,
|
||||
height: 64,
|
||||
height: 72,
|
||||
width: '100%',
|
||||
displlay: 'flex',
|
||||
flexDirection: 'row',
|
||||
|
@ -19,26 +19,26 @@ export function Service() {
|
||||
const showSetup = {display: tab === 'setup' ? 'flex' : 'none'};
|
||||
|
||||
return (
|
||||
<SafeAreaView style={styles.service}>
|
||||
<View style={styles.service}>
|
||||
{state.layout !== 'large' && (
|
||||
<View>
|
||||
<View style={styles.full}>
|
||||
<View style={styles.screen}>
|
||||
<View
|
||||
<SafeAreaView
|
||||
style={{
|
||||
...styles.body,
|
||||
...showAccounts,
|
||||
}}>
|
||||
<Accounts />
|
||||
</View>
|
||||
<View
|
||||
</SafeAreaView>
|
||||
<SafeAreaView
|
||||
style={{
|
||||
...styles.body,
|
||||
...showSetup,
|
||||
}}>
|
||||
<Setup />
|
||||
</View>
|
||||
<View style={styles.tabs}>
|
||||
</SafeAreaView>
|
||||
<SafeAreaView style={styles.tabs}>
|
||||
{tab === 'accounts' && (
|
||||
<IconButton
|
||||
style={styles.activeTab}
|
||||
@ -83,7 +83,7 @@ export function Service() {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
@ -95,7 +95,7 @@ export function Service() {
|
||||
</View>
|
||||
</NavigationContainer>
|
||||
)}
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@ -103,9 +103,7 @@ function SetupScreen() {
|
||||
const SetupComponent = useCallback(
|
||||
() => (
|
||||
<Surface elevation={3} mode="flat">
|
||||
<SafeAreaView>
|
||||
<Setup />
|
||||
</SafeAreaView>
|
||||
<Setup />
|
||||
</Surface>
|
||||
),
|
||||
[],
|
||||
@ -120,7 +118,7 @@ function SetupScreen() {
|
||||
drawerPosition: 'right',
|
||||
drawerType: 'front',
|
||||
headerShown: false,
|
||||
overlayColor: 'rgba(8,8,8,.9)',
|
||||
overlayColor: 'rgba(0,0,0,.7)',
|
||||
}}>
|
||||
<SetupDrawer.Screen name="home">{({navigation}) => <AccountScreen setup={navigation} />}</SetupDrawer.Screen>
|
||||
</SetupDrawer.Navigator>
|
||||
@ -129,9 +127,9 @@ function SetupScreen() {
|
||||
|
||||
function AccountScreen({setup}) {
|
||||
return (
|
||||
<View style={styles.frame}>
|
||||
<SafeAreaView style={styles.frame}>
|
||||
<Accounts setup={setup.openDrawer} />
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ export const styles = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
width: '100%',
|
||||
height: 48,
|
||||
paddingLeft: 8,
|
||||
paddingRight: 8,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
},
|
||||
line: {
|
||||
width: '100%',
|
||||
@ -49,6 +49,7 @@ export const styles = StyleSheet.create({
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
paddingTop: 16,
|
||||
paddingBottom: 64,
|
||||
minWidth: 0,
|
||||
},
|
||||
busy: {
|
||||
@ -72,7 +73,6 @@ export const styles = StyleSheet.create({
|
||||
},
|
||||
label: {
|
||||
fontSize: 14,
|
||||
flexShrink: 1,
|
||||
minWidth: 0,
|
||||
},
|
||||
inputSurface: {
|
||||
|
@ -36,7 +36,7 @@ console.log(state.setup);
|
||||
</View>
|
||||
</View>
|
||||
<Divider style={styles.line} bold={true} />
|
||||
<KeyboardAwareScrollView enableOnAndroid={true} style={styles.form} contentContainerStyle={styles.content}>
|
||||
<KeyboardAwareScrollView enableOnAndroid={true} style={styles.form} contentContainerStyle={styles.content} showsVerticalScrollIndicator={false}>
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{state.strings.keyType}:</Text>
|
||||
<View style={styles.radioSelect}>
|
||||
@ -136,6 +136,133 @@ console.log(state.setup);
|
||||
<Switch style={styles.controlSwitch} value={state.setup?.allowUnsealed} disabled={state.loading} onValueChange={()=>actions.setAllowUnsealed(!state.setup?.allowUnsealed)} />
|
||||
</View>
|
||||
<Divider style={styles.divider} bold={false} />
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{state.strings.enableImage}:</Text>
|
||||
<Switch style={styles.controlSwitch} value={state.setup?.enableImage} disabled={state.loading} onValueChange={()=>actions.setEnableImage(!state.setup?.enableImage)} />
|
||||
</View>
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{state.strings.enableAudio}:</Text>
|
||||
<Switch style={styles.controlSwitch} value={state.setup?.enableAudio} disabled={state.loading} onValueChange={()=>actions.setEnableAudio(!state.setup?.enableAudio)} />
|
||||
</View>
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{state.strings.enableVideo}:</Text>
|
||||
<Switch style={styles.controlSwitch} value={state.setup?.enableVideo} disabled={state.loading} onValueChange={()=>actions.setEnableVideo(!state.setup?.enableVideo)} />
|
||||
</View>
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{state.strings.enableBinary}:</Text>
|
||||
<Switch style={styles.controlSwitch} value={state.setup?.enableBinary} disabled={state.loading} onValueChange={()=>actions.setEnableBinary(!state.setup?.enableBinary)} />
|
||||
</View>
|
||||
<Divider style={styles.divider} bold={false} />
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{state.strings.enableWeb}:</Text>
|
||||
<Switch style={styles.controlSwitch} value={state.setup?.enableIce} disabled={state.loading} onValueChange={()=>actions.setEnableIce(!state.setup?.enableIce)} />
|
||||
</View>
|
||||
{ state.setup?.enableIce && (
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{state.strings.enableService}:</Text>
|
||||
<Switch style={styles.controlSwitch} value={state.setup?.enableService} disabled={state.loading} onValueChange={()=>actions.setEnableService(!state.setup?.enableService)} />
|
||||
</View>
|
||||
)}
|
||||
{ state.setup?.enableIce && state.setup?.enableService && (
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>TURN_KEY_ID:</Text>
|
||||
<Surface mode="flat" elevation={5} style={styles.inputSurface}>
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
autoCapitalize={false}
|
||||
underlineStyle={styles.inputUnderline}
|
||||
mode="outlined"
|
||||
disabled={state.loading}
|
||||
placeholder="ID"
|
||||
value={state.setup?.iceUsername}
|
||||
onChangeText={value => actions.setIceUsername(value)}
|
||||
/>
|
||||
</Surface>
|
||||
</View>
|
||||
)}
|
||||
{ state.setup?.enableIce && state.setup?.enableService && (
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>TURN_KEY_API_TOKEN:</Text>
|
||||
<Surface mode="flat" elevation={5} style={styles.inputSurface}>
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
autoCapitalize={false}
|
||||
underlineStyle={styles.inputUnderline}
|
||||
mode="outlined"
|
||||
disabled={state.loading}
|
||||
placeholder="TOKEN"
|
||||
value={state.setup?.icePassword}
|
||||
onChangeText={value => actions.setIcePassword(value)}
|
||||
/>
|
||||
</Surface>
|
||||
</View>
|
||||
)}
|
||||
{ state.setup?.enableIce && !state.setup?.enableService && (
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{ state.strings.serverUrl }:</Text>
|
||||
<Surface mode="flat" elevation={5} style={styles.inputSurface}>
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
autoCapitalize={false}
|
||||
underlineStyle={styles.inputUnderline}
|
||||
mode="outlined"
|
||||
disabled={state.loading}
|
||||
placeholder={state.strings.urlHint}
|
||||
value={state.setup?.iceUrl}
|
||||
onChangeText={value => actions.setIceUrl(value)}
|
||||
/>
|
||||
</Surface>
|
||||
</View>
|
||||
)}
|
||||
{ state.setup?.enableIce && !state.setup?.enableService && (
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{ state.strings.webUsername }:</Text>
|
||||
<Surface mode="flat" elevation={5} style={styles.inputSurface}>
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
autoCapitalize={false}
|
||||
underlineStyle={styles.inputUnderline}
|
||||
mode="outlined"
|
||||
disabled={state.loading}
|
||||
placeholder={state.strings.username}
|
||||
value={state.setup?.iceUsername}
|
||||
onChangeText={value => actions.setIceUsername(value)}
|
||||
/>
|
||||
</Surface>
|
||||
</View>
|
||||
)}
|
||||
{ state.setup?.enableIce && !state.setup?.enableService && (
|
||||
<View style={styles.option}>
|
||||
<Text style={styles.label}>{ state.strings.webPassword }:</Text>
|
||||
<Surface mode="flat" elevation={5} style={styles.inputSurface}>
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
autoCapitalize={false}
|
||||
underlineStyle={styles.inputUnderline}
|
||||
mode="outlined"
|
||||
disabled={state.loading}
|
||||
placeholder={state.strings.password}
|
||||
value={state.setup?.icePassword}
|
||||
onChangeText={value => actions.setIcePassword(value)}
|
||||
/>
|
||||
</Surface>
|
||||
</View>
|
||||
)}
|
||||
</KeyboardAwareScrollView>
|
||||
<Divider style={styles.line} bold={true} />
|
||||
<Confirm show={state.error} params={errorParams} />
|
||||
|
@ -137,6 +137,76 @@ export function useSetup() {
|
||||
save();
|
||||
}
|
||||
},
|
||||
setAllowUnsealed: (allowUnsealed: boolean) => {
|
||||
if (setup.current) {
|
||||
setup.current.allowUnsealed = allowUnsealed;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setEnableImage: (enableImage: boolean) => {
|
||||
if (setup.current) {
|
||||
setup.current.enableImage = enableImage;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setEnableAudio: (enableAudio: boolean) => {
|
||||
if (setup.current) {
|
||||
setup.current.enableAudio = enableAudio;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setEnableVideo: (enableVideo: boolean) => {
|
||||
if (setup.current) {
|
||||
setup.current.enableVideo = enableVideo;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setEnableBinary: (enableBinary: boolean) => {
|
||||
if (setup.current) {
|
||||
setup.current.enableBinary = enableBinary;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setEnableIce: (enableIce: boolean) => {
|
||||
if (setup.current) {
|
||||
setup.current.enableIce = enableIce;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setEnableService: (enableService: boolean) => {
|
||||
if (setup.current) {
|
||||
setup.current.enableService = enableService;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setIceUrl: (iceUrl: string) => {
|
||||
if (setup.current) {
|
||||
setup.current.iceUrl = iceUrl;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setIceUsername: (iceUsername: string) => {
|
||||
if (setup.current) {
|
||||
setup.current.iceUsername = iceUsername;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
setIcePassword: (icePassword: string) => {
|
||||
if (setup.current) {
|
||||
setup.current.icePassword = icePassword;
|
||||
updateState({ setup: setup.current });
|
||||
save();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return {state, actions};
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user