erweiterte einstellungen
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect, useContext } from 'react';
|
||||
import { View, Text, ScrollView, TextInput, Button, StyleSheet, Alert, Linking, TouchableOpacity, Platform, ActivityIndicator, Image } from 'react-native';
|
||||
import { View, Text, ScrollView, Button, StyleSheet, TouchableOpacity, ActivityIndicator, Alert } from 'react-native';
|
||||
import { SettingsContext } from '../SettingsProvider';
|
||||
import { useColors } from '../common/colors';
|
||||
import ErrorBoundary from 'react-native-error-boundary';
|
||||
@@ -19,6 +19,7 @@ const Login = () => {
|
||||
const [isDarkMode, setIsDarkMode] = useState(settings.darkTheme);
|
||||
const [requireAuth, setRequireAuth] = useState(settings.requireAuth);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [showAdvanced, setShowAdvanced] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (settings) {
|
||||
@@ -44,7 +45,7 @@ const Login = () => {
|
||||
darkTheme: isDarkMode,
|
||||
requireAuth,
|
||||
});
|
||||
hideToast()
|
||||
hideToast();
|
||||
} catch (error) {
|
||||
console.error('Error updating settings:', error);
|
||||
Alert.alert('Error', 'Failed to save settings.');
|
||||
@@ -58,6 +59,10 @@ const Login = () => {
|
||||
showToast(ToastType.Warn, 'Ungespeicherte Änderungen');
|
||||
};
|
||||
|
||||
const toggleAdvancedSettings = () => {
|
||||
setShowAdvanced(!showAdvanced);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
@@ -87,6 +92,16 @@ const Login = () => {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
advancedButton: {
|
||||
marginTop: 20,
|
||||
padding: 10,
|
||||
backgroundColor: colors.primary,
|
||||
borderRadius: 5,
|
||||
},
|
||||
advancedButtonText: {
|
||||
color: 'white',
|
||||
textAlign: 'center',
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -114,23 +129,31 @@ const Login = () => {
|
||||
{isSaving && <ActivityIndicator size="small" color={colors.primary} style={styles.activityindicator} />}
|
||||
</View>
|
||||
|
||||
<TouchableOpacity style={styles.advancedButton} onPress={toggleAdvancedSettings}>
|
||||
<Text style={styles.advancedButtonText}>
|
||||
{showAdvanced ? 'Erweiterte Einstellungen verbergen' : 'Erweiterte Einstellungen anzeigen'}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
<View style={styles.section}>
|
||||
<ThemeText style={styles.label}>URL</ThemeText>
|
||||
<ThemeTextInput
|
||||
value={url}
|
||||
onValueChange={handleChange(setUrl)}
|
||||
placeholder="URL"
|
||||
/>
|
||||
<View style={styles.switchContainer}>
|
||||
<ThemeText>Authentifizierung</ThemeText>
|
||||
<ThemeSwitch
|
||||
value={requireAuth}
|
||||
onValueChange={handleChange(setRequireAuth)}
|
||||
{showAdvanced && (
|
||||
<View style={styles.section}>
|
||||
<ThemeText style={styles.label}>URL</ThemeText>
|
||||
<ThemeTextInput
|
||||
value={url}
|
||||
onValueChange={handleChange(setUrl)}
|
||||
placeholder="URL"
|
||||
/>
|
||||
<View style={styles.switchContainer}>
|
||||
<ThemeText>Authentifizierung</ThemeText>
|
||||
<ThemeSwitch
|
||||
value={requireAuth}
|
||||
onValueChange={handleChange(setRequireAuth)}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<Credits/>
|
||||
)}
|
||||
|
||||
<Credits />
|
||||
</ScrollView>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user