Compare commits
78 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 31ccb22c82 | |||
| ddfbc4cee8 | |||
| 9d21138da7 | |||
| a6fc38ca47 | |||
| 2f07b76b6c | |||
| bb29f29de5 | |||
| b39a5681ea | |||
| 38a56b0fbd | |||
| c5906c2144 | |||
| 89015abe17 | |||
| 06fc4f4b6b | |||
| 64ed3aba4a | |||
| 5a18593ab5 | |||
| 3755ac8ac9 | |||
| d6dbea78ac | |||
| 84ff76096b | |||
| e030c4d75e | |||
| 4ed399c50c | |||
| 92546362a0 | |||
| 486dd185e2 | |||
| e576c5dc7d | |||
| 536106f757 | |||
| 552e63c9ef | |||
| 9dff2808c0 | |||
| 0f375530c8 | |||
| 5401789c46 | |||
| f6944328fb | |||
| f730b617cb | |||
| 668faf2534 | |||
| f304fee293 | |||
| 54b08c15bb | |||
| 6d51826dd6 | |||
| 5ff680a591 | |||
| 2cda2c38e9 | |||
| b638a5bd08 | |||
| 32cec10a79 | |||
| 2eca9ba097 | |||
| c432edbbaf | |||
| 67d58e3db4 | |||
| 773f1c86c2 | |||
| 3f2af788f3 | |||
| 573de7545e | |||
| 4139cba63c | |||
| d81dbac60c | |||
| 40fb65ca88 | |||
| ed7a5a341b | |||
| ca3cf16ff7 | |||
| fdbfef38f9 | |||
| 5c13e91fb3 | |||
| 2b235f4d10 | |||
| bcc7eaada9 | |||
| 714021465e | |||
| c3e4fd3f03 | |||
| e7f76bad33 | |||
| 9537e377e0 | |||
| f11eb3d1a1 | |||
| 5f83464649 | |||
| 6e2e03f39e | |||
| cc62e24229 | |||
| 1907a78dbf | |||
| cd24522b4d | |||
| 446638d6de | |||
| ae23ef2c58 | |||
| 38b9e8b31f | |||
| 84d657cabb | |||
| 4573b93921 | |||
| ab88a4c163 | |||
| baaf89c04e | |||
| d476f6c143 | |||
| b56e0818f3 | |||
| 1b5ffaf5d6 | |||
| f68cc2b49e | |||
| 27d430a465 | |||
| 28f52e2cea | |||
| 3f87f298fb | |||
| 585f32863d | |||
| 51e1c95e71 | |||
| 36c33c69b7 |
@@ -8,6 +8,7 @@ cache:
|
|||||||
|
|
||||||
test_async:
|
test_async:
|
||||||
script:
|
script:
|
||||||
|
- npm install npm@7.0.1 -g
|
||||||
- npm install
|
- npm install
|
||||||
- npm test
|
- npm test
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,4 @@ updates:
|
|||||||
- dependency-name: 'react'
|
- dependency-name: 'react'
|
||||||
- dependency-name: 'react-native'
|
- dependency-name: 'react-native'
|
||||||
- dependency-name: 'react-native-push-notifications'
|
- dependency-name: 'react-native-push-notifications'
|
||||||
|
- dependency-name: '@babel/core'
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
## oh no a bug 🐛
|
||||||
|
|
||||||
|
### Description what has happened
|
||||||
|
|
||||||
|
Short overview how the bug manifests.
|
||||||
|
|
||||||
|
### which OS + version is your device
|
||||||
|
|
||||||
|
- [ ] Android _number_
|
||||||
|
- [ ] iOS _number_
|
||||||
|
|
||||||
|
### which drip version number are you using
|
||||||
|
|
||||||
|
_On your phone go to ➞ menu on the top right ➞ about, scroll to the very bottom and find the version number_
|
||||||
|
|
||||||
|
### how did it happen
|
||||||
|
|
||||||
|
_what triggered the bug/behavior, always/sometimes, is it reproducible(how)?_
|
||||||
|
|
||||||
|
### describe how it looks or add screenshot
|
||||||
|
|
||||||
|
feel free to attach a file 📎
|
||||||
|
|
||||||
|
### any idea to solve it
|
||||||
|
|
||||||
|
💡
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
## This has to be done 🪠
|
||||||
|
|
||||||
|
### Description what has to be done
|
||||||
|
|
||||||
|
Short overview
|
||||||
|
|
||||||
|
### is it urgent? ⏳
|
||||||
|
|
||||||
|
- [ ] Yes
|
||||||
|
- [ ] No
|
||||||
|
- [ ] something in between
|
||||||
|
|
||||||
|
_Explain the urgency if possible, e.g. is it a security vulnerability for potentially everyone?_
|
||||||
|
|
||||||
|
### which OS
|
||||||
|
|
||||||
|
- [ ] Android
|
||||||
|
- [ ] iOS
|
||||||
|
|
||||||
|
### what shall be the ideal outcome 🎆
|
||||||
|
|
||||||
|
_You can e.g. specify here the version number for a library update_
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
## Yeah a feature idea 🧩
|
||||||
|
|
||||||
|
### what should this feature do or solve? 🪄
|
||||||
|
|
||||||
|
Please give a short overview so as many people as possible would be able to understand.
|
||||||
|
|
||||||
|
### what is particularly important to the people who would use this feature?
|
||||||
|
|
||||||
|
Do you have certain user groups in mind?
|
||||||
|
|
||||||
|
### Any idea where it shall be placed in the app?
|
||||||
|
|
||||||
|
### is it connected with or dependent on some other feature?
|
||||||
|
|
||||||
|
### any idea how it shall look (sketch?)
|
||||||
|
|
||||||
|
feel free to attach a file 📎
|
||||||
|
|
||||||
|
### what could be difficulties (with other components) 🪆
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
## Why this change?
|
## Why this change?
|
||||||
|
|
||||||
Closes ticket #
|
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
I have tested this MR:
|
I have tested this MR:
|
||||||
|
|||||||
@@ -2,12 +2,80 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## v1.2311.14
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
- Make the app compatible with Android 13
|
||||||
|
- Update Android's targetSdkVersion to 33
|
||||||
|
- Update buildToolsVersion to 33.0.2
|
||||||
|
- Update Android Gradle plugin to 7.0.3
|
||||||
|
- Update Gradle to 7.3.3
|
||||||
|
- Update kotlinVersion to 1.3.40
|
||||||
|
- Chart: Improved readability
|
||||||
|
- Finer temperature lines and dots
|
||||||
|
- Enlarge screen space for temperature chart
|
||||||
|
- A very light grey background color for weekend days on the whole chart screen
|
||||||
|
- Reminders:
|
||||||
|
- Use new fork of react-native-push-notification: <https://github.com/github:bl00dymarie/react-native-push-notification> without google services
|
||||||
|
- Adding channels after breaking changes in react-native-push-notification
|
||||||
|
- Homescreen: date displayed in new format
|
||||||
|
- Minor changes in "about" section
|
||||||
|
- Updated dependencies:
|
||||||
|
- moment ^2.29.4,
|
||||||
|
- prop-types ^15.8.1,
|
||||||
|
- react v17.0.2,
|
||||||
|
- react-native v0.67.4,
|
||||||
|
- react-native-calendars ^1.1287.0,
|
||||||
|
- react-native-document-picker ^8.1.1,
|
||||||
|
- react-native-fs ^2.20.0,
|
||||||
|
- react-native-modal-datetime-picker v14.0.0,
|
||||||
|
- react-native-share ^7.9.0,
|
||||||
|
- react-native-vector-icons ^9.2.0,
|
||||||
|
- realm ^10.16.0,
|
||||||
|
- sympto v3.0.1
|
||||||
|
|
||||||
|
### Adds
|
||||||
|
|
||||||
|
- Stats: Show period details, including cycle start, cycle length and amount of days with bleeding
|
||||||
|
- Stats: Explainer text for standard deviation
|
||||||
|
- Settings: Privacy Policy
|
||||||
|
- App asks for permissions for notifications right at the start, which allows you to set reminders (this is a new requirement for Android 13)
|
||||||
|
- Buttons can now be displayed as row
|
||||||
|
|
||||||
|
- Added dependencies:
|
||||||
|
- @js-joda/core ^5.3.0,
|
||||||
|
- @react-native-async-storage/async-storage ^1.17.9,
|
||||||
|
- @react-native-community/art ^1.2.0,
|
||||||
|
- @react-native-community/datetimepicker ^6.3.1,
|
||||||
|
- @react-native-community/push-notification-ios ^1.11.0,
|
||||||
|
- i18next ^22.0.2,
|
||||||
|
- react-i18next ^12.0.0,
|
||||||
|
- jshashes ^1.0.8,
|
||||||
|
- react-native-permissions ^3.10.0,
|
||||||
|
- react-native-push-notification: github:bl00dymarie/react-native-push-notification,
|
||||||
|
- react-native-simple-toast ^1.1.3,
|
||||||
|
- react-native-size-matters ^0.4.0,
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Password: Disable setting empty passwords
|
||||||
|
- After updating the password the app will do a full restart
|
||||||
|
- Chart: Grid for symptoms
|
||||||
|
- Chart: Horizontal lines in temperature chart
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- Partially implemented translations with react-i18next
|
||||||
|
|
||||||
## v1.2102.28
|
## v1.2102.28
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|
||||||
- Temperature range is now between 35 - 39°C and its default values are now set to 35.5 - 37.5°C
|
- Temperature range is now between 35 - 39°C and its default values are now set to 35.5 - 37.5°C
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Blocks invalid input of temperature value
|
- Blocks invalid input of temperature value
|
||||||
- Error message for incorrect password on login screen
|
- Error message for incorrect password on login screen
|
||||||
- Phase text on home screen for last fertile day
|
- Phase text on home screen for last fertile day
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# Contributing to drip aka CONDRIPUTING
|
# Contributing to drip aka CONDRIPUTING
|
||||||
So good to see you here, hello :wave\_tone1: :wave\_tone2: :wave\_tone3: :wave\_tone4: :wave\_tone5:
|
|
||||||
|
|
||||||
|
So good to see you here, hello :wave_tone1: :wave_tone2: :wave_tone3: :wave_tone4: :wave_tone5:
|
||||||
|
|
||||||
## Table Of Contents
|
## Table Of Contents
|
||||||
|
|
||||||
[TL;DR](#tl-dr)
|
[TL;DR](#tldr)
|
||||||
|
|
||||||
[What should I know before I get started?](#what-should-i-know-before-i-get-started)
|
[What should I know before I get started?](#what-should-i-know-before-i-get-started)
|
||||||
|
|
||||||
@@ -14,45 +14,44 @@ So good to see you here, hello :wave\_tone1: :wave\_tone2: :wave\_tone3: :wave\_
|
|||||||
|
|
||||||
## TL;DR
|
## TL;DR
|
||||||
|
|
||||||
You just want to say hello? Send us a [nice email](mailto:drip@mailbox.org?Subject=Nice%20incoming%20mail) :postbox:, ask to [join our Slack](mailto:drip@mailbox.org?Subject=Join%20Slack) or tweet :bird: at us [@dripberlin](https://twitter.com/dripberlin).
|
You just want to say hello? Send us a [nice email](mailto:drip@mailbox.org?Subject=Nice%20incoming%20mail) :postbox:, toot :mammoth: [@dripapp@mastodon.social](https://mastodon.social/@dripapp) or tweet :bird: at us [@dripberlin](https://twitter.com/dripberlin).
|
||||||
|
|
||||||
## What should I know before I get started?
|
## What should I know before I get started?
|
||||||
|
|
||||||
We have prepared something for **you**: check out our [README](https://gitlab.com/bloodyhealth/drip/blob/master/README.md) for more information on how to set up and install everything you'll need.
|
We have prepared something for **you**: check out our [README](https://gitlab.com/bloodyhealth/drip/blob/main/README.md) for more information on how to set up and install everything you'll need.
|
||||||
[Ping us](mailto:drip@mailbox.org) if you could need some help :helmet\_with\_cross: !
|
[Ping us](mailto:drip@mailbox.org) if you could need some help :helmet_with_cross: !
|
||||||
|
|
||||||
Let us know if you want to suggest improvements for the README and open a merge request (which is just like Github's pull request)
|
Let us know if you want to suggest improvements for the README and open a merge request (which is just like Github's pull request)
|
||||||
|
|
||||||
## How can I condripute?
|
## How can I condripute?
|
||||||
|
|
||||||
### Your First Code Condripution
|
We are an open source project and we highly appreciate contributions. At the same time please keep some things in mind: :heart:
|
||||||
|
|
||||||
We are fans of labels, at least for our issues. You can find a list of `newbie` issues [here](https://gitlab.com/bloodyhealth/drip/issues?label_name%5B%5D=Newbie).
|
- The drip maintainers are usually around 2-3 people and are responsible for everything from developing new features to answering press inquiries or fixing bugs. Most of this work is done unpaid. (If you write a nice email your chances to get an answer are much higher than if you behave like a tech bro.)
|
||||||
If you decide to work on an issue, please click on `Create branch` based on that issue. You can find this as a dropdown option right under `Create merge request`.
|
- We have a plan for the direction in which drip should evolve. This means that even if it isn't always transparent on gitlab, we have a list of features that we are building and more importantly, which bugs need to be fixed and which dependencies need to be updated.
|
||||||
This allows us to keep track of the issues that are related to an existing branch and tells everyone "somebody is working on it".
|
- drips core values are:
|
||||||
|
- 🔮 open source
|
||||||
|
- 🩸 feminist and gender inclusive
|
||||||
|
- 🔒 secure: data entered stays with that person/on their device
|
||||||
|
- 🔬 science based: we implemented the symptothermal method
|
||||||
|
|
||||||
If you want to open a merge request, yeah :tada: exciting! We are using a template for merge requests to make sure we explain what we have done and why.
|
This means that we will never implement anything that contradicts these core values. Some examples: We will never build a cloud integration, we will never make an ovulation prediction.
|
||||||
Keep in mind that people who will review your merge request are more motivated to do so when the merge request is well explained and ideally not too big.
|
- If you would like to make a sustainable contribution to the project, we would be happy to join the game.
|
||||||
|
|
||||||
### Reporting Bugs
|
### Reporting Bugs or Making Suggestions
|
||||||
|
|
||||||
You found a bug :bug:? Please feel free to investigate and save logs for more specific details.
|
If you found a bug or have suggestions, please :one: first review the [list of existing issues](https://gitlab.com/bloodyhealth/drip/issues) to make sure the bug/suggestion is unknown; :two: after that, take time to investigate and write a detailed issue report. Best you use our [templates for bug /chore/ feature](https://gitlab.com/bloodyhealth/drip/-/tree/main/.gitlab/issue_templates) (you can choose when creating a new issue) in gitlab or send us an email to our [gitlab email](mailto:incoming+bloodyhealth/drip@incoming.gitlab.com). It will automagically add a new issue to the list with a description text taken from the body of your email. Please attach screenshots or other helpful things.
|
||||||
|
|
||||||
Before creating a new issue, please review the [list of existing issues](https://gitlab.com/bloodyhealth/drip/issues) to make sure the bug is unknown. You are invited to describe the bug in all its details e.g. in what context/settings has it occurred?
|
### Your First Condripution
|
||||||
|
|
||||||
To send us a new issue you can also use our [gitlab email](mailto:incoming+bloodyhealth/drip@incoming.gitlab.com). It will automagically add a new issue to the list with a description text taken from the body of your email.
|
- If you want to contribute to drip's code or translation, please get in touch with us. We can tell you if someone is already working on something similar, if your idea does (not) match drip's core values, etc. Of course, you can always create a drip version for your private use with anything you want, but please don't expect us to review and merge code that has not been discussed before.
|
||||||
|
- If you want to open a merge request, yeah :tada: exciting! We are using a template for merge requests to make sure we explain what we have done and why.
|
||||||
|
- Keep in mind that people who will review your merge request are more motivated to do so when the merge request is well explained and ideally not too big.
|
||||||
|
|
||||||
### Suggesting Enhancements
|
|
||||||
|
|
||||||
Do you have suggestions for enhancing the app or for cleaning up some code? Fantastic!
|
|
||||||
|
|
||||||
Before creating a new issue, please review the [list of existing issues](https://gitlab.com/bloodyhealth/drip/issues) to make sure nobody else had the same idea before you! You are then invited to open a new issue with a somewhat extensive description, you can use emojis or GIFs if it helps :)!
|
|
||||||
|
|
||||||
To send us a new issue you can also use our [gitlab email](mailto:incoming+bloodyhealth/drip@incoming.gitlab.com). It will automagically add a new issue to the list with the title taken from the subject line and the description text for the issue taken from the body of your email.
|
|
||||||
|
|
||||||
### Thank you
|
### Thank you
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Thank you for condriputing to open source, thank you for condriputing to drip!
|
Thank you for condriputing to open source, thank you for condriputing to drip!
|
||||||
Much love from Bloody Health :heart\_exclamation:
|
Much love from Bloody Health :heart_exclamation:
|
||||||
|
|||||||
@@ -5,19 +5,22 @@ Find more information on [our website](https://dripapp.org/).
|
|||||||
|
|
||||||
[<img src="https://dripapp.org/assets/get.png"
|
[<img src="https://dripapp.org/assets/get.png"
|
||||||
alt="Get it here"
|
alt="Get it here"
|
||||||
height="55">](https://dripapp.org/release/8.apk)
|
height="55">](https://dripapp.org/release/v1.2311.14.apk)
|
||||||
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
[<img src="https://dripapp.org/assets/badge_google-play.png"
|
||||||
alt="Get it on F-Droid"
|
|
||||||
height="80">](https://f-droid.org/packages/com.drip/)
|
|
||||||
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png"
|
|
||||||
alt="Get it on Google Play"
|
alt="Get it on Google Play"
|
||||||
height="80">](https://play.google.com/store/apps/details?id=com.drip)
|
height="55">](https://dripapp.org/android)
|
||||||
|
[<img src="https://dripapp.org/assets/badge_app-store.png"
|
||||||
|
alt="Get drip on the App Store"
|
||||||
|
height="55">](https://dripapp.org/ios)
|
||||||
|
[<img src="https://dripapp.org/assets/badge_f-droid.png"
|
||||||
|
alt="Get it on F-Droid"
|
||||||
|
height="55">](https://dripapp.org/fdroid)
|
||||||
|
|
||||||
The app is built in React Native and currently developed for Android.
|
The app is built in React Native and developed for Android and iOS.
|
||||||
|
|
||||||
▶ [How to contribute to the project](https://gitlab.com/bloodyhealth/drip/blob/master/CONTRIBUTING.md)
|
▶ [How to contribute to the project](https://gitlab.com/bloodyhealth/drip/blob/main/CONTRIBUTING.md)
|
||||||
|
|
||||||
▶ [How to release a new version](https://gitlab.com/bloodyhealth/drip/blob/master/RELEASE.md)
|
▶ [How to release a new version](https://gitlab.com/bloodyhealth/drip/blob/main/RELEASE.md)
|
||||||
|
|
||||||
## Development setup
|
## Development setup
|
||||||
|
|
||||||
@@ -33,14 +36,14 @@ or clone it with HTTPS
|
|||||||
|
|
||||||
### 2. Node & yarn version
|
### 2. Node & yarn version
|
||||||
|
|
||||||
Make sure you are running Node 14 and classic yarn (v.1). It's easiest to switch Node versions using `nvm`, here's how to install NVM: https://github.com/nvm-sh/nvm#installing-and-updating. Once you have nvm you can install node 14:
|
Make sure you are running Node 14 and classic yarn (v.1). It's easiest to switch Node versions using `nvm`, here's how to install NVM: https://github.com/nvm-sh/nvm#installing-and-updating. After installing nvm close the terminal and open it again to be able to use nvm.
|
||||||
|
Once you have nvm running you can install node 14:
|
||||||
|
|
||||||
nvm install v14.19.3
|
nvm install v14.19.3
|
||||||
|
|
||||||
and then run
|
use npm to install yarn:
|
||||||
|
|
||||||
cd drip
|
npm install --global yarn
|
||||||
yarn install
|
|
||||||
|
|
||||||
## for Android
|
## for Android
|
||||||
|
|
||||||
@@ -50,13 +53,34 @@ Install [Android Studio](https://developer.android.com/studio/) - you'll need it
|
|||||||
|
|
||||||
### 3.2 More requirements from Android Studio
|
### 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. If the message "SDK location not found" appears when you try to start it, edit `.bashrc` in your home directory by adding:
|
||||||
|
|
||||||
|
export ANDROID_SDK_ROOT="$HOME/Android/Sdk"
|
||||||
|
|
||||||
|
Check by typing in your terminal:
|
||||||
|
|
||||||
|
echo $ANDROID_SDK_ROOT
|
||||||
|
|
||||||
|
You should see the path of Sdk.
|
||||||
|
If you haven't installed [adb tools](https://developer.android.com/tools/adb) before, you will also have to do so and add to the .bashrc
|
||||||
|
|
||||||
|
PATH="$PATH:$HOME/Android/Sdk/platform-tools"
|
||||||
|
|
||||||
|
In Android Studio 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.
|
||||||
|
|
||||||
### 3.3 Run the app on Android
|
### 3.3 Run the app on Android
|
||||||
|
|
||||||
Either start a [virtual device in Android Studio](https://developer.android.com/studio/run/emulator) or [set your physical device like your Android phone up](https://developer.android.com/training/basics/firstapp/running-app) to run the app.
|
Either create and start a [virtual device in Android Studio](https://developer.android.com/studio/run/emulator) or [set your physical device like your Android phone up](https://developer.android.com/training/basics/firstapp/running-app) to run the app.
|
||||||
|
|
||||||
i. Open a terminal and run
|
i. Open a terminal, navigate to the drip folder and run
|
||||||
|
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
In a separate tab, that needs to keep running as long as you want to keep the app connected, run
|
||||||
|
|
||||||
|
yarn start
|
||||||
|
|
||||||
|
Also run in a new tab
|
||||||
|
|
||||||
yarn android
|
yarn android
|
||||||
|
|
||||||
@@ -64,7 +88,11 @@ ii. To see logging output, run the following command in another tab:
|
|||||||
|
|
||||||
yarn log
|
yarn log
|
||||||
|
|
||||||
iii. Run the following command and select enable hot reloading (see https://facebook.github.io/react-native/docs/debugging.html):
|
iii. If you had an older version of drip before and you are now trying to run a new drip version, clear cache by running
|
||||||
|
|
||||||
|
yarn clear
|
||||||
|
|
||||||
|
iv. Run the following command and select enable hot reloading (see https://facebook.github.io/react-native/docs/debugging.html):
|
||||||
|
|
||||||
adb shell input keyevent 82
|
adb shell input keyevent 82
|
||||||
|
|
||||||
@@ -147,7 +175,7 @@ You can run the tests with:
|
|||||||
|
|
||||||
### End to end tests
|
### End to end tests
|
||||||
|
|
||||||
1. Check what testing device is specified in [package.json](https://gitlab.com/bloodyhealth/drip/blob/master/package.json) under:
|
1. Check what testing device is specified in [package.json](https://gitlab.com/bloodyhealth/drip/blob/main/package.json) under:
|
||||||
```
|
```
|
||||||
{"detox":
|
{"detox":
|
||||||
{"configurations":
|
{"configurations":
|
||||||
@@ -201,7 +229,3 @@ More information about how the app calculates fertility status and bleeding pred
|
|||||||
react-native link
|
react-native link
|
||||||
|
|
||||||
5. You should be able to use the icon now within drip, e.g. in Cycle Day Overview and on the chart.
|
5. You should be able to use the icon now within drip, e.g. in Cycle Day Overview and on the chart.
|
||||||
|
|
||||||
## Translation
|
|
||||||
|
|
||||||
We are using [Weblate](https://weblate.org/) as translation software.
|
|
||||||
|
|||||||
@@ -1,33 +1,108 @@
|
|||||||
# How to release a new version
|
# How to release a new app version for Android
|
||||||
|
|
||||||
Note: You need the release-key to bundle a release that can be uploaded to Google Play Store.
|
_Note: You need the release-key for Android to bundle a signed release that can be uploaded and published via the Google Play Store. A similar process for Apple requires a certificate to upload and publish the app to the App Store. More documentation on 'How to release a new app version for iOS' coming soon._
|
||||||
|
|
||||||
Run the release wizard that takes you through all the steps necessary to prepare a new release:
|
# Table of Contents
|
||||||
|
|
||||||
|
1. [version updating](#Version-updating)
|
||||||
|
2. [android building](#Building-in-Android)
|
||||||
|
- [APK](#APK)
|
||||||
|
- [AAB](#AAB)
|
||||||
|
3. [release sharing](#Share-the-release)
|
||||||
|
|
||||||
|
## Version updating
|
||||||
|
|
||||||
|
When you are done with a chore, a feature or a bugfix, you may want to share it with testers and eventually publish a release. In order to identify a specific app version we can update the version name, which is created based on the following format: `1.yymm.d` e.g. `1.2311.7`. If you want to upload a new app version to Google Play you also need to update the version code.
|
||||||
|
|
||||||
|
The following command will:
|
||||||
|
|
||||||
|
- create a new versionName and a new higher versionCode (+1)
|
||||||
|
- create a commit including a tag named after the new release version name.
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run release
|
yarn release
|
||||||
```
|
|
||||||
This will trigger the following:
|
|
||||||
* update version number
|
|
||||||
* create a new tag for the release
|
|
||||||
* update the changelog
|
|
||||||
* make a release commit
|
|
||||||
|
|
||||||
To then bundle a release run the following command on your branch:
|
|
||||||
|
|
||||||
```
|
|
||||||
cd android && ./gradlew bundleRelease
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This command creates an `app.aab` file in the folder `/android/app/build/outputs/bundle/release`.
|
The versionName and versionCode [are defined here](https://gitlab.com/bloodyhealth/drip/-/blob/5401789c46f4a02915ab900ef284581be420451c/android/app/build.gradle#L137-138) and in [package.json](https://gitlab.com/bloodyhealth/drip/-/blob/5401789c46f4a02915ab900ef284581be420451c/package.json#L3).
|
||||||
|
|
||||||
[More on Android App Bundle](https://blog.swmansion.com/make-your-react-native-app-3x-smaller-44c993eda2c9)
|
## Building in Android
|
||||||
|
|
||||||
You need to manually push the created tag to Gitlab:
|
APK versus AAB
|
||||||
|
|
||||||
|
> Android App Bundles (AAB) include all your app’s compiled code and resources, but defer APK generation and signing to Google Play. Unlike an APK, you can't deploy an app bundle directly to a device. So, if you want to quickly test or share an APK with someone else, you should instead build an APK.
|
||||||
|
|
||||||
|
(https://developer.android.com/build/building-cmdline)
|
||||||
|
|
||||||
|
### APK
|
||||||
|
|
||||||
|
To build a release apk file, run the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
git push origin <tagname>
|
yarn build-android-apk-release
|
||||||
```
|
```
|
||||||
Also don't forget to push your branch to Gitlab and review and merge it if ready!
|
|
||||||
|
|
||||||
Yay, done (have a scoop of ice cream, I suggest coconut 🍦)!
|
_which is a shortcut for:_ `cd android && ./gradlew clean && ./gradlew assembleRelease && cd ..`
|
||||||
|
|
||||||
|
This will create a new apk file named `app-release.apk` under `./android/app/build/outputs/apk/release/`.
|
||||||
|
|
||||||
|
For signing an apk you can run this command:
|
||||||
|
|
||||||
|
```
|
||||||
|
yarn sign-android-apk-release
|
||||||
|
```
|
||||||
|
|
||||||
|
_which is a shortcut for:_ `zipalign -v -p 4 ./android/app/build/outputs/apk/release/app-release.apk ./android/app/build/outputs/apk/release/app-release_signed.apk`
|
||||||
|
|
||||||
|
It adds a file name `app-release_signed.apk` in the same folder in `./android/app/build/outputs/apk/release/`
|
||||||
|
|
||||||
|
### AAB
|
||||||
|
|
||||||
|
To build a release aab file, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
yarn build-android-aab-release
|
||||||
|
```
|
||||||
|
|
||||||
|
_which is a shortcut for:_ `cd android && ./gradlew clean && ./gradlew :app:bundleRelease && cd ..`
|
||||||
|
|
||||||
|
It creates a new aab file named `app-release.aab` under `./android/app/build/outputs/bundle/release`
|
||||||
|
|
||||||
|
For signing an aab you first need to configure the base module’s build.gradle file with your app’s signing information. You can then run this command:
|
||||||
|
|
||||||
|
```
|
||||||
|
yarn sign-android-aab-release
|
||||||
|
```
|
||||||
|
|
||||||
|
_which is a shortcut for:_ `jarsigner -keystore ./android/app/drip-release-key.keystore ./android/app/build/outputs/bundle/release/app-release.aab drip-release-key`
|
||||||
|
|
||||||
|
## Share the release
|
||||||
|
|
||||||
|
### Gitlab repository
|
||||||
|
|
||||||
|
For a quick and easy way to share an apk to testers who are willing to sideload drip onto their Android phones, do this: Upload a signed apk to the Gitlab repository of the drip website under `/release` https://gitlab.com/bloodyhealth/bloodyhealth.gitlab.io/-/tree/main/release and maybe adapt the name of the apk with a more specific name than "app-release.apk". Now you can simply share a direct link to download your newly bundled apk, e.g. [a download link for v1.2311.14](https://gitlab.com/bloodyhealth/bloodyhealth.gitlab.io/-/blob/main/release/v1.2311.14.apk).
|
||||||
|
|
||||||
|
### Google Play Console
|
||||||
|
|
||||||
|
Upload a signed aab to the [Google Play Console for developers](https://play.google.com/console/) and add it to the "App bundle explorer". This requires a higher versionCode and a different version name compared to previously uploaded aab or apk files.
|
||||||
|
You can decide if you want the new app version to get released for testing (internal, closed or open) or for production. Keep in mind that any track other than "internal testing" triggers an external review by Google and might take a few hours.
|
||||||
|
|
||||||
|
#### Phone screenshots
|
||||||
|
|
||||||
|
If there are visual changes in the app you may want to update the screenshots for the Google Play Store listing. Keep in mind that Google Play has specific resolution requirements. You'll find them in Grow -> Store presence -> Main Store Listing -> Phone screenshots.
|
||||||
|
|
||||||
|
### drip website
|
||||||
|
|
||||||
|
After a new version has been published on Google Play (or F-Droid) the apk version that is downloadable directly from the [drip website](https://dripapp.org) needs to get updated as well. Therefore you upload a signed apk to the [repository](https://gitlab.com/bloodyhealth/bloodyhealth.gitlab.io/) and adapt the name and link on /index.html.
|
||||||
|
Last time I checked it was [here](f3da9776b1943ffa32458e74ef86eeca98c1891c/index.html#L114).
|
||||||
|
|
||||||
|
#### Phone screenshots
|
||||||
|
|
||||||
|
Please also update [phone screenshots here](https://gitlab.com/bloodyhealth/bloodyhealth.gitlab.io/-/tree/main/assets) and set links on [/index](https://gitlab.com/bloodyhealth/bloodyhealth.gitlab.io/-/blob/f3da9776b1943ffa32458e74ef86eeca98c1891c/index.html#L47) and [/media](https://gitlab.com/bloodyhealth/bloodyhealth.gitlab.io/-/blob/c7f999bb7ad736345321537cbffa3f4c24eeee6d/media.html#L33) that can then also be attached to a social media post.
|
||||||
|
|
||||||
|
You probably want to share the app update by posting on one or more of these platforms:
|
||||||
|
|
||||||
|
- [Twitter](twitter.com/dripberlin)
|
||||||
|
- [Mastodon](mastodon.social/@dripapp)
|
||||||
|
- [Ko-fi](https://ko-fi.com/dripapp)
|
||||||
|
- [Linkedin](https://www.linkedin.com/company/34899684/)
|
||||||
|
- Different tech, privacy, feminist oriented slacks
|
||||||
|
|||||||
@@ -134,10 +134,10 @@ android {
|
|||||||
applicationId "com.drip"
|
applicationId "com.drip"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 8
|
versionCode 25
|
||||||
versionName "1.2102.28"
|
versionName "1.2311.14"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "armeabi-v7a", "x86", "arm64-v8a"
|
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
||||||
}
|
}
|
||||||
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
|
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
|
||||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||||
@@ -198,7 +198,7 @@ android {
|
|||||||
// For each separate APK per architecture, set a unique version code as described here:
|
// For each separate APK per architecture, set a unique version code as described here:
|
||||||
// https://developer.android.com/studio/build/configure-apk-splits.html
|
// https://developer.android.com/studio/build/configure-apk-splits.html
|
||||||
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
|
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
|
||||||
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
|
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
||||||
def abi = output.getFilter(OutputFile.ABI)
|
def abi = output.getFilter(OutputFile.ABI)
|
||||||
if (abi != null) { // null for the universal-debug, universal-release variants
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||||
output.versionCodeOverride =
|
output.versionCodeOverride =
|
||||||
@@ -211,11 +211,12 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
//noinspection GradleDynamicVersion
|
//noinspection GradleDynamicVersion
|
||||||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
implementation "androidx.appcompat:appcompat:1.0.0"
|
||||||
implementation 'androidx.annotation:annotation:1.1.0'
|
implementation "androidx.annotation:annotation:1.1.0"
|
||||||
|
implementation "androidx.work:work-runtime-ktx:2.7.1"
|
||||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||||
|
|
||||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
||||||
|
|
||||||
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
|
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
|
||||||
exclude group:'com.facebook.fbjni'
|
exclude group:'com.facebook.fbjni'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,20 +7,19 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||||
|
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission tools:node="remove" android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission tools:node="remove" android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission tools:node="remove" android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission tools:node="remove" android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission tools:node="remove" android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission tools:node="remove" android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
|
||||||
|
|
||||||
<permission
|
<permission
|
||||||
android:name="${applicationId}.permission.C2D_MESSAGE"
|
android:name="${applicationId}.permission.C2D_MESSAGE"
|
||||||
android:protectionLevel="signature" />
|
android:protectionLevel="signature" />
|
||||||
|
|
||||||
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
|
||||||
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MainApplication"
|
android:name=".MainApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
@@ -28,18 +27,49 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.dieam.reactnativepushnotification.notification_foreground"
|
||||||
|
android:value="false" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.dieam.reactnativepushnotification.notification_color"
|
||||||
|
android:resource="@color/purple" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.dieam.reactnativepushnotification.default_notification_channel_id"
|
||||||
|
android:value="..." />
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions"
|
||||||
|
android:exported="false"
|
||||||
|
tools:ignore="MissingClass" />
|
||||||
|
<receiver
|
||||||
|
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher"
|
||||||
|
android:exported="false" />
|
||||||
|
<receiver
|
||||||
|
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver"
|
||||||
|
android:exported="false" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||||
|
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="adjustPan"
|
android:windowSoftInputMode="adjustPan"
|
||||||
android:screenOrientation="sensorPortrait">
|
android:screenOrientation="sensorPortrait">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="com.drip.provider"
|
android:authorities="com.drip.provider"
|
||||||
@@ -51,28 +81,5 @@
|
|||||||
android:resource="@xml/filepaths" />
|
android:resource="@xml/filepaths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
|
|
||||||
android:value="false"/>
|
|
||||||
<!-- Change the resource name to your App's accent color - or any other color you want -->
|
|
||||||
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
|
|
||||||
android:resource="@android:color/white"/> <!-- or @android:color/{name} to use a standard color -->
|
|
||||||
|
|
||||||
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
|
|
||||||
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
|
|
||||||
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
|
||||||
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
|
|
||||||
android:exported="false" >
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -14,4 +14,5 @@
|
|||||||
<color name="grey">#A5A5A5</color>
|
<color name="grey">#A5A5A5</color>
|
||||||
<color name="orange">#F38337</color>
|
<color name="orange">#F38337</color>
|
||||||
<color name="purple">#3A2671</color>
|
<color name="purple">#3A2671</color>
|
||||||
|
<color name="turquoiseDark">#69CBC1</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -5,13 +5,13 @@ buildscript {
|
|||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
ext.kotlinVersion = "1.3.10"
|
ext.kotlinVersion = '1.3.40'
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("com.android.tools.build:gradle:4.2.2")
|
classpath('com.android.tools.build:gradle:7.0.3')
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,12 +46,9 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
googlePlayServicesVersion = "+" // default: "+"
|
buildToolsVersion = "33.0.2"
|
||||||
firebaseMessagingVersion = "21.1.0" // default: "+"
|
minSdkVersion = 21
|
||||||
|
compileSdkVersion = 33
|
||||||
buildToolsVersion = "30.0.2"
|
targetSdkVersion = 33
|
||||||
minSdkVersion = 23
|
|
||||||
compileSdkVersion = 30
|
|
||||||
targetSdkVersion = 30
|
|
||||||
ndkVersion = "21.4.7075529"
|
ndkVersion = "21.4.7075529"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
#Wed Oct 11 14:45:21 CEST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -6,16 +6,17 @@ import AppText from '../common/app-text'
|
|||||||
import CloseIcon from '../common/close-icon'
|
import CloseIcon from '../common/close-icon'
|
||||||
|
|
||||||
import { Containers, Spacing } from '../../styles'
|
import { Containers, Spacing } from '../../styles'
|
||||||
import { chart } from '../../i18n/en/labels'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
const image = require('../../assets/swipe.png')
|
const image = require('../../assets/swipe.png')
|
||||||
|
|
||||||
const Tutorial = ({ onClose }) => {
|
const Tutorial = ({ onClose }) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Image resizeMode="contain" source={image} style={styles.image} />
|
<Image resizeMode="contain" source={image} style={styles.image} />
|
||||||
<View style={styles.textContainer}>
|
<View style={styles.textContainer}>
|
||||||
<AppText>{chart.tutorial}</AppText>
|
<AppText>{t('chart.tutorial')}</AppText>
|
||||||
</View>
|
</View>
|
||||||
<CloseIcon onClose={onClose} />
|
<CloseIcon onClose={onClose} />
|
||||||
</View>
|
</View>
|
||||||
@@ -4,16 +4,20 @@ import { StyleSheet, View } from 'react-native'
|
|||||||
|
|
||||||
import AppText from '../common/app-text'
|
import AppText from '../common/app-text'
|
||||||
|
|
||||||
import { Typography } from '../../styles'
|
import { Sizes, Typography } from '../../styles'
|
||||||
import { CHART_YAXIS_WIDTH } from '../../config'
|
import { CHART_YAXIS_WIDTH } from '../../config'
|
||||||
import { shared as labels } from '../../i18n/en/labels'
|
import { shared as labels } from '../../i18n/en/labels'
|
||||||
|
|
||||||
const ChartLegend = ({ height }) => {
|
const ChartLegend = ({ height }) => {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, { height }]}>
|
<View style={[styles.container, { height }]}>
|
||||||
|
<View style={[styles.singleLabelContainer, { height: height / 2 }]}>
|
||||||
<AppText style={styles.textBold}>#</AppText>
|
<AppText style={styles.textBold}>#</AppText>
|
||||||
|
</View>
|
||||||
|
<View style={[styles.singleLabelContainer, { height: height / 2 }]}>
|
||||||
<AppText style={styles.text}>{labels.date}</AppText>
|
<AppText style={styles.text}>{labels.date}</AppText>
|
||||||
</View>
|
</View>
|
||||||
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,8 +31,13 @@ const styles = StyleSheet.create({
|
|||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
width: CHART_YAXIS_WIDTH,
|
width: CHART_YAXIS_WIDTH,
|
||||||
},
|
},
|
||||||
|
singleLabelContainer: {
|
||||||
|
justifyContent: 'space-around',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
...Typography.label,
|
...Typography.label,
|
||||||
|
fontSize: Sizes.footnote,
|
||||||
},
|
},
|
||||||
textBold: {
|
textBold: {
|
||||||
...Typography.labelBold,
|
...Typography.labelBold,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import HorizontalGrid from './horizontal-grid'
|
|||||||
import MainGrid from './main-grid'
|
import MainGrid from './main-grid'
|
||||||
import NoData from './no-data'
|
import NoData from './no-data'
|
||||||
import NoTemperature from './no-temperature'
|
import NoTemperature from './no-temperature'
|
||||||
import Tutorial from './tutorial'
|
import Tutorial from './Tutorial'
|
||||||
import YAxis from './y-axis'
|
import YAxis from './y-axis'
|
||||||
|
|
||||||
import { getCycleDaysSortedByDate } from '../../db'
|
import { getCycleDaysSortedByDate } from '../../db'
|
||||||
@@ -29,7 +29,7 @@ const getSymptomsFromCycleDays = (cycleDays) =>
|
|||||||
SYMPTOMS.filter((symptom) => cycleDays.some((cycleDay) => cycleDay[symptom]))
|
SYMPTOMS.filter((symptom) => cycleDays.some((cycleDay) => cycleDay[symptom]))
|
||||||
|
|
||||||
const CycleChart = ({ navigate, setDate }) => {
|
const CycleChart = ({ navigate, setDate }) => {
|
||||||
const [shouldShowHint, setShouldShowHint] = useState(true)
|
const [shouldShowHint, setShouldShowHint] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let isMounted = true
|
let isMounted = true
|
||||||
|
|||||||
@@ -19,11 +19,20 @@ const CycleDayLabel = ({ height, date }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, { height }]}>
|
<View style={[styles.container, { height }]}>
|
||||||
|
<View style={{ ...styles.labelRow, height: height / 2 }}>
|
||||||
<AppText style={styles.textBold}>{cycleDayLabel}</AppText>
|
<AppText style={styles.textBold}>{cycleDayLabel}</AppText>
|
||||||
<View style={styles.dateLabel}>
|
</View>
|
||||||
<AppText style={styles.text}>
|
|
||||||
{isFirstDayOfMonth ? momentDate.format('MMM') : dayOfMonth}
|
<View style={{ ...styles.labelRow, height: height / 2 }}>
|
||||||
|
{isFirstDayOfMonth && (
|
||||||
|
<AppText style={styles.textFootnote}>
|
||||||
|
{momentDate.format('MMM')}
|
||||||
</AppText>
|
</AppText>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!isFirstDayOfMonth && (
|
||||||
|
<AppText style={styles.textSmall}>{dayOfMonth}</AppText>
|
||||||
|
)}
|
||||||
{!isFirstDayOfMonth && (
|
{!isFirstDayOfMonth && (
|
||||||
<AppText style={styles.textLight}>
|
<AppText style={styles.textLight}>
|
||||||
{getOrdinalSuffix(dayOfMonth)}
|
{getOrdinalSuffix(dayOfMonth)}
|
||||||
@@ -45,17 +54,21 @@ const styles = StyleSheet.create({
|
|||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
left: 4,
|
left: 4,
|
||||||
},
|
},
|
||||||
text: {
|
textSmall: {
|
||||||
...Typography.label,
|
...Typography.label,
|
||||||
fontSize: Sizes.small,
|
fontSize: Sizes.small,
|
||||||
},
|
},
|
||||||
|
textFootnote: {
|
||||||
|
...Typography.label,
|
||||||
|
fontSize: Sizes.footnote,
|
||||||
|
},
|
||||||
textBold: {
|
textBold: {
|
||||||
...Typography.labelBold,
|
...Typography.labelBold,
|
||||||
},
|
},
|
||||||
textLight: {
|
textLight: {
|
||||||
...Typography.labelLight,
|
...Typography.labelLight,
|
||||||
},
|
},
|
||||||
dateLabel: {
|
labelRow: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-around',
|
justifyContent: 'space-around',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { TouchableOpacity } from 'react-native'
|
import { TouchableOpacity } from 'react-native'
|
||||||
|
import moment from 'moment'
|
||||||
|
|
||||||
import { getCycleDay } from '../../db'
|
import { getCycleDay } from '../../db'
|
||||||
|
|
||||||
@@ -26,6 +27,8 @@ const DayColumn = ({
|
|||||||
symptomRowSymptoms,
|
symptomRowSymptoms,
|
||||||
xAxisHeight,
|
xAxisHeight,
|
||||||
}) => {
|
}) => {
|
||||||
|
const momentDate = moment(dateString)
|
||||||
|
const isWeekend = momentDate.day() == 0 || momentDate.day() == 6
|
||||||
const cycleDayData = getCycleDay(dateString)
|
const cycleDayData = getCycleDay(dateString)
|
||||||
let data = {}
|
let data = {}
|
||||||
|
|
||||||
@@ -73,6 +76,7 @@ const DayColumn = ({
|
|||||||
isVerticalLine={fhmAndLtl.drawFhmLine}
|
isVerticalLine={fhmAndLtl.drawFhmLine}
|
||||||
data={data && data.temperature}
|
data={data && data.temperature}
|
||||||
columnHeight={columnHeight}
|
columnHeight={columnHeight}
|
||||||
|
isWeekend={isWeekend}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -92,6 +96,7 @@ const DayColumn = ({
|
|||||||
isSymptomDataComplete={
|
isSymptomDataComplete={
|
||||||
hasSymptomData && isSymptomDataComplete(symptom, dateString)
|
hasSymptomData && isSymptomDataComplete(symptom, dateString)
|
||||||
}
|
}
|
||||||
|
isWeekend={isWeekend}
|
||||||
height={symptomHeight}
|
height={symptomHeight}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { Colors } from '../../styles'
|
|||||||
import {
|
import {
|
||||||
CHART_COLUMN_WIDTH,
|
CHART_COLUMN_WIDTH,
|
||||||
CHART_COLUMN_MIDDLE,
|
CHART_COLUMN_MIDDLE,
|
||||||
CHART_DOT_RADIUS,
|
CHART_DOT_RADIUS_SYMPTOM,
|
||||||
|
CHART_DOT_RADIUS_TEMPERATURE,
|
||||||
CHART_STROKE_WIDTH,
|
CHART_STROKE_WIDTH,
|
||||||
} from '../../config'
|
} from '../../config'
|
||||||
|
|
||||||
@@ -35,9 +36,9 @@ const DotAndLine = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dot = new Path()
|
const dot = new Path()
|
||||||
.moveTo(CHART_COLUMN_MIDDLE, y - CHART_DOT_RADIUS)
|
.moveTo(CHART_COLUMN_MIDDLE, y - CHART_DOT_RADIUS_TEMPERATURE)
|
||||||
.arc(0, CHART_DOT_RADIUS * 2, CHART_DOT_RADIUS)
|
.arc(0, CHART_DOT_RADIUS_TEMPERATURE * 2, CHART_DOT_RADIUS_TEMPERATURE)
|
||||||
.arc(0, CHART_DOT_RADIUS * -2, CHART_DOT_RADIUS)
|
.arc(0, CHART_DOT_RADIUS_TEMPERATURE * -2, CHART_DOT_RADIUS_TEMPERATURE)
|
||||||
const dotColor = exclude ? Colors.turquoise : Colors.turquoiseDark
|
const dotColor = exclude ? Colors.turquoise : Colors.turquoiseDark
|
||||||
const lineColorLeft = excludeLeftLine
|
const lineColorLeft = excludeLeftLine
|
||||||
? Colors.turquoise
|
? Colors.turquoise
|
||||||
@@ -58,13 +59,13 @@ const DotAndLine = ({
|
|||||||
d={lineRight}
|
d={lineRight}
|
||||||
stroke={lineColorRight}
|
stroke={lineColorRight}
|
||||||
strokeWidth={CHART_STROKE_WIDTH}
|
strokeWidth={CHART_STROKE_WIDTH}
|
||||||
key={y + CHART_DOT_RADIUS}
|
key={y + CHART_DOT_RADIUS_SYMPTOM}
|
||||||
/>
|
/>
|
||||||
<Shape
|
<Shape
|
||||||
d={dot}
|
d={dot}
|
||||||
stroke={dotColor}
|
stroke={dotColor}
|
||||||
strokeWidth={CHART_STROKE_WIDTH}
|
strokeWidth={CHART_STROKE_WIDTH}
|
||||||
fill="white"
|
fill={Colors.turquoiseDark}
|
||||||
key="dot"
|
key="dot"
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { StyleSheet, View } from 'react-native'
|
|||||||
import { Colors, Containers } from '../../styles'
|
import { Colors, Containers } from '../../styles'
|
||||||
import {
|
import {
|
||||||
CHART_COLUMN_WIDTH,
|
CHART_COLUMN_WIDTH,
|
||||||
CHART_DOT_RADIUS,
|
CHART_DOT_RADIUS_SYMPTOM,
|
||||||
CHART_GRID_LINE_HORIZONTAL_WIDTH,
|
CHART_GRID_LINE_HORIZONTAL_WIDTH,
|
||||||
} from '../../config'
|
} from '../../config'
|
||||||
|
|
||||||
@@ -15,14 +15,31 @@ const SymptomCell = ({
|
|||||||
symptom,
|
symptom,
|
||||||
symptomValue,
|
symptomValue,
|
||||||
isSymptomDataComplete,
|
isSymptomDataComplete,
|
||||||
|
isWeekend,
|
||||||
}) => {
|
}) => {
|
||||||
const shouldDrawDot = symptomValue !== false
|
const shouldDrawDot = symptomValue !== false
|
||||||
|
// Determine the background color based on isWeekend prop
|
||||||
|
const backgroundColor = isWeekend ? Colors.greyVeryLight : 'white'
|
||||||
const styleCell =
|
const styleCell =
|
||||||
index !== 0
|
index !== 0
|
||||||
? [styles.cell, { height, width: CHART_COLUMN_WIDTH }]
|
? [
|
||||||
: [styles.cell, { height, width: CHART_COLUMN_WIDTH }, styles.topBorder]
|
styles.cell,
|
||||||
|
{
|
||||||
|
height,
|
||||||
|
width: CHART_COLUMN_WIDTH,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
styles.cell,
|
||||||
|
{
|
||||||
|
height,
|
||||||
|
width: CHART_COLUMN_WIDTH,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
},
|
||||||
|
styles.topBorder,
|
||||||
|
]
|
||||||
let styleDot
|
let styleDot
|
||||||
|
|
||||||
if (shouldDrawDot) {
|
if (shouldDrawDot) {
|
||||||
const styleSymptom = Colors.iconColors[symptom]
|
const styleSymptom = Colors.iconColors[symptom]
|
||||||
const symptomColor = styleSymptom.shades[symptomValue]
|
const symptomColor = styleSymptom.shades[symptomValue]
|
||||||
@@ -47,11 +64,11 @@ SymptomCell.propTypes = {
|
|||||||
symptom: PropTypes.string,
|
symptom: PropTypes.string,
|
||||||
symptomValue: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
|
symptomValue: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
|
||||||
isSymptomDataComplete: PropTypes.bool,
|
isSymptomDataComplete: PropTypes.bool,
|
||||||
|
isWeekend: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
cell: {
|
cell: {
|
||||||
backgroundColor: 'white',
|
|
||||||
borderBottomColor: Colors.grey,
|
borderBottomColor: Colors.grey,
|
||||||
borderBottomWidth: CHART_GRID_LINE_HORIZONTAL_WIDTH,
|
borderBottomWidth: CHART_GRID_LINE_HORIZONTAL_WIDTH,
|
||||||
borderLeftColor: Colors.grey,
|
borderLeftColor: Colors.grey,
|
||||||
@@ -63,8 +80,8 @@ const styles = StyleSheet.create({
|
|||||||
borderTopWidth: CHART_GRID_LINE_HORIZONTAL_WIDTH,
|
borderTopWidth: CHART_GRID_LINE_HORIZONTAL_WIDTH,
|
||||||
},
|
},
|
||||||
dot: {
|
dot: {
|
||||||
width: CHART_DOT_RADIUS * 2,
|
width: CHART_DOT_RADIUS_SYMPTOM * 2,
|
||||||
height: CHART_DOT_RADIUS * 2,
|
height: CHART_DOT_RADIUS_SYMPTOM * 2,
|
||||||
borderRadius: 50,
|
borderRadius: 50,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { StyleSheet } from 'react-native'
|
import { Colors } from '../../styles'
|
||||||
|
|
||||||
import { Surface, Path } from '@react-native-community/art'
|
import { Surface, Path } from '@react-native-community/art'
|
||||||
|
|
||||||
@@ -14,14 +14,16 @@ const TemperatureColumn = ({
|
|||||||
isVerticalLine,
|
isVerticalLine,
|
||||||
data,
|
data,
|
||||||
columnHeight,
|
columnHeight,
|
||||||
|
isWeekend,
|
||||||
}) => {
|
}) => {
|
||||||
const x = CHART_STROKE_WIDTH / 2
|
const x = CHART_STROKE_WIDTH / 2
|
||||||
|
|
||||||
|
const backgroundColor = isWeekend ? Colors.greyVeryLight : 'white'
|
||||||
return (
|
return (
|
||||||
<Surface
|
<Surface
|
||||||
width={CHART_COLUMN_WIDTH}
|
width={CHART_COLUMN_WIDTH}
|
||||||
height={columnHeight}
|
height={columnHeight}
|
||||||
style={styles.container}
|
style={{ backgroundColor: backgroundColor }}
|
||||||
>
|
>
|
||||||
<ChartLine path={new Path().lineTo(0, columnHeight)} />
|
<ChartLine path={new Path().lineTo(0, columnHeight)} />
|
||||||
|
|
||||||
@@ -63,12 +65,7 @@ TemperatureColumn.propTypes = {
|
|||||||
isVerticalLine: PropTypes.bool,
|
isVerticalLine: PropTypes.bool,
|
||||||
data: PropTypes.object,
|
data: PropTypes.object,
|
||||||
columnHeight: PropTypes.number,
|
columnHeight: PropTypes.number,
|
||||||
|
isWeekend: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
backgroundColor: 'white',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default TemperatureColumn
|
export default TemperatureColumn
|
||||||
|
|||||||
@@ -8,13 +8,15 @@ import { Sizes } from '../../styles'
|
|||||||
import { CHART_TICK_WIDTH } from '../../config'
|
import { CHART_TICK_WIDTH } from '../../config'
|
||||||
|
|
||||||
const Tick = ({ yPosition, height, isBold, shouldShowLabel, label }) => {
|
const Tick = ({ yPosition, height, isBold, shouldShowLabel, label }) => {
|
||||||
const top = yPosition - height / 2
|
const top = yPosition - height / 2 - 4
|
||||||
const containerStyle = [styles.container, { flexBasis: height, height, top }]
|
const containerStyle = [styles.container, { flexBasis: height, height, top }]
|
||||||
const textStyle = isBold ? styles.textBold : styles.textNormal
|
const textStyle = isBold ? styles.textBold : styles.textNormal
|
||||||
|
|
||||||
|
if (!shouldShowLabel) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={containerStyle}>
|
<View style={containerStyle}>
|
||||||
<AppText style={textStyle}>{shouldShowLabel && label}</AppText>
|
<AppText style={textStyle}>{label}</AppText>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -36,6 +38,7 @@ const styles = StyleSheet.create({
|
|||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
right: 0,
|
right: 0,
|
||||||
width: CHART_TICK_WIDTH,
|
width: CHART_TICK_WIDTH,
|
||||||
|
minHeight: Sizes.base + 2,
|
||||||
},
|
},
|
||||||
textBold: {
|
textBold: {
|
||||||
fontSize: Sizes.base,
|
fontSize: Sizes.base,
|
||||||
|
|||||||
@@ -6,20 +6,23 @@ import MenuItem from './menu-item'
|
|||||||
|
|
||||||
import { Containers } from '../../styles'
|
import { Containers } from '../../styles'
|
||||||
import { pages } from '../pages'
|
import { pages } from '../pages'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
const Menu = ({ currentPage, navigate }) => {
|
const Menu = ({ currentPage, navigate }) => {
|
||||||
const menuItems = pages.filter((page) => page.isInMenu)
|
const menuItems = pages.filter((page) => page.isInMenu)
|
||||||
|
|
||||||
|
const { t } = useTranslation(null, { keyPrefix: 'bottomMenu' })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
{menuItems.map(({ icon, label, component }) => {
|
{menuItems.map(({ icon, labelKey, component }) => {
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
isActive={component === currentPage}
|
isActive={component === currentPage}
|
||||||
onPress={() => navigate(component)}
|
onPress={() => navigate(component)}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
key={label}
|
key={labelKey}
|
||||||
label={label}
|
label={t(labelKey)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,75 +1,63 @@
|
|||||||
import settingsViews from './settings'
|
import settingsViews from './settings'
|
||||||
|
|
||||||
import settingsLabels from '../i18n/en/settings'
|
|
||||||
const labels = settingsLabels.menuItems
|
|
||||||
|
|
||||||
export const pages = [
|
export const pages = [
|
||||||
{
|
{
|
||||||
component: 'Home',
|
component: 'Home',
|
||||||
icon: 'home',
|
icon: 'home',
|
||||||
label: 'Home',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Calendar',
|
component: 'Calendar',
|
||||||
icon: 'calendar',
|
icon: 'calendar',
|
||||||
isInMenu: true,
|
isInMenu: true,
|
||||||
label: 'Calendar',
|
labelKey: 'calendar',
|
||||||
parent: 'Home',
|
parent: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Chart',
|
component: 'Chart',
|
||||||
icon: 'chart',
|
icon: 'chart',
|
||||||
isInMenu: true,
|
isInMenu: true,
|
||||||
label: 'Chart',
|
labelKey: 'chart',
|
||||||
parent: 'Home',
|
parent: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Stats',
|
component: 'Stats',
|
||||||
icon: 'statistics',
|
icon: 'statistics',
|
||||||
isInMenu: true,
|
isInMenu: true,
|
||||||
label: 'Stats',
|
labelKey: 'stats',
|
||||||
parent: 'Home',
|
parent: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
children: Object.keys(settingsViews),
|
children: Object.keys(settingsViews),
|
||||||
component: 'SettingsMenu',
|
component: 'SettingsMenu',
|
||||||
icon: 'settings',
|
icon: 'settings',
|
||||||
label: 'Settings',
|
|
||||||
parent: 'Home',
|
parent: 'Home',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Reminders',
|
component: 'Reminders',
|
||||||
label: labels.reminders.name,
|
|
||||||
parent: 'SettingsMenu',
|
parent: 'SettingsMenu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'NfpSettings',
|
component: 'NfpSettings',
|
||||||
label: labels.nfpSettings.name,
|
|
||||||
parent: 'SettingsMenu',
|
parent: 'SettingsMenu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'DataManagement',
|
component: 'DataManagement',
|
||||||
label: labels.dataManagement.name,
|
|
||||||
parent: 'SettingsMenu',
|
parent: 'SettingsMenu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Password',
|
component: 'Password',
|
||||||
label: labels.password.name,
|
|
||||||
parent: 'SettingsMenu',
|
parent: 'SettingsMenu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'About',
|
component: 'About',
|
||||||
label: 'About',
|
|
||||||
parent: 'SettingsMenu',
|
parent: 'SettingsMenu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'License',
|
component: 'License',
|
||||||
label: 'License',
|
|
||||||
parent: 'SettingsMenu',
|
parent: 'SettingsMenu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'PrivacyPolicy',
|
component: 'PrivacyPolicy',
|
||||||
label: 'PrivacyPolicy',
|
|
||||||
parent: 'SettingsMenu',
|
parent: 'SettingsMenu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,40 +6,23 @@ import AppText from '../../common/app-text'
|
|||||||
import Button from '../../common/button'
|
import Button from '../../common/button'
|
||||||
import Segment from '../../common/segment'
|
import Segment from '../../common/segment'
|
||||||
|
|
||||||
import { openImportDialog, getFileContent, importData } from './import-dialog'
|
|
||||||
import openShareDialogAndExport from './export-dialog'
|
import openShareDialogAndExport from './export-dialog'
|
||||||
import DeleteData from './delete-data'
|
import DeleteData from './delete-data'
|
||||||
|
|
||||||
import labels from '../../../i18n/en/settings'
|
import labels from '../../../i18n/en/settings'
|
||||||
import { ACTION_DELETE, ACTION_EXPORT, ACTION_IMPORT } from '../../../config'
|
import ImportData from './ImportData'
|
||||||
|
|
||||||
const DataManagement = () => {
|
const DataManagement = () => {
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const [currentAction, setCurrentAction] = useState(null)
|
const [isDeletingData, setIsDeletingData] = useState(false)
|
||||||
|
|
||||||
const startImportFlow = async (shouldDeleteExistingData) => {
|
|
||||||
setIsLoading(true)
|
|
||||||
const fileContent = await getFileContent()
|
|
||||||
if (fileContent) {
|
|
||||||
await importData(shouldDeleteExistingData, fileContent)
|
|
||||||
}
|
|
||||||
setIsLoading(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
const startExport = () => {
|
const startExport = () => {
|
||||||
setCurrentAction(ACTION_EXPORT)
|
setIsDeletingData(false)
|
||||||
openShareDialogAndExport()
|
openShareDialogAndExport()
|
||||||
}
|
}
|
||||||
|
|
||||||
const startImport = () => {
|
|
||||||
setCurrentAction(ACTION_IMPORT)
|
|
||||||
openImportDialog(startImportFlow)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLoading) return <AppLoadingView />
|
if (isLoading) return <AppLoadingView />
|
||||||
|
|
||||||
const isDeletingData = currentAction === ACTION_DELETE
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppPage>
|
<AppPage>
|
||||||
<Segment title={labels.export.button}>
|
<Segment title={labels.export.button}>
|
||||||
@@ -48,17 +31,15 @@ const DataManagement = () => {
|
|||||||
{labels.export.button}
|
{labels.export.button}
|
||||||
</Button>
|
</Button>
|
||||||
</Segment>
|
</Segment>
|
||||||
<Segment title={labels.import.button}>
|
<ImportData
|
||||||
<AppText>{labels.import.segmentExplainer}</AppText>
|
resetIsDeletingData={() => setIsDeletingData(false)}
|
||||||
<Button isCTA onPress={startImport}>
|
setIsLoading={setIsLoading}
|
||||||
{labels.import.button}
|
/>
|
||||||
</Button>
|
|
||||||
</Segment>
|
|
||||||
<Segment title={labels.deleteSegment.title} last>
|
<Segment title={labels.deleteSegment.title} last>
|
||||||
<AppText>{labels.deleteSegment.explainer}</AppText>
|
<AppText>{labels.deleteSegment.explainer}</AppText>
|
||||||
<DeleteData
|
<DeleteData
|
||||||
isDeletingData={isDeletingData}
|
isDeletingData={isDeletingData}
|
||||||
onStartDeletion={() => setCurrentAction(ACTION_DELETE)}
|
onStartDeletion={() => setIsDeletingData(true)}
|
||||||
/>
|
/>
|
||||||
</Segment>
|
</Segment>
|
||||||
</AppPage>
|
</AppPage>
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import { Alert } from 'react-native'
|
||||||
|
import DocumentPicker from 'react-native-document-picker'
|
||||||
|
import rnfs from 'react-native-fs'
|
||||||
|
import importCsv from '../../../lib/import-export/import-from-csv'
|
||||||
|
import alertError from '../common/alert-error'
|
||||||
|
import Segment from '../../common/segment'
|
||||||
|
import AppText from '../../common/app-text'
|
||||||
|
import Button from '../../common/button'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
|
export default function ImportData({ resetIsDeletingData, setIsLoading }) {
|
||||||
|
const { t } = useTranslation(null, {
|
||||||
|
keyPrefix: 'hamburgerMenu.settings.data.import',
|
||||||
|
})
|
||||||
|
|
||||||
|
async function startImport(shouldDeleteExistingData) {
|
||||||
|
setIsLoading(true)
|
||||||
|
await importData(shouldDeleteExistingData)
|
||||||
|
setIsLoading(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getFileInfo() {
|
||||||
|
try {
|
||||||
|
const fileInfo = await DocumentPicker.pickSingle({
|
||||||
|
type: [DocumentPicker.types.csv, 'text/comma-separated-values'],
|
||||||
|
})
|
||||||
|
return fileInfo
|
||||||
|
} catch (error) {
|
||||||
|
if (DocumentPicker.isCancel(error)) return // User cancelled the picker, exit any dialogs or menus and move on
|
||||||
|
showImportErrorAlert(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getFileContent() {
|
||||||
|
const fileInfo = await getFileInfo()
|
||||||
|
if (!fileInfo) return null
|
||||||
|
|
||||||
|
try {
|
||||||
|
const fileContent = await rnfs.readFile(fileInfo.uri, 'utf8')
|
||||||
|
return fileContent
|
||||||
|
} catch (err) {
|
||||||
|
return showImportErrorAlert(t('error.couldNotOpenFile'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function importData(shouldDeleteExistingData) {
|
||||||
|
const fileContent = await getFileContent()
|
||||||
|
if (!fileContent) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
await importCsv(fileContent, shouldDeleteExistingData)
|
||||||
|
Alert.alert(t('success.title'), t('success.message'))
|
||||||
|
} catch (err) {
|
||||||
|
showImportErrorAlert(err.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function openImportDialog() {
|
||||||
|
resetIsDeletingData()
|
||||||
|
Alert.alert(t('dialog.title'), t('dialog.message'), [
|
||||||
|
{
|
||||||
|
text: t('dialog.cancel'),
|
||||||
|
style: 'cancel',
|
||||||
|
onPress: () => {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t('dialog.delete'),
|
||||||
|
onPress: () => startImport(true),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t('dialog.replace'),
|
||||||
|
onPress: () => startImport(false),
|
||||||
|
},
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
function showImportErrorAlert(message) {
|
||||||
|
const errorMessage = t('error.noDataImported', { message })
|
||||||
|
alertError(errorMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Segment title={t('button')}>
|
||||||
|
<AppText>{t('segmentExplainer')}</AppText>
|
||||||
|
<Button isCTA onPress={openImportDialog}>
|
||||||
|
{t('button')}
|
||||||
|
</Button>
|
||||||
|
</Segment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
ImportData.propTypes = {
|
||||||
|
resetIsDeletingData: PropTypes.func.isRequired,
|
||||||
|
setIsLoading: PropTypes.func.isRequired,
|
||||||
|
}
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
import { Alert } from 'react-native'
|
|
||||||
import DocumentPicker from 'react-native-document-picker'
|
|
||||||
import rnfs from 'react-native-fs'
|
|
||||||
import importCsv from '../../../lib/import-export/import-from-csv'
|
|
||||||
import { shared as sharedLabels } from '../../../i18n/en/labels'
|
|
||||||
import labels from '../../../i18n/en/settings'
|
|
||||||
import alertError from '../common/alert-error'
|
|
||||||
|
|
||||||
export function openImportDialog(onImportData) {
|
|
||||||
Alert.alert(labels.import.title, labels.import.message, [
|
|
||||||
{
|
|
||||||
text: sharedLabels.cancel,
|
|
||||||
style: 'cancel',
|
|
||||||
onPress: () => {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: labels.import.replaceOption,
|
|
||||||
onPress: () => onImportData(false),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: labels.import.deleteOption,
|
|
||||||
onPress: () => onImportData(true),
|
|
||||||
},
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getFileContent() {
|
|
||||||
let fileInfo
|
|
||||||
try {
|
|
||||||
fileInfo = await DocumentPicker.pickSingle({
|
|
||||||
type: [DocumentPicker.types.csv, 'text/comma-separated-values'],
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
if (DocumentPicker.isCancel(error)) {
|
|
||||||
// User cancelled the picker, exit any dialogs or menus and move on
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
importError(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let fileContent
|
|
||||||
try {
|
|
||||||
fileContent = await rnfs.readFile(fileInfo.uri, 'utf8')
|
|
||||||
} catch (err) {
|
|
||||||
return importError(labels.import.errors.couldNotOpenFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
return fileContent
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function importData(shouldDeleteExistingData, fileContent) {
|
|
||||||
try {
|
|
||||||
await importCsv(fileContent, shouldDeleteExistingData)
|
|
||||||
Alert.alert(sharedLabels.successTitle, labels.import.success.message)
|
|
||||||
} catch (err) {
|
|
||||||
importError(err.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function importError(msg) {
|
|
||||||
const postFixed = `${msg}\n\n${labels.import.errors.postFix}`
|
|
||||||
alertError(postFixed)
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import Reminders from './reminders/reminders'
|
import Reminders from './reminders/reminders'
|
||||||
import NfpSettings from './nfp-settings'
|
import NfpSettings from './nfp-settings'
|
||||||
import DataManagement from './data-management'
|
import DataManagement from './data-management/DataManagement'
|
||||||
import Password from './password'
|
import Password from './password'
|
||||||
import About from './About'
|
import About from './About'
|
||||||
import License from './License'
|
import License from './License'
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import { PixelRatio, StatusBar } from 'react-native'
|
import { PixelRatio, StatusBar } from 'react-native'
|
||||||
import { scale, verticalScale } from 'react-native-size-matters'
|
import { scale, verticalScale } from 'react-native-size-matters'
|
||||||
|
|
||||||
export const ACTION_DELETE = 'delete'
|
|
||||||
export const ACTION_EXPORT = 'export'
|
|
||||||
export const ACTION_IMPORT = 'import'
|
|
||||||
|
|
||||||
export const SYMPTOMS = [
|
export const SYMPTOMS = [
|
||||||
'bleeding',
|
'bleeding',
|
||||||
'temperature',
|
'temperature',
|
||||||
@@ -19,12 +15,13 @@ export const SYMPTOMS = [
|
|||||||
|
|
||||||
export const CHART_COLUMN_WIDTH = 32
|
export const CHART_COLUMN_WIDTH = 32
|
||||||
export const CHART_COLUMN_MIDDLE = CHART_COLUMN_WIDTH / 2
|
export const CHART_COLUMN_MIDDLE = CHART_COLUMN_WIDTH / 2
|
||||||
export const CHART_DOT_RADIUS = scale(6)
|
export const CHART_DOT_RADIUS_SYMPTOM = scale(6)
|
||||||
|
export const CHART_DOT_RADIUS_TEMPERATURE = scale(4)
|
||||||
export const CHART_GRID_LINE_HORIZONTAL_WIDTH =
|
export const CHART_GRID_LINE_HORIZONTAL_WIDTH =
|
||||||
PixelRatio.roundToNearestPixel(0.3)
|
PixelRatio.roundToNearestPixel(0.3)
|
||||||
export const CHART_ICON_SIZE = scale(20)
|
export const CHART_ICON_SIZE = scale(20)
|
||||||
export const CHART_STROKE_WIDTH = scale(3)
|
export const CHART_STROKE_WIDTH = scale(1.5)
|
||||||
export const CHART_SYMPTOM_HEIGHT_RATIO = scale(0.08)
|
export const CHART_SYMPTOM_HEIGHT_RATIO = scale(0.06)
|
||||||
export const CHART_XAXIS_HEIGHT_RATIO = scale(0.1)
|
export const CHART_XAXIS_HEIGHT_RATIO = scale(0.1)
|
||||||
export const CHART_YAXIS_WIDTH = scale(32)
|
export const CHART_YAXIS_WIDTH = scale(32)
|
||||||
export const CHART_TICK_WIDTH = scale(44)
|
export const CHART_TICK_WIDTH = scale(44)
|
||||||
@@ -40,7 +37,7 @@ export const HIT_SLOP = {
|
|||||||
top: verticalScale(20),
|
top: verticalScale(20),
|
||||||
bottom: verticalScale(20),
|
bottom: verticalScale(20),
|
||||||
left: scale(20),
|
left: scale(20),
|
||||||
right: scale(20)
|
right: scale(20),
|
||||||
}
|
}
|
||||||
|
|
||||||
export const STATUSBAR_HEIGHT = StatusBar.currentHeight
|
export const STATUSBAR_HEIGHT = StatusBar.currentHeight
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
{
|
{
|
||||||
|
"bottomMenu": {
|
||||||
|
"calendar": "Calendar",
|
||||||
|
"chart": "Chart",
|
||||||
|
"stats": "Stats"
|
||||||
|
},
|
||||||
|
"chart": {
|
||||||
|
"tutorial": "You can swipe the chart to view more dates."
|
||||||
|
},
|
||||||
"cycleDay": {
|
"cycleDay": {
|
||||||
"symptomBox": {
|
"symptomBox": {
|
||||||
"bleeding": "Bleeding",
|
"bleeding": "bleeding",
|
||||||
"temperature": "Temperature",
|
"temperature": "temperature",
|
||||||
"mucus": "Cervical Mucus",
|
"mucus": "cervical mucus",
|
||||||
"cervix": "Cervix",
|
"cervix": "cervix",
|
||||||
"note": "Note",
|
"note": "note",
|
||||||
"desire": "Desire",
|
"desire": "desire",
|
||||||
"sex": "Sex",
|
"sex": "sex",
|
||||||
"pain": "Pain",
|
"pain": "pain",
|
||||||
"mood": "Mood"
|
"mood": "mood"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
@@ -80,6 +88,29 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"data": {
|
||||||
|
"import": {
|
||||||
|
"button": "Import data",
|
||||||
|
"dialog": {
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"delete": "Import and delete existing",
|
||||||
|
"message": "There are two options for the import:\n\n1. Keep existing cycle days and replace only the ones in the import file.\n\n2. Delete all existing cycle days and import cycle days from file",
|
||||||
|
"replace": "Import and replace",
|
||||||
|
"title": "Keep existing data?"
|
||||||
|
},
|
||||||
|
"error": {
|
||||||
|
"couldNotOpenFile": "Could not open file",
|
||||||
|
"futureEdit": "Future dates may only contain a note, no other symptoms",
|
||||||
|
"incorrectColumns": "Expected CSV column titles to be {{incorrectColumns}}",
|
||||||
|
"noDataImported": "{{message}}\n\nNo data was imported or changed"
|
||||||
|
},
|
||||||
|
"segmentExplainer": "Import data in CSV format",
|
||||||
|
"success": {
|
||||||
|
"message": "Data successfully imported",
|
||||||
|
"title": "Success"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"menuItem": {
|
"menuItem": {
|
||||||
"dataManagement": {
|
"dataManagement": {
|
||||||
"name": "Data",
|
"name": "Data",
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ export const home = {
|
|||||||
phase: (n) => `${['1st', '2nd', '3rd'][n - 1]} cycle phase`,
|
phase: (n) => `${['1st', '2nd', '3rd'][n - 1]} cycle phase`,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const chart = {
|
|
||||||
tutorial: 'You can swipe the chart to view more dates.',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const shared = {
|
export const shared = {
|
||||||
cancel: 'Cancel',
|
cancel: 'Cancel',
|
||||||
save: 'Save',
|
save: 'Save',
|
||||||
|
|||||||
@@ -1,24 +1,6 @@
|
|||||||
import links from './links'
|
import links from './links'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
menuItems: {
|
|
||||||
reminders: {
|
|
||||||
name: 'Reminders',
|
|
||||||
text: 'turn on/off reminders',
|
|
||||||
},
|
|
||||||
nfpSettings: {
|
|
||||||
name: 'NFP settings',
|
|
||||||
text: 'define how you want to use NFP',
|
|
||||||
},
|
|
||||||
dataManagement: {
|
|
||||||
name: 'Data',
|
|
||||||
text: 'import, export or delete your data',
|
|
||||||
},
|
|
||||||
password: {
|
|
||||||
name: 'Password',
|
|
||||||
text: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
export: {
|
export: {
|
||||||
errors: {
|
errors: {
|
||||||
noData: 'There is no data to export',
|
noData: 'There is no data to export',
|
||||||
@@ -31,24 +13,6 @@ export default {
|
|||||||
segmentExplainer:
|
segmentExplainer:
|
||||||
'Export data in CSV format for backup or so you can use it elsewhere',
|
'Export data in CSV format for backup or so you can use it elsewhere',
|
||||||
},
|
},
|
||||||
import: {
|
|
||||||
button: 'Import data',
|
|
||||||
title: 'Keep existing data?',
|
|
||||||
message: `There are two options for the import:
|
|
||||||
1. Keep existing cycle days and replace only the ones in the import file.
|
|
||||||
2. Delete all existing cycle days and import cycle days from file.`,
|
|
||||||
replaceOption: 'Import and replace',
|
|
||||||
deleteOption: 'Import and delete existing',
|
|
||||||
errors: {
|
|
||||||
couldNotOpenFile: 'Could not open file',
|
|
||||||
postFix: 'No data was imported or changed',
|
|
||||||
futureEdit: 'Future dates may only contain a note, no other symptoms',
|
|
||||||
},
|
|
||||||
success: {
|
|
||||||
message: 'Data successfully imported',
|
|
||||||
},
|
|
||||||
segmentExplainer: 'Import data in CSV format',
|
|
||||||
},
|
|
||||||
deleteSegment: {
|
deleteSegment: {
|
||||||
title: 'Delete app data',
|
title: 'Delete app data',
|
||||||
explainer: 'Delete app data from this phone',
|
explainer: 'Delete app data from this phone',
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ i18n
|
|||||||
compatibilityJSON: 'v3', // TODO: migrate json to v4 and afterwards remove it
|
compatibilityJSON: 'v3', // TODO: migrate json to v4 and afterwards remove it
|
||||||
resources,
|
resources,
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
debug: true,
|
|
||||||
|
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false, // not needed for react as it escapes by default
|
escapeValue: false, // not needed for react as it escapes by default
|
||||||
|
|||||||
@@ -5,4 +5,8 @@ module.exports = {
|
|||||||
transformIgnorePatterns: [
|
transformIgnorePatterns: [
|
||||||
'node_modules/(?!((jest-)?react-native(-.*)?|@react-native(-community)?)/)',
|
'node_modules/(?!((jest-)?react-native(-.*)?|@react-native(-community)?)/)',
|
||||||
],
|
],
|
||||||
|
watchPlugins: [
|
||||||
|
'jest-watch-typeahead/filename',
|
||||||
|
'jest-watch-typeahead/testname',
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import { getCycleLengthStats } from './cycle-length'
|
|||||||
const LocalDate = joda.LocalDate
|
const LocalDate = joda.LocalDate
|
||||||
const DAYS = joda.ChronoUnit.DAYS
|
const DAYS = joda.ChronoUnit.DAYS
|
||||||
|
|
||||||
const toJSON = (realmObj) => JSON.parse(JSON.stringify(realmObj))
|
|
||||||
|
|
||||||
export default function config(opts) {
|
export default function config(opts) {
|
||||||
let bleedingDaysSortedByDate
|
let bleedingDaysSortedByDate
|
||||||
let cycleStartsSortedByDate
|
let cycleStartsSortedByDate
|
||||||
@@ -16,13 +14,10 @@ export default function config(opts) {
|
|||||||
if (!opts) {
|
if (!opts) {
|
||||||
// we only want to require (and run) the db module
|
// we only want to require (and run) the db module
|
||||||
// when not running the tests
|
// when not running the tests
|
||||||
bleedingDaysSortedByDate = toJSON(
|
bleedingDaysSortedByDate = require('../db').getBleedingDaysSortedByDate()
|
||||||
require('../db').getBleedingDaysSortedByDate()
|
cycleStartsSortedByDate = require('../db').getCycleStartsSortedByDate()
|
||||||
)
|
cycleDaysSortedByDate = require('../db').getCycleDaysSortedByDate()
|
||||||
cycleStartsSortedByDate = toJSON(
|
|
||||||
require('../db').getCycleStartsSortedByDate()
|
|
||||||
)
|
|
||||||
cycleDaysSortedByDate = toJSON(require('../db').getCycleDaysSortedByDate())
|
|
||||||
maxBreakInBleeding = 1
|
maxBreakInBleeding = 1
|
||||||
maxCycleLength = 99
|
maxCycleLength = 99
|
||||||
minCyclesForPrediction = 3
|
minCyclesForPrediction = 3
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
import getColumnNamesForCsv from './get-csv-column-names'
|
import getColumnNamesForCsv from './get-csv-column-names'
|
||||||
import replaceWithNullIfAllPropertiesAreNull from './replace-with-null'
|
import replaceWithNullIfAllPropertiesAreNull from './replace-with-null'
|
||||||
import { LocalDate } from '@js-joda/core'
|
import { LocalDate } from '@js-joda/core'
|
||||||
import labels from '../../i18n/en/settings'
|
import i18next from 'i18next'
|
||||||
|
|
||||||
export default async function importCsv(csv, deleteFirst) {
|
export default async function importCsv(csv, deleteFirst) {
|
||||||
const parseFuncs = {
|
const parseFuncs = {
|
||||||
@@ -46,7 +46,10 @@ export default async function importCsv(csv, deleteFirst) {
|
|||||||
|
|
||||||
const cycleDays = await csvParser(config)
|
const cycleDays = await csvParser(config)
|
||||||
.fromString(csv)
|
.fromString(csv)
|
||||||
.on('header', validateHeaders)
|
.on('header', (headers) => validateHeaders(headers))
|
||||||
|
.on('error', (error) => {
|
||||||
|
throw error
|
||||||
|
})
|
||||||
|
|
||||||
//remove symptoms where all fields are null
|
//remove symptoms where all fields are null
|
||||||
putNullForEmptySymptoms(cycleDays)
|
putNullForEmptySymptoms(cycleDays)
|
||||||
@@ -67,8 +70,11 @@ function validateHeaders(headers) {
|
|||||||
return expectedHeaders.indexOf(header) > -1
|
return expectedHeaders.indexOf(header) > -1
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
const msg = `Expected CSV column titles to be ${expectedHeaders.join()}`
|
throw new Error(
|
||||||
throw new Error(msg)
|
i18next.t('hamburgerMenu.settings.data.import.error.incorrectColumns', {
|
||||||
|
incorrectColumns: expectedHeaders.join(),
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +98,9 @@ function throwIfFutureData(cycleDays) {
|
|||||||
day.date > today &&
|
day.date > today &&
|
||||||
Object.keys(day).some((symptom) => symptom != 'date' && symptom != 'note')
|
Object.keys(day).some((symptom) => symptom != 'date' && symptom != 'note')
|
||||||
) {
|
) {
|
||||||
throw new Error(labels.import.errors.futureEdit)
|
throw new Error(
|
||||||
|
i18next.t('hamburgerMenu.settings.data.import.error.futureEdit')
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
export default function (feeling, texture) {
|
export default function getSensiplanMucus(feeling, texture) {
|
||||||
|
|
||||||
if (typeof feeling != 'number' || typeof texture != 'number') return null
|
if (typeof feeling != 'number' || typeof texture != 'number') return null
|
||||||
|
|
||||||
const feelingMapping = {
|
const feelingMapping = {
|
||||||
0: 0,
|
0: 0,
|
||||||
1: 1,
|
1: 1,
|
||||||
2: 2,
|
2: 2,
|
||||||
3: 4
|
3: 4,
|
||||||
}
|
}
|
||||||
const textureMapping = {
|
const textureMapping = {
|
||||||
0: 0,
|
0: 0,
|
||||||
1: 3,
|
1: 3,
|
||||||
2: 4
|
2: 4,
|
||||||
}
|
}
|
||||||
const nfpFeelingValue = feelingMapping[feeling]
|
const nfpFeelingValue = feelingMapping[feeling]
|
||||||
const nfpTextureValue = textureMapping[texture]
|
const nfpTextureValue = textureMapping[texture]
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
import { Platform } from 'react-native'
|
||||||
import {
|
import {
|
||||||
tempReminderObservable,
|
tempReminderObservable,
|
||||||
periodReminderObservable,
|
periodReminderObservable,
|
||||||
} from '../local-storage'
|
} from '../local-storage'
|
||||||
import Notification from 'react-native-push-notification'
|
import * as PN from 'react-native-push-notification'
|
||||||
|
import { requestNotifications } from 'react-native-permissions'
|
||||||
import Moment from 'moment'
|
import Moment from 'moment'
|
||||||
import { LocalDate } from '@js-joda/core'
|
import { LocalDate } from '@js-joda/core'
|
||||||
|
|
||||||
@@ -12,7 +14,16 @@ import cycleModule from './cycle'
|
|||||||
import nothingChanged from '../db/db-unchanged'
|
import nothingChanged from '../db/db-unchanged'
|
||||||
|
|
||||||
export default function setupNotifications(navigate, setDate) {
|
export default function setupNotifications(navigate, setDate) {
|
||||||
Notification.configure({
|
requestNotifications()
|
||||||
|
const PushNotification = Platform.OS === 'ios' ? PN : PN.default
|
||||||
|
|
||||||
|
PushNotification.createChannel({
|
||||||
|
channelId: 'drip-channel-id', // (required)
|
||||||
|
channelName: 'drip reminder', // (required)
|
||||||
|
playSound: false, // (optional) default: true
|
||||||
|
})
|
||||||
|
|
||||||
|
PushNotification.configure({
|
||||||
onNotification: (notification) => {
|
onNotification: (notification) => {
|
||||||
// https://github.com/zo0r/react-native-push-notification/issues/966#issuecomment-479069106
|
// https://github.com/zo0r/react-native-push-notification/issues/966#issuecomment-479069106
|
||||||
if (notification.data?.id === '1' || notification.id === '1') {
|
if (notification.data?.id === '1' || notification.id === '1') {
|
||||||
@@ -26,7 +37,7 @@ export default function setupNotifications(navigate, setDate) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
tempReminderObservable((reminder) => {
|
tempReminderObservable((reminder) => {
|
||||||
Notification.cancelLocalNotifications({ id: '1' })
|
PushNotification.cancelLocalNotification({ id: '1' })
|
||||||
if (reminder.enabled) {
|
if (reminder.enabled) {
|
||||||
const [hours, minutes] = reminder.time.split(':')
|
const [hours, minutes] = reminder.time.split(':')
|
||||||
let target = new Moment()
|
let target = new Moment()
|
||||||
@@ -38,31 +49,33 @@ export default function setupNotifications(navigate, setDate) {
|
|||||||
target = target.add(1, 'd')
|
target = target.add(1, 'd')
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification.localNotificationSchedule({
|
PushNotification.localNotificationSchedule({
|
||||||
id: '1',
|
id: '1',
|
||||||
userInfo: { id: '1' },
|
userInfo: { id: '1' },
|
||||||
message: labels.tempReminder.notification,
|
message: labels.tempReminder.notification,
|
||||||
date: target.toDate(),
|
date: target.toDate(),
|
||||||
vibrate: false,
|
vibrate: false,
|
||||||
repeatType: 'day',
|
repeatType: 'day',
|
||||||
|
channelId: 'drip-channel-id',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
periodReminderObservable((reminder) => {
|
periodReminderObservable((reminder) => {
|
||||||
Notification.cancelLocalNotifications({ id: '2' })
|
PushNotification.cancelLocalNotification({ id: '2' })
|
||||||
if (reminder.enabled) setupPeriodReminder()
|
if (reminder.enabled) setupPeriodReminder()
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
getBleedingDaysSortedByDate().addListener((_, changes) => {
|
getBleedingDaysSortedByDate().addListener((_, changes) => {
|
||||||
// the listener fires on setup, so we check if there were actually any changes
|
// the listener fires on setup, so we check if there were actually any changes
|
||||||
if (nothingChanged(changes)) return
|
if (nothingChanged(changes)) return
|
||||||
Notification.cancelLocalNotifications({ id: '2' })
|
PushNotification.cancelLocalNotification({ id: '2' })
|
||||||
if (periodReminderObservable.value.enabled) setupPeriodReminder()
|
if (periodReminderObservable.value.enabled) setupPeriodReminder()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupPeriodReminder() {
|
function setupPeriodReminder() {
|
||||||
|
const PushNotification = Platform.OS === 'ios' ? PN : PN.default
|
||||||
const bleedingPrediction = cycleModule().getPredictedMenses()
|
const bleedingPrediction = cycleModule().getPredictedMenses()
|
||||||
if (bleedingPrediction.length > 0) {
|
if (bleedingPrediction.length > 0) {
|
||||||
const predictedBleedingStart = Moment(
|
const predictedBleedingStart = Moment(
|
||||||
@@ -80,12 +93,13 @@ function setupPeriodReminder() {
|
|||||||
// period is likely to start in 3 to 3 + (length of prediction - 1) days
|
// period is likely to start in 3 to 3 + (length of prediction - 1) days
|
||||||
const daysToEndOfPrediction = bleedingPrediction[0].length + 2
|
const daysToEndOfPrediction = bleedingPrediction[0].length + 2
|
||||||
|
|
||||||
Notification.localNotificationSchedule({
|
PushNotification.localNotificationSchedule({
|
||||||
id: '2',
|
id: '2',
|
||||||
userInfo: { id: '2' },
|
userInfo: { id: '2' },
|
||||||
message: labels.periodReminder.notification(daysToEndOfPrediction),
|
message: labels.periodReminder.notification(daysToEndOfPrediction),
|
||||||
date: reminderDate.toDate(),
|
date: reminderDate.toDate(),
|
||||||
vibrate: false,
|
vibrate: false,
|
||||||
|
channelId: 'drip-channel-id',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 152 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "drip.",
|
"name": "drip.",
|
||||||
"version": "1.2208.11",
|
"version": "1.2311.14",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Julia Friesel <julia.friesel@gmail.com>",
|
"Julia Friesel <julia.friesel@gmail.com>",
|
||||||
"Marie Kochsiek",
|
"Marie Kochsiek",
|
||||||
@@ -18,11 +18,13 @@
|
|||||||
"test-watch": "jest --watch test",
|
"test-watch": "jest --watch test",
|
||||||
"lint": "eslint components lib test styles db",
|
"lint": "eslint components lib test styles db",
|
||||||
"devtool": "adb shell input keyevent 82",
|
"devtool": "adb shell input keyevent 82",
|
||||||
"build-android-release": "cd android && ./gradlew clean && ./gradlew assembleRelease && cd ..",
|
"build-android-apk-release": "cd android && ./gradlew clean && ./gradlew assembleRelease && cd ..",
|
||||||
|
"sign-android-apk-release": "zipalign -v -p 4 ./android/app/build/outputs/apk/release/app-release.apk ./android/app/build/outputs/apk/release/app-release_signed.apk",
|
||||||
|
"build-android-aab-release": "cd android && ./gradlew clean && ./gradlew :app:bundleRelease && cd ..",
|
||||||
|
"sign-android-aab-release": "jarsigner -keystore ./android/app/drip-release-key.keystore ./android/app/build/outputs/bundle/release/app-release.aab drip-release-key",
|
||||||
"update-version": "node ./tools/bin/update-version.js",
|
"update-version": "node ./tools/bin/update-version.js",
|
||||||
"commit-release": "node ./tools/bin/commit-release.js",
|
"commit-release": "node ./tools/bin/commit-release.js",
|
||||||
"tag-release": "node ./tools/bin/tag-release.js",
|
"tag-release": "node ./tools/bin/tag-release.js",
|
||||||
"update-changelog": "node ./tools/bin/update-changelog.js",
|
|
||||||
"release": "node ./tools/release-wizard.js",
|
"release": "node ./tools/release-wizard.js",
|
||||||
"clear": ". scripts/clear.sh",
|
"clear": ". scripts/clear.sh",
|
||||||
"postinstall": "npx jetify",
|
"postinstall": "npx jetify",
|
||||||
@@ -34,22 +36,23 @@
|
|||||||
"@react-native-async-storage/async-storage": "^1.17.9",
|
"@react-native-async-storage/async-storage": "^1.17.9",
|
||||||
"@react-native-community/art": "^1.2.0",
|
"@react-native-community/art": "^1.2.0",
|
||||||
"@react-native-community/datetimepicker": "^6.3.1",
|
"@react-native-community/datetimepicker": "^6.3.1",
|
||||||
"@react-native-community/push-notification-ios": "^1.8.0",
|
"@react-native-community/push-notification-ios": "^1.11.0",
|
||||||
"csvtojson": "^2.0.8",
|
"csvtojson": "^2.0.8",
|
||||||
"i18next": "^21.9.0",
|
"i18next": "^22.0.2",
|
||||||
"jshashes": "^1.0.8",
|
"jshashes": "^1.0.8",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"object-path": "^0.11.4",
|
"object-path": "^0.11.4",
|
||||||
"obv": "0.0.1",
|
"obv": "0.0.1",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"react": "17.0.2",
|
"react": "17.0.2",
|
||||||
"react-i18next": "^11.18.3",
|
"react-i18next": "^12.0.0",
|
||||||
"react-native": "0.67.4",
|
"react-native": "0.67.4",
|
||||||
"react-native-calendars": "^1.1287.0",
|
"react-native-calendars": "^1.1287.0",
|
||||||
"react-native-document-picker": "^8.1.1",
|
"react-native-document-picker": "^8.1.1",
|
||||||
"react-native-fs": "^2.20.0",
|
"react-native-fs": "^2.20.0",
|
||||||
"react-native-modal-datetime-picker": "14.0.0",
|
"react-native-modal-datetime-picker": "14.0.0",
|
||||||
"react-native-push-notification": "3.2.1",
|
"react-native-permissions": "^3.10.0",
|
||||||
|
"react-native-push-notification": "github:bl00dymarie/react-native-push-notification",
|
||||||
"react-native-share": "^7.9.0",
|
"react-native-share": "^7.9.0",
|
||||||
"react-native-simple-toast": "^1.1.3",
|
"react-native-simple-toast": "^1.1.3",
|
||||||
"react-native-size-matters": "^0.4.0",
|
"react-native-size-matters": "^0.4.0",
|
||||||
@@ -58,18 +61,18 @@
|
|||||||
"sympto": "3.0.1"
|
"sympto": "3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.12.9",
|
"@babel/core": "^7.20.2",
|
||||||
"@babel/eslint-parser": "^7.19.1",
|
"@babel/eslint-parser": "^7.19.1",
|
||||||
"@babel/preset-react": "^7.16.0",
|
"@babel/preset-react": "^7.18.6",
|
||||||
"@babel/runtime": "^7.12.5",
|
"@babel/runtime": "^7.12.5",
|
||||||
"@testing-library/jest-native": "^4.0.12",
|
"@testing-library/jest-native": "^4.0.12",
|
||||||
"@testing-library/react-native": "^11.1.0",
|
"@testing-library/react-native": "^11.1.0",
|
||||||
"basic-changelog": "gitlab:bloodyhealth/basic-changelog",
|
"eslint": "^7.32.0",
|
||||||
"eslint": "7.14.0",
|
"eslint-plugin-react": "^7.31.10",
|
||||||
"eslint-plugin-react": "^7.8.2",
|
|
||||||
"husky": "^8.0.0",
|
"husky": "^8.0.0",
|
||||||
"jest": "^28.1.3",
|
"jest": "^29.1.2",
|
||||||
"jetifier": "^1.6.6",
|
"jest-watch-typeahead": "^2.2.0",
|
||||||
|
"jetifier": "^2.0.0",
|
||||||
"metro-react-native-babel-preset": "^0.66.2",
|
"metro-react-native-babel-preset": "^0.66.2",
|
||||||
"prettier": "2.4.0",
|
"prettier": "2.4.0",
|
||||||
"pretty-quick": "^3.1.1",
|
"pretty-quick": "^3.1.1",
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
const redColor = '#c3000d'
|
const redColor = '#c3000d'
|
||||||
export const shadesOfRed = ['#e7999e', '#db666d', '#cf323d', '#c3000d'] // light to dark
|
export const shadesOfRed = ['#e7999e', '#db666d', '#cf323d', '#c3000d'] // light to dark
|
||||||
const violetColor = '#6a7b98'
|
const violetColor = '#6a7b98'
|
||||||
const shadesOfViolet = ['#e3e7ed', '#c8cfdc', '#acb8cb', '#91a0ba', '#7689a9', violetColor] // light to dark
|
const shadesOfViolet = [
|
||||||
|
'#e3e7ed',
|
||||||
|
'#c8cfdc',
|
||||||
|
'#acb8cb',
|
||||||
|
'#91a0ba',
|
||||||
|
'#7689a9',
|
||||||
|
violetColor,
|
||||||
|
] // light to dark
|
||||||
const yellowColor = '#dbb40c'
|
const yellowColor = '#dbb40c'
|
||||||
const shadesOfYellow = ['#f0e19d', '#e9d26d', '#e2c33c', yellowColor] // light to dark
|
const shadesOfYellow = ['#f0e19d', '#e9d26d', '#e2c33c', yellowColor] // light to dark
|
||||||
const magentaColor = '#6f2565'
|
const magentaColor = '#6f2565'
|
||||||
@@ -16,6 +23,7 @@ export default {
|
|||||||
greyDark: '#555',
|
greyDark: '#555',
|
||||||
grey: '#888',
|
grey: '#888',
|
||||||
greyLight: '#CCC',
|
greyLight: '#CCC',
|
||||||
|
greyVeryLight: '#F4F4F4',
|
||||||
orange: '#F38337',
|
orange: '#F38337',
|
||||||
purple: '#3A2671',
|
purple: '#3A2671',
|
||||||
purpleLight: '#938EB2',
|
purpleLight: '#938EB2',
|
||||||
@@ -23,35 +31,35 @@ export default {
|
|||||||
turquoise: '#CFECEA',
|
turquoise: '#CFECEA',
|
||||||
turquoiseLight: '#E9F2ED',
|
turquoiseLight: '#E9F2ED',
|
||||||
iconColors: {
|
iconColors: {
|
||||||
'bleeding': {
|
bleeding: {
|
||||||
color: redColor,
|
color: redColor,
|
||||||
shades: shadesOfRed,
|
shades: shadesOfRed,
|
||||||
},
|
},
|
||||||
'mucus': {
|
mucus: {
|
||||||
color: violetColor,
|
color: violetColor,
|
||||||
shades: shadesOfViolet,
|
shades: shadesOfViolet,
|
||||||
},
|
},
|
||||||
'cervix': {
|
cervix: {
|
||||||
color: yellowColor,
|
color: yellowColor,
|
||||||
shades: shadesOfYellow,
|
shades: shadesOfYellow,
|
||||||
},
|
},
|
||||||
'sex': {
|
sex: {
|
||||||
color: magentaColor,
|
color: magentaColor,
|
||||||
shades: shadesOfMagenta,
|
shades: shadesOfMagenta,
|
||||||
},
|
},
|
||||||
'desire': {
|
desire: {
|
||||||
color: pinkColor,
|
color: pinkColor,
|
||||||
shades: shadesOfPink,
|
shades: shadesOfPink,
|
||||||
},
|
},
|
||||||
'pain': {
|
pain: {
|
||||||
color: lightGreenColor,
|
color: lightGreenColor,
|
||||||
shades: [lightGreenColor],
|
shades: [lightGreenColor],
|
||||||
},
|
},
|
||||||
'mood': {
|
mood: {
|
||||||
color: orangeColor,
|
color: orangeColor,
|
||||||
shades: [orangeColor],
|
shades: [orangeColor],
|
||||||
},
|
},
|
||||||
'note': {
|
note: {
|
||||||
color: mintColor,
|
color: mintColor,
|
||||||
shades: [mintColor],
|
shades: [mintColor],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,27 +1,19 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render, screen, fireEvent } from '@testing-library/react-native'
|
|
||||||
import AcceptLicense from '../components/AcceptLicense'
|
import AcceptLicense from '../components/AcceptLicense'
|
||||||
|
|
||||||
import { saveLicenseFlag } from '../local-storage'
|
import { saveLicenseFlag } from '../local-storage'
|
||||||
|
import { render, screen, fireEvent } from './test-utils'
|
||||||
|
|
||||||
jest.mock('../local-storage', () => ({
|
jest.mock('../local-storage', () => ({
|
||||||
saveLicenseFlag: jest.fn(() => Promise.resolve()),
|
saveLicenseFlag: jest.fn(() => Promise.resolve()),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
jest.mock('react-i18next', () => ({
|
|
||||||
useTranslation: () => ({
|
|
||||||
t: (str, options) => {
|
|
||||||
return str + (options ? JSON.stringify(options) : '')
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}))
|
|
||||||
|
|
||||||
describe('AcceptLicense', () => {
|
describe('AcceptLicense', () => {
|
||||||
test('On clicking OK button, the license is accepted', async () => {
|
test('should accept license when clicking ok button', async () => {
|
||||||
const mockedSetLicense = jest.fn()
|
const mockedSetLicense = jest.fn()
|
||||||
render(<AcceptLicense setLicense={mockedSetLicense} />)
|
render(<AcceptLicense setLicense={mockedSetLicense} />)
|
||||||
|
|
||||||
const okButton = screen.getByText('ok', { exact: false })
|
const okButton = screen.getByText('OK')
|
||||||
|
|
||||||
fireEvent(okButton, 'click')
|
fireEvent(okButton, 'click')
|
||||||
|
|
||||||
@@ -29,9 +21,9 @@ describe('AcceptLicense', () => {
|
|||||||
expect(mockedSetLicense).toHaveBeenCalled()
|
expect(mockedSetLicense).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('There is a Cancel button', async () => {
|
test('should render cancel button', async () => {
|
||||||
render(<AcceptLicense setLicense={jest.fn()} />)
|
render(<AcceptLicense setLicense={jest.fn()} />)
|
||||||
|
|
||||||
screen.getByText('cancel', { exact: false })
|
screen.getByText('Cancel')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render, screen } from '@testing-library/react-native'
|
|
||||||
import License from '../components/settings/License'
|
import License from '../components/settings/License'
|
||||||
|
import { render, screen } from './test-utils'
|
||||||
jest.mock('react-i18next', () => ({
|
|
||||||
useTranslation: () => ({
|
|
||||||
t: (str, options) => {
|
|
||||||
return str + (options ? JSON.stringify(options) : '')
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}))
|
|
||||||
|
|
||||||
describe('License screen', () => {
|
describe('License screen', () => {
|
||||||
test('It should have a correct year', async () => {
|
test('should display license text with correct year', async () => {
|
||||||
render(<License />)
|
render(<License />)
|
||||||
const year = new Date().getFullYear().toString()
|
const year = new Date().getFullYear().toString()
|
||||||
|
|
||||||
screen.getByText(year, { exact: false })
|
screen.getByText(year, { exact: false })
|
||||||
})
|
})
|
||||||
|
|
||||||
test('It should match the snapshot', async () => {
|
test('should match the snapshot', async () => {
|
||||||
const licenseScreen = render(<License />)
|
const licenseScreen = render(<License />)
|
||||||
|
|
||||||
expect(licenseScreen).toMatchSnapshot()
|
expect(licenseScreen).toMatchSnapshot()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`License screen It should match the snapshot 1`] = `
|
exports[`License screen should match the snapshot 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Object {
|
{
|
||||||
"backgroundColor": "#E9F2ED",
|
"backgroundColor": "#E9F2ED",
|
||||||
"flex": 1,
|
"flex": 1,
|
||||||
}
|
}
|
||||||
@@ -11,8 +11,8 @@ exports[`License screen It should match the snapshot 1`] = `
|
|||||||
>
|
>
|
||||||
<RCTScrollView
|
<RCTScrollView
|
||||||
contentContainerStyle={
|
contentContainerStyle={
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"backgroundColor": "#E9F2ED",
|
"backgroundColor": "#E9F2ED",
|
||||||
"flexGrow": 1,
|
"flexGrow": 1,
|
||||||
},
|
},
|
||||||
@@ -23,13 +23,13 @@ exports[`License screen It should match the snapshot 1`] = `
|
|||||||
<View>
|
<View>
|
||||||
<Text
|
<Text
|
||||||
style={
|
style={
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"color": "#555",
|
"color": "#555",
|
||||||
"fontFamily": "Jost-Book",
|
"fontFamily": "Jost-Book",
|
||||||
"fontSize": 34.285714285714285,
|
"fontSize": 34.285714285714285,
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"alignSelf": "center",
|
"alignSelf": "center",
|
||||||
"color": "#3A2671",
|
"color": "#3A2671",
|
||||||
"fontFamily": "Jost-Bold",
|
"fontFamily": "Jost-Bold",
|
||||||
@@ -41,11 +41,11 @@ exports[`License screen It should match the snapshot 1`] = `
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
title
|
drip. an open-source cycle tracking app
|
||||||
</Text>
|
</Text>
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Object {
|
{
|
||||||
"marginBottom": 34.285714285714285,
|
"marginBottom": 34.285714285714285,
|
||||||
"marginHorizontal": 34.285714285714285,
|
"marginHorizontal": 34.285714285714285,
|
||||||
}
|
}
|
||||||
@@ -53,8 +53,8 @@ exports[`License screen It should match the snapshot 1`] = `
|
|||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
style={
|
style={
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"color": "#555",
|
"color": "#555",
|
||||||
"fontFamily": "Jost-Book",
|
"fontFamily": "Jost-Book",
|
||||||
"fontSize": 34.285714285714285,
|
"fontSize": 34.285714285714285,
|
||||||
@@ -63,12 +63,14 @@ exports[`License screen It should match the snapshot 1`] = `
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
text{"currentYear":2022}
|
Copyright (C) 2023 Heart of Code e.V.
|
||||||
|
|
||||||
|
This 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:
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
onPress={[Function]}
|
onPress={[Function]}
|
||||||
style={
|
style={
|
||||||
Object {
|
{
|
||||||
"color": "#3A2671",
|
"color": "#3A2671",
|
||||||
"fontFamily": "Jost-Book",
|
"fontFamily": "Jost-Book",
|
||||||
"fontSize": 34.285714285714285,
|
"fontSize": 34.285714285714285,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
exports[`Footnote component when children are present, renders them 1`] = `
|
exports[`Footnote component when children are present, renders them 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Object {
|
{
|
||||||
"alignContent": "flex-start",
|
"alignContent": "flex-start",
|
||||||
"flexDirection": "row",
|
"flexDirection": "row",
|
||||||
"marginBottom": 8.571428571428571,
|
"marginBottom": 8.571428571428571,
|
||||||
@@ -13,13 +13,13 @@ exports[`Footnote component when children are present, renders them 1`] = `
|
|||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
style={
|
style={
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"color": "#555",
|
"color": "#555",
|
||||||
"fontFamily": "Jost-Book",
|
"fontFamily": "Jost-Book",
|
||||||
"fontSize": 34.285714285714285,
|
"fontSize": 34.285714285714285,
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"color": "#F38337",
|
"color": "#F38337",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -29,18 +29,18 @@ exports[`Footnote component when children are present, renders them 1`] = `
|
|||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
linkStyle={
|
linkStyle={
|
||||||
Object {
|
{
|
||||||
"color": "white",
|
"color": "white",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
style={
|
style={
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"color": "#555",
|
"color": "#555",
|
||||||
"fontFamily": "Jost-Book",
|
"fontFamily": "Jost-Book",
|
||||||
"fontSize": 34.285714285714285,
|
"fontSize": 34.285714285714285,
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"color": "#555",
|
"color": "#555",
|
||||||
"paddingLeft": 21.428571428571427,
|
"paddingLeft": 21.428571428571427,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { render } from '@testing-library/react-native'
|
||||||
|
import '../i18n/i18n'
|
||||||
|
|
||||||
|
const customRender = (ui, options) => render(ui, { ...options })
|
||||||
|
|
||||||
|
// re-export everything
|
||||||
|
export * from '@testing-library/react-native'
|
||||||
|
|
||||||
|
// override render method
|
||||||
|
export { customRender as render }
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
const updateChangelog = require('../update-changelog');
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
await updateChangelog()
|
|
||||||
} catch(err) {
|
|
||||||
console.error(err)
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
const readline = require('readline')
|
const readline = require('readline')
|
||||||
const updateVersion = require('./update-version')
|
const updateVersion = require('./update-version')
|
||||||
const createTagForRelease = require('./tag-release')
|
const createTagForRelease = require('./tag-release')
|
||||||
const updateChangelog = require('./update-changelog')
|
|
||||||
const makeCommitRelease = require('./commit-release')
|
const makeCommitRelease = require('./commit-release')
|
||||||
|
|
||||||
process.on('unhandledRejection', err => { throw(err) })
|
process.on('unhandledRejection', err => { throw(err) })
|
||||||
@@ -16,24 +15,12 @@ async function leadThroughRelease() {
|
|||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout,
|
output: process.stdout,
|
||||||
})
|
})
|
||||||
const shouldUpdateChangelog = await new Promise(resolve => {
|
|
||||||
rl.question('Would you like to update the changelog (y/n)?', yn => {
|
|
||||||
yn === 'y' || yn === 'Y' ? resolve(true) : resolve(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
if (shouldUpdateChangelog) {
|
|
||||||
await updateChangelog()
|
|
||||||
await new Promise(resolve => {
|
|
||||||
rl.question("Awesome. We've added all commits for this release to the changelog file. Please review, edit and summarize where necessary so it's useful for the app's users. Then come back here and press enter.", () => resolve())
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await makeCommitRelease()
|
await makeCommitRelease()
|
||||||
|
|
||||||
console.log(`Groovy. We've created a commit for this release that includes the version and changelog updates, as well as a git tag for the release.
|
console.log(`Groovy. We've created a commit for this release that includes the version, as well as a git tag for the release.
|
||||||
Please review it, make any necessary changes, and if it's all good, push the commit and the tag up to master by running:
|
Please review it, make any necessary changes, and if it's all good, push the commit and the tag up to 'your-branch' by running:
|
||||||
git push origin master
|
git push origin 'your-branch'
|
||||||
git push origin ${require('../package.json').version}
|
git push origin ${require('../package.json').version}
|
||||||
|
|
||||||
Don't forget to also run 'npm run build-android-release' to package the apk and upload it to the app stores!
|
Don't forget to also run 'npm run build-android-release' to package the apk and upload it to the app stores!
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
const updateChangelog = require('basic-changelog')
|
|
||||||
|
|
||||||
const opts = {
|
|
||||||
filterCommitsStartingWith: ['release:']
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = () => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
updateChangelog('./CHANGELOG.md', opts, err => {
|
|
||||||
if (err) {
|
|
||||||
console.error('Something went wrong trying to update the changelog:')
|
|
||||||
reject(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
console.log('Changelog successfully updated')
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -10,14 +10,16 @@ const fs = require('fs')
|
|||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const currentVersion = JSON.parse(fs.readFileSync('./package.json')).version
|
const currentVersionName = JSON.parse(
|
||||||
|
fs.readFileSync('./package.json')
|
||||||
|
).version
|
||||||
|
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout,
|
output: process.stdout,
|
||||||
})
|
})
|
||||||
|
|
||||||
function createTodaysVersion(attempt) {
|
function createTodaysVersionName(attempt) {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
const yy = today.getFullYear() - 2000 // So it's two digits
|
const yy = today.getFullYear() - 2000 // So it's two digits
|
||||||
const monthString = (today.getMonth() + 1).toString()
|
const monthString = (today.getMonth() + 1).toString()
|
||||||
@@ -31,18 +33,20 @@ module.exports = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let nextVersion
|
let nextVersionName
|
||||||
for (let i = 0 /* letter a */; i <= 25 /* letter z */; i++) {
|
for (let i = 0 /* letter a */; i <= 25 /* letter z */; i++) {
|
||||||
nextVersion = createTodaysVersion(i)
|
nextVersionName = createTodaysVersionName(i)
|
||||||
if (nextVersion !== currentVersion) break
|
if (nextVersionName !== currentVersionName) break
|
||||||
}
|
}
|
||||||
if (nextVersion === currentVersion) {
|
if (nextVersionName === currentVersionName) {
|
||||||
console.error('I dont know what else to generate beyond ' + nextVersion)
|
console.error(
|
||||||
|
'I dont know what else to generate beyond ' + nextVersionName
|
||||||
|
)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
rl.question(
|
rl.question(
|
||||||
'Next version will be `' + nextVersion + '`, okay? y/n ',
|
'Next version name will be `' + nextVersionName + '`, okay? y/n ',
|
||||||
async (yn) => {
|
async (yn) => {
|
||||||
if (yn !== 'y' && yn !== 'Y') {
|
if (yn !== 'y' && yn !== 'Y') {
|
||||||
reject('Release cancelled.\n')
|
reject('Release cancelled.\n')
|
||||||
@@ -50,14 +54,8 @@ module.exports = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pkgJSON = JSON.parse(fs.readFileSync('./package.json'))
|
const pkgJSON = JSON.parse(fs.readFileSync('./package.json'))
|
||||||
const pkgLockJSON = JSON.parse(fs.readFileSync('./package-lock.json'))
|
pkgJSON.version = nextVersionName
|
||||||
pkgJSON.version = nextVersion
|
|
||||||
pkgLockJSON.version = nextVersion
|
|
||||||
fs.writeFileSync('./package.json', JSON.stringify(pkgJSON, null, 2))
|
fs.writeFileSync('./package.json', JSON.stringify(pkgJSON, null, 2))
|
||||||
fs.writeFileSync(
|
|
||||||
'./package-lock.json',
|
|
||||||
JSON.stringify(pkgLockJSON, null, 2)
|
|
||||||
)
|
|
||||||
|
|
||||||
await ReactNativeVersion.version(
|
await ReactNativeVersion.version(
|
||||||
{
|
{
|
||||||
|
|||||||