Skip to content

Commit

Permalink
Merge pull request #544 from shankari/release_v281
Browse files Browse the repository at this point in the history
Update plugins for the patch release
  • Loading branch information
shankari authored Mar 29, 2019
2 parents f737509 + 29b3dba commit 363a2bc
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 11 deletions.
6 changes: 3 additions & 3 deletions config.cordovabuild.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="38" id="edu.berkeley.eecs.emission" ios-CFBundleVersion="38" version="2.8.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="39" id="edu.berkeley.eecs.emission" ios-CFBundleVersion="39" version="2.8.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>emission</name>
<description>
A commute pattern tracker and carbon footprint estimator.
Expand Down Expand Up @@ -110,13 +110,13 @@
<preference name="SplashShowOnlyFirstTime" value="false" />
<plugin name="edu.berkeley.eecs.emission.cordova.auth" spec="https://github.com/e-mission/cordova-jwt-auth.git#v1.5.0" />
<plugin name="edu.berkeley.eecs.emission.cordova.comm" spec="https://github.com/e-mission/cordova-server-communication.git#v1.2.0" />
<plugin name="edu.berkeley.eecs.emission.cordova.datacollection" spec="https://github.com/e-mission/e-mission-data-collection.git#v1.3.1">
<plugin name="edu.berkeley.eecs.emission.cordova.datacollection" spec="https://github.com/e-mission/e-mission-data-collection.git#v1.3.2">
<variable name="LOCATION_VERSION" value="11.0.1" />
</plugin>
<plugin name="edu.berkeley.eecs.emission.cordova.serversync" spec="https://github.com/e-mission/cordova-server-sync.git#v1.1.2" />
<plugin name="edu.berkeley.eecs.emission.cordova.settings" spec="https://github.com/e-mission/cordova-connection-settings.git#v1.2.0" />
<plugin name="edu.berkeley.eecs.emission.cordova.transitionnotify" spec="https://github.com/e-mission/e-mission-transition-notify.git#v1.2.0" />
<plugin name="edu.berkeley.eecs.emission.cordova.unifiedlogger" spec="https://github.com/e-mission/cordova-unified-logger.git#v1.3.0" />
<plugin name="edu.berkeley.eecs.emission.cordova.unifiedlogger" spec="https://github.com/e-mission/cordova-unified-logger.git#v1.3.1" />
<plugin name="edu.berkeley.eecs.emission.cordova.usercache" spec="https://github.com/e-mission/cordova-usercache.git#v1.1.0" />
<engine name="ios" spec="^4.5.4" />
<engine name="android" spec="^6.4.0" />
Expand Down
6 changes: 3 additions & 3 deletions package.cordovabuild.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edu.berkeley.eecs.emission",
"version": "2.8.0",
"version": "2.8.1",
"displayName": "emission",
"scripts": {
"setup-serve": "./bin/download_settings_controls.js",
Expand Down Expand Up @@ -62,13 +62,13 @@
"cordova-plugin-whitelist": "~1.3.3",
"cordova-plugin-x-socialsharing": "~5.2.1",
"de.appplant.cordova.plugin.local-notification-ios9-fix": "https://github.com/shankari/cordova-plugin-local-notifications.git",
"e-mission-data-collection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.3.1",
"e-mission-data-collection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.3.2",
"em-cordova-connection-settings": "git+https://github.com/e-mission/cordova-connection-settings.git#v1.2.0",
"em-cordova-jwt-auth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.5.0",
"em-cordova-server-communication": "git+https://github.com/e-mission/cordova-server-communication.git#v1.2.0",
"em-cordova-server-sync": "git+https://github.com/e-mission/cordova-server-sync.git#v1.1.2",
"em-cordova-transition-notify": "git+https://github.com/e-mission/e-mission-transition-notify.git#v1.2.0",
"em-cordova-unified-logger": "git+https://github.com/e-mission/cordova-unified-logger.git#v1.3.0",
"em-cordova-unified-logger": "git+https://github.com/e-mission/cordova-unified-logger.git#v1.3.1",
"em-cordova-usercache": "git+https://github.com/e-mission/cordova-usercache.git#v1.1.0",
"fs-extra": "^5.0.0",
"ionic-plugin-keyboard": "~2.2.1",
Expand Down
62 changes: 57 additions & 5 deletions www/js/control/general-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ angular.module('emission.main.control',['emission.services',
$scope.$apply(function() {
$scope.settings.collect.state = response;
});
return response;
}, function(error) {
$ionicPopup.alert("while reading FSM state, "+error);
$ionicPopup.alert("while getting current state, "+error);
});
};

Expand Down Expand Up @@ -265,13 +266,39 @@ angular.module('emission.main.control',['emission.services',
}
};

var getStartTransitionKey = function() {
if($scope.isAndroid()) {
return "local.transition.exited_geofence";
}
else if($scope.isIOS()) {
return "T_EXITED_GEOFENCE";
}
}

var getEndTransitionKey = function() {
if($scope.isAndroid()) {
return "local.transition.stopped_moving";
}
else if($scope.isIOS()) {
return "T_TRIP_ENDED";
}
}

var getOngoingTransitionState = function() {
if($scope.isAndroid()) {
return "local.state.ongoing_trip";
}
else if($scope.isIOS()) {
return "STATE_ONGOING_TRIP";
}
}

$scope.forceSync = function() {
ClientStats.addEvent(ClientStats.getStatKeys().BUTTON_FORCE_SYNC).then(
function() {
console.log("Added "+ClientStats.getStatKeys().BUTTON_FORCE_SYNC+" event");
});
ControlSyncHelper.forceSync().then(function(response) {
Logger.log("response = "+response);
ControlSyncHelper.forceSync().then(function() {
/*
* Change to sensorKey to "background/location" after fixing issues
* with getLastSensorData and getLastMessages in the usercache
Expand All @@ -285,8 +312,7 @@ angular.module('emission.main.control',['emission.services',
// only have one entry for the battery, which is the one that was
// inserted on the last successful push.
var isTripEnd = function(entry) {
if (entry.metadata.key == "local.transition.stopped_moving" ||
entry.metadata.key == "T_TRIP_ENDED") {
if (entry.metadata.key == getEndTransition()) {
return true;
} else {
return false;
Expand Down Expand Up @@ -317,6 +343,32 @@ angular.module('emission.main.control',['emission.services',
});
};

var getTransition = function(transKey) {
var entry_data = {};
return $scope.getState().then(function(curr_state) {
entry_data.curr_state = curr_state;
if (transKey == getEndTransitionKey()) {
entry_data.curr_state = getOngoingTransitionState();
}
entry_data.transition = transKey;
entry_data.ts = moment().unix();
return entry_data;
})
}

$scope.endForceSync = function() {
/* First, quickly start and end the trip. Let's listen to the promise
* result for start so that we ensure ordering */
var sensorKey = "statemachine/transition";
return getTransition(getStartTransitionKey()).then(function(entry_data) {
return window.cordova.plugins.BEMUserCache.putMessage(sensorKey, entry_data);
}).then(function() {
return getTransition(getEndTransitionKey()).then(function(entry_data) {
return window.cordova.plugins.BEMUserCache.putMessage(sensorKey, entry_data);
})
}).then($scope.forceSync);
}

$scope.forceState = ControlCollectionHelper.forceState;
$scope.editCollectionConfig = ControlCollectionHelper.editConfig;
$scope.editSyncConfig = ControlSyncHelper.editConfig;
Expand Down
4 changes: 4 additions & 0 deletions www/templates/control/main-control.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
<div class="control-list-text">Refresh</div>
<div ng-click="refreshScreen()" class="control-icon-button"><i class="ion-refresh"></i></div>
</div>
<div class="control-list-item">
<div class="control-list-text">End trip + sync</div>
<div ng-click="endForceSync()" class="control-icon-button" ><i class="ion-android-sync"></i></div>
</div>
<div class="control-list-item">
<div class="control-list-text">Check consent</div>
<div ng-click="checkConsent()" class="control-icon-button"><i class="ion-checkmark-circled"></i></div>
Expand Down

0 comments on commit 363a2bc

Please sign in to comment.