Skip to content

Commit

Permalink
fixed initialization of localstorage in welcome screen and tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
alx-andru committed Dec 22, 2016
1 parent dc786b4 commit 4c15f95
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.alexandrugogan.recess" version="0.0.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.alexandrugogan.recess" version="0.0.8" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Recess</name>
<description>
A mobile application to collect and visualize fitness related data. Set goals, track your activity and help others achieve their goal.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "recess-app",
"version": "0.0.7",
"version": "0.0.8",
"description": "recess-app: An Ionic project",
"dependencies": {
"gulp": "^3.5.6",
Expand Down
14 changes: 9 additions & 5 deletions www/js/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,18 @@ directives.directive('uiChartActivityToday2', function ($moment, _) {
scope.total = 0;
}

var tempData = [];
_.each(scope.active, function (activeMin) {
tempData.push(60 - activeMin);
});


scope.chart = {
day: {
labels: ['0-1am', '1-2am', '2-3am', '3-4am', '4-5am', '5-6am', '6-7am', '7-8am', '8-9am', '9-10am', '10-11am', '11-12am', '12-1pm', '1-2pm', '2-3pm', '3-4pm', '4-5pm', '5-6pm', '6-7pm', '7-8pm', '8-9pm', '9-10pm', '10-11pm', '11-12pm',],
data: [
scope.active,
[],
tempData,
// goalData,
],
dataset: [
Expand Down Expand Up @@ -823,13 +829,11 @@ directives.directive('uiChartActivityToday3', function ($moment, _) {
}
console.log(tooltip);

if (tooltip.body.length == 2 && tooltip.body[0] !== undefined) {
if (tooltip.body.length == 1 && tooltip.body[0] !== undefined) {
var activeTime = tooltip.body[0].lines[0] || 0;
var sedentaryTime = tooltip.body[1].lines[0] || 60;
//var sedentaryTime = tooltip.body[1].lines[0] || 60;
var timePeriod = tooltip.title;
$('.chart-activity-today-tooltip__display-3').html(activeTime + ' min active between ' + timePeriod);


$('.chart-activity-today-tooltip__display-3').removeClass('chart-activity-today-tooltip__display-2--hidden');

}
Expand Down
34 changes: 21 additions & 13 deletions www/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ services.factory('hash', function ($window) {

services.factory('Permissions', function ($q, $localStorage, Storage) {
var permissions = $localStorage.permissions;
if (permissions === undefined) {
$localStorage.permissions = {fitness: false, notifications: false};
}

var _health = function () {
var deferred = $q.defer();
Expand Down Expand Up @@ -436,19 +439,24 @@ services.service('Fitness', function ($q, $moment) {
// cleanup data to ensure consistency and anonymity
for (var result in results) {
var data = results[result];
if (data.sourceBundleId.toLowerCase().indexOf('pebble') > 0) {
data.sourceName = 'Pebble';
}
if (data.sourceBundleId.toLowerCase().indexOf('apple') > 0) {
data.sourceName = 'Apple';
}
if (data.sourceBundleId.toLowerCase().indexOf('iphone') > 0) {
data.sourceName = 'iPhone';
}
if (data.sourceBundleId.toLowerCase().indexOf('watch') > 0) {
data.sourceName = 'Watch';
if (data.sourceBundleId !== undefined) {
if (data.sourceBundleId.toLowerCase().indexOf('pebble') > 0) {
data.sourceName = 'Pebble';
}
if (data.sourceBundleId.toLowerCase().indexOf('apple') > 0) {
data.sourceName = 'Apple';
}
if (data.sourceBundleId.toLowerCase().indexOf('iphone') > 0) {
data.sourceName = 'iPhone';
}
if (data.sourceBundleId.toLowerCase().indexOf('watch') > 0) {
data.sourceName = 'Watch';
}
delete data.sourceBundleId;
} else {
data.sourceName = 'Android'; //TODO: get deviceinfo and place it here
}
delete data.sourceBundleId;

}

deferred.resolve(results);
Expand Down Expand Up @@ -543,7 +551,7 @@ services.service('Storage', function (_, $localStorage, $moment, hash,
return $firebaseObject(ref);
};

var _device = function() {
var _device = function () {
var ref = _getBaseRef().child('device');
return $firebaseObject(ref);
};
Expand Down

0 comments on commit 4c15f95

Please sign in to comment.