Compare commits

..

1 Commits

74 changed files with 1033 additions and 1772 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"presets": ["module:metro-react-native-babel-preset"],
}
-2
View File
@@ -1,2 +0,0 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
+5 -1
View File
@@ -32,7 +32,6 @@ build/
.gradle
local.properties
*.iml
*.hprof
# node.js
#
@@ -73,6 +72,11 @@ ios/Podfile.lock
android/app/src/main/res/drawable-*
android/app/src/main/assets/*
# nodejs-mobile creates these with every npm install
nodejs-assets/nodejs-project/sample-*
nodejs-assets/build-native-modules-MacOS-helper-script-node.sh
nodejs-assets/build-native-modules-MacOS-helper-script-npm.sh
# yarn
.yarn/*
yarn-error.log
+1
View File
@@ -11,6 +11,7 @@ updates:
- dependency-name: '*'
update-types: ['version-update:semver-patch']
- dependency-name: 'realm'
- dependency-name: 'nodejs-mobile-react-native'
- dependency-name: 'react'
- dependency-name: 'react-native'
- dependency-name: 'react-native-push-notifications'
-1
View File
@@ -1 +0,0 @@
2.7.4
-4
View File
@@ -1,4 +0,0 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.4'
gem 'cocoapods', '~> 1.11', '>= 1.11.2'
-96
View File
@@ -1,96 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.5)
rexml
activesupport (6.1.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.11.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.9)
escape (0.0.4)
ethon (0.15.0)
ffi (>= 1.15.0)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
json (2.6.1)
minitest (5.15.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.6)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
xcodeproj (1.21.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.4)
PLATFORMS
ruby
DEPENDENCIES
cocoapods (~> 1.11, >= 1.11.2)
RUBY VERSION
ruby 2.7.4p191
BUNDLED WITH
2.2.27
+1 -1
View File
@@ -50,7 +50,7 @@ Install [Android Studio](https://developer.android.com/studio/) - you'll need it
### 3.2 More requirements from Android Studio
Open Android Studio and click on "Open an existing Android Studio project". Navigate to the drip repository you cloned and double click the android folder. It detects, downloads and cofigures requirements that might be missing, like the NDK and CMake to build the native code part of the project.
Open Android Studio and click on "Open an existing Android Studio project". Navigate to the drip repository you cloned and double click the android folder. It detects, downloads and cofigures requirements that might be missing, like the NDK and CMake to build the native code part of the project. Also see the [nodejs-mobile repository](https://github.com/janeasystems/nodejs-mobile) for the necessary prerequisites for your system.
### 3.3 Run the app on Android
+1 -11
View File
@@ -114,17 +114,12 @@ def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and that value will be read here. If it is not set
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
/**
* Architectures to build native code for in debug.
*/
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
@@ -169,11 +164,6 @@ android {
buildTypes {
debug {
signingConfig signingConfigs.debug
if (nativeArchitectures) {
ndk {
abiFilters nativeArchitectures.split(',')
}
}
}
release {
// Caution! In production, you need to generate your own keystore file.
+1 -1
View File
@@ -33,7 +33,7 @@
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
android:insetTop="@dimen/abc_edit_text_inset_top_material"
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
<selector>
<!--
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
-->
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
</selector>
</inset>
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
<item name="android:textColor">#000000</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
+15 -9
View File
@@ -7,7 +7,7 @@ buildscript {
}
ext.kotlinVersion = "1.3.10"
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath("com.android.tools.build:gradle:4.2.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -17,6 +17,8 @@ buildscript {
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
@@ -25,13 +27,6 @@ allprojects {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
maven {
@@ -53,5 +48,16 @@ ext {
minSdkVersion = 23
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
ndkVersion = "20.1.5948944"
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
}
}
}
}
+2 -5
View File
@@ -9,7 +9,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
@@ -25,7 +25,4 @@ android.useAndroidX=true
android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0
# https://github.com/facebook/react-native/issues/30729
org.gradle.jvmargs=-Xmx4g
FLIPPER_VERSION=0.93.0
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
}
-43
View File
@@ -1,43 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { BackHandler, StyleSheet, View } from 'react-native'
import { useTranslation } from 'react-i18next'
import License from './settings/License'
import Button from './common/button'
import { saveLicenseFlag } from '../local-storage'
import { Containers } from '../styles'
export default function AcceptLicense({ setLicense }) {
const onAcceptLicense = async () => {
await saveLicenseFlag()
setLicense()
}
const { t } = useTranslation()
return (
<License>
<View style={styles.container}>
<Button onPress={BackHandler.exitApp} testID="licenseCancelButton">
{t('labels.shared.cancel')}
</Button>
<Button isCTA onPress={onAcceptLicense} testID="licenseOkButton">
{t('labels.shared.ok')}
</Button>
</View>
</License>
)
}
AcceptLicense.propTypes = {
setLicense: PropTypes.func.isRequired,
}
const styles = StyleSheet.create({
container: {
...Containers.rowContainer,
},
})
+28 -3
View File
@@ -4,9 +4,7 @@ import PropTypes from 'prop-types'
import moment from 'moment'
import AppText from './common/app-text'
import Asterisk from './common/Asterisk'
import Button from './common/button'
import Footnote from './common/Footnote'
import cycleModule from '../lib/cycle'
import { getFertilityStatusForDay } from '../lib/sympto-adapter'
@@ -71,12 +69,26 @@ const Home = ({ navigate, setDate }) => {
<Button isCTA isSmall={false} onPress={navigateToCycleDayView}>
{t('labels.home.addDataForToday')}
</Button>
{phase && <Footnote colorLabel="greyLight">{statusText}</Footnote>}
{phase && (
<View style={styles.asteriskLine}>
<Asterisk />
<AppText linkStyle={styles.whiteText} style={styles.greyText}>
{statusText}
</AppText>
</View>
)}
</ScrollView>
)
}
const Asterisk = () => {
return <AppText style={styles.asterisk}>*</AppText>
}
const styles = StyleSheet.create({
asterisk: {
color: Colors.orange,
},
container: {
backgroundColor: Colors.purple,
flex: 1,
@@ -92,6 +104,12 @@ const styles = StyleSheet.create({
marginBottom: Spacing.tiny,
marginTop: Spacing.small,
},
asteriskLine: {
flexDirection: 'row',
alignContent: 'flex-start',
marginBottom: Spacing.tiny,
marginTop: Spacing.small,
},
title: {
color: Colors.purpleLight,
fontFamily: Fonts.bold,
@@ -106,6 +124,13 @@ const styles = StyleSheet.create({
color: 'white',
fontSize: Sizes.subtitle,
},
whiteText: {
color: 'white',
},
greyText: {
color: Colors.greyLight,
paddingLeft: Spacing.base,
},
})
Home.propTypes = {
+51
View File
@@ -0,0 +1,51 @@
import React from 'react'
import PropTypes from 'prop-types'
import { BackHandler, StyleSheet, View } from 'react-native'
import { useTranslation } from 'react-i18next'
import AppPage from './common/app-page'
import AppText from './common/app-text'
import Button from './common/button'
import Segment from './common/segment'
import { saveLicenseFlag } from '../local-storage'
import { Containers } from '../styles'
export default function License({ setLicense }) {
const onAcceptLicense = async () => {
await saveLicenseFlag()
setLicense()
}
const { t } = useTranslation()
const currentYear = new Date().getFullYear()
return (
<AppPage testID="licensePage">
<Segment last testID="test" title={t('settings.license.title')}>
<AppText testID="test">
{t('settings.license.text', { currentYear })}
</AppText>
<View style={styles.container}>
<Button onPress={BackHandler.exitApp} testID="licenseCancelButton">
{t('labels.shared.cancel')}
</Button>
<Button isCTA onPress={onAcceptLicense} testID="licenseOkButton">
{t('labels.shared.ok')}
</Button>
</View>
</Segment>
</AppPage>
)
}
License.propTypes = {
setLicense: PropTypes.func.isRequired,
}
const styles = StyleSheet.create({
container: {
...Containers.rowContainer,
},
})
+4 -2
View File
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react'
import nodejs from 'nodejs-mobile-react-native'
import { getLicenseFlag, saveEncryptionFlag } from '../local-storage'
import { openDb } from '../db'
@@ -6,7 +7,7 @@ import { openDb } from '../db'
import App from './app'
import AppLoadingView from './common/app-loading'
import AppStatusBar from './common/app-status-bar'
import AcceptLicense from './AcceptLicense'
import License from './License'
import PasswordPrompt from './password-prompt'
export default function AppWrapper() {
@@ -27,6 +28,7 @@ export default function AppWrapper() {
}
useEffect(() => {
nodejs.start('main.js')
checkIsLicenseAccepted()
checkIsDbEncrypted()
}, [])
@@ -36,7 +38,7 @@ export default function AppWrapper() {
}
if (!isLicenseAccepted) {
return <AcceptLicense setLicense={() => setIsLicenseAccepted(true)} />
return <License setLicense={() => setIsLicenseAccepted(true)} />
}
return (
+3 -15
View File
@@ -31,21 +31,9 @@ const getSymptomsFromCycleDays = (cycleDays) =>
const CycleChart = ({ navigate, setDate }) => {
const [shouldShowHint, setShouldShowHint] = useState(true)
useEffect(() => {
let isMounted = true
async function checkShouldShowHint() {
const flag = await getChartFlag()
if (isMounted) {
setShouldShowHint(flag === 'true')
}
}
checkShouldShowHint()
return () => {
isMounted = false
}
useEffect(async () => {
const flag = await getChartFlag()
setShouldShowHint(flag === 'true')
}, [])
const hideHint = () => {
+2 -5
View File
@@ -8,15 +8,13 @@ import { Sizes } from '../../styles'
import { CHART_TICK_WIDTH } from '../../config'
const Tick = ({ yPosition, height, isBold, shouldShowLabel, label }) => {
const top = yPosition - height / 2 - 4
const top = yPosition - height / 2
const containerStyle = [styles.container, { flexBasis: height, height, top }]
const textStyle = isBold ? styles.textBold : styles.textNormal
if (!shouldShowLabel) return null
return (
<View style={containerStyle}>
<AppText style={textStyle}>{label}</AppText>
<AppText style={textStyle}>{shouldShowLabel && label}</AppText>
</View>
)
}
@@ -38,7 +36,6 @@ const styles = StyleSheet.create({
position: 'absolute',
right: 0,
width: CHART_TICK_WIDTH,
minHeight: Sizes.base + 2,
},
textBold: {
fontSize: Sizes.base,
-28
View File
@@ -1,28 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { StyleSheet, Text, Linking } from 'react-native'
import { Colors, Typography } from '../../styles'
const AppLink = ({ children, url, ...props }) => {
return (
<Text style={styles.link} {...props} onPress={() => Linking.openURL(url)}>
{children}
</Text>
)
}
AppLink.propTypes = {
children: PropTypes.node,
url: PropTypes.string,
}
const styles = StyleSheet.create({
link: {
...Typography.mainText,
color: Colors.purple,
textDecorationLine: 'underline',
},
})
export default AppLink
-16
View File
@@ -1,16 +0,0 @@
import React from 'react'
import { StyleSheet } from 'react-native'
import AppText from './app-text'
import { Colors } from '../../styles'
const Asterisk = () => <AppText style={styles.asterisk}>*</AppText>
const styles = StyleSheet.create({
asterisk: {
color: Colors.orange,
},
})
export default Asterisk
-50
View File
@@ -1,50 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { StyleSheet, View } from 'react-native'
import AppText from '../common/app-text'
import Asterisk from '../common/Asterisk'
import { Colors, Spacing } from '../../styles'
const Footnote = ({ children, colorLabel }) => {
if (!children) return false
return (
<View style={styles.container}>
<Asterisk />
<AppText
linkStyle={styles.link}
style={{ ...styles.text, color: Colors[colorLabel] }}
>
{children}
</AppText>
</View>
)
}
Footnote.propTypes = {
children: PropTypes.node,
colorLabel: PropTypes.string,
}
Footnote.defaultProps = {
colorLabel: 'greyDark',
}
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignContent: 'flex-start',
marginBottom: Spacing.tiny,
marginTop: Spacing.base,
},
link: {
color: 'white',
},
text: {
paddingLeft: Spacing.small,
},
})
export default Footnote
+13 -48
View File
@@ -1,33 +1,20 @@
import React from 'react'
import {
Dimensions,
Modal,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native'
import { Modal, StyleSheet, TouchableOpacity } from 'react-native'
import PropTypes from 'prop-types'
import CloseIcon from './close-icon'
import { Sizes, Spacing } from '../../styles'
const AppModal = ({ children, onClose }) => (
<Modal
animationType="fade"
onRequestClose={onClose}
transparent={true}
visible={true}
>
<TouchableOpacity onPress={onClose} style={styles.blackBackground} />
<View style={styles.modalWindow}>
<View style={styles.headerContainer}>
<CloseIcon onClose={onClose} />
</View>
const AppModal = ({ children, onClose }) => {
return (
<Modal
animationType="fade"
onRequestClose={onClose}
transparent={true}
visible={true}
>
<TouchableOpacity onPress={onClose} style={styles.blackBackground} />
{children}
</View>
</Modal>
)
</Modal>
)
}
AppModal.propTypes = {
children: PropTypes.node,
@@ -40,28 +27,6 @@ const styles = StyleSheet.create({
flex: 1,
opacity: 0.5,
},
headerContainer: {
flexDirection: 'row',
justifyContent: 'flex-end',
paddingTop: Spacing.base,
paddingHorizontal: Spacing.base,
position: 'absolute',
width: '100%',
zIndex: 3, // works on ios
elevation: 3, // works on android
},
modalWindow: {
alignSelf: 'center',
backgroundColor: 'white',
borderRadius: 10,
marginTop: Sizes.huge * 2,
paddingVertical: Spacing.large * 2,
position: 'absolute',
maxHeight: Dimensions.get('window').height * 0.7,
zIndex: 2, // works on ios
elevation: 2, // works on android
minWidth: '80%',
},
})
export default AppModal
+5 -2
View File
@@ -4,7 +4,7 @@ import { ScrollView, StyleSheet, View } from 'react-native'
import AppText from '../common/app-text'
import { Colors, Containers, Typography } from '../../styles'
import { Colors, Typography } from '../../styles'
const AppPage = ({
children,
@@ -35,7 +35,10 @@ AppPage.propTypes = {
}
const styles = StyleSheet.create({
container: { ...Containers.pageContainer },
container: {
backgroundColor: Colors.turquoiseLight,
flex: 1,
},
scrollView: {
backgroundColor: Colors.turquoiseLight,
flexGrow: 1,
+19 -4
View File
@@ -1,15 +1,30 @@
import React from 'react'
import { StyleSheet, TextInput } from 'react-native'
import { KeyboardAvoidingView, StyleSheet, TextInput } from 'react-native'
import PropTypes from 'prop-types'
import { Colors, Spacing, Typography } from '../../styles'
const AppTextInput = ({ style, ...props }) => (
<TextInput style={[styles.input, style]} {...props} />
)
const AppTextInput = ({ style, isKeyboardOffset, ...props }) => {
const behavior = isKeyboardOffset ? 'padding' : 'height'
const keyboardVerticalOffset = isKeyboardOffset ? 300 : 0
return (
<KeyboardAvoidingView
behavior={behavior}
keyboardVerticalOffset={keyboardVerticalOffset}
>
<TextInput style={[styles.input, style]} {...props} />
</KeyboardAvoidingView>
)
}
AppTextInput.propTypes = {
style: PropTypes.object,
isKeyboardOffset: PropTypes.bool,
}
AppTextInput.defultProps = {
isKeyboardOffset: true,
}
const styles = StyleSheet.create({
+10 -4
View File
@@ -2,18 +2,24 @@ import React from 'react'
import PropTypes from 'prop-types'
import { StyleSheet, Text } from 'react-native'
import Link from './link'
import { Colors, Typography } from '../../styles'
const AppText = ({ children, style, ...props }) => {
const AppText = ({ children, linkStyle, style, ...props }) => {
// we parse for links in case the text contains any
return (
<Text style={[styles.text, style]} {...props}>
{children}
</Text>
<Link style={linkStyle}>
<Text style={[styles.text, style]} {...props}>
{children}
</Text>
</Link>
)
}
AppText.propTypes = {
children: PropTypes.node,
linkStyle: PropTypes.object,
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
}
+40
View File
@@ -0,0 +1,40 @@
import React from 'react'
import PropTypes from 'prop-types'
import Hyperlink from 'react-native-hyperlink'
import { StyleSheet } from 'react-native'
import { Colors, Typography } from '../../styles'
import links from '../../i18n/en/links'
const Link = ({ children, style }) => {
return (
<Hyperlink
linkStyle={[styles.link, style]}
linkText={replaceUrlWithText}
linkDefault
>
{children}
</Hyperlink>
)
}
Link.propTypes = {
children: PropTypes.node,
style: PropTypes.object,
}
const styles = StyleSheet.create({
link: {
color: Colors.purple,
textDecorationLine: 'underline',
...Typography.mainText,
},
})
function replaceUrlWithText(url) {
const link = Object.values(links).find((l) => l.url === url)
return (link && link.text) || url
}
export default Link
+8 -3
View File
@@ -4,7 +4,7 @@ import { StyleSheet, View } from 'react-native'
import AppText from './app-text'
import { Colors, Containers, Spacing, Typography } from '../../styles'
import { Colors, Spacing, Typography } from '../../styles'
const Segment = ({ children, last, title }) => {
const containerStyle = last ? styles.containerLast : styles.container
@@ -25,16 +25,21 @@ Segment.propTypes = {
title: PropTypes.string,
}
const segmentContainer = {
marginHorizontal: Spacing.base,
marginBottom: Spacing.base,
}
const styles = StyleSheet.create({
container: {
borderStyle: 'solid',
borderBottomWidth: 1,
borderBottomColor: Colors.greyLight,
paddingBottom: Spacing.base,
...Containers.segmentContainer,
...segmentContainer,
},
containerLast: {
...Containers.segmentContainer,
...segmentContainer,
},
title: {
...Typography.subtitle,
@@ -2,25 +2,25 @@ import React from 'react'
import { StyleSheet, View } from 'react-native'
import PropTypes from 'prop-types'
import AppText from '../common/app-text'
import AppText from './app-text'
import { Sizes, Spacing, Typography } from '../../styles'
const StatsOverview = ({ data }) => {
return data.map((rowContent, i) => <Row key={i} rowContent={rowContent} />)
const Table = ({ tableContent }) => {
return tableContent.map((rowContent, i) => (
<Row key={i} rowContent={rowContent} />
))
}
StatsOverview.propTypes = {
data: PropTypes.array.isRequired,
Table.propTypes = {
tableContent: PropTypes.array.isRequired,
}
const Row = ({ rowContent }) => {
const isStandardDeviation = rowContent[1].includes('deviation')
return (
<View style={styles.row}>
<Cell content={rowContent[0]} isLeft />
<Cell content={rowContent[1]} hasAsterisk={isStandardDeviation} />
<Cell content={rowContent[1]} />
</View>
)
}
@@ -29,7 +29,7 @@ Row.propTypes = {
rowContent: PropTypes.array.isRequired,
}
const Cell = ({ content, isLeft, hasAsterisk }) => {
const Cell = ({ content, isLeft }) => {
const styleContainer = isLeft ? styles.cellLeft : styles.cellRight
const styleText = isLeft ? styles.accentPurpleBig : styles.accentOrange
const numberOfLines = isLeft ? 1 : 2
@@ -43,7 +43,6 @@ const Cell = ({ content, isLeft, hasAsterisk }) => {
style={styleText}
>
{content}
{hasAsterisk && <AppText style={styles.accentOrange}>*</AppText>}
</AppText>
</View>
)
@@ -52,7 +51,6 @@ const Cell = ({ content, isLeft, hasAsterisk }) => {
Cell.propTypes = {
content: PropTypes.node.isRequired,
isLeft: PropTypes.bool,
hasAsterisk: PropTypes.bool,
}
const styles = StyleSheet.create({
@@ -67,11 +65,18 @@ const styles = StyleSheet.create({
},
cellLeft: {
alignItems: 'flex-end',
flex: 3,
flex: 5,
justifyContent: 'center',
},
cellRight: { flex: 5 },
row: { flexDirection: 'row' },
cellRight: {
flex: 5,
justifyContent: 'center',
},
row: {
flexDirection: 'row',
marginBottom: Spacing.tiny,
marginLeft: Spacing.tiny,
},
})
export default StatsOverview
export default Table
+4 -3
View File
@@ -10,7 +10,7 @@ import SymptomEditView from './symptom-edit-view'
import { isDateInFuture } from '../helpers/cycle-day'
import { Colors, Sizes, Spacing } from '../../styles'
import { useTranslation } from 'react-i18next'
import { headerTitles as symptomTitles } from '../../i18n/en/labels'
const SymptomBox = ({
date,
@@ -20,7 +20,6 @@ const SymptomBox = ({
editedSymptom,
setEditedSymptom,
}) => {
const { t } = useTranslation(null, { keyPrefix: 'cycleDay.symptomBox' })
const isSymptomEdited = editedSymptom === symptom
const isSymptomDisabled = isDateInFuture(date) && symptom !== 'note'
const isExcluded = symptomData !== null ? symptomData.exclude : false
@@ -62,7 +61,9 @@ const SymptomBox = ({
size={Sizes.icon}
/>
<View style={styles.textContainer}>
<AppText style={symptomNameStyle}>{t(symptom)}</AppText>
<AppText style={symptomNameStyle}>
{symptomTitles[symptom].toLowerCase()}
</AppText>
{symptomDataToDisplay && (
<AppText style={textStyle} numberOfLines={4}>
{symptomDataToDisplay}
+24 -16
View File
@@ -1,12 +1,13 @@
import React, { useState } from 'react'
import PropTypes from 'prop-types'
import { ScrollView, StyleSheet, View } from 'react-native'
import { Dimensions, ScrollView, StyleSheet, View } from 'react-native'
import AppModal from '../common/app-modal'
import AppSwitch from '../common/app-switch'
import AppText from '../common/app-text'
import AppTextInput from '../common/app-text-input'
import Button from '../common/button'
import CloseIcon from '../common/close-icon'
import Segment from '../common/segment'
import SelectBoxGroup from './select-box-group'
import SelectTabGroup from './select-tab-group'
@@ -108,20 +109,16 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
}
const iconName = shouldShowInfo ? 'chevron-up' : 'chevron-down'
const noteText = symptom === 'note' ? data.value : data.note
const inputProps = {
multiline: true,
numberOfLines: 3,
scrollEnabled: false,
style: styles.input,
textAlignVertical: 'top',
}
return (
<AppModal onClose={onSave}>
<ScrollView
contentContainerStyle={styles.modalContainer}
keyboardDismissMode="on-drag"
style={styles.modalWindow}
>
<View style={styles.headerContainer}>
<CloseIcon onClose={onSave} />
</View>
{symptom === 'temperature' && (
<Temperature
date={date}
@@ -159,7 +156,7 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
/>
{isOtherSelected && (
<AppTextInput
{...inputProps}
multiline={true}
placeholder={sharedLabels.enter}
value={data.note}
onChangeText={(value) => onSelectBoxNote(value)}
@@ -181,7 +178,8 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
<Segment style={styles.segmentBorder}>
<AppText>{symtomPage[symptom].note}</AppText>
<AppTextInput
{...inputProps}
multiline={true}
numberOfLines={3}
onChangeText={onEditNote}
placeholder={sharedLabels.enter}
testID="noteInput"
@@ -220,14 +218,24 @@ SymptomEditView.propTypes = {
const styles = StyleSheet.create({
buttonsContainer: {
...Containers.rowContainer,
paddingHorizontal: Spacing.base,
paddingBottom: Spacing.base,
},
input: {
height: Sizes.base * 5,
headerContainer: {
flexDirection: 'row',
justifyContent: 'flex-end',
paddingVertical: Spacing.tiny,
},
modalContainer: {
paddingHorizontal: Spacing.base,
flex: 1,
padding: Spacing.base,
},
modalWindow: {
alignSelf: 'center',
backgroundColor: 'white',
borderRadius: 10,
marginVertical: Sizes.huge * 2,
position: 'absolute',
minHeight: '40%',
maxHeight: Dimensions.get('window').height * 0.7,
},
segmentBorder: {
borderBottomColor: Colors.greyLight,
+21 -24
View File
@@ -7,28 +7,28 @@ import {
View,
} from 'react-native'
import PropTypes from 'prop-types'
import AppText from '../common/app-text'
import AppIcon from '../common/app-icon'
import CloseIcon from '../common/close-icon'
import MenuItem from './menu-item'
import { Colors, Sizes, Typography } from '../../styles'
import { Colors, Sizes } from '../../styles'
import settingsLabels from '../../i18n/en/settings'
import { HIT_SLOP } from '../../config'
import { useTranslation } from 'react-i18next'
const { menuItems } = settingsLabels
const settingsMenuItems = [
{ labelKey: 'settings', componentName: 'SettingsMenu' },
{ labelKey: 'about', componentName: 'About' },
{ labelKey: 'license', componentName: 'License' },
{ labelKey: 'privacyPolicy', componentName: 'PrivacyPolicy' },
{ name: menuItems.settings, component: 'SettingsMenu' },
{ name: menuItems.about, component: 'About' },
{ name: menuItems.license, component: 'License' },
{ name: menuItems.privacyPolicy, component: 'PrivacyPolicy' },
]
const HamburgerMenu = ({ navigate }) => {
const [isOpen, setIsOpen] = useState(false)
const closeMenu = () => setIsOpen(false)
const { t } = useTranslation(null, { keyPrefix: 'hamburgerMenu.menuMain' })
if (!isOpen)
return (
<TouchableOpacity onPress={() => setIsOpen(true)} hitSlop={HIT_SLOP}>
@@ -36,25 +36,23 @@ const HamburgerMenu = ({ navigate }) => {
</TouchableOpacity>
)
function onPress(componentName) {
closeMenu()
navigate(componentName)
}
return (
<Modal animationType="fade" onRequestClose={closeMenu} transparent>
<TouchableOpacity onPress={closeMenu} style={styles.blackBackground} />
<Modal animationType="fade" onRequestClose={closeMenu} transparent={true}>
<TouchableOpacity
onPress={closeMenu}
style={styles.blackBackground}
></TouchableOpacity>
<View style={styles.menu}>
<View style={styles.iconContainer}>
<CloseIcon color={'black'} onClose={closeMenu} />
</View>
{settingsMenuItems.map(({ labelKey, componentName }) => (
<TouchableOpacity
onPress={() => onPress(componentName)}
key={labelKey}
>
<AppText style={styles.menuItem}>{t(labelKey)}</AppText>
</TouchableOpacity>
{settingsMenuItems.map((item) => (
<MenuItem
item={item}
key={item.name}
closeMenu={closeMenu}
navigate={navigate}
/>
))}
</View>
</Modal>
@@ -86,5 +84,4 @@ const styles = StyleSheet.create({
position: 'absolute',
width: '60%',
},
menuItem: Typography.subtitle,
})
+35
View File
@@ -0,0 +1,35 @@
import React from 'react'
import { StyleSheet, TouchableOpacity } from 'react-native'
import PropTypes from 'prop-types'
import AppText from '../common/app-text'
import { Typography } from '../../styles'
const MenuItem = ({ item, navigate, closeMenu }) => {
const { component, name } = item
const onPress = () => {
closeMenu()
navigate(component)
}
return (
<TouchableOpacity onPress={onPress}>
<AppText style={styles.text}>{name}</AppText>
</TouchableOpacity>
)
}
MenuItem.propTypes = {
item: PropTypes.object.isRequired,
navigate: PropTypes.func.isRequired,
closeMenu: PropTypes.func.isRequired,
}
const styles = StyleSheet.create({
text: {
...Typography.subtitle,
},
})
export default MenuItem
+8 -13
View File
@@ -3,7 +3,6 @@ import { LocalDate } from '@js-joda/core'
import { scaleObservable, unitObservable } from '../../local-storage'
import { getCycleStatusForDay } from '../../lib/sympto-adapter'
import { getCycleDay, getAmountOfCycleDays } from '../../db'
import { Sizes } from '../../styles'
//YAxis helpers
@@ -51,19 +50,15 @@ export function getTickList(columnHeight) {
const label = tick.toFixed(1)
let shouldShowLabel
// when units === 0.1 and tick height is big enough, we show temp values with step 0.2
// when units === 0.5 and tick height is not big enough, we show temp values with step 1
// otherwise we show temp values with step 0.5
// when temp range <= 2, units === 0.1 we show temp values with step 0.2
// when temp range > 2, units === 0.5 we show temp values with step 0.5
switch (true) {
case unit === 0.1 && tickHeight > Sizes.base + 2:
shouldShowLabel = !((label * 10) % 2)
break
case unit === 0.5 && tickHeight <= Sizes.base + 2:
shouldShowLabel = !((label * 10) % 10)
break
default:
shouldShowLabel = !((label * 10) % 5)
if (unit === 0.1) {
// show label with step 0.2
shouldShowLabel = !((label * 10) % 2)
} else {
// show label with step 0.5
shouldShowLabel = !((label * 10) % 5)
}
// don't show label, if first or last tick
-15
View File
@@ -22,18 +22,3 @@ export function dateToTitle(dateString) {
? labels.today
: moment(dateString).format('ddd DD. MMM YY')
}
export function humanizeDate(dateString) {
if (!dateString) return ''
const today = LocalDate.now()
try {
const dateToDisplay = LocalDate.parse(dateString)
return today.equals(dateToDisplay)
? labels.today
: moment(dateString).format('DD. MMM YY')
} catch (e) {
return ''
}
}
+29 -24
View File
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import { Alert, KeyboardAvoidingView, StyleSheet, View } from 'react-native'
import { SHA512 } from 'jshashes'
import { Alert, StyleSheet, View } from 'react-native'
import nodejs from 'nodejs-mobile-react-native'
import AppPage from './common/app-page'
import AppTextInput from './common/app-text-input'
@@ -9,7 +9,7 @@ import Button from './common/button'
import Header from './header'
import { saveEncryptionFlag } from '../local-storage'
import { deleteDbAndOpenNew, openDb } from '../db'
import { requestHash, deleteDbAndOpenNew, openDb } from '../db'
import { passwordPrompt as labels, shared } from '../i18n/en/labels'
import { Containers, Spacing } from '../styles'
@@ -17,10 +17,9 @@ const cancelButton = { text: shared.cancel, style: 'cancel' }
const PasswordPrompt = ({ enableShowApp }) => {
const [password, setPassword] = useState(null)
const unlockApp = () => requestHash('check-pw', password)
const isPasswordEntered = Boolean(password)
const unlockApp = async () => {
const hash = new SHA512().hex(password)
const passHashToDb = async (hash) => {
const connected = await openDb(hash)
if (!connected) {
@@ -32,9 +31,16 @@ const PasswordPrompt = ({ enableShowApp }) => {
])
return
}
enableShowApp()
}
useEffect(() => {
nodejs.channel.addListener('check-pw', passHashToDb, this)
return () => nodejs.channel.remove('check-pw', passHashToDb)
}, [])
const onDeleteDataConfirmation = async () => {
await deleteDbAndOpenNew()
await saveEncryptionFlag(false)
@@ -62,23 +68,22 @@ const PasswordPrompt = ({ enableShowApp }) => {
<>
<Header isStatic />
<AppPage contentContainerStyle={styles.contentContainer}>
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={150}>
<AppTextInput
onChangeText={setPassword}
secureTextEntry={true}
placeholder={labels.enterPassword}
/>
<View style={styles.containerButtons}>
<Button onPress={onConfirmDeletion}>{labels.forgotPassword}</Button>
<Button
disabled={!isPasswordEntered}
isCTA={isPasswordEntered}
onPress={unlockApp}
>
{labels.title}
</Button>
</View>
</KeyboardAvoidingView>
<AppTextInput
isKeyboardOffset={false}
onChangeText={setPassword}
secureTextEntry={true}
placeholder={labels.enterPassword}
/>
<View style={styles.containerButtons}>
<Button onPress={onConfirmDeletion}>{labels.forgotPassword}</Button>
<Button
disabled={!isPasswordEntered}
isCTA={isPasswordEntered}
onPress={unlockApp}
>
{labels.title}
</Button>
</View>
</AppPage>
</>
)
-29
View File
@@ -1,29 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import AppPage from '../common/app-page'
import AppText from '../common/app-text'
import AppLink from '../common/AppLink'
import Segment from '../common/segment'
const License = ({ children }) => {
const { t } = useTranslation(null, { keyPrefix: 'hamburgerMenu.license' })
const currentYear = new Date().getFullYear()
const link = 'https://www.gnu.org/licenses/gpl-3.0.html'
return (
<AppPage title={t('title')}>
<Segment last>
<AppText>{t('text', { currentYear })}</AppText>
<AppLink url={link}>{link}</AppLink>
{children}
</Segment>
</AppPage>
)
}
License.propTypes = {
children: PropTypes.node,
}
export default License
@@ -3,7 +3,6 @@ import { Platform, Linking } from 'react-native'
import AppPage from '../common/app-page'
import AppText from '../common/app-text'
import AppLink from '../common/AppLink'
import Segment from '../common/segment'
import Button from '../common/button'
import ButtonRow from '../common/button-row'
@@ -12,7 +11,7 @@ import links from '../../i18n/en/links'
import { useTranslation } from 'react-i18next'
const AboutSection = () => {
const { t } = useTranslation(null, { keyPrefix: 'hamburgerMenu.about' })
const { t } = useTranslation(null, { keyPrefix: 'settings.about' })
return (
<AppPage title={t('title')}>
@@ -36,15 +35,13 @@ const AboutSection = () => {
</Segment>
<Segment title={t('credits.title')}>
<AppText>
{t('credits.text')}{' '}
<AppLink url={links.flaticon.url}>flaticon</AppLink>.{' '}
</AppText>
<AppText>
{t('credits.madeBy')}{' '}
<AppLink url={links.smashicons.url}>smashicons</AppLink>,{' '}
<AppLink url={links.pause08.url}>pause08</AppLink>,{' '}
<AppLink url={links.kazachek.url}>kazachek</AppLink>,{' '}
<AppLink url={links.freepik.url}>freepik</AppLink>.
{t('credits.text', {
smashicons: links.smashicons.url,
pause08: links.pause08.url,
kazachek: links.kazachek.url,
freepik: links.freepik.url,
flaticon: links.flaticon.url,
})}
</AppText>
</Segment>
<Segment title={t('donate.title')}>
@@ -1,12 +1,12 @@
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { Alert, KeyboardAvoidingView, StyleSheet, View } from 'react-native'
import { SHA512 } from 'jshashes'
import { Alert, StyleSheet, View } from 'react-native'
import nodejs from 'nodejs-mobile-react-native'
import AppTextInput from '../../common/app-text-input'
import Button from '../../common/button'
import { openDb } from '../../../db'
import { requestHash, openDb } from '../../../db'
import { Containers } from '../../../styles'
import settings from '../../../i18n/en/settings'
import { shared } from '../../../i18n/en/labels'
@@ -14,8 +14,7 @@ import { shared } from '../../../i18n/en/labels'
const ConfirmWithPassword = ({ onSuccess, onCancel }) => {
const [password, setPassword] = useState(null)
const checkPassword = async () => {
const hash = new SHA512().hex(password)
const checkPassword = async (hash) => {
try {
await openDb(hash)
onSuccess()
@@ -24,6 +23,13 @@ const ConfirmWithPassword = ({ onSuccess, onCancel }) => {
}
}
useEffect(() => {
nodejs.channel.addListener('password-check', checkPassword, this)
return () => {
nodejs.channel.removeListener('password-check', checkPassword)
}
}, [])
const onIncorrectPassword = () => {
Alert.alert(shared.incorrectPassword, shared.incorrectPasswordMessage, [
{
@@ -37,11 +43,15 @@ const ConfirmWithPassword = ({ onSuccess, onCancel }) => {
])
}
const initPasswordCheck = () => {
requestHash('password-check', password)
}
const labels = settings.passwordSettings
const isPassword = password !== null
return (
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={150}>
<>
<AppTextInput
onChangeText={setPassword}
placeholder={labels.enterCurrent}
@@ -53,12 +63,12 @@ const ConfirmWithPassword = ({ onSuccess, onCancel }) => {
<Button
disabled={!isPassword}
isCTA={isPassword}
onPress={checkPassword}
onPress={initPasswordCheck}
>
{shared.confirmToProceed}
</Button>
</View>
</KeyboardAvoidingView>
</>
)
}
+2 -2
View File
@@ -2,8 +2,8 @@ import Reminders from './reminders/reminders'
import NfpSettings from './nfp-settings'
import DataManagement from './data-management'
import Password from './password'
import About from './About'
import License from './License'
import About from './about'
import License from './license'
import PrivacyPolicy from './privacy-policy'
export default {
+21
View File
@@ -0,0 +1,21 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import AppPage from '../common/app-page'
import AppText from '../common/app-text'
import Segment from '../common/segment'
const License = () => {
const { t } = useTranslation()
const currentYear = new Date().getFullYear()
return (
<AppPage title={t('settings.license.title')}>
<Segment last>
<AppText>{t('settings.license.text', { currentYear })}</AppText>
</Segment>
</AppPage>
)
}
export default License
+4 -8
View File
@@ -7,22 +7,18 @@ import AppText from '../common/app-text'
import Segment from '../common/segment'
import { Colors, Containers, Sizes } from '../../styles'
import { useTranslation } from 'react-i18next'
const MenuItem = ({ item, last, navigate }) => {
const { t } = useTranslation(null, {
keyPrefix: 'hamburgerMenu.settings.menuItem',
})
return (
<Segment last={last}>
<TouchableOpacity
style={styles.container}
key={item.label}
onPress={() => navigate(item.componentName)}
key={item.name}
onPress={() => navigate(item.component)}
>
<View>
<AppText style={styles.title}>{t(`${item.label}.name`)}</AppText>
{!!item.label && <AppText>{t(`${item.label}.text`)}</AppText>}
<AppText style={styles.title}>{item.name}</AppText>
{item.text.length > 0 && <AppText>{item.text}</AppText>}
</View>
<AppIcon name="chevron-right" color={Colors.orange} />
</TouchableOpacity>
@@ -1,24 +1,35 @@
import React, { useState } from 'react'
import { KeyboardAvoidingView, StyleSheet } from 'react-native'
import React, { useState, useEffect } from 'react'
import { StyleSheet } from 'react-native'
import nodejs from 'nodejs-mobile-react-native'
import PropTypes from 'prop-types'
import { SHA512 } from 'jshashes'
import AppText from '../../common/app-text'
import AppTextInput from '../../common/app-text-input'
import Button from '../../common/button'
import { requestHash } from '../../../db'
import { Colors, Spacing } from '../../../styles'
import settings from '../../../i18n/en/settings'
const LISTENER_TYPE = 'create-or-change-pw'
const EnterNewPassword = ({ changeEncryptionAndRestart }) => {
const [password, setPassword] = useState('')
const [passwordConfirmation, setPasswordConfirmation] = useState('')
const [shouldShowErrorMessage, setShouldShowErrorMessage] = useState(false)
useEffect(() => {
const listener = nodejs.channel.addListener(
LISTENER_TYPE,
changeEncryptionAndRestart,
this
)
return () => listener.remove()
}, [])
const savePassword = () => {
if (comparePasswords()) {
const hash = new SHA512().hex(password)
changeEncryptionAndRestart(hash)
requestHash(LISTENER_TYPE, password)
} else {
setShouldShowErrorMessage(true)
}
@@ -30,8 +41,9 @@ const EnterNewPassword = ({ changeEncryptionAndRestart }) => {
const isButtonActive = password.length > 0 && passwordConfirmation.length > 0
return (
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={150}>
<>
<AppTextInput
isKeyboardOffset={false}
onChangeText={setPassword}
placeholder={labels.enterNew}
textContentType="password"
@@ -39,6 +51,7 @@ const EnterNewPassword = ({ changeEncryptionAndRestart }) => {
secureTextEntry={true}
/>
<AppTextInput
isKeyboardOffset={false}
onChangeText={setPasswordConfirmation}
placeholder={labels.confirmPassword}
textContentType="password"
@@ -55,7 +68,7 @@ const EnterNewPassword = ({ changeEncryptionAndRestart }) => {
>
{labels.savePassword}
</Button>
</KeyboardAvoidingView>
</>
)
}
+1 -3
View File
@@ -9,9 +9,7 @@ import Segment from '../common/segment'
import { Colors, Sizes } from '../../styles'
const PrivacyPolicy = () => {
const { t } = useTranslation(null, {
keyPrefix: 'hamburgerMenu.privacyPolicy',
})
const { t } = useTranslation(null, { keyPrefix: 'settings.privacyPolicy' })
const sections = ['intro', 'dataUse', 'permissions', 'transparency']
return (
+10 -10
View File
@@ -4,21 +4,21 @@ import PropTypes from 'prop-types'
import AppPage from '../common/app-page'
import MenuItem from './menu-item'
import { useTranslation } from 'react-i18next'
import settingsLabels from '../../i18n/en/settings'
const menuItems = [
{ label: 'reminders', componentName: 'Reminders' },
{ label: 'nfpSettings', componentName: 'NfpSettings' },
{ label: 'dataManagement', componentName: 'DataManagement' },
{ label: 'password', componentName: 'Password' },
const { menuItems } = settingsLabels
const menu = [
{ ...menuItems.reminders, component: 'Reminders' },
{ ...menuItems.nfpSettings, component: 'NfpSettings' },
{ ...menuItems.dataManagement, component: 'DataManagement' },
{ ...menuItems.password, component: 'Password' },
]
const SettingsMenu = ({ navigate }) => {
const { t } = useTranslation()
return (
<AppPage title={t('hamburgerMenu.settings.title')}>
{menuItems.map((menuItem, i) => {
const last = menuItems.length === i + 1
<AppPage title={settingsLabels.title}>
{menu.map((menuItem, i) => {
const last = menu.length === i + 1
return (
<MenuItem item={menuItem} key={i} last={last} navigate={navigate} />
+113
View File
@@ -0,0 +1,113 @@
import React from 'react'
import { ImageBackground, View } from 'react-native'
import { ScaledSheet } from 'react-native-size-matters'
import AppPage from './common/app-page'
import AppText from './common/app-text'
import Segment from './common/segment'
import Table from './common/table'
import cycleModule from '../lib/cycle'
import {getCycleLengthStats as getCycleInfo} from '../lib/cycle-length'
import {stats as labels} from '../i18n/en/labels'
import { Sizes, Spacing, Typography } from '../styles'
const image = require('../assets/cycle-icon.png')
const Stats = () => {
const cycleLengths = cycleModule().getAllCycleLengths()
const numberOfCycles = cycleLengths.length
const hasAtLeastOneCycle = numberOfCycles >= 1
const cycleData = hasAtLeastOneCycle ? getCycleInfo(cycleLengths)
: { minimum: '—', maximum: '—', stdDeviation: '—' }
const statsData = [
[cycleData.minimum, labels.minLabel],
[cycleData.maximum, labels.maxLabel],
[cycleData.stdDeviation ? cycleData.stdDeviation : '—', labels.stdLabel],
[numberOfCycles, labels.basisOfStatsEnd]
]
return (
<AppPage contentContainerStyle={styles.pageContainer}>
<Segment last style={styles.pageContainer}>
<AppText>{labels.cycleLengthExplainer}</AppText>
{!hasAtLeastOneCycle && <AppText>{labels.emptyStats}</AppText>}
{hasAtLeastOneCycle &&
<View style={styles.container}>
<View style={styles.columnLeft}>
<ImageBackground
source={image}
imageStyle={styles.image}
style={styles.imageContainter}
>
<AppText
numberOfLines={1}
ellipsizeMode="clip"
style={styles.accentPurpleGiant}
>
{cycleData.mean}
</AppText>
<AppText style={styles.accentPurpleHuge}>
{labels.daysLabel}
</AppText>
</ImageBackground>
<AppText style={styles.accentOrange}>
{labels.averageLabel}
</AppText>
</View>
<View style={styles.columnRight}>
<Table tableContent={statsData} />
</View>
</View>
}
</Segment>
</AppPage>
)
}
const column = {
flexDirection: 'column',
}
const styles = ScaledSheet.create({
accentOrange: {
...Typography.accentOrange,
fontSize: Sizes.small,
},
accentPurpleGiant: {
...Typography.accentPurpleGiant,
marginTop: Spacing.base * (-2),
},
accentPurpleHuge: {
...Typography.accentPurpleHuge,
marginTop: Spacing.base * (-1),
},
container: {
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
paddingTop: Spacing.base
},
columnLeft: {
...column,
flex: 2,
},
columnRight: {
...column,
flex: 3,
paddingTop: Spacing.small,
},
image: {
resizeMode: 'contain',
},
imageContainter: {
paddingTop: Spacing.large * 2.5,
marginBottom: Spacing.large,
},
pageContainer: {
marginTop: Spacing.base * 2,
}
})
export default Stats
-118
View File
@@ -1,118 +0,0 @@
import React from 'react'
import { FlatList, StyleSheet, View } from 'react-native'
import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import AppModal from '../common/app-modal'
import AppText from '../common/app-text'
import cycleModule from '../../lib/cycle'
import { Spacing, Typography, Colors } from '../../styles'
import { humanizeDate } from '../helpers/format-date'
const Item = ({ data }) => {
const { t } = useTranslation(null, { keyPrefix: 'plurals' })
if (!data) return false
const { date, cycleLength, bleedingLength } = data
return (
<View style={styles.row}>
<View style={styles.accentCell}>
<AppText>{humanizeDate(date)}</AppText>
</View>
<View style={styles.cell}>
<AppText>{t('day', { count: cycleLength })}</AppText>
</View>
<View style={styles.cell}>
<AppText>{t('day', { count: bleedingLength })}</AppText>
</View>
</View>
)
}
Item.propTypes = {
data: PropTypes.object.isRequired,
}
const PeriodDetailsModal = ({ onClose }) => {
const renderItem = ({ item }) => <Item data={item} />
const data = cycleModule().getStats()
if (!data || data.length === 0) return false
return (
<AppModal onClose={onClose}>
<View>
<FlatList
data={data}
renderItem={renderItem}
keyExtractor={(item) => item.date}
ItemSeparatorComponent={ItemDivider}
ListHeaderComponent={FlatListHeader}
ListHeaderComponentStyle={styles.headerDivider}
stickyHeaderIndices={[0]}
contentContainerStyle={styles.container}
/>
</View>
</AppModal>
)
}
PeriodDetailsModal.propTypes = {
onClose: PropTypes.func,
}
const ItemDivider = () => <View style={styles.divider} />
const FlatListHeader = () => (
<View style={styles.row}>
<View style={styles.accentCell}>
<AppText style={styles.header}>{'Cycle Start'}</AppText>
</View>
<View style={styles.cell}>
<AppText style={styles.header}>{'Cycle Length'}</AppText>
</View>
<View style={styles.cell}>
<AppText style={styles.header}>{'Bleeding'}</AppText>
</View>
</View>
)
const styles = StyleSheet.create({
divider: {
height: 1,
width: '100%',
backgroundColor: Colors.grey,
},
header: {
...Typography.accentOrange,
paddingVertical: Spacing.small,
},
headerDivider: {
borderBottomColor: Colors.purple,
borderBottomWidth: 2,
},
row: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingVertical: Spacing.tiny,
backgroundColor: 'white',
},
cell: {
flex: 2,
justifyContent: 'center',
},
accentCell: {
flex: 3,
justifyContent: 'center',
},
container: {
minHeight: '40%',
minWidth: '95%',
paddingHorizontal: Spacing.base,
},
})
export default PeriodDetailsModal
-135
View File
@@ -1,135 +0,0 @@
import React, { useState } from 'react'
import { ImageBackground, SafeAreaView, ScrollView, View } from 'react-native'
import { ScaledSheet } from 'react-native-size-matters'
import { useTranslation } from 'react-i18next'
import AppText from '../common/app-text'
import Button from '../common/button'
import Footnote from '../common/Footnote'
import StatsOverview from './StatsOverview'
import PeriodDetailsModal from './PeriodDetailsModal'
import cycleModule from '../../lib/cycle'
import { getCycleLengthStats as getCycleInfo } from '../../lib/cycle-length'
import { Containers, Sizes, Spacing, Typography } from '../../styles'
const image = require('../../assets/cycle-icon.png')
const Stats = () => {
const [isStatsVisible, setIsStatsVisible] = useState(false)
const { t } = useTranslation(null, { keyPrefix: 'stats' })
const cycleLengths = cycleModule().getAllCycleLengths()
const numberOfCycles = cycleLengths.length
const cycleData =
numberOfCycles > 0
? getCycleInfo(cycleLengths)
: { minimum: '—', maximum: '—', stdDeviation: '—' }
const standardDeviation = cycleData.stdDeviation
? cycleData.stdDeviation
: '—'
const statsData = [
[cycleData.minimum, t('overview.min')],
[cycleData.maximum, t('overview.max')],
[standardDeviation, t('overview.standardDeviation')],
[numberOfCycles, t('overview.completedCycles')],
]
return (
<SafeAreaView style={styles.pageContainer}>
<ScrollView contentContainerStyle={styles.overviewContainer}>
<AppText>{t('intro')}</AppText>
{numberOfCycles === 0 ? (
<AppText>{t('noData')}</AppText>
) : (
<>
<View style={styles.container}>
<View style={styles.columnLeft}>
<ImageBackground
source={image}
imageStyle={styles.image}
style={styles.imageContainter}
>
<AppText
numberOfLines={1}
ellipsizeMode="clip"
style={styles.accentPurpleGiant}
>
{cycleData.mean}
</AppText>
<AppText style={styles.accentPurpleHuge}>
{t('overview.days')}
</AppText>
</ImageBackground>
<AppText style={styles.accentOrange}>
{t('overview.average')}
</AppText>
</View>
<View style={styles.columnRight}>
<StatsOverview data={statsData} />
</View>
</View>
<Button isCTA onPress={() => setIsStatsVisible(true)}>
{t('showStats')}
</Button>
{isStatsVisible && (
<PeriodDetailsModal onClose={() => setIsStatsVisible(false)} />
)}
<Footnote>{t('footnote')}</Footnote>
</>
)}
</ScrollView>
</SafeAreaView>
)
}
const column = {
flexDirection: 'column',
}
const styles = ScaledSheet.create({
accentOrange: {
...Typography.accentOrange,
fontSize: Sizes.small,
},
accentPurpleGiant: {
...Typography.accentPurpleGiant,
marginTop: Spacing.base * -2,
},
accentPurpleHuge: {
...Typography.accentPurpleHuge,
marginTop: Spacing.base * -1,
},
container: {
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
},
columnLeft: {
...column,
flex: 3,
},
columnRight: {
...column,
flex: 5,
paddingTop: Spacing.small,
},
image: {
resizeMode: 'contain',
},
imageContainter: {
paddingTop: Spacing.large * 2.5,
marginBottom: Spacing.large,
},
overviewContainer: {
paddingHorizontal: Spacing.base,
paddingTop: Spacing.base,
},
pageContainer: {
...Containers.pageContainer,
},
})
export default Stats
+11
View File
@@ -1,5 +1,6 @@
import Realm from 'realm'
import { LocalDate, ChronoUnit } from '@js-joda/core'
import nodejs from 'nodejs-mobile-react-native'
import fs from 'react-native-fs'
import schemas from './schemas'
@@ -183,6 +184,16 @@ export function tryToImportWithoutDelete(cycleDays) {
})
}
export function requestHash(type, pw) {
nodejs.channel.post(
'request-SHA512',
JSON.stringify({
type: type,
message: pw,
})
)
}
export async function changeDbEncryption(hash) {
let key
if (hash) key = hashToInt8Array(hash)
+3 -67
View File
@@ -1,17 +1,4 @@
{
"cycleDay": {
"symptomBox": {
"bleeding": "Bleeding",
"temperature": "Temperature",
"mucus": "Cervical Mucus",
"cervix": "Cervix",
"note": "Note",
"desire": "Desire",
"sex": "Sex",
"pain": "Pain",
"mood": "Mood"
}
},
"labels": {
"bleedingPrediction": {
"noPrediction": "As soon as you have tracked 3 menstrual cycles, drip. will make predictions for the next ones."
@@ -26,12 +13,11 @@
"ok": "OK"
}
},
"hamburgerMenu": {
"settings": {
"about": {
"credits": {
"title": "Credits",
"text": "We love the drip. team. Thanks and lots of <3 to all of our condriputors. Thanks to Paula Härtel for the symptom tracking icons. All the other icons from:",
"madeBy": "Made by:"
"text": "We love the drip. team. Thanks and lots of <3 to all of our condriputors. Thanks to Paula Härtel for the symptom tracking icons. All the other icons are made by {{smashicons}}, {{pause08}}, {{kazachek}} & {{freepik}} from {{flaticon}}."
},
"donate": {
"button": "Donate here",
@@ -52,13 +38,7 @@
},
"license": {
"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:"
},
"menuMain": {
"about": "About",
"license": "License",
"settings": "Settings",
"privacyPolicy": "Privacy Policy"
"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": {
"title": "Privacy Policy",
@@ -78,50 +58,6 @@
"title": "Transparency",
"text": "You can read through the source code of drip. to ensure the given information is correct. The source code is like a recipe: It tells you how much and what kind of ingredients you need and how you prepare them to cook a tasty meal or program a funky app.\n\nBuon appetito!"
}
},
"settings": {
"menuItem": {
"dataManagement": {
"name": "Data",
"text": "import, export or delete your data"
},
"nfpSettings": {
"name": "NFP settings",
"text": "define how you want to use NFP"
},
"password": {
"name": "Password",
"text": ""
},
"reminders": {
"name": "Reminders",
"text": "turn on/off reminders"
}
},
"title": "Settings"
}
},
"stats": {
"noData": "At least one completed cycle is needed to display stats.",
"intro": "Basic statistics about the length of your cycles.",
"overview": {
"average": "Average cycle",
"days": "days",
"min": "Shortest",
"max": "Longest",
"standardDeviation": "Standard\ndeviation",
"completedCycles": "completed\ncycles"
},
"showStats": "Show period details",
"details": {
"cycleStart": "Cycle start",
"cycleLength": "Cycle length",
"bleedingDays": "Bleeding"
},
"footnote": "Based on the standard deviation of all your tracked periods drip. calculates a range for the starting day of the upcoming 3 periods. The range will be 3 days if your standard deviation is smaller than 1.5 and 5 days if the value is bigger.\n\nThe standard deviation tells you how much the length of your periods vary, 0 means all your periods are exactly the same length and the bigger the value the more the period length varies."
},
"plurals": {
"day": "{{count}} day",
"day_plural": "{{count}} days"
}
}
+27
View File
@@ -1,3 +1,6 @@
import labels from './settings'
const settingsTitles = labels.menuItems
export const home = {
unknown: '?',
phase: (n) => `${['1st', '2nd', '3rd'][n - 1]} cycle phase`,
@@ -30,6 +33,30 @@ export const shared = {
learnMore: 'Learn more',
}
export const headerTitles = {
Home: 'Home',
Calendar: 'Calendar',
Chart: 'Chart',
Stats: 'Statistics',
SettingsMenu: 'Settings',
Reminders: settingsTitles.reminders.name,
NfpSettings: settingsTitles.nfpSettings.name,
DataManagement: settingsTitles.dataManagement.name,
Password: settingsTitles.password.name,
About: 'About',
License: 'License',
PrivacyPolicy: 'Privacy Policy',
bleeding: 'Bleeding',
temperature: 'Temperature',
mucus: 'Cervical Mucus',
cervix: 'Cervix',
note: 'Note',
desire: 'Desire',
sex: 'Sex',
pain: 'Pain',
mood: 'Mood',
}
export const stats = {
cycleLengthExplainer: 'Basic statistics about the length of your cycles.',
emptyStats: 'At least one completed cycle is needed to display stats.',
+5
View File
@@ -1,6 +1,7 @@
import links from './links'
export default {
title: 'Settings',
menuItems: {
reminders: {
name: 'Reminders',
@@ -18,6 +19,10 @@ export default {
name: 'Password',
text: '',
},
about: 'About',
license: 'License',
settings: 'Settings',
privacyPolicy: 'Privacy Policy',
},
export: {
errors: {
-1
View File
@@ -19,6 +19,5 @@ target 'drip' do
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
+161 -4
View File
@@ -36,9 +36,12 @@
54DFE73D25D94DED0025C3FC /* cycle-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 54DFE73C25D94DED0025C3FC /* cycle-icon.png */; };
54DFE73E25D94DED0025C3FC /* cycle-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 54DFE73C25D94DED0025C3FC /* cycle-icon.png */; };
54E1D49923E7588F003FA37B /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54E1D49823E7588F003FA37B /* JavaScriptCore.framework */; };
5C4C9DDE2824847500B72CBE /* NodeMobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C225FC4966694B9FBD32E946 /* NodeMobile.framework */; };
62F2A4645AC84CDC9506FF27 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AEBF0735214455AAEDF56D5 /* libc++.tbd */; };
A16B351C3F3644CF95F104D2 /* builtin_modules in Resources */ = {isa = PBXBuildFile; fileRef = 36F1B55D0DEE47AA9AF4BBDD /* builtin_modules */; };
BD7041F2826E4A2CBE6CB87D /* RealmJSTests.xctest in Frameworks */ = {isa = PBXBuildFile; fileRef = F79F72C5390646E0A06AAE68 /* RealmJSTests.xctest */; };
D91133DCE120440893E2FD2E /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = CD8C8B91E0A747B3883A0D56 /* libz.tbd */; };
E4584E55EEC24302A3E84A23 /* nodejs-project in Resources */ = {isa = PBXBuildFile; fileRef = 6466AE2461BE4FA88B8372F0 /* nodejs-project */; };
E545887DBE87912F11770AB9 /* libPods-drip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 699D3B3789FC2E5185CB9894 /* libPods-drip.a */; };
FAC423E577F555F66C9891E4 /* libPods-drip-dripTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F33CCAAB670FD0D98C5C72DF /* libPods-drip-dripTests.a */; };
/* End PBXBuildFile section */
@@ -66,6 +69,7 @@
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = drip/main.m; sourceTree = "<group>"; };
2B1578D5817F46EE9BFC9BAF /* Pods-drip.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-drip.debug.xcconfig"; path = "Target Support Files/Pods-drip/Pods-drip.debug.xcconfig"; sourceTree = "<group>"; };
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
36F1B55D0DEE47AA9AF4BBDD /* builtin_modules */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = builtin_modules; path = "../node_modules/nodejs-mobile-react-native/install/resources/nodejs-modules/builtin_modules"; sourceTree = "<group>"; };
4A9B2D77CAC90DFEB5C4565A /* Pods-dripTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-dripTests.debug.xcconfig"; path = "Target Support Files/Pods-dripTests/Pods-dripTests.debug.xcconfig"; sourceTree = "<group>"; };
5409189625AB725F00086AE1 /* OpenSans-LightItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "OpenSans-LightItalic.ttf"; path = "../../assets/fonts/OpenSans-LightItalic.ttf"; sourceTree = "<group>"; };
540918A225AB725F00086AE1 /* Prompt-ExtraLight.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Prompt-ExtraLight.ttf"; path = "../../assets/fonts/Prompt-ExtraLight.ttf"; sourceTree = "<group>"; };
@@ -93,6 +97,7 @@
54E1D49823E7588F003FA37B /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
5ABC2C1190B4D25AC0398D09 /* Pods-dripTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-dripTests.release.xcconfig"; path = "Target Support Files/Pods-dripTests/Pods-dripTests.release.xcconfig"; sourceTree = "<group>"; };
5C649EDC281151BC005FED46 /* dripRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = dripRelease.entitlements; path = drip/dripRelease.entitlements; sourceTree = "<group>"; };
6466AE2461BE4FA88B8372F0 /* nodejs-project */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "nodejs-project"; path = "../nodejs-assets/nodejs-project"; sourceTree = "<group>"; };
699D3B3789FC2E5185CB9894 /* libPods-drip.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-drip.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6B7C2A0A7AAA83BBEFBD0B6A /* libPods-drip-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-drip-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
72DDDE8D34518ED64FD7EBBA /* Pods-drip-dripTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-drip-dripTests.release.xcconfig"; path = "Target Support Files/Pods-drip-dripTests/Pods-drip-dripTests.release.xcconfig"; sourceTree = "<group>"; };
@@ -103,6 +108,7 @@
A8B59389C2FC4F19BD30ABC3 /* libRNShare.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNShare.a; sourceTree = "<group>"; };
AB636AA0286D45CE9B23B2C3 /* libRCTRestart.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTRestart.a; sourceTree = "<group>"; };
B6FD0A300273E09D74C14C19 /* Pods-drip-dripTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-drip-dripTests.debug.xcconfig"; path = "Target Support Files/Pods-drip-dripTests/Pods-drip-dripTests.debug.xcconfig"; sourceTree = "<group>"; };
C225FC4966694B9FBD32E946 /* NodeMobile.framework */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.framework; name = NodeMobile.framework; path = "../node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework"; sourceTree = "<group>"; };
CD8C8B91E0A747B3883A0D56 /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
D211D71BE5A8436A978770A9 /* libRNDocumentPicker.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDocumentPicker.a; sourceTree = "<group>"; };
E086AB579387F878A2CBCFEB /* libPods-drip-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-drip-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -111,6 +117,7 @@
F5039D0A572B4BBCB7995891 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
F710D85E391D4094816E1B62 /* libRealmJS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRealmJS.a; sourceTree = "<group>"; };
F79F72C5390646E0A06AAE68 /* RealmJSTests.xctest */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = RealmJSTests.xctest; sourceTree = "<group>"; };
F992F2D99E614DD79FAD6565 /* libRNNodeJsMobile.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNNodeJsMobile.a; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -130,6 +137,7 @@
62F2A4645AC84CDC9506FF27 /* libc++.tbd in Frameworks */,
D91133DCE120440893E2FD2E /* libz.tbd in Frameworks */,
BD7041F2826E4A2CBE6CB87D /* RealmJSTests.xctest in Frameworks */,
5C4C9DDE2824847500B72CBE /* NodeMobile.framework in Frameworks */,
E545887DBE87912F11770AB9 /* libPods-drip.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -196,6 +204,7 @@
2D16E6891FA4F8E400B85C8A /* libReact.a */,
9AEBF0735214455AAEDF56D5 /* libc++.tbd */,
CD8C8B91E0A747B3883A0D56 /* libz.tbd */,
C225FC4966694B9FBD32E946 /* NodeMobile.framework */,
6B7C2A0A7AAA83BBEFBD0B6A /* libPods-drip-tvOS.a */,
E086AB579387F878A2CBCFEB /* libPods-drip-tvOSTests.a */,
699D3B3789FC2E5185CB9894 /* libPods-drip.a */,
@@ -213,6 +222,7 @@
D211D71BE5A8436A978770A9 /* libRNDocumentPicker.a */,
84CCEBD3B2C44758853BC941 /* libRNFS.a */,
AB636AA0286D45CE9B23B2C3 /* libRCTRestart.a */,
F992F2D99E614DD79FAD6565 /* libRNNodeJsMobile.a */,
90224CB4571D41C4969E9722 /* libGCDWebServers.a */,
F710D85E391D4094816E1B62 /* libRealmJS.a */,
F79F72C5390646E0A06AAE68 /* RealmJSTests.xctest */,
@@ -257,6 +267,8 @@
00E356EF1AD99517003FC87E /* dripTests */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
6466AE2461BE4FA88B8372F0 /* nodejs-project */,
36F1B55D0DEE47AA9AF4BBDD /* builtin_modules */,
42C7F9942202468200F22656 /* Recovered References */,
6817ABC38854EEB6D3EE933A /* Pods */,
006C39A0B9774387BC5ACA43 /* Resources */,
@@ -286,6 +298,7 @@
00E356EA1AD99517003FC87E /* Sources */,
00E356EB1AD99517003FC87E /* Frameworks */,
00E356EC1AD99517003FC87E /* Resources */,
22A5D3F7F84BDF2020F07B0E /* [CP] Embed Pods Frameworks */,
46313D848A7A3E69E5ED05E7 /* [CP] Copy Pods Resources */,
);
buildRules = (
@@ -307,6 +320,14 @@
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
DE9DD9049EBE47E5A1EA3F5D /* Build NodeJS Mobile Native Modules */,
6C10CEE2CE544C7F9400F1B4 /* Sign NodeJS Mobile Native Modules */,
B93B657279074F0DB95BCDE2 /* Remove NodeJS Mobile Framework Simulator Strips */,
CD43B73558845DFAF38EE039 /* [CP] Embed Pods Frameworks */,
935E6C85F581DC5BB536B833 /* [CP-User] [NODEJS MOBILE] Copy Node.js Project files */,
FCE9B437260EC219FF32251C /* [CP-User] [NODEJS MOBILE] Build Native Modules */,
2A3F66C5C345646DE949E1FF /* [CP-User] [NODEJS MOBILE] Sign Native Modules */,
CD7DBF41D9E2377DC61F80D8 /* [CP-User] [NODEJS MOBILE] Remove Simulator Strip */,
616E70055A3365D214C7B201 /* [CP] Copy Pods Resources */,
);
buildRules = (
@@ -391,6 +412,8 @@
54DFE73A25D94D6E0025C3FC /* swipe.png in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
5472A44A25BB7806005E81DE /* drip-home-icons.ttf in Resources */,
E4584E55EEC24302A3E84A23 /* nodejs-project in Resources */,
A16B351C3F3644CF95F104D2 /* builtin_modules in Resources */,
5472A45225BB7807005E81DE /* Jost-700-Bold.otf in Resources */,
5472A44E25BB7807005E81DE /* Prompt-ExtraLight.ttf in Resources */,
);
@@ -413,6 +436,34 @@
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
};
22A5D3F7F84BDF2020F07B0E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-drip-dripTests/Pods-drip-dripTests-frameworks.sh",
"${PODS_ROOT}/../../node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NodeMobile.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-drip-dripTests/Pods-drip-dripTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
2A3F66C5C345646DE949E1FF /* [CP-User] [NODEJS MOBILE] Sign Native Modules */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "[CP-User] [NODEJS MOBILE] Sign Native Modules";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/sh\nset -e\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, look for it in the project's\n#nodejs-assets/BUILD_NATIVE_MODULES.txt file.\nNODEJS_ASSETS_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../nodejs-assets/ && pwd )\"\nPREFERENCE_FILE_PATH=\"$NODEJS_ASSETS_DIR/BUILD_NATIVE_MODULES.txt\"\n if [ -f \"$PREFERENCE_FILE_PATH\" ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=\"$(cat $PREFERENCE_FILE_PATH | xargs)\"\n fi\nfi\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, try to find .gyp files\n#to turn it on.\n gypfiles=($(find \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -type f -name \"*.gyp\"))\n if [ ${#gypfiles[@]} -gt 0 ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=1\n else\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=0\n fi\nfi\nif [ \"1\" != \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then exit 0; fi\n# Delete object files\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.o\" -type f -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.a\" -type f -delete\n# Create Info.plist for each framework built and loader override.\nPATCH_SCRIPT_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/scripts/ && pwd )\"\nNODEJS_PROJECT_DIR=\"$( cd \"$CODESIGNING_FOLDER_PATH\" && cd nodejs-project/ && pwd )\"\nnode \"$PATCH_SCRIPT_DIR\"/ios-create-plists-and-dlopen-override.js $NODEJS_PROJECT_DIR\n# Embed every resulting .framework in the application and delete them afterwards.\nembed_framework()\n{\n FRAMEWORK_NAME=\"$(basename \"$1\")\"\n cp -r \"$1\" \"$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH/\"\n /usr/bin/codesign --force --sign $EXPANDED_CODE_SIGN_IDENTITY --preserve-metadata=identifier,entitlements,flags --timestamp=none \"$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH/$FRAMEWORK_NAME\"\n}\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d | while read frmwrk_path; do embed_framework \"$frmwrk_path\"; done\n\n#Delete gyp temporary .deps dependency folders from the project structure.\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/.deps/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \".deps\" -type d -delete\n\n#Delete frameworks from their build paths\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/*.framework/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d -delete\n";
};
46313D848A7A3E69E5ED05E7 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -513,6 +564,20 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-drip/Pods-drip-resources.sh\"\n";
showEnvVarsInLog = 0;
};
6C10CEE2CE544C7F9400F1B4 /* Sign NodeJS Mobile Native Modules */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Sign NodeJS Mobile Native Modules";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -e\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, look for it in the project's\n#nodejs-assets/BUILD_NATIVE_MODULES.txt file.\nNODEJS_ASSETS_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../nodejs-assets/ && pwd )\"\nPREFERENCE_FILE_PATH=\"$NODEJS_ASSETS_DIR/BUILD_NATIVE_MODULES.txt\"\n if [ -f \"$PREFERENCE_FILE_PATH\" ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=\"$(cat $PREFERENCE_FILE_PATH | xargs)\"\n fi\nfi\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, try to find .gyp files\n#to turn it on.\n gypfiles=($(find \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -type f -name \"*.gyp\"))\n if [ ${#gypfiles[@]} -gt 0 ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=1\n else\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=0\n fi\nfi\nif [ \"1\" != \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then exit 0; fi\n# Delete object files\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.o\" -type f -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.a\" -type f -delete\n# Create Info.plist for each framework built and loader override.\nPATCH_SCRIPT_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/scripts/ && pwd )\"\nNODEJS_PROJECT_DIR=\"$( cd \"$CODESIGNING_FOLDER_PATH\" && cd nodejs-project/ && pwd )\"\nnode \"$PATCH_SCRIPT_DIR\"/ios-create-plists-and-dlopen-override.js $NODEJS_PROJECT_DIR\n# Embed every resulting .framework in the application and delete them afterwards.\nembed_framework()\n{\n FRAMEWORK_NAME=\"$(basename \"$1\")\"\n cp -r \"$1\" \"$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH/\"\n \n /usr/bin/codesign --force --sign $EXPANDED_CODE_SIGN_IDENTITY --preserve-metadata=identifier,entitlements,flags --timestamp=none \"$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH/$FRAMEWORK_NAME\"\n}\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d | while read frmwrk_path; do embed_framework \"$frmwrk_path\"; done\n\n#Delete gyp temporary .deps dependency folders from the project structure.\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/.deps/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \".deps\" -type d -delete\n\n#Delete frameworks from their build paths\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/*.framework/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d -delete\n";
};
852A2E0CD5D0F561CE2927A3 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -535,6 +600,48 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
935E6C85F581DC5BB536B833 /* [CP-User] [NODEJS MOBILE] Copy Node.js Project files */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "[CP-User] [NODEJS MOBILE] Copy Node.js Project files";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/sh\nset -e\nNODEJS_ASSETS_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../nodejs-assets/ && pwd )\"\nNODEJS_BUILT_IN_MODULES_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/install/resources/nodejs-modules/ && pwd )\"\nif [ -d \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" ]\nthen\nrm -rf \"$CODESIGNING_FOLDER_PATH/nodejs-project/\"\nfi\nif [ -d \"$CODESIGNING_FOLDER_PATH/builtin_modules/\" ]\nthen\nrm -rf \"$CODESIGNING_FOLDER_PATH/builtin_modules/\"\nfi\nrsync -av --delete \"$NODEJS_ASSETS_DIR/nodejs-project\" \"$CODESIGNING_FOLDER_PATH\"\nrsync -av --delete \"$NODEJS_BUILT_IN_MODULES_DIR/builtin_modules\" \"$CODESIGNING_FOLDER_PATH\"\n";
};
B93B657279074F0DB95BCDE2 /* Remove NodeJS Mobile Framework Simulator Strips */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Remove NodeJS Mobile Framework Simulator Strips";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -e\nFRAMEWORK_BINARY_PATH=\"$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH/NodeMobile.framework/NodeMobile\"\nFRAMEWORK_STRIPPED_PATH=\"$FRAMEWORK_BINARY_PATH-strip\"\nif [ \"$PLATFORM_NAME\" != \"iphonesimulator\" ]; then\n if $(lipo \"$FRAMEWORK_BINARY_PATH\" -verify_arch \"x86_64\") ; then\n lipo -output \"$FRAMEWORK_STRIPPED_PATH\" -remove \"x86_64\" \"$FRAMEWORK_BINARY_PATH\"\n rm \"$FRAMEWORK_BINARY_PATH\"\n mv \"$FRAMEWORK_STRIPPED_PATH\" \"$FRAMEWORK_BINARY_PATH\"\n echo \"Removed simulator strip from NodeMobile.framework\"\n fi\nfi\n";
};
CD43B73558845DFAF38EE039 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-drip/Pods-drip-frameworks.sh",
"${PODS_ROOT}/../../node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NodeMobile.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-drip/Pods-drip-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CD68B565C5F4A7A674494D02 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -557,6 +664,40 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
CD7DBF41D9E2377DC61F80D8 /* [CP-User] [NODEJS MOBILE] Remove Simulator Strip */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "[CP-User] [NODEJS MOBILE] Remove Simulator Strip";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/sh\nset -e\nFRAMEWORK_BINARY_PATH=\"$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH/NodeMobile.framework/NodeMobile\"\nFRAMEWORK_STRIPPED_PATH=\"$FRAMEWORK_BINARY_PATH-strip\"\nif [ \"$PLATFORM_NAME\" != \"iphonesimulator\" ]; then\n if $(lipo \"$FRAMEWORK_BINARY_PATH\" -verify_arch \"x86_64\") ; then\n lipo -output \"$FRAMEWORK_STRIPPED_PATH\" -remove \"x86_64\" \"$FRAMEWORK_BINARY_PATH\"\n rm \"$FRAMEWORK_BINARY_PATH\"\n mv \"$FRAMEWORK_STRIPPED_PATH\" \"$FRAMEWORK_BINARY_PATH\"\n echo \"Removed simulator strip from NodeMobile.framework\"\n fi\nfi\n";
};
DE9DD9049EBE47E5A1EA3F5D /* Build NodeJS Mobile Native Modules */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Build NodeJS Mobile Native Modules";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\nset -e\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, look for it in the project's\n#nodejs-assets/BUILD_NATIVE_MODULES.txt file.\nNODEJS_ASSETS_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../nodejs-assets/ && pwd )\"\nPREFERENCE_FILE_PATH=\"$NODEJS_ASSETS_DIR/BUILD_NATIVE_MODULES.txt\"\n if [ -f \"$PREFERENCE_FILE_PATH\" ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=\"$(cat $PREFERENCE_FILE_PATH | xargs)\"\n fi\nfi\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, try to find .gyp files\n#to turn it on.\n gypfiles=($(find \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -type f -name \"*.gyp\"))\n if [ ${#gypfiles[@]} -gt 0 ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=1\n else\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=0\n fi\nfi\nif [ \"1\" != \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then exit 0; fi\n# Delete object files that may already come from within the npm package.\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.o\" -type f -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.a\" -type f -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.node\" -type f -delete\n# Delete bundle contents that may be there from previous builds.\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/*.node/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.node\" -type d -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/*.framework/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d -delete\n# Apply patches to the modules package.json\nif [ -d \"$CODESIGNING_FOLDER_PATH\"/nodejs-project/node_modules/ ]; then\n PATCH_SCRIPT_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/scripts/ && pwd )\"\n NODEJS_PROJECT_MODULES_DIR=\"$( cd \"$CODESIGNING_FOLDER_PATH\" && cd nodejs-project/node_modules/ && pwd )\"\n node \"$PATCH_SCRIPT_DIR\"/patch-package.js $NODEJS_PROJECT_MODULES_DIR\nfi\n# Get the nodejs-mobile-gyp location\nif [ -d \"$PROJECT_DIR/../node_modules/nodejs-mobile-gyp/\" ]; then\n NODEJS_MOBILE_GYP_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-gyp/ && pwd )\"\nelse\n NODEJS_MOBILE_GYP_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/node_modules/nodejs-mobile-gyp/ && pwd )\"\nfi\nNODEJS_MOBILE_GYP_BIN_FILE=\"$NODEJS_MOBILE_GYP_DIR\"/bin/node-gyp.js\n# Rebuild modules with right environment\nNODEJS_HEADERS_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/ios/libnode/ && pwd )\"\npushd $CODESIGNING_FOLDER_PATH/nodejs-project/\nif [ \"$PLATFORM_NAME\" == \"iphoneos\" ]\nthen\n GYP_DEFINES=\"OS=ios\" npm_config_nodedir=\"$NODEJS_HEADERS_DIR\" npm_config_node_gyp=\"$NODEJS_MOBILE_GYP_BIN_FILE\" npm_config_platform=\"ios\" npm_config_format=\"make-ios\" npm_config_node_engine=\"chakracore\" npm_config_arch=\"arm64\" npm --verbose rebuild --build-from-source\nelse\n GYP_DEFINES=\"OS=ios\" npm_config_nodedir=\"$NODEJS_HEADERS_DIR\" npm_config_node_gyp=\"$NODEJS_MOBILE_GYP_BIN_FILE\" npm_config_platform=\"ios\" npm_config_format=\"make-ios\" npm_config_node_engine=\"chakracore\" npm_config_arch=\"x64\" npm --verbose rebuild --build-from-source\nfi\npopd\n";
};
FCE9B437260EC219FF32251C /* [CP-User] [NODEJS MOBILE] Build Native Modules */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "[CP-User] [NODEJS MOBILE] Build Native Modules";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/sh\nset -e\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, look for it in the project's\n#nodejs-assets/BUILD_NATIVE_MODULES.txt file.\nNODEJS_ASSETS_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../nodejs-assets/ && pwd )\"\nPREFERENCE_FILE_PATH=\"$NODEJS_ASSETS_DIR/BUILD_NATIVE_MODULES.txt\"\n if [ -f \"$PREFERENCE_FILE_PATH\" ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=\"$(cat $PREFERENCE_FILE_PATH | xargs)\"\n fi\nfi\nif [ -z \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then\n# If build native modules preference is not set, try to find .gyp files\n#to turn it on.\n gypfiles=($(find \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -type f -name \"*.gyp\"))\n if [ ${#gypfiles[@]} -gt 0 ]; then\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=1\n else\n NODEJS_MOBILE_BUILD_NATIVE_MODULES=0\n fi\nfi\nif [ \"1\" != \"$NODEJS_MOBILE_BUILD_NATIVE_MODULES\" ]; then exit 0; fi\n# Delete object files that may already come from within the npm package.\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.o\" -type f -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.a\" -type f -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.node\" -type f -delete\n# Delete bundle contents that may be there from previous builds.\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/*.node/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.node\" -type d -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/*.framework/*\" -delete\nfind \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d -delete\n# Apply patches to the modules package.json\nif [ -d \"$CODESIGNING_FOLDER_PATH\"/nodejs-project/node_modules/ ]; then\n PATCH_SCRIPT_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/scripts/ && pwd )\"\n NODEJS_PROJECT_MODULES_DIR=\"$( cd \"$CODESIGNING_FOLDER_PATH\" && cd nodejs-project/node_modules/ && pwd )\"\n node \"$PATCH_SCRIPT_DIR\"/patch-package.js $NODEJS_PROJECT_MODULES_DIR\nfi\n# Get the nodejs-mobile-gyp location\nif [ -d \"$PROJECT_DIR/../node_modules/nodejs-mobile-gyp/\" ]; then\n NODEJS_MOBILE_GYP_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-gyp/ && pwd )\"\nelse\n NODEJS_MOBILE_GYP_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/node_modules/nodejs-mobile-gyp/ && pwd )\"\nfi\nNODEJS_MOBILE_GYP_BIN_FILE=\"$NODEJS_MOBILE_GYP_DIR\"/bin/node-gyp.js\n# Support building neon-bindings (Rust) native modules\nif [ -f ~/.cargo/env ]; then\n source ~/.cargo/env;\nfi\n# Rebuild modules with right environment\nNODEJS_HEADERS_DIR=\"$( cd \"$PROJECT_DIR\" && cd ../node_modules/nodejs-mobile-react-native/ios/libnode/ && pwd )\"\npushd $CODESIGNING_FOLDER_PATH/nodejs-project/\nif [ \"$PLATFORM_NAME\" == \"iphoneos\" ]\nthen\n GYP_DEFINES=\"OS=ios\" CARGO_BUILD_TARGET=\"aarch64-apple-ios\" npm_config_nodedir=\"$NODEJS_HEADERS_DIR\" npm_config_node_gyp=\"$NODEJS_MOBILE_GYP_BIN_FILE\" npm_config_platform=\"ios\" npm_config_format=\"make-ios\" npm_config_node_engine=\"chakracore\" npm_config_arch=\"arm64\" npm --verbose rebuild --build-from-source\nelse\n GYP_DEFINES=\"OS=ios\" CARGO_BUILD_TARGET=\"x86_64-apple-ios\" npm_config_nodedir=\"$NODEJS_HEADERS_DIR\" npm_config_node_gyp=\"$NODEJS_MOBILE_GYP_BIN_FILE\" npm_config_platform=\"ios\" npm_config_format=\"make-ios\" npm_config_node_engine=\"chakracore\" npm_config_arch=\"x64\" npm --verbose rebuild --build-from-source\nfi\npopd\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -596,6 +737,8 @@
ENABLE_BITCODE = "$(inherited)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"../node_modules/nodejs-mobile-react-native/ios\"",
"\"../node_modules/nodejs-mobile-react-native/ios\"",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -610,6 +753,7 @@
"$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/nodejs-mobile-react-native/ios/**",
"$(SRCROOT)/../node_modules/realm/src/**",
);
INFOPLIST_FILE = dripTests/Info.plist;
@@ -641,6 +785,8 @@
ENABLE_BITCODE = "$(inherited)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"../node_modules/nodejs-mobile-react-native/ios\"",
"\"../node_modules/nodejs-mobile-react-native/ios\"",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
HEADER_SEARCH_PATHS = (
@@ -651,6 +797,7 @@
"$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/nodejs-mobile-react-native/ios/**",
"$(SRCROOT)/../node_modules/realm/src/**",
);
INFOPLIST_FILE = dripTests/Info.plist;
@@ -685,7 +832,10 @@
ENABLE_BITCODE = "$(inherited)";
EXCLUDED_ARCHS = "";
"EXCLUDED_ARCHS[sdk=*]" = "";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"../node_modules/nodejs-mobile-react-native/ios\"",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"COCOAPODS=1",
"$(inherited)",
@@ -698,6 +848,7 @@
"$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/nodejs-mobile-react-native/ios/**",
"$(SRCROOT)/../node_modules/@react-native-community/push-notification-ios/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
@@ -732,6 +883,7 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/RealmJS\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/Yoga\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/glog\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/nodejs-mobile-react-native\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-document-picker\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-restart\"",
"\"${PODS_ROOT}/../../node_modules/realm/vendor/realm-ios\"",
@@ -763,7 +915,10 @@
DEVELOPMENT_TEAM = 6AD72X6W26;
ENABLE_BITCODE = "$(inherited)";
EXCLUDED_ARCHS = "";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"../node_modules/nodejs-mobile-react-native/ios\"",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"COCOAPODS=1",
"$(inherited)",
@@ -776,6 +931,7 @@
"$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/nodejs-mobile-react-native/ios/**",
"$(SRCROOT)/../node_modules/@react-native-community/push-notification-ios/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
@@ -810,6 +966,7 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/RealmJS\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/Yoga\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/glog\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/nodejs-mobile-react-native\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-document-picker\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-restart\"",
"\"${PODS_ROOT}/../../node_modules/realm/vendor/realm-ios\"",
@@ -881,8 +1038,8 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"\"$(inherited)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
);
MTL_ENABLE_DEBUG_INFO = YES;
@@ -937,8 +1094,8 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"\"$(inherited)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
);
MTL_ENABLE_DEBUG_INFO = NO;
-2
View File
@@ -1,2 +0,0 @@
// Import Jest Native matchers
import '@testing-library/jest-native/extend-expect'
-8
View File
@@ -1,8 +0,0 @@
module.exports = {
preset: '@testing-library/react-native',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
setupFilesAfterEnv: ['./jest-setup.js'],
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native(-.*)?|@react-native(-community)?)/)',
],
}
+3 -23
View File
@@ -3,8 +3,6 @@ import { getCycleLengthStats } from './cycle-length'
const LocalDate = joda.LocalDate
const DAYS = joda.ChronoUnit.DAYS
const toJSON = (realmObj) => JSON.parse(JSON.stringify(realmObj))
export default function config(opts) {
let bleedingDaysSortedByDate
let cycleStartsSortedByDate
@@ -16,13 +14,9 @@ export default function config(opts) {
if (!opts) {
// we only want to require (and run) the db module
// when not running the tests
bleedingDaysSortedByDate = toJSON(
require('../db').getBleedingDaysSortedByDate()
)
cycleStartsSortedByDate = toJSON(
require('../db').getCycleStartsSortedByDate()
)
cycleDaysSortedByDate = toJSON(require('../db').getCycleDaysSortedByDate())
bleedingDaysSortedByDate = require('../db').getBleedingDaysSortedByDate()
cycleStartsSortedByDate = require('../db').getCycleStartsSortedByDate()
cycleDaysSortedByDate = require('../db').getCycleDaysSortedByDate()
maxBreakInBleeding = 1
maxCycleLength = 99
minCyclesForPrediction = 3
@@ -228,19 +222,6 @@ export default function config(opts) {
return predictedMenses
}
const getStats = () =>
cycleStartsSortedByDate.map((day, i) => {
const today = getTodayDate()
const cycleLength =
i === 0 ? getCycleDayNumber(today) : getAllCycleLengths()[i - 1]
return {
date: day.date,
cycleLength,
bleedingLength: ++getMensesDaysRightAfter(day).length,
}
})
return {
getCycleDayNumber,
getCycleForDay,
@@ -251,6 +232,5 @@ export default function config(opts) {
isMensesStart,
getMensesDaysRightAfter,
getCycleByStartDay,
getStats,
}
}
+4 -10
View File
@@ -12,16 +12,10 @@ export const unitObservable = Observable()
unitObservable.set(TEMP_SCALE_UNITS)
scaleObservable((scale) => {
const scaleRange = scale.max - scale.min
switch (true) {
case scaleRange <= 1:
unitObservable.set(0.1)
break
case scaleRange > 1 && scaleRange <= 2:
unitObservable.set(0.2)
break
default:
unitObservable.set(0.5)
if (scaleRange <= 1.5) {
unitObservable.set(0.1)
} else {
unitObservable.set(0.5)
}
})
+12
View File
@@ -0,0 +1,12 @@
// too see stdout / stderr from this process, run
// adb logcat | grep "NODEJS-MOBILE"
const rnBridge = require('rn-bridge')
const crypto = require('crypto')
rnBridge.channel.on('request-SHA512', (msg) => {
msg = JSON.parse(msg)
const hash = crypto.createHash('sha512')
hash.update(msg.message)
const result = hash.digest('hex')
rnBridge.channel.post(msg.type, result)
})
@@ -0,0 +1,4 @@
{
"dependencies": {},
"main": "main.js"
}
+9 -10
View File
@@ -14,7 +14,7 @@
"android": "react-native run-android",
"ios": "react-native run-ios --simulator=\"iPhone 8 Plus\"",
"log": "react-native log-android",
"test": "jest test && yarn lint",
"test": "jest test && npm run lint",
"test-watch": "jest --watch test",
"lint": "eslint components lib test styles db",
"devtool": "adb shell input keyevent 82",
@@ -37,18 +37,19 @@
"@react-native-community/push-notification-ios": "^1.8.0",
"csvtojson": "^2.0.8",
"i18next": "^21.9.0",
"jshashes": "^1.0.8",
"moment": "^2.29.4",
"nodejs-mobile-react-native": "^0.8.2",
"object-path": "^0.11.4",
"obv": "0.0.1",
"prop-types": "^15.8.1",
"react": "17.0.2",
"react-i18next": "^11.18.3",
"react-native": "0.67.4",
"react-native": "0.65.2",
"react-native-calendars": "^1.1287.0",
"react-native-document-picker": "^8.1.1",
"react-native-fs": "^2.20.0",
"react-native-modal-datetime-picker": "14.0.0",
"react-native-hyperlink": "0.0.19",
"react-native-modal-datetime-picker": "10.2.0",
"react-native-push-notification": "3.2.1",
"react-native-share": "^7.9.0",
"react-native-simple-toast": "^1.1.3",
@@ -58,23 +59,21 @@
"sympto": "3.0.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/eslint-parser": "^7.19.1",
"@babel/core": "^7.19.1",
"@babel/eslint-parser": "^7.16.3",
"@babel/preset-react": "^7.16.0",
"@babel/runtime": "^7.12.5",
"@testing-library/jest-native": "^4.0.12",
"@testing-library/react-native": "^11.1.0",
"basic-changelog": "gitlab:bloodyhealth/basic-changelog",
"eslint": "7.14.0",
"eslint-plugin-react": "^7.8.2",
"husky": "^8.0.0",
"jest": "^28.1.3",
"jetifier": "^1.6.6",
"metro-react-native-babel-preset": "^0.66.2",
"metro-react-native-babel-preset": "^0.66.0",
"prettier": "2.4.0",
"pretty-quick": "^3.1.1",
"react-native-codegen": "^0.0.7",
"react-native-version": "^3.1.0",
"react-test-renderer": "17.0.2",
"readline": "^1.3.0"
},
"description": "A menstrual cycle tracking app that's open-source and leaves your data on your phone. Use it to track your menstrual cycle or for fertility awareness!",
+13
View File
@@ -0,0 +1,13 @@
// https://github.com/janeasystems/nodejs-mobile-react-native#duplicate-module-name
const blacklist = require('metro-config/src/defaults/blacklist')
module.exports = {
resolver:{
blacklistRE: blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
])
},
}
+6 -14
View File
@@ -9,7 +9,7 @@ export default {
marginTop: Spacing.small,
marginRight: Spacing.small,
paddingHorizontal: Spacing.small,
paddingVertical: Spacing.tiny,
paddingVertical: Spacing.tiny
},
boxActive: {
backgroundColor: Colors.orange,
@@ -17,25 +17,17 @@ export default {
centerItems: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
pageContainer: {
backgroundColor: Colors.turquoiseLight,
flex: 1,
justifyContent: 'center'
},
rowContainer: {
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
justifyContent: 'space-between'
},
selectGroupContainer: {
alignItems: 'center',
flexDirection: 'row',
flexWrap: 'wrap',
marginVertical: Spacing.small,
},
segmentContainer: {
marginHorizontal: Spacing.base,
marginBottom: Spacing.base,
},
}
marginVertical: Spacing.small
}
}
-37
View File
@@ -1,37 +0,0 @@
import React from 'react'
import { render, screen, fireEvent } from '@testing-library/react-native'
import AcceptLicense from '../components/AcceptLicense'
import { saveLicenseFlag } from '../local-storage'
jest.mock('../local-storage', () => ({
saveLicenseFlag: jest.fn(() => Promise.resolve()),
}))
jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: (str, options) => {
return str + (options ? JSON.stringify(options) : '')
},
}),
}))
describe('AcceptLicense', () => {
test('On clicking OK button, the license is accepted', async () => {
const mockedSetLicense = jest.fn()
render(<AcceptLicense setLicense={mockedSetLicense} />)
const okButton = screen.getByText('ok', { exact: false })
fireEvent(okButton, 'click')
await expect(saveLicenseFlag).toHaveBeenCalled()
expect(mockedSetLicense).toHaveBeenCalled()
})
test('There is a Cancel button', async () => {
render(<AcceptLicense setLicense={jest.fn()} />)
screen.getByText('cancel', { exact: false })
})
})
-26
View File
@@ -1,26 +0,0 @@
import React from 'react'
import { render, screen } from '@testing-library/react-native'
import License from '../components/settings/License'
jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: (str, options) => {
return str + (options ? JSON.stringify(options) : '')
},
}),
}))
describe('License screen', () => {
test('It should have a correct year', async () => {
render(<License />)
const year = new Date().getFullYear().toString()
screen.getByText(year, { exact: false })
})
test('It should match the snapshot', async () => {
const licenseScreen = render(<License />)
expect(licenseScreen).toMatchSnapshot()
})
})
-85
View File
@@ -1,85 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`License screen It should match the snapshot 1`] = `
<View
style={
Object {
"backgroundColor": "#E9F2ED",
"flex": 1,
}
}
>
<RCTScrollView
contentContainerStyle={
Array [
Object {
"backgroundColor": "#E9F2ED",
"flexGrow": 1,
},
undefined,
]
}
>
<View>
<Text
style={
Array [
Object {
"color": "#555",
"fontFamily": "Jost-Book",
"fontSize": 34.285714285714285,
},
Object {
"alignSelf": "center",
"color": "#3A2671",
"fontFamily": "Jost-Bold",
"fontSize": 51.42857142857143,
"fontWeight": "700",
"marginHorizontal": 34.285714285714285,
"marginVertical": 42.857142857142854,
},
]
}
>
title
</Text>
<View
style={
Object {
"marginBottom": 34.285714285714285,
"marginHorizontal": 34.285714285714285,
}
}
>
<Text
style={
Array [
Object {
"color": "#555",
"fontFamily": "Jost-Book",
"fontSize": 34.285714285714285,
},
undefined,
]
}
>
text{"currentYear":2022}
</Text>
<Text
onPress={[Function]}
style={
Object {
"color": "#3A2671",
"fontFamily": "Jost-Book",
"fontSize": 34.285714285714285,
"textDecorationLine": "underline",
}
}
>
https://www.gnu.org/licenses/gpl-3.0.html
</Text>
</View>
</View>
</RCTScrollView>
</View>
`;
-19
View File
@@ -1,19 +0,0 @@
import React from 'react'
import { render } from '@testing-library/react-native'
import Footnote from '../../../components/common/Footnote'
describe('Footnote component', () => {
test('when children are present, renders them', () => {
const text = 'Some footnote text'
const { toJSON } = render(<Footnote>{text}</Footnote>)
expect(toJSON()).toMatchSnapshot()
})
test('when no children, renders nothing', () => {
const { toJSON } = render(<Footnote></Footnote>)
expect(toJSON()).toMatchSnapshot()
})
})
@@ -1,55 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Footnote component when children are present, renders them 1`] = `
<View
style={
Object {
"alignContent": "flex-start",
"flexDirection": "row",
"marginBottom": 8.571428571428571,
"marginTop": 34.285714285714285,
}
}
>
<Text
style={
Array [
Object {
"color": "#555",
"fontFamily": "Jost-Book",
"fontSize": 34.285714285714285,
},
Object {
"color": "#F38337",
},
]
}
>
*
</Text>
<Text
linkStyle={
Object {
"color": "white",
}
}
style={
Array [
Object {
"color": "#555",
"fontFamily": "Jost-Book",
"fontSize": 34.285714285714285,
},
Object {
"color": "#555",
"paddingLeft": 21.428571428571427,
},
]
}
>
Some footnote text
</Text>
</View>
`;
exports[`Footnote component when no children, renders nothing 1`] = `null`;
-27
View File
@@ -1,27 +0,0 @@
import { humanizeDate } from '../../components/helpers/format-date'
describe('humanizeDate', () => {
test('if receives null, returns empty string', () => {
const result = humanizeDate(null)
expect(result).toEqual('')
})
test('if receives undefined, returns empty string', () => {
const result = humanizeDate(undefined)
expect(result).toEqual('')
})
test('if receives incorrectly formatted date, returns empty string', () => {
const result = humanizeDate('abc')
expect(result).toEqual('')
})
test('if receives correct date string, returns date in humanized format', () => {
const result = humanizeDate('2022-01-07')
expect(result).toEqual('07. Jan 22')
})
})
-10
View File
@@ -1,10 +0,0 @@
import * as React from 'react'
import { render, screen } from '@testing-library/react-native'
import Logo from '../components/header/logo'
describe('Logo', () => {
test('It works', async () => {
render(<Logo />)
screen.getByText('drip.')
})
})
+222 -544
View File
File diff suppressed because it is too large Load Diff