Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-045
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
2020-045
2020-045
Commits
3d526459
Commit
3d526459
authored
Jan 10, 2021
by
Boteju W.J.M.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10/01
parent
de6eccf5
Pipeline
#2058
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
14 deletions
+55
-14
fitnessapp/lib/Screens/Home/MainHome.dart
fitnessapp/lib/Screens/Home/MainHome.dart
+39
-13
fitnessapp/lib/Screens/WalkingPatternRecognition/service.dart
...essapp/lib/Screens/WalkingPatternRecognition/service.dart
+16
-1
No files found.
fitnessapp/lib/Screens/Home/MainHome.dart
View file @
3d526459
...
@@ -22,7 +22,7 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -22,7 +22,7 @@ class _ProfilePageState extends State<ProfilePage> {
int
sliderValue
=
1
;
int
sliderValue
=
1
;
static
dynamic
value
=
[];
static
dynamic
value
=
[];
int
walkingHrs
,
walkingMins
,
runningHrs
,
runningMins
;
int
walkingHrs
,
walkingMins
,
runningHrs
,
runningMins
,
restingHrs
,
restingMins
;
int
totalActivityHrs
=
0
;
int
totalActivityHrs
=
0
;
int
totalActivityMins
=
0
;
int
totalActivityMins
=
0
;
int
_currentStrength
;
int
_currentStrength
;
...
@@ -62,7 +62,7 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -62,7 +62,7 @@ class _ProfilePageState extends State<ProfilePage> {
finalDate
=
formattedDate
.
toString
();
finalDate
=
formattedDate
.
toString
();
dogBirthday
=
dogBirthdayAge
.
toString
();
dogBirthday
=
dogBirthdayAge
.
toString
();
globals
.
age
=
dogBirthdayAge
;
globals
.
age
=
dogBirthdayAge
;
dogName
=
globals
.
dogName
;
dogName
=
globals
.
dogName
;
});
});
getTotalWalkingMinutes
(
datee
,
dog
);
getTotalWalkingMinutes
(
datee
,
dog
);
}
}
...
@@ -92,7 +92,7 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -92,7 +92,7 @@ class _ProfilePageState extends State<ProfilePage> {
}
}
getTotalRunningMinutes
(
day
,
dog
)
async
{
getTotalRunningMinutes
(
day
,
dog
)
async
{
print
(
"
Hereee i
n run"
);
print
(
"
I
n run"
);
SearchService
.
getTotalRunningMinutesPerDay
(
day
,
dog
).
then
((
responseBody
)
{
SearchService
.
getTotalRunningMinutesPerDay
(
day
,
dog
).
then
((
responseBody
)
{
dynamic
data
=
jsonDecode
(
responseBody
);
dynamic
data
=
jsonDecode
(
responseBody
);
setState
(()
{
setState
(()
{
...
@@ -118,6 +118,26 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -118,6 +118,26 @@ class _ProfilePageState extends State<ProfilePage> {
int
totalTime
=
(
totalActivityHrs
*
60
)
+
totalActivityMins
;
int
totalTime
=
(
totalActivityHrs
*
60
)
+
totalActivityMins
;
compare
(
globals
.
dogBreed
,
totalTime
);
compare
(
globals
.
dogBreed
,
totalTime
);
getTotalRestingMinutes
(
day
,
globals
.
dogId
);
});
});
}
getTotalRestingMinutes
(
day
,
dog
)
async
{
print
(
"In Rest"
);
SearchService
.
getTotalRestingMinutesPerDay
(
day
,
dog
).
then
((
responseBody
)
{
dynamic
data
=
jsonDecode
(
responseBody
);
setState
(()
{
value
=
data
[
0
][
'minutes per day'
];
print
(
value
);
if
(
value
!=
0
)
{
value
=
value
.
toInt
();
restingHrs
=
value
~/
60
;
restingMins
=
value
%
60
;
}
else
{
restingHrs
=
0
;
restingMins
=
0
;
}
});
});
});
});
}
}
...
@@ -134,11 +154,10 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -134,11 +154,10 @@ class _ProfilePageState extends State<ProfilePage> {
sliderValue
=
3
;
sliderValue
=
3
;
}
}
globals
.
status
=
data
[
'status'
];
globals
.
status
=
data
[
'status'
];
status
=
globals
.
status
;
status
=
globals
.
status
;
globals
.
sliderValue
=
sliderValue
;
globals
.
sliderValue
=
sliderValue
;
loading
=
false
;
loading
=
false
;
_showNotification
();
_showNotification
();
});
});
});
});
}
}
...
@@ -155,11 +174,10 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -155,11 +174,10 @@ class _ProfilePageState extends State<ProfilePage> {
fltrNotification
.
initialize
(
initilizationsSettings
,
fltrNotification
.
initialize
(
initilizationsSettings
,
onSelectNotification:
notificationSelected
);
onSelectNotification:
notificationSelected
);
getTotalActivityMinutesPerDay
(
globals
.
birthday
,
globals
.
dogId
);
getTotalActivityMinutesPerDay
(
globals
.
birthday
,
globals
.
dogId
);
}
}
Future
_showNotification
()
async
{
Future
_showNotification
()
async
{
final
String
currentTimeZone
=
final
String
currentTimeZone
=
await
FlutterNativeTimezone
.
getLocalTimezone
();
await
FlutterNativeTimezone
.
getLocalTimezone
();
tz
.
initializeTimeZones
();
tz
.
initializeTimeZones
();
...
@@ -172,16 +190,23 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -172,16 +190,23 @@ class _ProfilePageState extends State<ProfilePage> {
var
generalNotificationDetails
=
var
generalNotificationDetails
=
new
NotificationDetails
(
android:
androidDetails
,
iOS:
iSODetails
);
new
NotificationDetails
(
android:
androidDetails
,
iOS:
iSODetails
);
// await fltrNotification.periodicallyShow(
// 1,
// 'Dog Status',
// "$dogName's activity level is $status",
// RepeatInterval.everyMinute,
// generalNotificationDetails,
// androidAllowWhileIdle: true);
await
fltrNotification
.
periodicallyShow
(
await
fltrNotification
.
periodicallyShow
(
1
,
1
,
'Dog Status'
,
'Dog Status'
,
"
$dogName
's activity level is
$status
"
,
"
$dogName
resting level is low
"
,
RepeatInterval
.
everyMinute
,
RepeatInterval
.
everyMinute
,
generalNotificationDetails
,
generalNotificationDetails
,
androidAllowWhileIdle:
true
);
androidAllowWhileIdle:
true
);
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
loading
return
loading
...
@@ -260,7 +285,8 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -260,7 +285,8 @@ class _ProfilePageState extends State<ProfilePage> {
TableRow
(
TableRow
(
children:
[
children:
[
ProfileInfoBigCard
(
ProfileInfoBigCard
(
firstText:
"0 hrs 0 mins"
,
firstText:
"
$restingHrs
hr
$restingMins
mins"
,
secondText:
"Resting"
,
secondText:
"Resting"
,
activity:
3
,
activity:
3
,
icon:
Image
.
asset
(
icon:
Image
.
asset
(
...
@@ -269,7 +295,7 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -269,7 +295,7 @@ class _ProfilePageState extends State<ProfilePage> {
),
),
),
),
ProfileInfoBigCard
(
ProfileInfoBigCard
(
firstText:
"
0 hrs 0 mins
"
,
firstText:
""
,
activity:
4
,
activity:
4
,
secondText:
"Barking"
,
secondText:
"Barking"
,
icon:
Image
.
asset
(
icon:
Image
.
asset
(
...
@@ -292,7 +318,7 @@ class _ProfilePageState extends State<ProfilePage> {
...
@@ -292,7 +318,7 @@ class _ProfilePageState extends State<ProfilePage> {
);
);
}
}
Future
notificationSelected
(
String
payload
)
async
{
Future
notificationSelected
(
String
payload
)
async
{
showDialog
(
showDialog
(
context:
context
,
context:
context
,
builder:
(
context
)
=>
AlertDialog
(
builder:
(
context
)
=>
AlertDialog
(
...
...
fitnessapp/lib/Screens/WalkingPatternRecognition/service.dart
View file @
3d526459
...
@@ -85,7 +85,6 @@ class SearchService {
...
@@ -85,7 +85,6 @@ class SearchService {
body:
body
)
body:
body
)
.
then
((
http
.
Response
response
)
{
.
then
((
http
.
Response
response
)
{
return
response
;
return
response
;
});
});
return
response
.
body
;
return
response
.
body
;
...
@@ -195,6 +194,22 @@ class SearchService {
...
@@ -195,6 +194,22 @@ class SearchService {
return
response
.
body
;
return
response
.
body
;
}
}
static
Future
<
String
>
getTotalRestingMinutesPerDay
(
day
,
dog
)
async
{
String
url
=
'
$ip
/getTotalMinutesPerDay'
;
var
body
=
jsonEncode
({
"activity"
:
0
,
"dog"
:
dog
,
"date"
:
day
});
http
.
Response
response
=
await
http
.
post
(
url
,
headers:
{
"Content-Type"
:
"application/json"
,
'authorization'
:
basicAuth
},
body:
body
)
.
then
((
http
.
Response
response
)
{
return
response
;
});
return
response
.
body
;
}
static
Future
<
String
>
getHighlightsPerDay
(
date
)
async
{
static
Future
<
String
>
getHighlightsPerDay
(
date
)
async
{
String
url
=
'
$ip
/highlightsPerDay'
;
String
url
=
'
$ip
/highlightsPerDay'
;
var
body
=
jsonEncode
(
var
body
=
jsonEncode
(
...
...
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