Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
21_22-J 38
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
21_22-J 38
21_22-J 38
Commits
eef3fe0a
Commit
eef3fe0a
authored
May 01, 2022
by
Lihinikaduwa D.N.R.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created reading session
parent
46256e77
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
103 additions
and
93 deletions
+103
-93
API/__pycache__/app.cpython-39.pyc
API/__pycache__/app.cpython-39.pyc
+0
-0
API/app.py
API/app.py
+15
-10
frontend/src/component/reading/ReadCategory.js
frontend/src/component/reading/ReadCategory.js
+1
-2
frontend/src/screen/Read.js
frontend/src/screen/Read.js
+0
-3
frontend/src/screen/Start.js
frontend/src/screen/Start.js
+50
-50
frontend/src/screen/auth/Login.js
frontend/src/screen/auth/Login.js
+2
-0
frontend/src/screen/reading/ReadActivity.js
frontend/src/screen/reading/ReadActivity.js
+4
-0
frontend/src/screen/reading/advanced/ReadActivityBird.js
frontend/src/screen/reading/advanced/ReadActivityBird.js
+30
-27
frontend/src/screen/report.js
frontend/src/screen/report.js
+1
-1
No files found.
API/__pycache__/app.cpython-39.pyc
View file @
eef3fe0a
No preview for this file type
API/app.py
View file @
eef3fe0a
...
...
@@ -134,14 +134,14 @@ def login():
userId
=
user
[
0
]
if
userId
==
0
:
data
=
{
"
body
"
:
[],
"
userId
"
:
[],
"message"
:
"Failed"
,
"status"
:
404
}
else
:
token
=
saveUserSession
(
userId
)
data
=
{
"body"
:
user
,
"body"
:
user
Id
,
"token"
:
token
,
"message"
:
"Success"
,
"status"
:
200
...
...
@@ -156,11 +156,11 @@ def logout():
req
=
request
.
get_json
()
token
=
req
[
'token'
]
if
(
logoutUser
(
token
)
==
1
):
data
=
{
response
=
{
"message"
:
"Success"
,
"status"
:
200
}
body
=
jsonify
(
data
)
body
=
jsonify
(
response
)
return
make_response
(
body
)
...
...
@@ -169,25 +169,30 @@ def reading_session():
req
=
request
.
get_json
()
userId
=
req
[
'userId'
]
token
=
save_session_details
(
userId
,
1
)
data
=
{
response
=
{
"token"
:
token
,
"message"
:
"Success"
,
"status"
:
200
}
body
=
jsonify
(
data
)
body
=
jsonify
(
response
)
return
make_response
(
body
)
@
app
.
route
(
"/reading"
,
methods
=
[
'POST'
])
def
reading
():
@
app
.
route
(
"/reading/<readingToken>"
,
methods
=
[
'POST'
])
def
reading
(
readingToken
):
assert
readingToken
==
request
.
view_args
[
'readingToken'
]
token
=
readingToken
req
=
request
.
get_json
()
word
=
req
[
'word'
]
userId
=
req
[
'userId'
]
token
=
req
[
'token'
]
level
=
req
[
'level'
]
triedCount
=
req
[
'triedCount'
]
result
=
save_activity_details
(
userId
,
word
,
token
,
level
,
triedCount
)
body
=
jsonify
(
word
)
response
=
{
"message"
:
"Success"
,
"status"
:
200
}
body
=
jsonify
(
response
)
return
make_response
(
body
)
...
...
frontend/src/component/reading/ReadCategory.js
View file @
eef3fe0a
...
...
@@ -33,11 +33,10 @@ const ReadCategory = props => {
console
.
log
(
res
.
data
);
const
token
=
res
.
data
.
token
;
try
{
AsyncStorage
.
setItem
(
'
toke
n
'
,
token
);
AsyncStorage
.
setItem
(
'
readingSessio
n
'
,
token
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
navigation
.
navigate
(
path
);
}
})
...
...
frontend/src/screen/Read.js
View file @
eef3fe0a
...
...
@@ -51,19 +51,16 @@ export default function Read() {
</View> */
}
<
TouchableOpacity
style
=
{
styles
.
screen
}
>
<
ReadCategory
id
=
{
1
}
title
=
{
'
Basic
'
}
image
=
{
ImagePaths
.
roundOne
}
path
=
{
'
ReadActivity
'
}
/
>
<
ReadCategory
id
=
{
1
}
title
=
{
'
Advanced
'
}
image
=
{
ImagePaths
.
roundTwo
}
path
=
{
'
ReadActivityBird
'
}
/
>
<
ReadCategory
id
=
{
1
}
title
=
{
'
Result & Summery
'
}
image
=
{
ImagePaths
.
summery
}
path
=
{
'
ReadActivity
'
}
...
...
frontend/src/screen/Start.js
View file @
eef3fe0a
import
React
from
"
react
"
;
import
{
SafeAreaView
,
ScrollView
,
View
,
Text
}
from
"
react-native
"
;
import
{
SafeAreaView
,
ScrollView
,
View
,
Text
,
Button
}
from
'
react-native
'
;
import
{
NavigationContainer
}
from
"
@react-navigation/native
"
;
import
{
createDrawerNavigator
,
DrawerItem
}
from
"
@react-navigation/drawer
"
;
import
FontAwesome5
from
'
react-native-vector-icons/FontAwesome5
'
;
...
...
@@ -7,70 +7,70 @@ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import
Home
from
"
./home
"
;
import
profile
from
"
./profile
"
;
import
report
from
"
./report
"
;
import
Login
from
"
./auth/Login
"
;
const
Drawer
=
createDrawerNavigator
();
function
Start
()
{
return
(
<
Drawer
.
Navigator
<
Drawer
.
Navigator
initialRouteName
=
"
Home
"
screenOptions
=
{{
hearderTitleAlign
:
'
right
'
,
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
,
headerStyle
:{
backgroundColor
:
'
#1DCE92
'
headerStyle
:
{
backgroundColor
:
'
#1DCE92
'
,
},
headerTintColor
:
'
#ffffff
'
headerTintColor
:
'
#ffffff
'
,
}}
>
<
Drawer
.
Screen
name
=
"
Home
"
component
=
{
Home
}
options
=
{{
title
:
'
Home
'
,
drawerIcon
:
({
focused
})
=>
(
<
FontAwesome5
name
=
"
home
"
size
=
{
focused
?
25
:
20
}
color
=
{
focused
?
'
#1DCE92
'
:
'
#0096FF
'
}
/
>
)
}}
/
>
<
Drawer
.
Screen
name
=
"
Home
"
component
=
{
Home
}
options
=
{{
title
:
'
Home
'
,
drawerIcon
:
({
focused
})
=>
(
<
FontAwesome5
name
=
"
home
"
size
=
{
focused
?
25
:
20
}
color
=
{
focused
?
'
#1DCE92
'
:
'
#0096FF
'
}
/
>
),
}}
/
>
<
Drawer
.
Screen
name
=
"
Profile
"
component
=
{
profile
}
options
=
{{
title
:
'
Profile
'
,
drawerIcon
:
({
focused
})
=>
(
<
FontAwesome5
name
=
"
users
"
size
=
{
focused
?
25
:
20
}
color
=
{
focused
?
'
#1DCE92
'
:
'
#0096FF
'
}
/
>
)
}}
/
>
<
Drawer
.
Screen
name
=
"
Report
"
component
=
{
report
}
options
=
{{
title
:
'
Report
'
,
drawerIcon
:
({
focused
})
=>
(
<
FontAwesome5
name
=
"
chart-line
"
size
=
{
focused
?
25
:
20
}
color
=
{
focused
?
'
#1DCE92
'
:
'
#0096FF
'
}
/
>
)
}}
/
>
<
/Drawer.Navigator
>
<
Drawer
.
Screen
name
=
"
Profile
"
component
=
{
profile
}
options
=
{{
title
:
'
Profile
'
,
drawerIcon
:
({
focused
})
=>
(
<
FontAwesome5
name
=
"
users
"
size
=
{
focused
?
25
:
20
}
color
=
{
focused
?
'
#1DCE92
'
:
'
#0096FF
'
}
/
>
),
}}
/
>
<
Drawer
.
Screen
name
=
"
Report
"
component
=
{
report
}
options
=
{{
title
:
'
Report
'
,
drawerIcon
:
({
focused
})
=>
(
<
FontAwesome5
name
=
"
chart-line
"
size
=
{
focused
?
25
:
20
}
color
=
{
focused
?
'
#1DCE92
'
:
'
#0096FF
'
}
/
>
),
}}
/
>
<
/Drawer.Navigator
>
);
}
...
...
frontend/src/screen/auth/Login.js
View file @
eef3fe0a
...
...
@@ -98,7 +98,9 @@ const Login = () => {
}
if
(
response
.
data
.
status
==
200
)
{
const
userToken
=
res
.
data
.
token
;
const
userId
=
res
.
data
.
userId
;
AsyncStorage
.
setItem
(
'
userToken
'
,
userToken
);
AsyncStorage
.
setItem
(
'
userId
'
,
userId
);
return
navigation
.
navigate
(
'
Start
'
);
}
})
...
...
frontend/src/screen/reading/ReadActivity.js
View file @
eef3fe0a
...
...
@@ -24,6 +24,10 @@ export default function ReadActivity() {
const
[
results
,
setResults
]
=
useState
([]);
const
[
partialResults
,
setPartialResults
]
=
useState
([]);
useEffect
(()
=>
{
Voice
.
destroy
().
then
(
Voice
.
removeAllListeners
);
},
[]);
useEffect
(()
=>
{
Voice
.
onSpeechStart
=
onSpeechStartHandler
;
Voice
.
onSpeechEnd
=
onSpeechEndHandler
;
...
...
frontend/src/screen/reading/advanced/ReadActivityBird.js
View file @
eef3fe0a
...
...
@@ -21,11 +21,12 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
import
{
Authorize
}
from
'
../../auth/AuthenticateUser
'
;
export
default
function
ReadActivityBird
()
{
const
userToken
=
Authorize
();
// const userToken = Authorize();
const
navigation
=
useNavigation
();
const
[
error
,
setError
]
=
useState
(
''
);
const
[
readingData
,
setReadingData
]
=
useState
({
activity
:
''
});
const
readToken
=
AsyncStorage
.
getItem
(
'
readingSession
'
);
// let user = AsyncStorage.getItem('readingSession');
// useEffect(() => {
// if (Authorize) {
// }
...
...
@@ -42,15 +43,33 @@ export default function ReadActivityBird() {
};
},
[]);
useEffect
(()
=>
{
AsyncStorage
.
getItem
(
'
token
'
)
.
then
(
value
=>
{
console
.
log
(
value
);
const
getToken
=
data
=>
{
AsyncStorage
.
getItem
(
'
readingSession
'
)
.
then
(
readingSession
=>
{
sendRedingData
(
data
,
readingSession
);
})
.
catch
(
error
=>
{
console
.
log
(
error
);
});
},
[]);
};
const
sendRedingData
=
(
data
,
readingSession
)
=>
{
console
.
log
(
'
itemValue
'
,
data
);
Client
.
post
(
'
reading/
'
+
readingSession
,
JSON
.
stringify
(
data
),
{
headers
:
{
Accept
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
})
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
navigation
.
navigate
(
'
ReadActivity
'
);
})
.
catch
(
error
=>
{
console
.
log
(
error
);
});
};
const
onSpeechStartHandler
=
e
=>
{
console
.
log
(
'
start handler =>>
'
,
e
);
...
...
@@ -65,20 +84,19 @@ export default function ReadActivityBird() {
};
const
onSpeechError
=
e
=>
{
console
.
log
(
'
onSpeechError:
'
,
e
);
setError
(
JSON
.
stringify
(
e
.
error
));
const
result
=
DummyReadResult
.
value
;
const
data
=
{
word
:
'
bird
'
,
userId
:
1
,
token
:
readToken
,
level
:
1
,
triedCount
:
1
,
};
if
(
result
.
includes
(
'
hello
'
))
{
setReadingData
(
data
);
console
.
log
(
localStorage
.
getItem
(
'
readingSession
'
));
sendRedingData
(
data
);
console
.
log
(
'
data
'
,
getToken
());
console
.
log
(
'
readingData:
'
,
readingData
);
getToken
(
data
);
}
};
...
...
@@ -90,21 +108,6 @@ export default function ReadActivityBird() {
}
};
const
sendRedingData
=
data
=>
{
Client
.
post
(
'
reading
'
,
JSON
.
stringify
(
data
),
{
headers
:
{
Accept
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
})
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
})
.
catch
(
error
=>
{
console
.
log
(
error
);
});
};
return
(
<
SafeAreaView
>
<
View
style
=
{{
flexDirection
:
'
column
'
}}
>
...
...
frontend/src/screen/report.js
View file @
eef3fe0a
...
...
@@ -9,7 +9,7 @@ export default function report({ navigation }){
return
(
<
View
>
<
Text
>
report
<
/Text
>
<
/View
>
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment