Browse Source

add recap

master
Dslak 6 years ago
parent
commit
159436f4e0
  1. BIN
      builds/VDS-Quiz-64dad45c8d0a483b85ecedd661d68ba6-signed.aab
  2. BIN
      screenshots/Screenshot_20191106-183306_Expo.jpg
  3. BIN
      screenshots/Screenshot_20191106-183334_Expo.jpg
  4. BIN
      screenshots/Screenshot_20191106-183350_Expo.jpg
  5. BIN
      screenshots/g927-8.png
  6. BIN
      screenshots/g933-1.png
  7. BIN
      screenshots/g980-4.png
  8. BIN
      screenshots/header.png
  9. 266
      screenshots/header.svg
  10. 4
      vds-app/App/components/Button.js
  11. 6
      vds-app/App/components/Variables.js
  12. 11
      vds-app/App/index.js
  13. 26
      vds-app/App/screens/Exam.js
  14. 71
      vds-app/App/screens/Info.js
  15. 22
      vds-app/App/screens/Quiz.js
  16. 162
      vds-app/App/screens/Recap.js
  17. 102
      vds-app/App/screens/Results.js
  18. 4
      vds-app/app.json

BIN
builds/VDS-Quiz-64dad45c8d0a483b85ecedd661d68ba6-signed.aab

Binary file not shown.

BIN
screenshots/Screenshot_20191106-183306_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

BIN
screenshots/Screenshot_20191106-183334_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

BIN
screenshots/Screenshot_20191106-183350_Expo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 KiB

BIN
screenshots/g927-8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
screenshots/g933-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
screenshots/g980-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

BIN
screenshots/header.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 136 KiB

266
screenshots/header.svg

@ -30,13 +30,19 @@
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
@ -46,16 +52,22 @@
</rdf:RDF>
</metadata>
<defs
id="defs45"><linearGradient
id="linearGradient940"
@ -66,15 +78,21 @@
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop938"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient898"
inkscape:collect="always">
@ -84,15 +102,21 @@
style="stop-color:#ffffff;stop-opacity:0.1606186" />
<stop
id="stop896"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient862"
inkscape:collect="always">
@ -104,6 +128,8 @@
<stop
id="stop860"
offset="1"
@ -112,11 +138,15 @@
</linearGradient>
<linearGradient
id="linearGradient1177"
inkscape:collect="always">
@ -128,6 +158,8 @@
<stop
id="stop1175"
offset="1"
@ -136,11 +168,15 @@
</linearGradient>
<linearGradient
id="linearGradient1113"
inkscape:collect="always">
@ -152,6 +188,8 @@
<stop
id="stop1111"
offset="1"
@ -160,12 +198,16 @@
</linearGradient>
<defs
id="defs13">
<rect
@ -179,12 +221,16 @@
</defs>
<clipPath
id="SVGID_2_">
<use
@ -200,12 +246,16 @@
</clipPath>
@ -231,6 +281,8 @@
<linearGradient
gradientTransform="matrix(1.4791905,0,0,1.4791905,25.462738,22.270725)"
gradientUnits="userSpaceOnUse"
@ -245,6 +297,8 @@
<linearGradient
y2="19.294325"
x2="122.02882"
@ -259,6 +313,8 @@
<linearGradient
y2="19.294325"
x2="122.02882"
@ -275,6 +331,8 @@
<mask
id="mask1236"
maskUnits="userSpaceOnUse">
@ -288,11 +346,15 @@
</mask>
<mask
id="mask1243"
maskUnits="userSpaceOnUse">
@ -306,11 +368,15 @@
</mask>
<linearGradient
y2="147.05267"
x2="266.32431"
@ -328,6 +394,8 @@
<linearGradient
gradientTransform="translate(-71.635743,25.813861)"
gradientUnits="userSpaceOnUse"
@ -340,6 +408,8 @@
inkscape:collect="always" />
<linearGradient
y2="691.98407"
x2="-391.84567"
@ -352,6 +422,8 @@
inkscape:collect="always" />
<linearGradient
gradientTransform="matrix(1,0,0,2.1631993,-67.336207,-293.4148)"
gradientUnits="userSpaceOnUse"
@ -364,6 +436,8 @@
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1177"
@ -376,6 +450,8 @@
y2="77.732155" />
<clipPath
id="SVGID_2_-2">
<use
@ -388,9 +464,13 @@
height="100%" />
</clipPath>
<clipPath
id="clipPath960">
<use
@ -403,9 +483,13 @@
height="100%" />
</clipPath>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient940"
@ -418,6 +502,8 @@
gradientTransform="matrix(0.84076326,0,0,1.0564819,-361.37427,-1038.9139)" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="819.63794"
@ -430,6 +516,8 @@
gradientTransform="matrix(1.1577052,0,0,1,-1315.1116,-748.52772)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient898"
@ -442,6 +530,8 @@
y2="716.57642" />
<linearGradient
y2="716.57642"
x2="283.17621"
@ -454,6 +544,8 @@
inkscape:collect="always" />
<linearGradient
y2="691.98407"
x2="-391.84567"
@ -466,11 +558,15 @@
inkscape:collect="always" />
</defs>
<sodipodi:namedview
fit-margin-bottom="0"
fit-margin-right="0"
@ -481,9 +577,9 @@
inkscape:window-maximized="1"
inkscape:window-y="22"
inkscape:window-x="0"
inkscape:cy="373.68557"
inkscape:cx="574.94842"
inkscape:zoom="0.35"
inkscape:cy="251.05827"
inkscape:cx="-249.21704"
inkscape:zoom="0.22990437"
showgrid="false"
id="namedview43"
inkscape:window-height="719"
@ -502,6 +598,8 @@
<style
id="style10"
type="text/css">
@ -514,6 +612,8 @@
<g
transform="translate(318.96439,1070.5177)"
inkscape:label="root"
@ -529,6 +629,8 @@
ry="0" />
<g
transform="matrix(0.87213479,0,0,0.48838862,-374.27503,-1001.1904)"
id="g938">
@ -541,6 +643,8 @@
ry="400.51532" />
<ellipse
id="path870-0"
style="fill:url(#linearGradient900-4);fill-opacity:1;stroke:none;stroke-width:1.07597"
@ -551,6 +655,8 @@
cx="-973.08563" />
<ellipse
transform="matrix(-0.94066274,0.3393429,-0.10838861,-0.9941086,0,0)"
style="fill:url(#linearGradient1109);fill-opacity:1;stroke:none;stroke-width:0.808527"
@ -561,6 +667,8 @@
ry="251.08421" />
<ellipse
ry="400.51532"
rx="1205.2823"
@ -570,14 +678,20 @@
style="fill:url(#linearGradient932);fill-opacity:1;stroke:none" />
</g>
</g>
<g
transform="translate(-24.887482)"
id="g1025"
@ -593,6 +707,8 @@
<g
inkscape:label="Logo"
id="layer2"
@ -609,6 +725,8 @@
inkscape:connector-curvature="0" />
<path
style="opacity:1;fill:#71e000;fill-opacity:1;stop-opacity:1"
inkscape:connector-curvature="0"
@ -619,6 +737,8 @@
transform="matrix(8.4971318,0,0,8.4971318,-528.76068,366.00368)" />
<path
style="opacity:1;stop-opacity:1"
inkscape:connector-curvature="0"
@ -629,9 +749,13 @@
transform="matrix(8.4971318,0,0,8.4971318,-528.76068,366.00368)" />
</g>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:221.9px;font-family:'URW Gothic L';-inkscape-font-specification:'URW Gothic L Bold';opacity:1;fill:#ffffff;fill-opacity:1;stroke-width:16.6425;stop-opacity:1"
@ -645,6 +769,8 @@
style="stroke-width:16.6425">QUIZ</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:120.554px;font-family:'URW Gothic L';-inkscape-font-specification:'URW Gothic L Bold';opacity:1;fill:#71e000;fill-opacity:1;stroke-width:9.04156;stop-opacity:1"
@ -658,29 +784,37 @@
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-family:'URW Gothic L';-inkscape-font-specification:'URW Gothic L Semi-Bold';fill:#71e000;fill-opacity:1;stroke-width:9.04156">VDS</tspan></text>
</g>
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191022-123656_VDS Quiz.jpg"
xlink:href="Screenshot_20191022-123656_VDS%20Quiz.jpg"
y="79.508011"
x="628.29712"
y="79.690063"
x="609.48169"
width="191.78508"
height="340.95126"
preserveAspectRatio="none"
id="image917"
style="opacity:1;stop-opacity:1" />
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191022-123700_VDS Quiz.jpg"
xlink:href="Screenshot_20191022-123700_VDS%20Quiz.jpg"
y="242.18605"
x="572.349"
y="472.9129"
x="962.10144"
width="191.78508"
height="340.95126"
preserveAspectRatio="none"
id="image931"
style="opacity:1;stop-opacity:1" />
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191022-123704_VDS Quiz.jpg"
xlink:href="Screenshot_20191022-123704_VDS%20Quiz.jpg"
@ -691,6 +825,8 @@
preserveAspectRatio="none"
id="image945"
style="opacity:1;stop-opacity:1" />
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191022-123710_VDS Quiz.jpg"
xlink:href="Screenshot_20191022-123710_VDS%20Quiz.jpg"
@ -701,6 +837,8 @@
preserveAspectRatio="none"
id="image959"
style="opacity:1;stop-opacity:1" />
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191022-123725_VDS Quiz.jpg"
xlink:href="Screenshot_20191022-123725_VDS%20Quiz.jpg"
@ -711,16 +849,20 @@
preserveAspectRatio="none"
id="image973"
style="opacity:1;stop-opacity:1" />
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191022-123730_VDS Quiz.jpg"
xlink:href="Screenshot_20191022-123730_VDS%20Quiz.jpg"
y="208.26073"
x="795.66528"
y="510.90723"
x="1072.8041"
width="191.78508"
height="340.95126"
preserveAspectRatio="none"
id="image987"
style="opacity:1;stop-opacity:1" />
<text
id="text993"
y="395.96133"
@ -731,9 +873,111 @@
y="395.96133"
x="149.12097"
id="tspan991"
sodipodi:role="line">v1.1.0 | by Dslak</tspan></text>
sodipodi:role="line"
rotate="0 0 0 0 0 0">v1.5.0 | by Dslak</tspan></text>
<g
id="g933">
<g
id="g943">
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191106-183350_Expo.jpg"
xlink:href="Screenshot_20191106-183350_Expo.jpg"
y="267.74564"
x="582.86255"
width="199.33191"
height="354.36786"
preserveAspectRatio="none"
id="image935"
style="opacity:1;stop-opacity:1" />
<rect
style="fill:#1279be;fill-opacity:1;stroke-width:1.23514"
id="rect939"
width="161.79826"
height="134.58467"
x="602.86108"
y="466.51099" />
</g>
<rect
y="268.93622"
x="608.34534"
height="9.1699238"
width="31.055977"
id="rect945"
style="fill:#15354a;fill-opacity:1" />
</g>
<g
id="g980">
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191106-183334_Expo.jpg"
xlink:href="Screenshot_20191106-183334_Expo.jpg"
style="opacity:1;stop-opacity:1"
id="image921"
preserveAspectRatio="none"
height="354.36786"
width="199.33191"
x="795.47382"
y="185.38087" />
<rect
y="163.57695"
x="825.86206"
height="6.27492"
width="31.055977"
id="rect945-9-8"
style="fill:#0e2d42;fill-opacity:1;stroke-width:0.82722"
transform="rotate(1.5345432)" />
<rect
transform="rotate(1.5345432)"
style="fill:#15354a;fill-opacity:1;stroke-width:0.82722"
id="rect945-9"
width="31.697063"
height="6.3292689"
x="825.58301"
y="167.62637" />
</g>
<g
id="g927">
<image
sodipodi:absref="/docs/Dslak/vds_quiz/screenshots/Screenshot_20191106-183306_Expo.jpg"
xlink:href="Screenshot_20191106-183306_Expo.jpg"
style="opacity:1;stop-opacity:1"
id="image907"
preserveAspectRatio="none"
height="370.04266"
width="208.14899"
x="705.81494"
y="673.13123" />
<rect
y="653.82831"
x="749.31653"
height="6.27492"
width="31.055977"
id="rect945-9-8-6"
style="fill:#0e2d42;fill-opacity:1;stroke-width:0.82722"
transform="rotate(1.5345432)" />
<rect
transform="rotate(1.5345432)"
style="fill:#15354a;fill-opacity:1;stroke-width:0.82722"
id="rect945-9-9"
width="31.697063"
height="6.3292689"
x="749.03748"
y="657.87769" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 19 KiB

4
vds-app/App/components/Button.js

@ -13,7 +13,7 @@ const styles = StyleSheet.create({
alignItems: "center",
justifyContent: "center",
width: "100%",
marginTop: 20
marginTop: 15
},
text: {
color: colors.white,
@ -28,7 +28,7 @@ const styles = StyleSheet.create({
buttonContainer: {
flexDirection: "row",
flexWrap: "wrap",
marginTop: 10,
marginTop: 20,
justifyContent: "space-between"
}
})

6
vds-app/App/components/Variables.js

@ -40,17 +40,18 @@ export const texts = {
physiopathology: "Fisiopatologia del volo",
piloting_techniques: "Tecniche di pilotaggio",
restart: "Ricomincia",
recap: "Visualizza errori",
recapTitle: "Riepilogo domande sbagliate",
infoTitle: "Informazioni",
version: "Versione",
author: "Autore",
description: "VDS Quiz è una applicazione che utilizza le 500 domande ufficiali dell'AeCI, nella simulazione le domande vengono estrapolate seguendo lo schema ufficiale d'esame:",
description: "VDS Quiz è una applicazione che utilizza le 500 domande ufficiali dell'AeCI (Aero Club d'Italia), nella simulazione le domande vengono estrapolate seguendo lo schema ufficiale d'esame:",
source: "Domande ufficiali",
pdfLinkText: "Fonte: AeCI (Aero Club d'Italia) \"500 Quiz\"",
pdfLink: "http://www.aeci.it/upload/files/quiz_VDS-VL_2017.pdf",
schema: "Normativa e legislazione: 4 domande / 3pt \n\r Aerodinamica: 8 domande / 3pt \n\r Pronto soccorso: 1 domande / 2pt \n\r Fisiopatologia del volo: 1 domande / 2pt \n\r Meteorologia e aerologia: 6 domande / 4pt \n\r Strumenti: 1 domande / 2pt \n\r Tecnica di pilotaggio: 5 domande / 4pt \n\r Materiali: 1 domande / 2pt \n\r Sicurezza del volo: 3 domande / 4pt \n\r TOTALE: 30 domande / 100pt",
resultsSchema: "da 100pt a 86pt idoneo\n\r da 85pt a 80pt idoneo con superamento di una verifica orale, riguardante i quesiti errati\n\r inferiore a 80pt non idoneo"
}
export const examScheme = [
{section: "aerodynamics", questions: 8, points: 3},
{section: "firstAid", questions: 1, points: 2},
@ -69,6 +70,7 @@ export const examScheme = [
{section: "flightSafety", questions: 1, points: 4},
{section: "instruments", questions: 1, points: 2}
]
*/
export const credentials = {
adMobUnitIDTest: "ca-app-pub-3940256099942544/6300978111",

11
vds-app/App/index.js

@ -6,6 +6,7 @@ import QuizIndex from "./screens/QuizIndex"
import Quiz from "./screens/Quiz"
import Exam from "./screens/Exam"
import Results from "./screens/Results"
import Recap from "./screens/Recap"
import Info from "./screens/Info"
import { colors, texts} from "./components/Variables"
@ -20,6 +21,16 @@ const MainStack = createStackNavigator({
}
})
},
Recap: {
screen: Recap,
navigationOptions: ({ navigation }) => ({
header: null,
backgroundColor: colors.yellow,
headerStyle: {
backgroundColor: colors.yellow
}
})
},
Results: {
screen: Results,
navigationOptions: ({ navigation }) => ({

26
vds-app/App/screens/Exam.js

@ -26,7 +26,6 @@ const allQuestions = {
pilotingTechniques: pilotingTechniquesQuestions
}
const bgImage = require("../assets/bg.jpg")
const styles = StyleSheet.create({
@ -70,6 +69,7 @@ class Exam extends React.Component {
pointsCount: 0,
totalPoints: 0,
wrongCount: 0,
wrongAnswers: [],
totalCount: this.props.navigation.getParam("questions", []).length,
availableIds: this.props.navigation.getParam("questions", []).map(a => a.id),
activeQuestionId: this.props.navigation.getParam("questions", [])[
@ -91,8 +91,6 @@ class Exam extends React.Component {
handleBackButton = () => {
console.log('Mount Exam component')
const tmpQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
@ -111,20 +109,28 @@ class Exam extends React.Component {
return true
}
answer = (correct, id, points) => {
answer = (correct, id, question) => {
this.setState(
state => {
const nextState = { answered: true, clickedId: id, totalPoints: state.totalPoints + parseInt(points)}
const nextState = { answered: true, clickedId: id, totalPoints: state.totalPoints + parseInt(question.points)}
if (correct) {
nextState.correctCount = state.correctCount + 1
nextState.pointsCount = state.pointsCount + parseInt(points)
nextState.pointsCount = state.pointsCount + parseInt(question.points)
nextState.answerCorrect = true
} else {
nextState.wrongCount = state.wrongCount + 1
nextState.answerCorrect = false
nextState.wrongAnswers = state.wrongAnswers
nextState.wrongAnswers.push(
{ text: question.question,
id: question.id,
clicked: id,
answers: question.answers
}
)
//console.log(state.wrongAnswers)
}
return nextState
},
() => {
@ -133,6 +139,7 @@ class Exam extends React.Component {
}
}
)
}
nextQuestion = () => {
@ -151,7 +158,8 @@ class Exam extends React.Component {
correct: this.state.correctCount,
wrong: this.state.wrongCount,
points: this.state.pointsCount,
totalPoints: this.state.totalPoints
totalPoints: this.state.totalPoints,
wrongAnswers: this.state.wrongAnswers
}
})
@ -210,7 +218,7 @@ class Exam extends React.Component {
key={answer.id}
text={answer.text}
colorize={{id: answer.id, clicked: this.state.clickedId, answered: this.state.answered, isCorrect: answer.correct}}
onPress={() => this.answer(answer.correct, answer.id, question.points)}
onPress={() => this.answer(answer.correct, answer.id, question)}
/>
))}
</ButtonContainer>

71
vds-app/App/screens/Info.js

@ -9,12 +9,6 @@ const header = require("../assets/header.png")
const pkg = require('../../app.json')
const currentInfo = {
correct: "aaa",
wrong: "aaa"
}
const styles = StyleSheet.create({
container: {
backgroundColor: colors.dark_blue,
@ -44,18 +38,20 @@ const styles = StyleSheet.create({
},
box: {
width: screen.width-40,
paddingHorizontal: 20
},
text: {
color: colors.white,
fontSize: 22,
fontSize: 16,
textAlign: "center",
fontWeight: "400",
lineHeight: 40,
lineHeight: 20,
textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10
},
textSmall: {
lineHeight: 23,
marginTop: 15,
borderRadius: 5,
backgroundColor: colors.black_alpha,
@ -76,6 +72,7 @@ const styles = StyleSheet.create({
paddingVertical: 20
},
bold: {
lineHeight: 30,
fontSize: 26,
fontWeight: "600"
}
@ -100,34 +97,36 @@ class Info extends React.Component {
</View>
<SafeAreaView style={styles.safearea}>
<ScrollView style={styles.box}>
<Text style={styles.text}>
<Text style={[styles.textLabel, styles.bold]}>{`${pkg.expo.name}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.version}: ${pkg.expo.version}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.author}: Dslak`}</Text>
</Text>
<Text style={styles.textSmall}>
{texts.description}
</Text>
<Text style={styles.textSmall}>
{texts.schema}
</Text>
<Text style={styles.textSmall}>
{texts.resultsSchema}
</Text>
<Button
text={texts.source}
subtitle={texts.pdfLinkText}
isBig={false}
onPress={() => this.openURL(texts.pdfLink)}
/>
<Text></Text>
<ScrollView>
<View style={styles.box}>
<Text style={styles.text}>
<Text style={[styles.textLabel, styles.bold]}>{`${pkg.expo.name}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.version}: ${pkg.expo.version}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.author}: Dslak`}</Text>
</Text>
<Text style={styles.textSmall}>
{texts.description}
</Text>
<Text style={styles.textSmall}>
{texts.schema}
</Text>
<Text style={styles.textSmall}>
{texts.resultsSchema}
</Text>
<Button
text={texts.source}
subtitle={texts.pdfLinkText}
isBig={false}
onPress={() => this.openURL(texts.pdfLink)}
/>
<Text></Text>
</View>
</ScrollView>
</SafeAreaView>

22
vds-app/App/screens/Quiz.js

@ -34,6 +34,7 @@ class Quiz extends React.Component {
state = {
correctCount: 0,
wrongCount: 0,
wrongAnswers: [],
pointsCount: 0,
totalPoints: 0,
totalCount: this.props.navigation.getParam("questions", []).length,
@ -46,18 +47,26 @@ class Quiz extends React.Component {
results: false
}
answer = (correct, id, points) => {
answer = (correct, id, question) => {
this.setState(
state => {
const nextState = { answered: true, clickedId: id, totalPoints: state.totalPoints + parseInt(points)}
const nextState = { answered: true, clickedId: id, totalPoints: state.totalPoints + parseInt(question.points)}
if (correct) {
nextState.correctCount = state.correctCount + 1
nextState.pointsCount = state.pointsCount + parseInt(points)
nextState.pointsCount = state.pointsCount + parseInt(question.points)
nextState.answerCorrect = true
} else {
nextState.wrongCount = state.wrongCount + 1
nextState.answerCorrect = false
nextState.answerCorrect = false,
nextState.wrongAnswers = state.wrongAnswers
nextState.wrongAnswers.push(
{ text: question.question,
id: question.id,
clicked: id,
answers: question.answers
}
)
}
return nextState
@ -82,7 +91,8 @@ class Quiz extends React.Component {
correct: this.state.correctCount,
wrong: this.state.wrongCount,
points: this.state.pointsCount,
totalPoints: this.state.totalPoints
totalPoints: this.state.totalPoints,
wrongAnswers: this.state.wrongAnswers
}
})
@ -118,7 +128,7 @@ class Quiz extends React.Component {
key={answer.id}
text={answer.text}
colorize={{id: answer.id, clicked: this.state.clickedId, answered: this.state.answered, isCorrect: answer.correct}}
onPress={() => this.answer(answer.correct, answer.id, question.points)}
onPress={() => this.answer(answer.correct, answer.id, question)}
/>
))}
</ButtonContainer>

162
vds-app/App/screens/Recap.js

@ -0,0 +1,162 @@
import React from "react"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image, ImageBackground, BackHandler} from "react-native"
import { Button, ButtonContainer } from "../components/Button"
import { colors, texts, examScheme } from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
import firstAidQuestions from "../data/firstAid"
import flightSafetyQuestions from "../data/flightSafety"
import instrumentsQuestions from "../data/instruments"
import legislationQuestions from "../data/legislation"
import materialsQuestions from "../data/materials"
import meteorologyQuestions from "../data/meteorology"
import physiopathologyQuestions from "../data/physiopathology"
import pilotingTechniquesQuestions from "../data/pilotingTechniques"
const screen = Dimensions.get("window")
const header = require("../assets/header.png")
const bgImage = require("../assets/bg.jpg")
const allQuestions = {
aerodynamics: aerodynamicsQuestions,
firstAid: firstAidQuestions,
flightSafety: flightSafetyQuestions,
instruments: instrumentsQuestions,
legislation: legislationQuestions,
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
}
const styles = StyleSheet.create({
container: {
backgroundColor: colors.dark_blue,
flex: 1
},
safearea: {
flex: 1,
marginTop: 0,
justifyContent: "space-between",
paddingHorizontal: 20,
paddingBottom: 40
},
headerContainer: {
marginTop: -40,
alignItems: "center",
justifyContent: "center",
width: "100%",
height: screen.width/1.5
},
header: {
width: "100%"
},
box: {
marginTop: 30,
borderColor: colors.black_alpha,
borderWidth: 1,
padding: 15,
borderRadius: 5,
backgroundColor: colors.black_alpha
},
text: {
color: colors.white,
fontSize: 20,
textAlign: "center",
fontWeight: "600",
paddingVertical: 10
},
textBig: {
color: colors.white,
fontSize: 24,
textAlign: "center",
fontWeight: "500",
paddingBottom: 10,
textShadowColor: 'rgba(0, 0, 0, 0.75)',
textShadowOffset: {width: -1, height: 1},
textShadowRadius: 10
},
bg: {
width: "100%",
height: "100%"
}
})
class Recap extends React.Component {
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton)
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton)
}
handleBackButton = () => {
const tmpQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
for(let i=0; i<elem.questions; i++) {
const currentIndex = Math.floor(Math.random() * currentSection.length)
tmpQuestions.push(currentSection[currentIndex])
currentSection = currentSection.filter( (item, index) => index != currentIndex)
}
})
//tmpQuestions.forEach( (e) => { console.log(e.id) })
this.props.navigation.navigate("Splash", {
examQuestions: tmpQuestions
})
return true
}
render() {
const questions = this.props.navigation.getParam("wrongAnswers", [])
return (
<View style={styles.container} >
<View style={styles.headerContainer} >
<Image source={header} style={styles.header} resizeMode="contain" />
</View>
<Text style={styles.textBig}>{texts.recapTitle}</Text>
<ScrollView>
<SafeAreaView style={styles.safearea}>
{questions.map( (question, index) => (
<View style={styles.box} key={question.id}>
<Text style={styles.text}>{question.text}</Text>
<ButtonContainer>
{question.answers.map( (answer, index) => (
<Button
key={answer.id}
text={answer.text}
colorize={{id: answer.id, clicked: question.clicked, answered: true, isCorrect: answer.correct}}
/>
))}
</ButtonContainer>
</View>
))}
<View style={styles.button}>
<Button
text={texts.restart}
onPress={() => {this.handleBackButton()}
}
/>
</View>
</SafeAreaView>
</ScrollView>
</View>
)
}
}
export default Recap

102
vds-app/App/screens/Results.js

@ -1,5 +1,5 @@
import React from "react"
import { View, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image, BackHandler} from "react-native"
import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image, BackHandler} from "react-native"
import { Button, ButtonContainer } from "../components/Button"
import { colors, texts, examScheme } from "../components/Variables"
@ -40,22 +40,23 @@ const styles = StyleSheet.create({
flex: 1,
marginTop: 0,
justifyContent: "space-between",
paddingHorizontal: 20
paddingHorizontal: 20,
paddingBottom: 40
},
headerContainer: {
marginTop: 0,
marginTop: -40,
alignItems: "center",
justifyContent: "center",
width: "100%",
height: 150
height: screen.width/1.5
},
header: {
width: "100%"
},
box: {
position: "absolute",
top: screen.width/4,
left: 40,
marginTop: 20,
marginBottom: 30,
marginHorizontal: 20,
width: screen.width-80,
borderRadius: 15,
backgroundColor: colors.white_alpha,
@ -73,10 +74,8 @@ const styles = StyleSheet.create({
borderColor: colors.orange,
},
button: {
position: "absolute",
bottom: 40,
left: 40,
width: screen.width-80
width: screen.width-80,
marginHorizontal: 20
},
text: {
color: colors.white,
@ -130,8 +129,6 @@ class Results extends React.Component {
handleBackButton = () => {
console.log('Mount Exam component')
const tmpQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
@ -153,6 +150,7 @@ class Results extends React.Component {
render() {
const currentResults = this.props.navigation.getParam("results")
const wrongAnswers = currentResults.wrongAnswers || null
const percentage = currentResults.total ? (100/currentResults.total) * currentResults.correct : 0
let resultStyle = currentResults.points >= 80 ? currentResults.points >= 85 ? styles.correct : styles.unsafe : styles.wrong
let boxStyle = currentResults.points >= 80 ? currentResults.points >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong
@ -162,45 +160,63 @@ class Results extends React.Component {
boxStyle = percentage >= 80 ? percentage >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong
}
console.log(currentResults)
//console.log(currentResults)
return (
<View style={styles.container} >
<View style={styles.headerContainer} >
<Image source={header} style={styles.header} resizeMode="contain" />
</View>
<ScrollView>
<SafeAreaView style={styles.safearea}>
<View style={[styles.box, boxStyle]}>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.corrects}: ${currentResults.correct}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.wrongs}: ${currentResults.wrong}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.percentage}: ${Math.round(percentage)}%`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.points}: ${currentResults.points}/${currentResults.totalPoints}`}</Text>
</Text>
{currentResults.isExam ?
<Text style={[styles.textSmall, resultStyle]}>
{currentResults.points >= 80 ? currentResults.points >= 85 ? texts.exam_passed : texts.exam_needs_oral : texts.exam_not_passed}
</Text> : <Text/>
}
</View>
<SafeAreaView style={styles.safearea}>
<View style={[styles.box, boxStyle]}>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.corrects}: ${currentResults.correct}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.wrongs}: ${currentResults.wrong}`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.percentage}: ${Math.round(percentage)}%`}</Text>
</Text>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.points}: ${currentResults.points}/${currentResults.totalPoints}`}</Text>
</Text>
{currentResults.isExam ?
<Text style={[styles.textSmall, resultStyle]}>
{currentResults.points >= 80 ? currentResults.points >= 85 ? texts.exam_passed : texts.exam_needs_oral : texts.exam_not_passed}
</Text> : <Text/>
{wrongAnswers ?
<View style={styles.button}>
<Button
text={texts.recap}
onPress={ ()=> {
this.props.navigation.navigate("Recap", {
wrongAnswers: wrongAnswers
})
}}/>
<Button
text={texts.restart}
onPress={() => {this.handleBackButton()}
}
/>
</View> :
<View style={styles.button}>
<Button
text={texts.restart}
onPress={() => {this.handleBackButton()}
}
/>
</View>
}
</View>
<View style={styles.button}>
<Button
text={texts.restart}
onPress={() => {this.handleBackButton()}
}
/>
</View>
</SafeAreaView>
</SafeAreaView>
</ScrollView>
</View>
)

4
vds-app/app.json

@ -8,7 +8,7 @@
"ios",
"android"
],
"version": "1.4.5",
"version": "1.5.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
@ -26,7 +26,7 @@
"icon": "./assets/icon.png",
"package": "com.dslak.vdsquiz",
"permissions": [],
"versionCode": 6,
"versionCode": 7,
"config": {
"googleMobileAdsAppId": "ca-app-pub-4145771316565790~1876877627"
}

Loading…
Cancel
Save