Browse Source

3.8.3

develop
Dslak 1 month ago
parent
commit
967c657ff5
  1. BIN
      builds/application-d53c6cb3-13a7-4556-a591-e89ec984beb6.aab
  2. 8
      vds-app/App/components/Banner.js
  3. 224
      vds-app/App/screens/Recap.js
  4. 202
      vds-app/App/screens/Results.js
  5. 3
      vds-app/App/screens/ResultsTrueFalse.js
  6. 6
      vds-app/android/gradle.properties
  7. 24
      vds-app/app.json
  8. 3
      vds-app/eas.json
  9. 2
      vds-app/ios/VDSQuiz/Info.plist
  10. 2
      vds-app/package.json
  11. 8286
      vds-app/yarn-error.log

BIN
builds/application-d53c6cb3-13a7-4556-a591-e89ec984beb6.aab

Binary file not shown.

8
vds-app/App/components/Banner.js

@ -13,8 +13,8 @@ const styles = StyleSheet.create({
flex: 1,
alignItems: "center",
justifyContent: "center",
marginTop: 20,
height: 100,
//marginTop: 20,
//height: 100,
width: "100%"
}
})
@ -24,9 +24,9 @@ export const Banner = () => {
let banner
if(__DEV__) {
banner = <Text>DEV BANNER</Text>
banner = <Text></Text>
} else {
banner = <Text>BANNER</Text> //<BannerAd size={BannerAdSize.LARGE_BANNER} unitId={adUnitId} />
banner = <Text></Text> //<BannerAd size={BannerAdSize.LARGE_BANNER} unitId={adUnitId} />
}
return (
<View style={styles.container}>

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

@ -1,7 +1,15 @@
import React from "react";
import { View, ScrollView, StyleSheet, Text, Image, BackHandler } from "react-native";
import SafeAreaView from 'react-native-safe-area-view';
import AsyncStorage from '@react-native-async-storage/async-storage';
import React, { useEffect, useState, useCallback } from "react";
import {
View,
ScrollView,
StyleSheet,
Text,
Image,
BackHandler,
} from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { useNavigation, useRoute, useFocusEffect } from "@react-navigation/native";
import { Button, ButtonContainer } from "../components/Button";
import { Banner } from "../components/Banner";
@ -26,120 +34,168 @@ const allQuestions = {
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
pilotingTechniques: pilotingTechniquesQuestions,
};
const header = require("../assets/header.png");
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: 200 },
safearea: {
flex: 1,
marginTop: 0,
justifyContent: "space-between",
paddingHorizontal: 20,
paddingBottom: 40,
},
headerContainer: {
marginTop: -40,
alignItems: "center",
justifyContent: "center",
width: "100%",
height: 200,
},
header: { width: "100%" },
box: { marginTop: 30, borderColor: colors.black_alpha, borderWidth: 1, padding: 15, borderRadius: 5, backgroundColor: colors.white_alpha },
text: { color: colors.white, fontSize: 20, textAlign: "center", fontWeight: "600", paddingTop: 0 },
textCode: { color: colors.white, fontSize: 12, textAlign: "center", fontWeight: "500", paddingTop: 10, paddingBottom: 0 },
textBig: { color: colors.white, fontSize: 22, textAlign: "center", fontWeight: "400", paddingBottom: 15, textTransform: "uppercase", textShadowColor: 'rgba(0, 0, 0, 0.75)', textShadowOffset: { width: -1, height: 1 }, textShadowRadius: 10 },
bannerContainer: { flex: 1, alignItems: "center", justifyContent: "center" }
box: {
marginTop: 30,
borderColor: colors.black_alpha,
borderWidth: 1,
padding: 15,
borderRadius: 5,
backgroundColor: colors.white_alpha,
},
text: {
color: colors.white,
fontSize: 20,
textAlign: "center",
fontWeight: "600",
paddingTop: 0,
},
textCode: {
color: colors.white,
fontSize: 12,
textAlign: "center",
fontWeight: "500",
paddingTop: 10,
paddingBottom: 0,
},
textBig: {
color: colors.white,
fontSize: 22,
textAlign: "center",
fontWeight: "400",
paddingBottom: 15,
textTransform: "uppercase",
textShadowColor: "rgba(0, 0, 0, 0.75)",
textShadowOffset: { width: -1, height: 1 },
textShadowRadius: 10,
},
bannerContainer: { flex: 1, alignItems: "center", justifyContent: "center" },
});
class Recap extends React.Component {
constructor(props) {
super(props);
this.state = {
storeWrongAnswers: []
};
}
const Recap = () => {
const navigation = useNavigation();
const route = useRoute();
const [storeWrongAnswers, setStoreWrongAnswers] = useState([]);
componentDidMount() {
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
AsyncStorage.getItem('storeWrongAnswers').then(value => {
// Load stored wrong answers
useEffect(() => {
AsyncStorage.getItem("storeWrongAnswers").then((value) => {
if (value) {
this.setState({ storeWrongAnswers: JSON.parse(value) });
setStoreWrongAnswers(JSON.parse(value));
}
});
}
componentWillUnmount() {
this.backHandler?.remove();
}
}, []);
handleBackButton = () => {
const handleBackButton = useCallback(() => {
const tmpQuestions = [];
AsyncStorage.getItem('setupData').then(value => {
AsyncStorage.getItem("setupData").then((value) => {
const setupData = JSON.parse(value) || {};
examScheme.forEach(elem => {
examScheme.forEach((elem) => {
let currentSection = setupData.excludeDelta
? allQuestions[elem.section].filter(item => !item.delta)
? allQuestions[elem.section].filter((item) => !item.delta)
: 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((_, index) => index !== currentIndex);
currentSection = currentSection.filter((_, idx) => idx !== currentIndex);
}
});
this.props.navigation.navigate("Splash", {
navigation.navigate("Splash", {
examQuestions: tmpQuestions,
storeWrongAnswers: this.state.storeWrongAnswers
storeWrongAnswers,
});
});
return true;
}
render() {
const questions = this.props.route.params?.wrongAnswers || [];
return (
<View style={styles.container}>
<View style={styles.headerContainer}>
<Image source={header} style={styles.header} resizeMode="contain" />
</View>
}, [navigation, storeWrongAnswers]);
// Attach hardware back handler
useFocusEffect(
useCallback(() => {
const backHandler = BackHandler.addEventListener(
"hardwareBackPress",
handleBackButton
);
return () => backHandler.remove();
}, [handleBackButton])
);
const questions = route.params?.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 => (
<View style={styles.box} key={question.id}>
<Text style={styles.textCode}>{question.id}</Text>
<Text style={styles.text}>{question.question}</Text>
<ButtonContainer>
{question.answers.map(answer => (
<Button
key={answer.id}
text={answer.text}
colorize={{ id: answer.id, clicked: question.clicked, answered: true, isCorrect: answer.correct }}
/>
))}
</ButtonContainer>
</View>
))}
<View style={{ marginTop: 20 }}>
<Button
color={colors.white_alpha2}
hasShadow
hasBg
text={texts.restart}
onPress={this.handleBackButton}
/>
<Text style={styles.textBig}>aaa{texts.recapTitle}</Text>
<ScrollView>
<SafeAreaView style={styles.safearea}>
{questions.map((question) => (
<View style={styles.box} key={question.id}>
<Text style={styles.textCode}>{question.id}</Text>
<Text style={styles.text}>{question.question}</Text>
<ButtonContainer>
{question.answers.map((answer) => (
<Button
key={answer.id}
text={answer.text}
colorize={{
id: answer.id,
clicked: question.clicked,
answered: true,
isCorrect: answer.correct,
}}
/>
))}
</ButtonContainer>
</View>
</SafeAreaView>
<View style={styles.bannerContainer}>
<Banner />
))}
<View style={{ marginTop: 20 }}>
<Button
color={colors.white_alpha2}
hasShadow
hasBg
text={texts.restart}
onPress={handleBackButton}
/>
</View>
</ScrollView>
</View>
);
}
}
</SafeAreaView>
<View style={styles.bannerContainer}>
<Banner />
</View>
</ScrollView>
</View>
);
};
export default Recap;

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

@ -1,20 +1,28 @@
import React from "react";
import { View, ScrollView, StyleSheet, Text, Image, BackHandler } from "react-native";
import SafeAreaView from 'react-native-safe-area-view';
import React, { useCallback } from "react";
import {
View,
ScrollView,
StyleSheet,
Text,
Image,
BackHandler,
} from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { useNavigation, useRoute, useFocusEffect } from "@react-navigation/native";
import { Button, ButtonContainer } from "../components/Button";
import { Banner } from "../components/Banner";
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"
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 allQuestions = {
aerodynamics: aerodynamicsQuestions,
@ -25,37 +33,72 @@ const allQuestions = {
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
pilotingTechniques: pilotingTechniquesQuestions,
};
const header = require("../assets/header.png");
const styles = StyleSheet.create({
container: { backgroundColor: colors.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: 200 },
safearea: {
flex: 1,
marginTop: 0,
justifyContent: "space-between",
paddingHorizontal: 20,
paddingBottom: 40,
},
headerContainer: {
marginTop: -40,
alignItems: "center",
justifyContent: "center",
width: "100%",
height: 200,
},
header: { width: "100%" },
box: { marginTop: 30, borderColor: colors.black_alpha, borderWidth: 1, padding: 15, borderRadius: 5, backgroundColor: colors.white_alpha },
text: { color: colors.white, fontSize: 20, textAlign: "center", fontWeight: "600" },
textCode: { color: colors.white, fontSize: 12, textAlign: "center", fontWeight: "500", paddingTop: 10 },
textBig: { color: colors.white, fontSize: 22, textAlign: "center", fontWeight: "400", paddingBottom: 15, textTransform: "uppercase", textShadowColor: 'rgba(0,0,0,0.75)', textShadowOffset: {width:-1, height:1}, textShadowRadius:10 },
bannerContainer: { flex: 1, alignItems: "center", justifyContent: "center" }
box: {
marginTop: 30,
borderColor: colors.black_alpha,
borderWidth: 1,
padding: 15,
borderRadius: 5,
backgroundColor: colors.white_alpha,
},
text: {
color: colors.white,
fontSize: 20,
textAlign: "center",
fontWeight: "600",
},
textCode: {
color: colors.white,
fontSize: 12,
textAlign: "center",
fontWeight: "500",
paddingTop: 10,
},
textBig: {
color: colors.white,
fontSize: 22,
textAlign: "center",
fontWeight: "400",
paddingBottom: 15,
textTransform: "uppercase",
textShadowColor: "rgba(0,0,0,0.75)",
textShadowOffset: { width: -1, height: 1 },
textShadowRadius: 10,
},
bannerContainer: { flex: 1, alignItems: "center", justifyContent: "center" },
});
class RecapTrueFalse extends React.Component {
componentDidMount() {
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
}
const RecapTrueFalse = () => {
const navigation = useNavigation();
const route = useRoute();
componentWillUnmount() {
this.backHandler?.remove();
}
handleBackButton = () => {
const handleBackButton = useCallback(() => {
const tmpQuestions = [];
let fullQuestions = [];
examScheme.forEach(elem => {
examScheme.forEach((elem) => {
fullQuestions.push(...allQuestions[elem.section]);
});
@ -65,54 +108,75 @@ class RecapTrueFalse extends React.Component {
fullQuestions.splice(index, 1);
}
this.props.navigation.navigate("Splash", { trueFalseQuestions: tmpQuestions });
navigation.navigate("Splash", { trueFalseQuestions: tmpQuestions });
return true;
}
render() {
const questions = this.props.route.params?.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(q => (
<View style={styles.box} key={q.id}>
<Text style={styles.textCode}>{q.id}</Text>
<Text style={styles.text}>{q.question}</Text>
<ButtonContainer>
{q.answers.map(ans => (
}, [navigation]);
// Attach hardware back button handler
useFocusEffect(
useCallback(() => {
const backHandler = BackHandler.addEventListener(
"hardwareBackPress",
handleBackButton
);
return () => backHandler.remove();
}, [handleBackButton])
);
const questions = route.params.results?.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((q) => (
<View style={styles.box} key={q.id}>
<Text style={styles.textCode}>{q.id}</Text>
<Text style={styles.text}>{q.question}</Text>
<ButtonContainer>
{q.answers.map(
(ans) =>
q.clicked === ans.id && (
<Button
key={ans.id}
text={ans.text}
noBorder
colorize={{id: ans.id, clicked: q.clicked, answered: true, isCorrect: ans.correct}}
colorize={{
id: ans.id,
clicked: q.clicked,
answered: true,
isCorrect: ans.correct,
}}
/>
)
))}
</ButtonContainer>
</View>
))}
<View style={{ marginTop: 20 }}>
<Button color={colors.white_alpha2} hasBg hasShadow text={texts.restart} onPress={this.handleBackButton} />
)}
</ButtonContainer>
</View>
</SafeAreaView>
<View style={styles.bannerContainer}>
<Banner />
))}
<View style={{ marginTop: 20 }}>
<Button
color={colors.white_alpha2}
hasBg
hasShadow
text={texts.restart}
onPress={handleBackButton}
/>
</View>
</ScrollView>
</View>
);
}
}
</SafeAreaView>
<View style={styles.bannerContainer}>
<Banner />
</View>
</ScrollView>
</View>
);
};
export default RecapTrueFalse;

3
vds-app/App/screens/ResultsTrueFalse.js

@ -70,7 +70,8 @@ class RecapTrueFalse extends React.Component {
}
render() {
const questions = this.props.route.params?.wrongAnswers || [];
const questions = this.props.route.params.results?.wrongAnswers || [];
return (
<View style={styles.container}>

6
vds-app/android/gradle.properties

@ -64,6 +64,6 @@ expo.useLegacyPackaging=false
# WARNING: This property has been deprecated and will be removed in Expo SDK 55. Use `edgeToEdgeEnabled` or `react.edgeToEdgeEnabled` to determine whether the project is using edge-to-edge.
expo.edgeToEdgeEnabled=true
android.compileSdkVersion=34
android.targetSdkVersion=34
android.buildToolsVersion=34.0.0
android.compileSdkVersion=35
android.targetSdkVersion=35
android.buildToolsVersion=35.0.0

24
vds-app/app.json

@ -24,9 +24,9 @@
],
"android": {
"icon": "./assets/icon.png",
"package": "com.dslak.vdsquiz",
"permissions": [],
"versionCode": 31
"versionCode": 31,
"package": "com.dslak.vdsquiz"
},
"ios": {
"icon": "./assets/iconIOS.png",
@ -54,16 +54,18 @@
"deploymentTarget": "15.1"
}
}
],
[
"react-native-google-mobile-ads",
{
"androidAppId": "ca-app-pub-3940256099942544~3347511713",
"iosAppId": "ca-app-pub-3940256099942544~1458002511",
"delayAppMeasurementInit": false,
"optimizeInitialization": true,
"optimizeAdLoading": true,
"userTrackingUsageDescription": "This identifier will be used to deliver personalized ads to you."
}
]
]
},
"react-native-google-mobile-ads": {
"android_app_id": "ca-app-pub-3940256099942544~3347511713",
"ios_app_id": "ca-app-pub-3940256099942544~1458002511",
"delay_app_measurement_init": false,
"optimize_initialization": true,
"optimize_ad_loading": true,
"user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you."
}
}

3
vds-app/eas.json

@ -1,6 +1,7 @@
{
"cli": {
"version": ">= 3.8.1"
"version": ">= 3.17.1",
"appVersionSource": "remote"
},
"build": {
"development": {

2
vds-app/ios/VDSQuiz/Info.plist

@ -50,6 +50,8 @@
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<key>RCTNewArchEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>SplashScreen</string>
<key>UIRequiredDeviceCapabilities</key>

2
vds-app/package.json

@ -9,6 +9,7 @@
"web": "expo start --web",
"build-android-old": "expo build:android -t app-bundle",
"build-android": "eas build -p android",
"build-android-prod" : "eas build --platform android --profile production",
"build-android-local": "eas build -p android --profile preview",
"build-ios": "expo build:ios",
"ios": "expo run:ios",
@ -32,6 +33,7 @@
"react-native": "^0.81.4",
"react-native-gesture-handler": "^2.28.0",
"react-native-google-mobile-ads": "^15.7.0",
"react-native-gradle-plugin": "^0.71.19",
"react-native-reanimated": "^4.1.0",
"react-native-safe-area-context": "^5.6.1",
"react-native-safe-area-view": "^1.1.1",

8286
vds-app/yarn-error.log

File diff suppressed because it is too large
Loading…
Cancel
Save