Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fab8b26cb | |||
| deb9d3d8e8 | |||
| fcc54566fc | |||
| 0118fcd6ce | |||
| 298eeafdba | |||
| 77ea075c23 | |||
| 38f91c2e25 | |||
| d9a1cd7895 | |||
| e954ddf991 | |||
| 74c570da38 | |||
| 8c99f2c6a3 | |||
| 34c1eae991 | |||
| e37d44c506 | |||
| 33dba03c47 | |||
| a7bdd4b6a6 |
@@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ export default class AppWrapper extends Component {
|
|||||||
} else if (shouldShowPasswordPrompt) {
|
} else if (shouldShowPasswordPrompt) {
|
||||||
initialView = <PasswordPrompt enableShowApp={this.enableShowApp} />
|
initialView = <PasswordPrompt enableShowApp={this.enableShowApp} />
|
||||||
} else if (shouldShowApp) {
|
} else if (shouldShowApp) {
|
||||||
initialView = <App />
|
initialView = <App restartApp={() => this.checkDbPasswordSet()} />
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -100,5 +100,5 @@ export default class AppWrapper extends Component {
|
|||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
+11
-14
@@ -17,12 +17,12 @@ 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,
|
||||||
navigate: PropTypes.func,
|
navigate: PropTypes.func,
|
||||||
goBack: PropTypes.func,
|
goBack: PropTypes.func,
|
||||||
|
restartApp: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -54,7 +54,7 @@ class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { date, navigation, goBack } = this.props
|
const { date, navigation, goBack, restartApp } = this.props
|
||||||
const { currentPage } = navigation
|
const { currentPage } = navigation
|
||||||
|
|
||||||
if (!currentPage) {
|
if (!currentPage) {
|
||||||
@@ -81,7 +81,7 @@ class App extends Component {
|
|||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Header {...headerProps} />
|
<Header {...headerProps} />
|
||||||
<Page { ...pageProps } />
|
<Page {...pageProps} restartApp={restartApp} />
|
||||||
<Menu />
|
<Menu />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
@@ -90,25 +90,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,4 +1,5 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import Button from '../../common/button'
|
import Button from '../../common/button'
|
||||||
|
|
||||||
@@ -8,6 +9,10 @@ import showBackUpReminder from './show-backup-reminder'
|
|||||||
import settings from '../../../i18n/en/settings'
|
import settings from '../../../i18n/en/settings'
|
||||||
|
|
||||||
export default class CreatePassword extends Component {
|
export default class CreatePassword extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
changeEncryptionAndRestart: PropTypes.func,
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
@@ -34,8 +39,11 @@ export default class CreatePassword extends Component {
|
|||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return <EnterNewPassword />
|
return (
|
||||||
}
|
<EnterNewPassword
|
||||||
|
changeEncryptionAndRestart={this.props.changeEncryptionAndRestart}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,13 @@ import PropTypes from 'prop-types'
|
|||||||
import Button from '../../common/button'
|
import Button from '../../common/button'
|
||||||
import ConfirmWithPassword from '../common/confirm-with-password'
|
import ConfirmWithPassword from '../common/confirm-with-password'
|
||||||
|
|
||||||
import { changeEncryptionAndRestartApp } from '../../../db'
|
|
||||||
import labels from '../../../i18n/en/settings'
|
import labels from '../../../i18n/en/settings'
|
||||||
|
|
||||||
export default class DeletePassword extends Component {
|
export default class DeletePassword extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onStartDelete: PropTypes.func,
|
onStartDelete: PropTypes.func,
|
||||||
onCancelDelete: PropTypes.func
|
onCancelDelete: PropTypes.func,
|
||||||
|
changeEncryptionAndRestart: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -24,10 +24,6 @@ export default class DeletePassword extends Component {
|
|||||||
this.props.onStartDelete()
|
this.props.onStartDelete()
|
||||||
}
|
}
|
||||||
|
|
||||||
startDeletePassword = async () => {
|
|
||||||
await changeEncryptionAndRestartApp()
|
|
||||||
}
|
|
||||||
|
|
||||||
cancelConfirmationWithPassword = () => {
|
cancelConfirmationWithPassword = () => {
|
||||||
this.setState({ enteringCurrentPassword: false })
|
this.setState({ enteringCurrentPassword: false })
|
||||||
this.props.onCancelDelete()
|
this.props.onCancelDelete()
|
||||||
@@ -39,7 +35,7 @@ export default class DeletePassword extends Component {
|
|||||||
if (enteringCurrentPassword) {
|
if (enteringCurrentPassword) {
|
||||||
return (
|
return (
|
||||||
<ConfirmWithPassword
|
<ConfirmWithPassword
|
||||||
onSuccess={this.startDeletePassword}
|
onSuccess={this.props.changeEncryptionAndRestart}
|
||||||
onCancel={this.cancelConfirmationWithPassword}
|
onCancel={this.cancelConfirmationWithPassword}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,20 +1,23 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { StyleSheet } from 'react-native'
|
import { StyleSheet } from 'react-native'
|
||||||
import nodejs from 'nodejs-mobile-react-native'
|
import nodejs from 'nodejs-mobile-react-native'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import AppText from '../../common/app-text'
|
import AppText from '../../common/app-text'
|
||||||
import AppTextInput from '../../common/app-text-input'
|
import AppTextInput from '../../common/app-text-input'
|
||||||
import Button from '../../common/button'
|
import Button from '../../common/button'
|
||||||
|
|
||||||
import { requestHash, changeEncryptionAndRestartApp } from '../../../db'
|
import { requestHash } from '../../../db'
|
||||||
import { Colors, Spacing } from '../../../styles'
|
import { Colors, Spacing } from '../../../styles'
|
||||||
import settings from '../../../i18n/en/settings'
|
import settings from '../../../i18n/en/settings'
|
||||||
|
|
||||||
const LISTENER_TYPE = 'create-or-change-pw'
|
const LISTENER_TYPE = 'create-or-change-pw'
|
||||||
|
|
||||||
export default class EnterNewPassword extends Component {
|
export default class EnterNewPassword extends Component {
|
||||||
|
static propTypes = {
|
||||||
constructor() {
|
changeEncryptionAndRestart: PropTypes.func,
|
||||||
|
}
|
||||||
|
constructor(props) {
|
||||||
super()
|
super()
|
||||||
this.state = {
|
this.state = {
|
||||||
password: '',
|
password: '',
|
||||||
@@ -23,13 +26,16 @@ export default class EnterNewPassword extends Component {
|
|||||||
}
|
}
|
||||||
nodejs.channel.addListener(
|
nodejs.channel.addListener(
|
||||||
LISTENER_TYPE,
|
LISTENER_TYPE,
|
||||||
changeEncryptionAndRestartApp,
|
props.changeEncryptionAndRestart,
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
nodejs.channel.removeListener(LISTENER_TYPE, changeEncryptionAndRestartApp)
|
nodejs.channel.removeListener(
|
||||||
|
LISTENER_TYPE,
|
||||||
|
this.props.changeEncryptionAndRestart
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
savePassword = () => {
|
savePassword = () => {
|
||||||
@@ -53,14 +59,11 @@ export default class EnterNewPassword extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { password, passwordConfirmation, shouldShowErrorMessage } =
|
||||||
password,
|
this.state
|
||||||
passwordConfirmation,
|
|
||||||
shouldShowErrorMessage
|
|
||||||
} = this.state
|
|
||||||
const labels = settings.passwordSettings
|
const labels = settings.passwordSettings
|
||||||
const isButtonActive =
|
const isButtonActive =
|
||||||
(password.length > 0) && (passwordConfirmation.length > 0)
|
password.length > 0 && passwordConfirmation.length > 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@@ -80,10 +83,14 @@ export default class EnterNewPassword extends Component {
|
|||||||
value={passwordConfirmation}
|
value={passwordConfirmation}
|
||||||
secureTextEntry={true}
|
secureTextEntry={true}
|
||||||
/>
|
/>
|
||||||
{shouldShowErrorMessage &&
|
{shouldShowErrorMessage && (
|
||||||
<AppText style={styles.error}>{labels.passwordsDontMatch}</AppText>
|
<AppText style={styles.error}>{labels.passwordsDontMatch}</AppText>
|
||||||
}
|
)}
|
||||||
<Button isCTA={isButtonActive} onPress={this.savePassword}>
|
<Button
|
||||||
|
isCTA={isButtonActive}
|
||||||
|
disabled={!isButtonActive}
|
||||||
|
onPress={this.savePassword}
|
||||||
|
>
|
||||||
{labels.savePassword}
|
{labels.savePassword}
|
||||||
</Button>
|
</Button>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
@@ -94,6 +101,6 @@ export default class EnterNewPassword extends Component {
|
|||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
error: {
|
error: {
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
marginTop: Spacing.base
|
marginTop: Spacing.base,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
|
import { connect } from 'react-redux'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
|
import { navigate } from '../../../slices/navigation'
|
||||||
|
|
||||||
|
import { changeDbEncryption } from '../../../db'
|
||||||
|
|
||||||
import AppPage from '../../common/app-page'
|
import AppPage from '../../common/app-page'
|
||||||
import AppText from '../../common/app-text'
|
import AppText from '../../common/app-text'
|
||||||
@@ -11,14 +17,18 @@ import DeletePassword from './delete'
|
|||||||
import { hasEncryptionObservable } from '../../../local-storage'
|
import { hasEncryptionObservable } from '../../../local-storage'
|
||||||
import labels from '../../../i18n/en/settings'
|
import labels from '../../../i18n/en/settings'
|
||||||
|
|
||||||
export default class PasswordSetting extends Component {
|
class PasswordSetting extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
navigate: PropTypes.func,
|
||||||
|
restartApp: PropTypes.func,
|
||||||
|
}
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isPasswordSet: hasEncryptionObservable.value,
|
isPasswordSet: hasEncryptionObservable.value,
|
||||||
isChangingPassword: false,
|
isChangingPassword: false,
|
||||||
isDeletingPassword: false
|
isDeletingPassword: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,19 +48,17 @@ export default class PasswordSetting extends Component {
|
|||||||
this.setState({ isDeletingPassword: false })
|
this.setState({ isDeletingPassword: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeEncryptionAndRestart = async (hash) => {
|
||||||
|
await changeDbEncryption(hash)
|
||||||
|
await this.props.restartApp()
|
||||||
|
this.props.navigate('Home')
|
||||||
|
}
|
||||||
|
|
||||||
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 +67,25 @@ export default class PasswordSetting extends Component {
|
|||||||
{isPasswordSet ? explainerEnabled : explainerDisabled}
|
{isPasswordSet ? explainerEnabled : explainerDisabled}
|
||||||
</AppText>
|
</AppText>
|
||||||
|
|
||||||
{!isPasswordSet && <CreatePassword/>}
|
{!isPasswordSet && (
|
||||||
|
<CreatePassword
|
||||||
{(isPasswordSet && !isDeletingPassword) && (
|
changeEncryptionAndRestart={this.changeEncryptionAndRestart}
|
||||||
<ChangePassword
|
|
||||||
onStartChange = {this.onChangingPassword}
|
|
||||||
onCancelChange = {this.onCancelChangingPassword}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(isPasswordSet && !isChangingPassword) && (
|
{isPasswordSet && !isDeletingPassword && (
|
||||||
|
<ChangePassword
|
||||||
|
onStartChange={this.onChangingPassword}
|
||||||
|
onCancelChange={this.onCancelChangingPassword}
|
||||||
|
changeEncryptionAndRestart={this.changeEncryptionAndRestart}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isPasswordSet && !isChangingPassword && (
|
||||||
<DeletePassword
|
<DeletePassword
|
||||||
onStartDelete={this.onDeletingPassword}
|
onStartDelete={this.onDeletingPassword}
|
||||||
onCancelDelete={this.onCancelDeletingPassword}
|
onCancelDelete={this.onCancelDeletingPassword}
|
||||||
|
changeEncryptionAndRestart={this.changeEncryptionAndRestart}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Segment>
|
</Segment>
|
||||||
@@ -79,3 +93,11 @@ export default class PasswordSetting extends Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => {
|
||||||
|
return {
|
||||||
|
navigate: (page) => dispatch(navigate(page)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(null, mapDispatchToProps)(PasswordSetting)
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ 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,
|
||||||
|
changeEncryptionAndRestart: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -21,7 +22,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 +42,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 +50,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
|
||||||
|
|
||||||
@@ -73,7 +71,11 @@ export default class ChangePassword extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (enteringNewPassword) {
|
if (enteringNewPassword) {
|
||||||
return <EnterNewPassword />
|
return (
|
||||||
|
<EnterNewPassword
|
||||||
|
changeEncryptionAndRestart={this.props.changeEncryptionAndRestart}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+2
-9
@@ -2,7 +2,6 @@ import Realm from 'realm'
|
|||||||
import { LocalDate, ChronoUnit } from 'js-joda'
|
import { LocalDate, ChronoUnit } from 'js-joda'
|
||||||
import nodejs from 'nodejs-mobile-react-native'
|
import nodejs from 'nodejs-mobile-react-native'
|
||||||
import fs from 'react-native-fs'
|
import fs from 'react-native-fs'
|
||||||
import { restartApp } from './restart-app'
|
|
||||||
|
|
||||||
import schemas from './schemas'
|
import schemas from './schemas'
|
||||||
import cycleModule from '../lib/cycle'
|
import cycleModule from '../lib/cycle'
|
||||||
@@ -195,7 +194,7 @@ export function requestHash(type, pw) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeEncryptionAndRestartApp(hash) {
|
export async function changeDbEncryption(hash) {
|
||||||
let key
|
let key
|
||||||
if (hash) key = hashToInt8Array(hash)
|
if (hash) key = hashToInt8Array(hash)
|
||||||
const defaultPath = db.path
|
const defaultPath = db.path
|
||||||
@@ -205,16 +204,10 @@ export async function changeEncryptionAndRestartApp(hash) {
|
|||||||
const copyPath = dir.join('/')
|
const copyPath = dir.join('/')
|
||||||
const exists = await fs.exists(copyPath)
|
const exists = await fs.exists(copyPath)
|
||||||
if (exists) await fs.unlink(copyPath)
|
if (exists) await fs.unlink(copyPath)
|
||||||
// for some reason, realm complains if we give it a key with value undefined
|
db.writeCopyTo({ path: copyPath, encryptionKey: key })
|
||||||
if (key) {
|
|
||||||
db.writeCopyTo(copyPath, key)
|
|
||||||
} else {
|
|
||||||
db.writeCopyTo(copyPath)
|
|
||||||
}
|
|
||||||
db.close()
|
db.close()
|
||||||
await fs.unlink(defaultPath)
|
await fs.unlink(defaultPath)
|
||||||
await fs.moveFile(copyPath, defaultPath)
|
await fs.moveFile(copyPath, defaultPath)
|
||||||
restartApp()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDbEmpty() {
|
export function isDbEmpty() {
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
// Current version of react-native-restart doesn't work with our ios setup
|
|
||||||
// therefore we have a fork and use different libraries on the platforms
|
|
||||||
import restart from 'react-native-restart'
|
|
||||||
|
|
||||||
export const restartApp = restart.Restart
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Current version of react-native-restart doesn't work with our ios setup
|
|
||||||
// therefore we have a fork and use different libraries on the platforms
|
|
||||||
import RNExitApp from 'react-native-exit-app-v2'
|
|
||||||
import { Alert } from 'react-native'
|
|
||||||
|
|
||||||
export const restartApp = () => {
|
|
||||||
Alert.alert('Closing app', 'App is shutting down. Please restart.')
|
|
||||||
setTimeout(() => {
|
|
||||||
RNExitApp.exitApp()
|
|
||||||
}, 3000)
|
|
||||||
}
|
|
||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"license": {
|
"license": {
|
||||||
"title": "drip. an open-source cycle tracking app",
|
"title": "drip. an open-source cycle tracking app",
|
||||||
"text": "Copyright (C) {{currentYear}} Heart of Code e.V.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details: https://www.gnu.org/licenses/gpl-3.0.html\n\nYou can contact us at drip@mailbox.org."
|
"text": "Copyright (C) {{currentYear}} Heart of Code e.V.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details: https://www.gnu.org/licenses/gpl-3.0.html."
|
||||||
},
|
},
|
||||||
"privacyPolicy": {
|
"privacyPolicy": {
|
||||||
"title": "Privacy Policy",
|
"title": "Privacy Policy",
|
||||||
|
|||||||
@@ -57,19 +57,6 @@
|
|||||||
};
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
|
||||||
2B572382D4504B8FB4B9D251 /* Embed Frameworks */ = {
|
|
||||||
isa = PBXCopyFilesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
dstPath = "";
|
|
||||||
dstSubfolderSpec = 10;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
name = "Embed Frameworks";
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
|
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
|
||||||
00E356EE1AD99517003FC87E /* dripTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = dripTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
00E356EE1AD99517003FC87E /* dripTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = dripTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -525,7 +512,6 @@
|
|||||||
"${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
|
"${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/RNCPushNotificationIOS/RNCPushNotificationIOS.framework",
|
"${BUILT_PRODUCTS_DIR}/RNCPushNotificationIOS/RNCPushNotificationIOS.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/RNDateTimePicker/RNDateTimePicker.framework",
|
"${BUILT_PRODUCTS_DIR}/RNDateTimePicker/RNDateTimePicker.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/RNExitApp/RNExitApp.framework",
|
|
||||||
"${BUILT_PRODUCTS_DIR}/RNFS/RNFS.framework",
|
"${BUILT_PRODUCTS_DIR}/RNFS/RNFS.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/RNShare/RNShare.framework",
|
"${BUILT_PRODUCTS_DIR}/RNShare/RNShare.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/RNVectorIcons/RNVectorIcons.framework",
|
"${BUILT_PRODUCTS_DIR}/RNVectorIcons/RNVectorIcons.framework",
|
||||||
@@ -552,7 +538,6 @@
|
|||||||
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
|
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
|
||||||
"${PODS_ROOT}/../../node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework",
|
"${PODS_ROOT}/../../node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/react-native-document-picker/react_native_document_picker.framework",
|
"${BUILT_PRODUCTS_DIR}/react-native-document-picker/react_native_document_picker.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/react-native-restart/react_native_restart.framework",
|
|
||||||
"${BUILT_PRODUCTS_DIR}/react-native-simple-toast/react_native_simple_toast.framework",
|
"${BUILT_PRODUCTS_DIR}/react-native-simple-toast/react_native_simple_toast.framework",
|
||||||
);
|
);
|
||||||
name = "[CP] Embed Pods Frameworks";
|
name = "[CP] Embed Pods Frameworks";
|
||||||
@@ -564,7 +549,6 @@
|
|||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCPushNotificationIOS.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCPushNotificationIOS.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNDateTimePicker.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNDateTimePicker.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNExitApp.framework",
|
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNFS.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNFS.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNShare.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNShare.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNVectorIcons.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNVectorIcons.framework",
|
||||||
@@ -591,7 +575,6 @@
|
|||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NodeMobile.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NodeMobile.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_document_picker.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_document_picker.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_restart.framework",
|
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_simple_toast.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_simple_toast.framework",
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -857,7 +840,7 @@
|
|||||||
"\"${PODS_ROOT}/../../node_modules/realm/vendor/realm-ios\"",
|
"\"${PODS_ROOT}/../../node_modules/realm/vendor/realm-ios\"",
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.2208.2;
|
MARKETING_VERSION = 1.2208.11;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
"-lc++",
|
"-lc++",
|
||||||
@@ -936,7 +919,7 @@
|
|||||||
"\"${PODS_ROOT}/../../node_modules/realm/vendor/realm-ios\"",
|
"\"${PODS_ROOT}/../../node_modules/realm/vendor/realm-ios\"",
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.2208.2;
|
MARKETING_VERSION = 1.2208.11;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"-ObjC",
|
"-ObjC",
|
||||||
"-lc++",
|
"-lc++",
|
||||||
|
|||||||
+4
-2
@@ -22,6 +22,8 @@
|
|||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
|
<false/>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSAppTransportSecurity</key>
|
<key>NSAppTransportSecurity</key>
|
||||||
@@ -81,9 +83,9 @@
|
|||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
||||||
<false/>
|
|
||||||
<key>UIUserInterfaceStyle</key>
|
<key>UIUserInterfaceStyle</key>
|
||||||
<string>Light</string>
|
<string>Light</string>
|
||||||
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
|
<false/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
Generated
+4
-14
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "drip.",
|
"name": "drip.",
|
||||||
"version": "1.2208.2",
|
"version": "1.2208.11",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2485,9 +2485,9 @@
|
|||||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
|
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
|
||||||
},
|
},
|
||||||
"caniuse-lite": {
|
"caniuse-lite": {
|
||||||
"version": "1.0.30001258",
|
"version": "1.0.30001375",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001375.tgz",
|
||||||
"integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA=="
|
"integrity": "sha512-kWIMkNzLYxSvnjy0hL8w1NOaWNr2rn39RTAVyIwcw8juu60bZDWiF1/loOYANzjtJmy6qPgNmn38ro5Pygagdw=="
|
||||||
},
|
},
|
||||||
"capture-exit": {
|
"capture-exit": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
@@ -8561,11 +8561,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-document-picker/-/react-native-document-picker-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-document-picker/-/react-native-document-picker-4.3.0.tgz",
|
||||||
"integrity": "sha512-ygcY0ijlVuhxzdWnhqd917yMUFT9FF0b4CM81LWoY4/bpQYz5PGUdRAdh25kS0VA+cEUYNL2iI7OpHXq00epPA=="
|
"integrity": "sha512-ygcY0ijlVuhxzdWnhqd917yMUFT9FF0b4CM81LWoY4/bpQYz5PGUdRAdh25kS0VA+cEUYNL2iI7OpHXq00epPA=="
|
||||||
},
|
},
|
||||||
"react-native-exit-app-v2": {
|
|
||||||
"version": "1.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-native-exit-app-v2/-/react-native-exit-app-v2-1.2.2.tgz",
|
|
||||||
"integrity": "sha512-RWCfmus7h99M1aONqBnWG3g3TFRzKsmok6cLAuqN5NVQAxpcgzbJZgAryA/ADpmBrBP5EIJnCBFo64ApQGOZPw=="
|
|
||||||
},
|
|
||||||
"react-native-fs": {
|
"react-native-fs": {
|
||||||
"version": "2.19.0",
|
"version": "2.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.19.0.tgz",
|
||||||
@@ -8600,11 +8595,6 @@
|
|||||||
"@react-native-community/push-notification-ios": "^1.0.1"
|
"@react-native-community/push-notification-ios": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-native-restart": {
|
|
||||||
"version": "0.0.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-native-restart/-/react-native-restart-0.0.18.tgz",
|
|
||||||
"integrity": "sha512-AoEINeKuvj0yJY9I4GEbY27ifiVTo/2KhW2MnGeFgtjInfAvA9hgbGXjQO8xT2wQA9ZIzTgUQyyWC6yFiQeREA=="
|
|
||||||
},
|
|
||||||
"react-native-share": {
|
"react-native-share": {
|
||||||
"version": "3.8.5",
|
"version": "3.8.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-3.8.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-3.8.5.tgz",
|
||||||
|
|||||||
+1
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "drip.",
|
"name": "drip.",
|
||||||
"version": "1.2208.2",
|
"version": "1.2208.11",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Julia Friesel <julia.friesel@gmail.com>",
|
"Julia Friesel <julia.friesel@gmail.com>",
|
||||||
"Marie Kochsiek",
|
"Marie Kochsiek",
|
||||||
@@ -47,12 +47,10 @@
|
|||||||
"react-native": "0.61.0",
|
"react-native": "0.61.0",
|
||||||
"react-native-calendars": "^1.19.3",
|
"react-native-calendars": "^1.19.3",
|
||||||
"react-native-document-picker": "^4.2.0",
|
"react-native-document-picker": "^4.2.0",
|
||||||
"react-native-exit-app-v2": "^1.2.2",
|
|
||||||
"react-native-fs": "^2.19.0",
|
"react-native-fs": "^2.19.0",
|
||||||
"react-native-hyperlink": "0.0.19",
|
"react-native-hyperlink": "0.0.19",
|
||||||
"react-native-modal-datetime-picker": "8.0.0",
|
"react-native-modal-datetime-picker": "8.0.0",
|
||||||
"react-native-push-notification": "3.2.1",
|
"react-native-push-notification": "3.2.1",
|
||||||
"react-native-restart": "0.0.18",
|
|
||||||
"react-native-share": "^3.0.0",
|
"react-native-share": "^3.0.0",
|
||||||
"react-native-simple-toast": "^1.1.3",
|
"react-native-simple-toast": "^1.1.3",
|
||||||
"react-native-size-matters": "^0.4.0",
|
"react-native-size-matters": "^0.4.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user