Skip to content
Snippets Groups Projects
Commit 355bcbe8 authored by Julia Friesel's avatar Julia Friesel
Browse files

Extract labels

parent ebb628c6
No related branches found
No related tags found
No related merge requests found
export const settings = {
errors: {
noData: 'There is no data to export',
couldNotConvert: 'Could not convert data to CSV',
problemSharing: 'There was a problem sharing the data export file'
},
exportTitle: 'My Drip data export',
exportSubject: 'My Drip data export',
buttonLabel: 'Export data'
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import {
import Share from 'react-native-share'
import getDataAsCsvDataUri from '../lib/export-to-csv'
import styles from '../styles/index'
import { settings as labels } from './labels'
export default class Settings extends Component {
constructor(props) {
......@@ -31,27 +32,27 @@ export default class Settings extends Component {
try {
data = getDataAsCsvDataUri()
if (!data) {
return Alert.alert('There is no data to export')
return Alert.alert(labels.errors.noData)
}
} catch (err) {
console.error(err)
return Alert.alert('Could not convert data to CSV')
return Alert.alert(labels.errors.couldNotConvert)
}
try {
await Share.open({
title: 'My Drip data export',
title: labels.exportTitle,
url: data,
subject: 'My Drip data export',
subject: labels.exportSubject,
type: 'text/csv',
showAppsToView: true
})
} catch (err) {
console.error(err)
return Alert.alert('There was a problem sharing the data export file')
return Alert.alert(labels.errors.problemSharing)
}
}}
title="Export data">
title={labels.buttonLabel}>
</Button>
</View>
</View>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment