Skip to content
Snippets Groups Projects
Commit 52094573 authored by bl00dymarie's avatar bl00dymarie
Browse files

Merge branch 'Fix/Switch-options-in-import-text' into 'master'

Fix: Switch button order to match explainer text

See merge request bloodyhealth/drip!397
parents f7fc81d8 6b5ed65e
No related branches found
No related tags found
No related merge requests found
...@@ -7,19 +7,21 @@ import labels from '../../../i18n/en/settings' ...@@ -7,19 +7,21 @@ import labels from '../../../i18n/en/settings'
import alertError from '../common/alert-error' import alertError from '../common/alert-error'
export function openImportDialog(onImportData) { export function openImportDialog(onImportData) {
Alert.alert( Alert.alert(labels.import.title, labels.import.message, [
labels.import.title, {
labels.import.message, text: sharedLabels.cancel,
[{ style: 'cancel',
text: sharedLabels.cancel, style: 'cancel', onPress: () => { } onPress: () => {},
}, { },
text: labels.import.deleteOption, {
onPress: () => onImportData(true)
}, {
text: labels.import.replaceOption, text: labels.import.replaceOption,
onPress: () => onImportData(false) onPress: () => onImportData(false),
}] },
) {
text: labels.import.deleteOption,
onPress: () => onImportData(true),
},
])
} }
export async function getFileContent() { export async function getFileContent() {
...@@ -48,11 +50,10 @@ export async function getFileContent() { ...@@ -48,11 +50,10 @@ export async function getFileContent() {
} }
export async function importData(shouldDeleteExistingData, fileContent) { export async function importData(shouldDeleteExistingData, fileContent) {
try { try {
await importCsv(fileContent, shouldDeleteExistingData) await importCsv(fileContent, shouldDeleteExistingData)
Alert.alert(sharedLabels.successTitle, labels.import.success.message) Alert.alert(sharedLabels.successTitle, labels.import.success.message)
} catch(err) { } catch (err) {
importError(err.message) importError(err.message)
} }
} }
...@@ -60,4 +61,4 @@ export async function importData(shouldDeleteExistingData, fileContent) { ...@@ -60,4 +61,4 @@ export async function importData(shouldDeleteExistingData, fileContent) {
function importError(msg) { function importError(msg) {
const postFixed = `${msg}\n\n${labels.import.errors.postFix}` const postFixed = `${msg}\n\n${labels.import.errors.postFix}`
alertError(postFixed) alertError(postFixed)
} }
\ No newline at end of file
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