Commit 1a539b0b authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

Merge branch 'master' of http://gitlab.sliit.lk/21_22-j-38/21_22j-38 into it18257632

parents ff2326ed ef01cf5d
......@@ -45,5 +45,11 @@ def abc():
if __name__ == "__main__":
<<<<<<< HEAD
app.run(host='192.168.8.102')
=======
app.run(host='192.168.8.101')
# app.run(host='192.168.8.100,port='5000', debug=True)
# app.run(debug=True)
>>>>>>> ef01cf5d3888e989084c7d61dff42b160793ac0a
......@@ -10,6 +10,8 @@ import {
} from "react-native";
import {LogBox } from 'react-native';
LogBox.ignoreLogs(['Reanimated 2']);
LogBox.ignoreLogs(['new NativeEventEmitter']); // Ignore log notification by message
LogBox.ignoreAllLogs(); //Ignore all log notifications
// import Home from "./src/screen/Home";
// import Login from "./src/screen/auth/Login"
......
......@@ -2,6 +2,14 @@
package="com.firstapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MICROPHONE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".MainApplication"
......
......@@ -15,12 +15,17 @@
"native-base": "^3.2.2",
"react": "17.0.2",
"react-native": "0.66.2",
<<<<<<< HEAD
"react-native-audio-recorder-player": "^3.3.4",
"react-native-chartjs": "^1.0.3",
=======
"react-native-audio-record": "^0.2.2",
>>>>>>> ef01cf5d3888e989084c7d61dff42b160793ac0a
"react-native-elements": "^3.4.2",
"react-native-fontawesome": "^7.0.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-orientation-locker": "^1.4.0",
"react-native-permissions": "^3.2.0",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",
......@@ -13850,6 +13855,7 @@
"react": "17.0.2"
}
},
<<<<<<< HEAD
"node_modules/react-native-audio-recorder-player": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/react-native-audio-recorder-player/-/react-native-audio-recorder-player-3.3.4.tgz",
......@@ -15642,6 +15648,12 @@
"dependencies": {
"camelcase": "^4.1.0"
}
=======
"node_modules/react-native-audio-record": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/react-native-audio-record/-/react-native-audio-record-0.2.2.tgz",
"integrity": "sha512-+JEY3AWz21xylePbXZ81DLHcqU5oJYztn3Uel3ay53P3ZrvJlwfmOmyOuoavA9boPV1O0dLLQIu9gC7xbKwNvQ=="
>>>>>>> ef01cf5d3888e989084c7d61dff42b160793ac0a
},
"node_modules/react-native-codegen": {
"version": "0.0.7",
......@@ -15700,6 +15712,21 @@
"react-native-windows": ">=0.63.3"
}
},
"node_modules/react-native-permissions": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/react-native-permissions/-/react-native-permissions-3.2.0.tgz",
"integrity": "sha512-UPXxf2twjYL9vPI4HP2kT15AOTY489MhsNuyAgp+wJM2IRkkSVW6rO3k4WuSRL9ZmPhwkWb9bYjf8EEwRzZcXg==",
"peerDependencies": {
"react": ">=16.13.1",
"react-native": ">=0.63.3",
"react-native-windows": ">=0.62.0"
},
"peerDependenciesMeta": {
"react-native-windows": {
"optional": true
}
}
},
"node_modules/react-native-ratings": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/react-native-ratings/-/react-native-ratings-8.0.4.tgz",
......@@ -29509,6 +29536,7 @@
}
}
},
<<<<<<< HEAD
"react-native-audio-recorder-player": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/react-native-audio-recorder-player/-/react-native-audio-recorder-player-3.3.4.tgz",
......@@ -31029,6 +31057,12 @@
}
}
}
=======
"react-native-audio-record": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/react-native-audio-record/-/react-native-audio-record-0.2.2.tgz",
"integrity": "sha512-+JEY3AWz21xylePbXZ81DLHcqU5oJYztn3Uel3ay53P3ZrvJlwfmOmyOuoavA9boPV1O0dLLQIu9gC7xbKwNvQ=="
>>>>>>> ef01cf5d3888e989084c7d61dff42b160793ac0a
},
"react-native-codegen": {
"version": "0.0.7",
......@@ -31078,6 +31112,12 @@
"integrity": "sha512-O/Ki7uw1lltKiTZLcTuLcSh4EzLFqXKKo2J4cLKvyG52YiEawbn/ipsZriZlWzK0mhX4dSe79CoRS4IsyUs1fw==",
"requires": {}
},
"react-native-permissions": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/react-native-permissions/-/react-native-permissions-3.2.0.tgz",
"integrity": "sha512-UPXxf2twjYL9vPI4HP2kT15AOTY489MhsNuyAgp+wJM2IRkkSVW6rO3k4WuSRL9ZmPhwkWb9bYjf8EEwRzZcXg==",
"requires": {}
},
"react-native-ratings": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/react-native-ratings/-/react-native-ratings-8.0.4.tgz",
......@@ -17,12 +17,17 @@
"native-base": "^3.2.2",
"react": "17.0.2",
"react-native": "0.66.2",
<<<<<<< HEAD
"react-native-audio-recorder-player": "^3.3.4",
"react-native-chartjs": "^1.0.3",
=======
"react-native-audio-record": "^0.2.2",
>>>>>>> ef01cf5d3888e989084c7d61dff42b160793ac0a
"react-native-elements": "^3.4.2",
"react-native-fontawesome": "^7.0.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-orientation-locker": "^1.4.0",
"react-native-permissions": "^3.2.0",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",
......
......@@ -16,7 +16,7 @@ const Stack = createNativeStackNavigator();
const AppRouter = () => {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Splash">
<Stack.Navigator initialRouteName="Color">
<Stack.Screen
options={{headerShown: false}}
name="Home"
......
......@@ -6,7 +6,7 @@ import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image, Ima
import ImageButton from "../component/ImageButton";
import ColorActivity from "../component/colorActivity";
const webUrel = "http://192.168.8.102:5000/getColorActivities";
const webUrel = "http://192.168.8.101:5000/getColorActivities";
export default function Color(){
......
......@@ -18,12 +18,19 @@ import {
Image
} from 'react-native'
import Permissions from 'react-native-permissions';
import AudioRecord from 'react-native-audio-record';
import axios from "axios";
export default function Blue(color) {
const navigation = useNavigation();
const backColor = color.route.params.color;
React.useEffect(() => {
audioInit();
const unsubscribe = navigation.addListener("focus", () => {
// The screen is focused
// Call any action
......@@ -34,9 +41,68 @@ export default function Blue(color) {
return unsubscribe;
}, [navigation]);
return(
// audioInit
function audioInit() {
// console.log('audioInit');
const colorAudio = {
sampleRate: 16000,
channels: 1,
bitsPerSample: 16,
wavFile: 'color.wav', // thise wave file name
};
AudioRecord.init(colorAudio);
}
// checkPermission
async function checkPermission() {
// console.log('checkPermission');
const p = await Permissions.check('microphone');
// console.log(p);
// console.log('permission check', p);
if (p === 'authorized') {
// console.log('if');
//audio start
audioStart();
} else {
// console.log('else');
return requestPermission();
}
}
// requestPermission
async function requestPermission() {
const p = await Permissions.request('microphone');
// console.log('permission request', p);
}
// audioStart
async function audioStart() {
// console.log('audioStart');
checkPermission();
AudioRecord.start();
setTimeout(() => {
audioStop();
}, 4000);
}
// audioStop
async function audioStop() {
// console.log('audioStop');
let audioFile = await AudioRecord.stop();
console.log('userFile', audioFile);
}
return (
<SafeAreaView>
<View style={{flexDirection: "column"}}>
<View style={{ flexDirection: "column" }}>
<ImageBackground style={styles.image} source={require("../../assets/game/gameback.png")}>
<View>
......@@ -53,15 +119,15 @@ export default function Blue(color) {
<Image style={styles.blackboard} source={require("../../assets/game/blackboard.png")}></Image>
<View style={{width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100}}>
<View style={{ width: 180, height: 180, backgroundColor: backColor, marginTop: -370, marginLeft: 455, borderRadius: 100 }}>
</View>
</View>
<View style={{flexDirection: "row", marginLeft: 480}}>
<Button style={styles.button} title="Recode"/>
<Button title="Return" color="#1DCE92"/>
<Button title="Exit" color="#841584"/>
<View style={{ flexDirection: "row", marginLeft: 480 }}>
<Button style={styles.button} title="Recode" onPress={() => { audioStart(); }} />
<Button title="Return" color="#1DCE92" />
<Button title="Exit" color="#841584" />
</View>
</ImageBackground>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment