Prettify files before other changes

Prettify
This commit is contained in:
Sofiya Tepikin
2022-08-10 13:54:22 +02:00
parent e954ddf991
commit d9a1cd7895
5 changed files with 35 additions and 51 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ import AppStatusBar from './common/app-status-bar'
import License from './License' import License from './License'
import PasswordPrompt from './password-prompt' import PasswordPrompt from './password-prompt'
import store from "../store" import store from '../store'
export default class AppWrapper extends Component { export default class AppWrapper extends Component {
constructor() { constructor() {
@@ -51,7 +51,7 @@ export default class AppWrapper extends Component {
enableShowLicenseAgreement = () => { enableShowLicenseAgreement = () => {
this.setState({ this.setState({
shouldShowLicenseAgreement: true, shouldShowLicenseAgreement: true,
isCheckingLicenseAgreement: false isCheckingLicenseAgreement: false,
}) })
} }
@@ -62,7 +62,7 @@ export default class AppWrapper extends Component {
enableShowApp = () => { enableShowApp = () => {
this.setState({ this.setState({
shouldShowApp: true, shouldShowApp: true,
shouldShowPasswordPrompt: false shouldShowPasswordPrompt: false,
}) })
} }
@@ -79,7 +79,7 @@ export default class AppWrapper extends Component {
if (isCheckingLicenseAgreement) { if (isCheckingLicenseAgreement) {
initialView = <AppLoadingView /> initialView = <AppLoadingView />
} else if (shouldShowLicenseAgreement) { } else if (shouldShowLicenseAgreement) {
initialView = <License setLicense={this.disableShowLicenseAgreement}/> initialView = <License setLicense={this.disableShowLicenseAgreement} />
} else if (shouldShowPasswordPrompt) { } else if (shouldShowPasswordPrompt) {
initialView = <PasswordPrompt enableShowApp={this.enableShowApp} /> initialView = <PasswordPrompt enableShowApp={this.enableShowApp} />
} else if (shouldShowApp) { } else if (shouldShowApp) {
@@ -100,5 +100,5 @@ export default class AppWrapper extends Component {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
} },
}) })
+10 -14
View File
@@ -17,7 +17,6 @@ import setupNotifications from '../lib/notifications'
import { getCycleDay, closeDb } from '../db' import { getCycleDay, closeDb } from '../db'
class App extends Component { class App extends Component {
static propTypes = { static propTypes = {
date: PropTypes.string, date: PropTypes.string,
navigation: PropTypes.object.isRequired, navigation: PropTypes.object.isRequired,
@@ -80,8 +79,8 @@ class App extends Component {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Header { ...headerProps } /> <Header {...headerProps} />
<Page { ...pageProps } /> <Page {...pageProps} />
<Menu /> <Menu />
</View> </View>
) )
@@ -90,25 +89,22 @@ class App extends Component {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1 flex: 1,
} },
}) })
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return({ return {
date: getDate(state), date: getDate(state),
navigation: getNavigation(state) navigation: getNavigation(state),
}) }
} }
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return({ return {
navigate: (page) => dispatch(navigate(page)), navigate: (page) => dispatch(navigate(page)),
goBack: () => dispatch(goBack()), goBack: () => dispatch(goBack()),
}) }
} }
export default connect( export default connect(mapStateToProps, mapDispatchToProps)(App)
mapStateToProps,
mapDispatchToProps
)(App)
+1 -2
View File
@@ -23,7 +23,7 @@ export default class CreatePassword extends Component {
showBackUpReminder(this.toggleSettingPassword, () => {}) showBackUpReminder(this.toggleSettingPassword, () => {})
} }
render () { render() {
const { isSettingPassword } = this.state const { isSettingPassword } = this.state
const labels = settings.passwordSettings const labels = settings.passwordSettings
@@ -36,6 +36,5 @@ export default class CreatePassword extends Component {
} else { } else {
return <EnterNewPassword /> return <EnterNewPassword />
} }
} }
} }
+11 -19
View File
@@ -18,7 +18,7 @@ export default class PasswordSetting extends Component {
this.state = { this.state = {
isPasswordSet: hasEncryptionObservable.value, isPasswordSet: hasEncryptionObservable.value,
isChangingPassword: false, isChangingPassword: false,
isDeletingPassword: false isDeletingPassword: false,
} }
} }
@@ -39,18 +39,10 @@ export default class PasswordSetting extends Component {
} }
render() { render() {
const { isPasswordSet, isChangingPassword, isDeletingPassword } = this.state
const { const { title, explainerEnabled, explainerDisabled } =
isPasswordSet, labels.passwordSettings
isChangingPassword,
isDeletingPassword,
} = this.state
const {
title,
explainerEnabled,
explainerDisabled
} = labels.passwordSettings
return ( return (
<AppPage> <AppPage>
@@ -59,19 +51,19 @@ export default class PasswordSetting extends Component {
{isPasswordSet ? explainerEnabled : explainerDisabled} {isPasswordSet ? explainerEnabled : explainerDisabled}
</AppText> </AppText>
{!isPasswordSet && <CreatePassword/>} {!isPasswordSet && <CreatePassword />}
{(isPasswordSet && !isDeletingPassword) && ( {isPasswordSet && !isDeletingPassword && (
<ChangePassword <ChangePassword
onStartChange = {this.onChangingPassword} onStartChange={this.onChangingPassword}
onCancelChange = {this.onCancelChangingPassword} onCancelChange={this.onCancelChangingPassword}
/> />
)} )}
{(isPasswordSet && !isChangingPassword) && ( {isPasswordSet && !isChangingPassword && (
<DeletePassword <DeletePassword
onStartDelete = {this.onDeletingPassword} onStartDelete={this.onDeletingPassword}
onCancelDelete = {this.onCancelDeletingPassword} onCancelDelete={this.onCancelDeletingPassword}
/> />
)} )}
</Segment> </Segment>
+6 -9
View File
@@ -12,7 +12,7 @@ import settings from '../../../i18n/en/settings'
export default class ChangePassword extends Component { export default class ChangePassword extends Component {
static propTypes = { static propTypes = {
onStartChange: PropTypes.func, onStartChange: PropTypes.func,
onCancelChange: PropTypes.func onCancelChange: PropTypes.func,
} }
constructor() { constructor() {
@@ -21,7 +21,7 @@ export default class ChangePassword extends Component {
this.state = { this.state = {
currentPassword: null, currentPassword: null,
enteringCurrentPassword: false, enteringCurrentPassword: false,
enteringNewPassword: false enteringNewPassword: false,
} }
} }
@@ -41,7 +41,7 @@ export default class ChangePassword extends Component {
this.setState({ this.setState({
currentPassword: null, currentPassword: null,
enteringNewPassword: true, enteringNewPassword: true,
enteringCurrentPassword: false enteringCurrentPassword: false,
}) })
} }
@@ -49,17 +49,14 @@ export default class ChangePassword extends Component {
this.setState({ this.setState({
currentPassword: null, currentPassword: null,
enteringNewPassword: false, enteringNewPassword: false,
enteringCurrentPassword: false enteringCurrentPassword: false,
}) })
this.props.onCancelChange() this.props.onCancelChange()
} }
render() { render() {
const { const { enteringCurrentPassword, enteringNewPassword, currentPassword } =
enteringCurrentPassword, this.state
enteringNewPassword,
currentPassword
} = this.state
const labels = settings.passwordSettings const labels = settings.passwordSettings
const isPasswordSet = currentPassword !== null const isPasswordSet = currentPassword !== null