diff --git a/components/cycle-day/symptoms/action-button-footer.js b/components/cycle-day/symptoms/action-button-footer.js index 9da25e2..5f666e9 100644 --- a/components/cycle-day/symptoms/action-button-footer.js +++ b/components/cycle-day/symptoms/action-button-footer.js @@ -45,8 +45,7 @@ export default class ActionButtonFooter extends Component { title: labels.save, action: () => { if(saveDisabled) { - ToastAndroid.show(labels.disabledInfo, ToastAndroid.LONG); - console.log() + ToastAndroid.show(labels.disabledInfo, ToastAndroid.LONG) } else { saveAction() if (autoShowDayView) navigateToOverView() @@ -62,7 +61,7 @@ export default class ActionButtonFooter extends Component { {buttons.map(({ title, action, disabledCondition, icon }, i) => { const textStyle = [styles.menuText] if (disabledCondition) { - textStyle.push(styles.menuTextInActive); + textStyle.push(styles.menuTextInActive) } const iconStyle = disabledCondition ? Object.assign( diff --git a/components/helpers/replace-url-with-text.js b/components/helpers/replace-url-with-text.js new file mode 100644 index 0000000..a490333 --- /dev/null +++ b/components/helpers/replace-url-with-text.js @@ -0,0 +1,6 @@ +import {links} from '../../i18n/en/settings' + +export default function(url) { + const link = Object.values(links).find(link => link.url === url) + return link ? link.text : url +} \ No newline at end of file diff --git a/components/link.js b/components/link.js deleted file mode 100644 index f5d2c10..0000000 --- a/components/link.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react' -import { Linking } from 'react-native' -import AppText from "./app-text" -import styles from '../styles'; - -export default function Link(props) { - return ( - Linking.openURL(props.href)} - >{props.text} - ) -} \ No newline at end of file diff --git a/components/settings/about.js b/components/settings/about.js index 49f5843..6ee5451 100644 --- a/components/settings/about.js +++ b/components/settings/about.js @@ -1,20 +1,35 @@ import React, { Component } from 'react' import { ScrollView } from 'react-native' +import Hyperlink from 'react-native-hyperlink' import AppText from '../app-text' import SettingsSegment from './settings-segment' import styles from '../../styles/index' -import labels from '../../i18n/en/settings' +import labels, { links } from '../../i18n/en/settings' +import replace from '../helpers/replace-url-with-text' export default class AboutSection extends Component { render() { return ( - - {`${labels.aboutSection.segmentExplainer} `} + + + {`${labels.aboutSection.text} `} + - + + {labels.philosophy.text} + + {`${labels.credits.note}`} + + + {links.website.url} + + + + {require('../../package.json').version} + ) } diff --git a/components/settings/data-management/index.js b/components/settings/data-management/index.js index 4199760..93887b8 100644 --- a/components/settings/data-management/index.js +++ b/components/settings/data-management/index.js @@ -7,7 +7,6 @@ import openImportDialogAndImport from './import-dialog' import openShareDialogAndExport from './export-dialog' import DeleteData from './delete-data' import labels from '../../../i18n/en/settings' -import styles from '../../../styles/index' const DataManagement = () => { return ( @@ -26,7 +25,7 @@ const DataManagement = () => { {labels.deleteSegment.explainer} diff --git a/components/settings/index.js b/components/settings/index.js index 7bbbdc5..4a8fc25 100644 --- a/components/settings/index.js +++ b/components/settings/index.js @@ -3,7 +3,8 @@ import NfpSettings from './nfp-settings' import DataManagement from './data-management' import Password from './password' import About from './about' +import License from './license' export default { - Reminders, NfpSettings, DataManagement, Password, About + Reminders, NfpSettings, DataManagement, Password, About, License } diff --git a/components/settings/license.js b/components/settings/license.js new file mode 100644 index 0000000..342193d --- /dev/null +++ b/components/settings/license.js @@ -0,0 +1,22 @@ +import React, { Component } from 'react' +import { View, ScrollView } from 'react-native' +import Hyperlink from 'react-native-hyperlink' +import AppText from '../app-text' +import styles from '../../styles/index' +import labels from '../../i18n/en/settings' +import replace from '../helpers/replace-url-with-text' + +export default class License extends Component { + render() { + return ( + + + + {`${labels.license.title} `} + {`${labels.license.text} `} + + + + ) + } +} diff --git a/components/settings/nfp-settings/index.js b/components/settings/nfp-settings/index.js index e975dc7..c4810bc 100644 --- a/components/settings/nfp-settings/index.js +++ b/components/settings/nfp-settings/index.js @@ -2,13 +2,14 @@ import React, { Component } from 'react' import { ScrollView, View } from 'react-native' +import Hyperlink from 'react-native-hyperlink' import styles, { iconStyles } from '../../../styles' import labels from '../../../i18n/en/settings' import AppText from '../../app-text' import TempSlider from './temp-slider' import UseCervixSetting from './use-cervix' import Icon from 'react-native-vector-icons/Entypo' -import Link from '../../link' +import replaceUrlWithText from '../../helpers/replace-url-with-text' export default class Settings extends Component { constructor(props) { @@ -32,11 +33,9 @@ export default class Settings extends Component { {`${labels.preOvu.title} `} - - {labels.preOvu.note1} - - {labels.preOvu.note2} - + + {labels.preOvu.note} + ) diff --git a/components/settings/settings-menu.js b/components/settings/settings-menu.js index 3d927e0..a26a289 100644 --- a/components/settings/settings-menu.js +++ b/components/settings/settings-menu.js @@ -14,7 +14,8 @@ const menu = [ {title: labels.nfpSettings, component: 'NfpSettings'}, {title: labels.dataManagement, component: 'DataManagement'}, {title: labels.password, component: 'Password'}, - {title: labels.about, component: 'About'} + {title: labels.about, component: 'About'}, + {title: labels.license, component: 'License'} ] export default function SettingsMenu(props) { diff --git a/components/settings/settings-segment.js b/components/settings/settings-segment.js index 0a87719..f29f7c5 100644 --- a/components/settings/settings-segment.js +++ b/components/settings/settings-segment.js @@ -6,8 +6,10 @@ import AppText from '../app-text' import styles from '../../styles' const SettingsSegment = ({ children, ...props }) => { + const style = [styles.settingsSegment, props.style] + if (props.last) style.push(styles.settingsSegmentLast) return ( - + {props.title} {children} diff --git a/i18n/en/labels.js b/i18n/en/labels.js index 17e3526..1917917 100644 --- a/i18n/en/labels.js +++ b/i18n/en/labels.js @@ -30,6 +30,7 @@ export const headerTitles = { DataManagement: settingsTitles.dataManagement, Password: settingsTitles.password, About: settingsTitles.about, + License: settingsTitles.license, BleedingEditView: 'Bleeding', TemperatureEditView: 'Temperature', MucusEditView: 'Mucus', diff --git a/i18n/en/settings.js b/i18n/en/settings.js index d3565d3..52bc075 100644 --- a/i18n/en/settings.js +++ b/i18n/en/settings.js @@ -1,11 +1,30 @@ +export const links = { + gitlab: { + url: 'https://gitlab.com/bloodyhealth/drip', + text: 'GitLab' + }, + email: { + url: 'mailto:bl00dyhealth@mailbox.org', + text: 'email' + }, + wiki: { + url: 'https://gitlab.com/bloodyhealth/drip/wikis/home', + text: 'wiki' + }, + website: { + url: 'https://bloodyhealth.gitlab.io/' + } +} + export default { menuTitles: { reminders: 'Reminders', dataManagement: 'Manage your data', nfpSettings: 'NFP settings', password: 'Password', - about: 'About' + about: 'About', + license: 'License' }, export: { errors: { @@ -93,16 +112,35 @@ export default { }, aboutSection: { title: 'About', - segmentExplainer: 'Please note that your data is stored locally on your phone and not on a server. We want to ensure that you stay in control of those sensitive information. If you are planning to switch or reset your phone, please remember to export your data before doing so. You can reinstall the app afterwards and import your data.\n\nIf you encounter any technical issues, don\'t hesitate to contact us via email (bl00dyhealth@mailbox.org). You can also contribute to the code base on GitLab (https://gitlab.com/bloodyhealth/drip/).', + text: `Please note that your data is stored locally on your phone and not on a server. This means your data cannot be read by anyone else unless they have access to your phone. We want to ensure that you stay in control of your own data. If you are planning to switch or reset your phone, please remember to export your data before doing so. You can reinstall the app afterwards and import your data.\n\nIf you encounter any technical issues, don't hesitate to contact via ${links.email.url}. You can also contribute to the code base on ${links.gitlab.url}`, + }, + philosophy: { + title: 'Remember to think for yourself', + text: `Drip makes period predictions for you and helps you apply NFP fertility awareness rules. But please remember that this app is made by humans, and humans make mistakes. Always think for yourself: "Does this make sense?" Remember, you don't need an app to understand your cycle! However, drip wants to support you and make period tracking easier, more transparent and secure.`, + }, + license: { + title: 'drip is an open-source cycle tracking app', + text: `Copyright (C) 2019 Bloody Health GbR + +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: https://www.gnu.org/licenses/gpl-3.0.html + +You can contact us by email at bloodyhealth@mailbox.com.` + }, + version: { + title: 'Version' + }, + website: { + title: 'Website' }, preOvu: { title: 'Infertile days at cycle start', - note1: "drip applies NFP's rules for calculating infertile days at the start of the cycle (see the ", - link: 'wiki', - note2: " for more info). However, drip does not currently apply the so called 20-day-rule, which determines infertile days at the cycle start from past cycle lengths in case no past symptothermal info is available." + note: `drip applies NFP's rules for calculating infertile days at the start of the cycle (see the ${links.wiki.url} for more info). However, drip does not currently apply the so called 20-day-rule, which determines infertile days at the cycle start from past cycle lengths in case no past symptothermal info is available.` }, credits: { title: 'Credits', note: 'Thanks and lots of <3 to all of our contributors, as well as, and especially, Susanne Umscheid for the wonderful visual and logo design, and Paula Härtel for the symptom icons' } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 9ae02fc..266c37a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -806,7 +806,7 @@ }, "ansi-colors": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "requires": { "ansi-wrap": "^0.1.0" @@ -3323,7 +3323,7 @@ }, "event-target-shim": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/event-target-shim/-/event-target-shim-1.1.1.tgz", "integrity": "sha1-qG5e5r2qFgVEddp5fM3fDFVphJE=" }, "eventemitter3": { @@ -3363,7 +3363,7 @@ }, "expand-range": { "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "resolved": "http://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "requires": { "fill-range": "^2.1.0" @@ -3652,7 +3652,7 @@ }, "fs-extra": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", "requires": { "graceful-fs": "^4.1.2", @@ -4409,7 +4409,7 @@ }, "http-errors": { "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "requires": { "depd": "~1.1.2", @@ -4950,7 +4950,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "requires": { "graceful-fs": "^4.1.6" @@ -4990,7 +4990,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=" }, "klaw": { @@ -5024,6 +5024,14 @@ "type-check": "~0.3.2" } }, + "linkify-it": { + "version": "1.2.4", + "resolved": "http://registry.npmjs.org/linkify-it/-/linkify-it-1.2.4.tgz", + "integrity": "sha1-B3NSbDF8j9E71TTuHRgP+Iq/iBo=", + "requires": { + "uc.micro": "^1.0.1" + } + }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -5137,6 +5145,11 @@ "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=" }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" + }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", @@ -5285,12 +5298,12 @@ }, "mime-db": { "version": "1.23.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz", + "resolved": "http://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz", "integrity": "sha1-oxtAcK2uon1zLqMzdApk0OyaZlk=" }, "mime-types": { "version": "2.1.11", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz", + "resolved": "http://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz", "integrity": "sha1-wlnEcb2oCKhdbNGTtDCl+uRHOzw=", "requires": { "mime-db": "~1.23.0" @@ -6037,7 +6050,7 @@ }, "opn": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/opn/-/opn-3.0.3.tgz", + "resolved": "http://registry.npmjs.org/opn/-/opn-3.0.3.tgz", "integrity": "sha1-ttmec5n3jWXDuq/+8fsojpuFJDo=", "requires": { "object-assign": "^4.0.1" @@ -6309,7 +6322,7 @@ }, "pretty-format": { "version": "4.3.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-4.3.1.tgz", + "resolved": "http://registry.npmjs.org/pretty-format/-/pretty-format-4.3.1.tgz", "integrity": "sha1-UwvlxCs8BbNkFKeipDN6qArNDo0=" }, "private": { @@ -6566,6 +6579,15 @@ "utf8": "^2.1.1" } }, + "react-native-hyperlink": { + "version": "0.0.14", + "resolved": "https://registry.npmjs.org/react-native-hyperlink/-/react-native-hyperlink-0.0.14.tgz", + "integrity": "sha1-E4u/5bQQZn0eN/BKK0cTFjqw7YE=", + "requires": { + "linkify-it": "^1.2.0", + "mdurl": "^1.0.0" + } + }, "react-native-modal": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/react-native-modal/-/react-native-modal-3.1.0.tgz", @@ -7122,7 +7144,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "requires": { "ret": "~0.1.10" @@ -7475,7 +7497,7 @@ }, "serialize-error": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz", "integrity": "sha1-ULZ51WNc34Rme9yOWa9OW4HV9go=" }, "serve-static": { @@ -8288,6 +8310,11 @@ "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.18.tgz", "integrity": "sha512-LtzwHlVHwFGTptfNSgezHp7WUlwiqb0gA9AALRbKaERfxwJoiX0A73QbTToxteIAuIaFshhgIZfqK8s7clqgnA==" }, + "uc.micro": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.5.tgz", + "integrity": "sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg==" + }, "uglify-es": { "version": "3.3.9", "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", @@ -8657,7 +8684,7 @@ }, "xmlbuilder": { "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" }, "xmldoc": { diff --git a/package.json b/package.json index f50ced9..1fc1f70 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "react-native-calendars": "^1.19.3", "react-native-document-picker": "^2.1.0", "react-native-fs": "^2.10.14", + "react-native-hyperlink": "0.0.14", "react-native-modal-datetime-picker-nevo": "^4.11.0", "react-native-push-notification": "^3.1.1", "react-native-restart": "0.0.7",