diff --git a/src/screens/GIPScreen.js b/src/screens/GIPScreen.js index b1015f0c1..bdf04c368 100644 --- a/src/screens/GIPScreen.js +++ b/src/screens/GIPScreen.js @@ -145,23 +145,37 @@ export default class GIPScreen extends React.Component{ saveData(goHome){ let tmpDateTime = this.state.selectedDateAndTime tmpDateTime.setFullYear(tmpDateTime.getFullYear()); - FileSystem.readAsStringAsync(this.state.photo.uri, - {'encoding': FileSystem.EncodingType.Base64}) - .then(result => { - this.state.photo.base46 = result; - DatabaseManager.getInstance().createGIPEvent( - this.state.gipManualResult, - this.state.gipEntryNote, - this.state.photo, - tmpDateTime.getTime(), - (error) => {alert(error)}, - () => { - GlutonManager.getInstance().setMessage(2); - GearManager.getInstance().sendMessage("msg 31") - } - ); - }) - .catch((err) => alert(error)) + if (this.state.photo) { + FileSystem.readAsStringAsync(this.state.photo.uri, + {'encoding': FileSystem.EncodingType.Base64}) + .then(result => { + this.state.photo.base46 = result; + DatabaseManager.getInstance().createGIPEvent( + this.state.gipManualResult, + this.state.gipEntryNote, + this.state.photo, + tmpDateTime.getTime(), + (error) => {alert(error)}, + () => { + GlutonManager.getInstance().setMessage(2); + GearManager.getInstance().sendMessage("msg 31") + } + ); + }) + .catch((err) => alert(error)) + } else { + DatabaseManager.getInstance().createGIPEvent( + this.state.gipManualResult, + this.state.gipEntryNote, + this.state.photo, + tmpDateTime.getTime(), + (error) => {alert(error)}, + () => { + GlutonManager.getInstance().setMessage(2); + GearManager.getInstance().sendMessage("msg 31") + } + ); + } if (goHome) { setTimeout(() => this.navigateHome(), 100); } diff --git a/src/screens/GIPViewScreen.js b/src/screens/GIPViewScreen.js index 376c4a0f6..e87cfb6de 100644 --- a/src/screens/GIPViewScreen.js +++ b/src/screens/GIPViewScreen.js @@ -56,27 +56,28 @@ export default class FoodViewScreen extends React.Component { accuracyPercentText: 100, dateValue: new Date(resultDate).getUTCDate() + '/' + (new Date(resultDate).getUTCMonth()+1) + '/' + new Date(resultDate).getUTCFullYear(), timeValue: new Date(resultDate).getUTCHours() + ':' + new Date(resultDate).getUTCMinutes(), - resultState: objData.result }; + resultState: objData.result + }; switch(objData.result) { - case 1: - displayBlock.resultValue = 'Negative'; - displayBlock.accuracyPercentText = 95; - displayBlock.resultState = 0; - break; case 0: - displayBlock.resultValue = 'Positive'; - displayBlock.accuracyPercentText = 95; + displayBlock.resultValue = 'Gluten'; + displayBlock.accuracyPercentText = 100; displayBlock.resultState = 1; break; + case 1: + displayBlock.resultValue = 'No gluten'; + displayBlock.accuracyPercentText = 100; + displayBlock.resultState = 0; + break; case 2: displayBlock.resultValue = 'Inconclusive'; - displayBlock.accuracyPercentText = 55; + displayBlock.accuracyPercentText = 50; displayBlock.resultState = 2; break; default: displayBlock.resultValue = 'Inconclusive'; - displayBlock.accuracyPercentText = 55; + displayBlock.accuracyPercentText = 50; displayBlock.resultState = 2; } const tags = [