Merge branch 'feature/add-toast-on-ios' into 'master'
Feature: add toast on ios Closes #321 See merge request bloodyhealth/drip!370
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Dimensions, ScrollView, StyleSheet, View } from 'react-native'
|
import { Dimensions, ScrollView, StyleSheet, View } from 'react-native'
|
||||||
|
import { connect } from 'react-redux'
|
||||||
|
|
||||||
import AppModal from '../common/app-modal'
|
import AppModal from '../common/app-modal'
|
||||||
import AppSwitch from '../common/app-switch'
|
import AppSwitch from '../common/app-switch'
|
||||||
@@ -13,9 +14,9 @@ import SelectBoxGroup from './select-box-group'
|
|||||||
import SelectTabGroup from './select-tab-group'
|
import SelectTabGroup from './select-tab-group'
|
||||||
import Temperature from './temperature'
|
import Temperature from './temperature'
|
||||||
|
|
||||||
import { connect } from 'react-redux'
|
|
||||||
import { getDate } from '../../slices/date'
|
import { getDate } from '../../slices/date'
|
||||||
import { blank, save, shouldShow, symtomPage } from '../helpers/cycle-day'
|
import { blank, save, shouldShow, symtomPage } from '../helpers/cycle-day'
|
||||||
|
import { showToast } from '../helpers/general'
|
||||||
|
|
||||||
import { shared as sharedLabels } from '../../i18n/en/labels'
|
import { shared as sharedLabels } from '../../i18n/en/labels'
|
||||||
import info from '../../i18n/en/symptom-info'
|
import info from '../../i18n/en/symptom-info'
|
||||||
@@ -84,11 +85,13 @@ class SymptomEditView extends Component {
|
|||||||
|
|
||||||
onRemove = () => {
|
onRemove = () => {
|
||||||
this.saveData(true)
|
this.saveData(true)
|
||||||
|
showToast(sharedLabels.dataDeleted)
|
||||||
this.props.onClose()
|
this.props.onClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
onSave = () => {
|
onSave = () => {
|
||||||
this.saveData()
|
this.saveData()
|
||||||
|
showToast(sharedLabels.dataSaved)
|
||||||
this.props.onClose()
|
this.props.onClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,8 +138,15 @@ class SymptomEditView extends Component {
|
|||||||
save[symptom](data, date, shouldDeleteData)
|
save[symptom](data, date, shouldDeleteData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeView = () => {
|
||||||
|
const { onClose } = this.props
|
||||||
|
|
||||||
|
showToast(sharedLabels.dataSaved)
|
||||||
|
onClose()
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { onClose, symptom } = this.props
|
const { symptom } = this.props
|
||||||
const { data,
|
const { data,
|
||||||
shouldShowExclude,
|
shouldShowExclude,
|
||||||
shouldShowInfo,
|
shouldShowInfo,
|
||||||
@@ -148,13 +158,13 @@ class SymptomEditView extends Component {
|
|||||||
const noteText = symptom === 'note' ? data.value : data.note
|
const noteText = symptom === 'note' ? data.value : data.note
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppModal onClose={onClose}>
|
<AppModal onClose={this.closeView}>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
contentContainerStyle={styles.modalContainer}
|
contentContainerStyle={styles.modalContainer}
|
||||||
style={styles.modalWindow}
|
style={styles.modalWindow}
|
||||||
>
|
>
|
||||||
<View style={styles.headerContainer}>
|
<View style={styles.headerContainer}>
|
||||||
<CloseIcon onClose={onClose} />
|
<CloseIcon onClose={this.closeView} />
|
||||||
</View>
|
</View>
|
||||||
{symptom === 'temperature' &&
|
{symptom === 'temperature' &&
|
||||||
<Temperature
|
<Temperature
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import Toast from 'react-native-simple-toast'
|
||||||
|
|
||||||
|
export const showToast = (text) => Toast.show(
|
||||||
|
text, Toast.SHORT, ['RCTModalHostViewController', 'UIAlertController']
|
||||||
|
)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import RNFS from 'react-native-fs'
|
import RNFS from 'react-native-fs'
|
||||||
import { Alert, ToastAndroid } from 'react-native'
|
import { Alert } from 'react-native'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import Button from '../../common/button'
|
import Button from '../../common/button'
|
||||||
@@ -9,6 +9,7 @@ import ConfirmWithPassword from '../common/confirm-with-password'
|
|||||||
import alertError from '../common/alert-error'
|
import alertError from '../common/alert-error'
|
||||||
|
|
||||||
import { clearDb, isDbEmpty } from '../../../db'
|
import { clearDb, isDbEmpty } from '../../../db'
|
||||||
|
import { showToast } from '../../helpers/general'
|
||||||
import { hasEncryptionObservable } from '../../../local-storage'
|
import { hasEncryptionObservable } from '../../../local-storage'
|
||||||
import settings from '../../../i18n/en/settings'
|
import settings from '../../../i18n/en/settings'
|
||||||
import { shared as sharedLabels } from '../../../i18n/en/labels'
|
import { shared as sharedLabels } from '../../../i18n/en/labels'
|
||||||
@@ -69,7 +70,7 @@ export default class DeleteData extends Component {
|
|||||||
clearDb()
|
clearDb()
|
||||||
}
|
}
|
||||||
await this.deleteExportedFile()
|
await this.deleteExportedFile()
|
||||||
ToastAndroid.show(success.message, ToastAndroid.LONG)
|
showToast(success.message)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alertError(errors.couldNotDeleteFile)
|
alertError(errors.couldNotDeleteFile)
|
||||||
}
|
}
|
||||||
@@ -104,4 +105,4 @@ export default class DeleteData extends Component {
|
|||||||
DeleteData.propTypes = {
|
DeleteData.propTypes = {
|
||||||
isDeletingData: PropTypes.bool,
|
isDeletingData: PropTypes.bool,
|
||||||
onStartDeletion: PropTypes.func.isRequired
|
onStartDeletion: PropTypes.func.isRequired
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ export const chart = {
|
|||||||
export const shared = {
|
export const shared = {
|
||||||
cancel: 'Cancel',
|
cancel: 'Cancel',
|
||||||
save: 'Save',
|
save: 'Save',
|
||||||
|
dataSaved: 'Symptom data was saved',
|
||||||
|
dataDeleted: 'Symptom data was deleted',
|
||||||
errorTitle: 'Error',
|
errorTitle: 'Error',
|
||||||
successTitle: 'Success',
|
successTitle: 'Success',
|
||||||
warning: 'Warning',
|
warning: 'Warning',
|
||||||
|
|||||||
@@ -566,11 +566,13 @@
|
|||||||
"${BUILT_PRODUCTS_DIR}/React-jsinspector/jsinspector.framework",
|
"${BUILT_PRODUCTS_DIR}/React-jsinspector/jsinspector.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
|
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/RealmJS/RealmJS.framework",
|
"${BUILT_PRODUCTS_DIR}/RealmJS/RealmJS.framework",
|
||||||
|
"${BUILT_PRODUCTS_DIR}/Toast/Toast.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
|
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
|
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
|
||||||
"${PODS_ROOT}/../../node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework",
|
"${PODS_ROOT}/../../node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/react-native-document-picker/react_native_document_picker.framework",
|
"${BUILT_PRODUCTS_DIR}/react-native-document-picker/react_native_document_picker.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/react-native-restart/react_native_restart.framework",
|
"${BUILT_PRODUCTS_DIR}/react-native-restart/react_native_restart.framework",
|
||||||
|
"${BUILT_PRODUCTS_DIR}/react-native-simple-toast/react_native_simple_toast.framework",
|
||||||
);
|
);
|
||||||
name = "[CP] Embed Pods Frameworks";
|
name = "[CP] Embed Pods Frameworks";
|
||||||
outputPaths = (
|
outputPaths = (
|
||||||
@@ -602,11 +604,13 @@
|
|||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmJS.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmJS.framework",
|
||||||
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Toast.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NodeMobile.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NodeMobile.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_document_picker.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_document_picker.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_restart.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_restart.framework",
|
||||||
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_simple_toast.framework",
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
|
|||||||
Generated
+11
@@ -33,6 +33,7 @@
|
|||||||
"react-native-push-notification": "3.2.1",
|
"react-native-push-notification": "3.2.1",
|
||||||
"react-native-restart": "0.0.17",
|
"react-native-restart": "0.0.17",
|
||||||
"react-native-share": "^3.0.0",
|
"react-native-share": "^3.0.0",
|
||||||
|
"react-native-simple-toast": "^1.1.3",
|
||||||
"react-native-vector-icons": "^7.1.0",
|
"react-native-vector-icons": "^7.1.0",
|
||||||
"react-redux": "^6.0.0",
|
"react-redux": "^6.0.0",
|
||||||
"realm": "^3.6.5",
|
"realm": "^3.6.5",
|
||||||
@@ -14536,6 +14537,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-3.0.0.tgz",
|
||||||
"integrity": "sha512-5P/Fhou5jW1yY475h+wIR+VZAUZ1Gnx8N4QKGToOLNo1yUhDeLxYRhm3bGCcS/MEy35NOZ222/43SQGfUzCl/g=="
|
"integrity": "sha512-5P/Fhou5jW1yY475h+wIR+VZAUZ1Gnx8N4QKGToOLNo1yUhDeLxYRhm3bGCcS/MEy35NOZ222/43SQGfUzCl/g=="
|
||||||
},
|
},
|
||||||
|
"node_modules/react-native-simple-toast": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-native-simple-toast/-/react-native-simple-toast-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-bkZy25axqlU4L6IoTysSl5KOQA7qdxzivbXz/L/yAw9g9fENxjzYvUUtv5wWtgq7mzOe5HiJ7GCQrOl3MhIevQ=="
|
||||||
|
},
|
||||||
"node_modules/react-native-swipe-gestures": {
|
"node_modules/react-native-swipe-gestures": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz",
|
||||||
@@ -29994,6 +30000,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-3.0.0.tgz",
|
||||||
"integrity": "sha512-5P/Fhou5jW1yY475h+wIR+VZAUZ1Gnx8N4QKGToOLNo1yUhDeLxYRhm3bGCcS/MEy35NOZ222/43SQGfUzCl/g=="
|
"integrity": "sha512-5P/Fhou5jW1yY475h+wIR+VZAUZ1Gnx8N4QKGToOLNo1yUhDeLxYRhm3bGCcS/MEy35NOZ222/43SQGfUzCl/g=="
|
||||||
},
|
},
|
||||||
|
"react-native-simple-toast": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-native-simple-toast/-/react-native-simple-toast-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-bkZy25axqlU4L6IoTysSl5KOQA7qdxzivbXz/L/yAw9g9fENxjzYvUUtv5wWtgq7mzOe5HiJ7GCQrOl3MhIevQ=="
|
||||||
|
},
|
||||||
"react-native-swipe-gestures": {
|
"react-native-swipe-gestures": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz",
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"react-native-push-notification": "3.2.1",
|
"react-native-push-notification": "3.2.1",
|
||||||
"react-native-restart": "0.0.17",
|
"react-native-restart": "0.0.17",
|
||||||
"react-native-share": "^3.0.0",
|
"react-native-share": "^3.0.0",
|
||||||
|
"react-native-simple-toast": "^1.1.3",
|
||||||
"react-native-vector-icons": "^7.1.0",
|
"react-native-vector-icons": "^7.1.0",
|
||||||
"react-redux": "^6.0.0",
|
"react-redux": "^6.0.0",
|
||||||
"realm": "^3.6.5",
|
"realm": "^3.6.5",
|
||||||
|
|||||||
Reference in New Issue
Block a user