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:
bl00dymarie
2021-09-19 10:07:58 +00:00
7 changed files with 41 additions and 7 deletions
+14 -4
View File
@@ -1,6 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Dimensions, ScrollView, StyleSheet, View } from 'react-native'
import { connect } from 'react-redux'
import AppModal from '../common/app-modal'
import AppSwitch from '../common/app-switch'
@@ -13,9 +14,9 @@ import SelectBoxGroup from './select-box-group'
import SelectTabGroup from './select-tab-group'
import Temperature from './temperature'
import { connect } from 'react-redux'
import { getDate } from '../../slices/date'
import { blank, save, shouldShow, symtomPage } from '../helpers/cycle-day'
import { showToast } from '../helpers/general'
import { shared as sharedLabels } from '../../i18n/en/labels'
import info from '../../i18n/en/symptom-info'
@@ -84,11 +85,13 @@ class SymptomEditView extends Component {
onRemove = () => {
this.saveData(true)
showToast(sharedLabels.dataDeleted)
this.props.onClose()
}
onSave = () => {
this.saveData()
showToast(sharedLabels.dataSaved)
this.props.onClose()
}
@@ -135,8 +138,15 @@ class SymptomEditView extends Component {
save[symptom](data, date, shouldDeleteData)
}
closeView = () => {
const { onClose } = this.props
showToast(sharedLabels.dataSaved)
onClose()
}
render() {
const { onClose, symptom } = this.props
const { symptom } = this.props
const { data,
shouldShowExclude,
shouldShowInfo,
@@ -148,13 +158,13 @@ class SymptomEditView extends Component {
const noteText = symptom === 'note' ? data.value : data.note
return (
<AppModal onClose={onClose}>
<AppModal onClose={this.closeView}>
<ScrollView
contentContainerStyle={styles.modalContainer}
style={styles.modalWindow}
>
<View style={styles.headerContainer}>
<CloseIcon onClose={onClose} />
<CloseIcon onClose={this.closeView} />
</View>
{symptom === 'temperature' &&
<Temperature
+5
View File
@@ -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 RNFS from 'react-native-fs'
import { Alert, ToastAndroid } from 'react-native'
import { Alert } from 'react-native'
import PropTypes from 'prop-types'
import Button from '../../common/button'
@@ -9,6 +9,7 @@ import ConfirmWithPassword from '../common/confirm-with-password'
import alertError from '../common/alert-error'
import { clearDb, isDbEmpty } from '../../../db'
import { showToast } from '../../helpers/general'
import { hasEncryptionObservable } from '../../../local-storage'
import settings from '../../../i18n/en/settings'
import { shared as sharedLabels } from '../../../i18n/en/labels'
@@ -69,7 +70,7 @@ export default class DeleteData extends Component {
clearDb()
}
await this.deleteExportedFile()
ToastAndroid.show(success.message, ToastAndroid.LONG)
showToast(success.message)
} catch (err) {
alertError(errors.couldNotDeleteFile)
}
+2
View File
@@ -13,6 +13,8 @@ export const chart = {
export const shared = {
cancel: 'Cancel',
save: 'Save',
dataSaved: 'Symptom data was saved',
dataDeleted: 'Symptom data was deleted',
errorTitle: 'Error',
successTitle: 'Success',
warning: 'Warning',
+4
View File
@@ -566,11 +566,13 @@
"${BUILT_PRODUCTS_DIR}/React-jsinspector/jsinspector.framework",
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
"${BUILT_PRODUCTS_DIR}/RealmJS/RealmJS.framework",
"${BUILT_PRODUCTS_DIR}/Toast/Toast.framework",
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/glog/glog.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-restart/react_native_restart.framework",
"${BUILT_PRODUCTS_DIR}/react-native-simple-toast/react_native_simple_toast.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@@ -602,11 +604,13 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.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}/glog.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_restart.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_simple_toast.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
+11
View File
@@ -33,6 +33,7 @@
"react-native-push-notification": "3.2.1",
"react-native-restart": "0.0.17",
"react-native-share": "^3.0.0",
"react-native-simple-toast": "^1.1.3",
"react-native-vector-icons": "^7.1.0",
"react-redux": "^6.0.0",
"realm": "^3.6.5",
@@ -14536,6 +14537,11 @@
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-3.0.0.tgz",
"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": {
"version": "1.0.5",
"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",
"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": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz",
+1
View File
@@ -52,6 +52,7 @@
"react-native-push-notification": "3.2.1",
"react-native-restart": "0.0.17",
"react-native-share": "^3.0.0",
"react-native-simple-toast": "^1.1.3",
"react-native-vector-icons": "^7.1.0",
"react-redux": "^6.0.0",
"realm": "^3.6.5",