diff --git a/components/labels.js b/components/labels.js
index ec41af7..5f1c20b 100644
--- a/components/labels.js
+++ b/components/labels.js
@@ -1,11 +1,24 @@
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'
+ shared: {
+ cancel: 'Cancel'
},
- exportTitle: 'My Drip data export',
- exportSubject: 'My Drip data export',
- exportLabel: 'Export data',
- importLabel: 'Import data'
+ export: {
+ 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'
+ },
+ title: 'My Drip data export',
+ subject: 'My Drip data export',
+ button: 'Export data',
+ },
+ 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'
+ }
}
\ No newline at end of file
diff --git a/components/settings.js b/components/settings.js
index b7b56b6..0070343 100644
--- a/components/settings.js
+++ b/components/settings.js
@@ -22,13 +22,27 @@ export default class Settings extends Component {
@@ -51,19 +65,19 @@ async function openShareDialogAndExport() {
try {
await Share.open({
- title: labels.exportTitle,
+ title: labels.export.title,
url: data,
- subject: labels.exportSubject,
+ subject: labels.export.subject,
type: 'text/csv',
showAppsToView: true
})
} catch (err) {
console.error(err)
- return alertError(labels.errors.problemSharing)
+ return alertError(labels.export.errors.problemSharing)
}
}
-async function getFileContentAndImport() {
+async function getFileContentAndImport({ deleteExisting }) {
let fileInfo
try {
fileInfo = await new Promise((resolve, reject) => {
@@ -87,7 +101,7 @@ async function getFileContentAndImport() {
}
try {
- await importCsv(fileContent, false)
+ await importCsv(fileContent, deleteExisting)
Alert.alert('Success', 'Data successfully imported')
} catch(err) {
alertError(err.message)