diff --git a/README.md b/README.md index 73910e4..960c342 100755 --- a/README.md +++ b/README.md @@ -8,6 +8,14 @@ ![commonroutes](https://raw.githubusercontent.com/arnaucode/commonroutesApp/master/commonroutes.png "commonroutes") + +To check the hash of the current version: +``` +> sha1sum commonroutes.apk +9e20ffa064b304a756badde207e347f8aa5117d7 +``` + + ## Build Add cordova camera plugin diff --git a/comandesUtils.txt b/comandesUtils.txt index c1b0659..52e7913 100755 --- a/comandesUtils.txt +++ b/comandesUtils.txt @@ -9,6 +9,10 @@ export ANDROID_HOME=/home/asus/Android/Sdk/ export PATH=$PATH:$ANDROID_HOME:/home/asus/Android/Sdk/tools export PATH=$PATH:$ANDROID_HOME/home/asus/Android/Sdk/platform-tools +export ANDROID_HOME=/home/xiaomi/Android/Sdk/ +export PATH=$PATH:$ANDROID_HOME:/home/xiaomi/Android/Sdk/tools +export PATH=$PATH:$ANDROID_HOME/home/xiaomi/Android/Sdk/platform-tools + #run android sdk manager tools: cd /home/nau/Android/Sdk/tools diff --git a/package-lock.json b/package-lock.json index 8139587..7df6b15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -736,14 +736,14 @@ } }, "cordova-plugin-camera": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-4.0.2.tgz", - "integrity": "sha1-MJQQkn70Ctxr69Sw6R3yyMZE84o=" + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-4.0.3.tgz", + "integrity": "sha1-c3Olk4MYyGzP2E43E+I4LRD+B2s=" }, "cordova-plugin-console": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/cordova-plugin-console/-/cordova-plugin-console-1.0.7.tgz", - "integrity": "sha1-ibepLtHDNYiN/ADZAtxBcgHPOws=" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-console/-/cordova-plugin-console-1.1.0.tgz", + "integrity": "sha1-4vusECkBeeRMtyxf28QQpTHBzW0=" }, "cordova-plugin-device": { "version": "1.1.7", @@ -756,9 +756,9 @@ "integrity": "sha1-pEj8vpdMprQpiL00VRCdkj1sl2k=" }, "cordova-plugin-splashscreen": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-4.0.3.tgz", - "integrity": "sha1-dzzRNjwfO6y5kBZj6eN5PdPgoZ0=" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-4.1.0.tgz", + "integrity": "sha1-gQKKt2Q+YVWT0n8q0CRFYR8ZRrY=" }, "cordova-plugin-whitelist": { "version": "1.3.3", diff --git a/package.json b/package.json index cd6929c..0cd4fa9 100755 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "description": "app: commonroutes", "dependencies": { "cordova-android": "7.0.0", - "cordova-plugin-camera": "^4.0.2", - "cordova-plugin-console": "^1.0.7", + "cordova-plugin-camera": "^4.0.3", + "cordova-plugin-console": "^1.1.0", "cordova-plugin-device": "^1.1.7", "cordova-plugin-inappbrowser": "^2.0.2", - "cordova-plugin-splashscreen": "^4.0.3", + "cordova-plugin-splashscreen": "^4.1.0", "cordova-plugin-whitelist": "^1.3.3", "gulp": "^3.5.6", "gulp-concat": "^2.2.0", @@ -45,4 +45,4 @@ "android" ] } -} +} \ No newline at end of file diff --git a/releases/commonroutes.apk b/releases/commonroutes.apk index 2733448..e4694b0 100644 Binary files a/releases/commonroutes.apk and b/releases/commonroutes.apk differ diff --git a/www/index.html b/www/index.html index 435a1e0..f9eb98e 100755 --- a/www/index.html +++ b/www/index.html @@ -42,6 +42,7 @@ + diff --git a/www/js/app.js b/www/js/app.js index 8b55091..bb70086 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -23,6 +23,7 @@ angular.module('starter', [ 'app.search', 'app.travels', 'app.travel', + 'app.editTravel', 'app.newTravel', 'app.offerCar', 'app.askForCar', @@ -120,7 +121,15 @@ angular.module('starter', [ } } }) - + .state('app.editTravel', { + url: '/editTravel/:travelid', + views: { + 'menuContent': { + templateUrl: 'templates/editTravel.html', + controller: 'EditTravelCtrl' + } + } + }) .state('app.newTravel', { url: '/newTravel', views: { diff --git a/www/js/editTravel.js b/www/js/editTravel.js new file mode 100644 index 0000000..73e0840 --- /dev/null +++ b/www/js/editTravel.js @@ -0,0 +1,103 @@ +angular.module('app.editTravel', ['pascalprecht.translate', 'ui-leaflet']) + +.controller('EditTravelCtrl', function($scope, $stateParams, $translate, + $http, $filter, $ionicLoading) { + $scope.center = {}; + $scope.bounds = {}; + $scope.markers = []; + $scope.tiles= { + url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + options: { + attribution: 'OpenStreetMap contributors' + } + }; + $scope.travel={}; + // get the travel + $http.get(urlapi + 'travels/id/' + $stateParams.travelid) + .then(function(data) { + console.log('data success travels'); + console.log(data); // for browser console + $scope.travel = data.data; // for UI + $scope.travel.date = new Date($scope.travel.date); + $scope.markers = []; + $scope.markers.push({ + lat: Number($scope.travel.from.lat), + lng: Number($scope.travel.from.long), + message: $scope.travel.from.name + }); + $scope.markers.push({ + lat: Number($scope.travel.to.lat), + lng: Number($scope.travel.to.long), + message: $scope.travel.to.name + }); + $scope.center = { + lat: (Number($scope.travel.from.lat) + Number($scope.travel.to.lat)) / 2, + lng: (Number($scope.travel.from.long) + Number($scope.travel.to.long)) / 2, + zoom: 4 + }; + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + }, function(data) { + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + $ionicLoading.show({ + template: 'Error connecting server', + noBackdrop: true, + duration: 2000 + }); + }); + + $scope.updateTravel =function(){ + $http({ + url: urlapi + 'travels/id/modify/' + $scope.travel._id, + method: "PUT", + data: $scope.travel + }) + .then(function(data) { + console.log(data); + + window.location="#app/travels/" + $scope.travel._id; + }, + function(data) { // optional + // failed + console.log(data); + $ionicLoading.show({ template: 'Error updating travel. ' + data.data, noBackdrop: true, duration: 2000 }); + + }); + }; + $scope.getGeo = function(){ + + $scope.markers=[]; + console.log($scope.travel.from.name); + console.log($scope.travel.to.name); + $http.get('https://nominatim.openstreetmap.org/search?q=' + $scope.travel.from.name + '&format=json&limit=1') + .then(function(data) { + console.log(data); + if(data.data[0]) + { + $scope.travel.from.lat=data.data[0].lat; + $scope.travel.from.long=data.data[0].lon; + $scope.travel.from.name=data.data[0].display_name; + $scope.markers.push({ + lat: Number(data.data[0].lat), + lng: Number(data.data[0].lon), + message: data.data[0].display_name + }); + } + $http.get('https://nominatim.openstreetmap.org/search?q=' + $scope.travel.to.name + '&format=json&limit=1') + .then(function(data) { + if(data.data[0]) + { + $scope.travel.to.lat=data.data[0].lat; + $scope.travel.to.long=data.data[0].lon; + $scope.travel.to.name=data.data[0].display_name; + $scope.markers.push({ + lat: Number(data.data[0].lat), + lng: Number(data.data[0].lon), + message: data.data[0].display_name + }); + } + }); + }); + + }; +}); diff --git a/www/js/travel.js b/www/js/travel.js index 70cbd0d..f1eb0e8 100755 --- a/www/js/travel.js +++ b/www/js/travel.js @@ -285,6 +285,10 @@ angular.module('app.travel', ['pascalprecht.translate', 'ui-leaflet']) //console.log("i: -1"); return -1; }; + $scope.openTravelLink = function(travelid) { + window.open('http://routes.fair.coop/app/#!/travel/' + travelid, '_system', 'location=yes'); + return false; + }; $scope.openTelegram = function(telegramuser) { window.open('http://telegram.me/' + telegramuser, '_system', 'location=yes'); return false; diff --git a/www/templates/editTravel.html b/www/templates/editTravel.html new file mode 100644 index 0000000..38fb9bb --- /dev/null +++ b/www/templates/editTravel.html @@ -0,0 +1,58 @@ + + +
+ +
+ + +
+
+ {{'Get_positions' | translate}} + + + +
+ + + + + + + {{'Can_carry_package' | translate}} + + + {{'Collectivized_car' | translate}} + + +

+ + {{'Update Travel' | translate}} + +

+
+
+
diff --git a/www/templates/travel.html b/www/templates/travel.html index 119640d..40dfc55 100755 --- a/www/templates/travel.html +++ b/www/templates/travel.html @@ -13,9 +13,13 @@

- + + + +