diff --git a/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock b/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock index dabb3d1..1780468 100644 Binary files a/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock and b/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock differ diff --git a/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin b/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin index 95fd229..50ff9bb 100644 Binary files a/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin and b/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin differ diff --git a/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin b/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin index 45ad796..76a2893 100644 Binary files a/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin and b/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin differ diff --git a/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin b/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin index 976e227..7dd13da 100644 Binary files a/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin and b/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin differ diff --git a/platforms/android/assets/www/js/controllers.js b/platforms/android/assets/www/js/controllers.js index 18fe355..d268c1c 100644 --- a/platforms/android/assets/www/js/controllers.js +++ b/platforms/android/assets/www/js/controllers.js @@ -1,6 +1,6 @@ angular.module('starter.controllers', []) -.controller('DashCtrl', function($scope,$ionicPopup,$http, $database, $timeout,$rootScope, $cordovaFileTransfer) { +.controller('DashCtrl', function($scope,$ionicPopup,$http, $database, $timeout,$rootScope, $cordovaFileTransfer,$cordovaFile) { $scope.preis=""; $scope.name=""; @@ -8,9 +8,6 @@ angular.module('starter.controllers', []) $scope.items=[]; $scope.item=[]; - //db = Database.getDb(); - - //$scope.items=$localstorage.getObject('items'); $scope.validate = function() { @@ -52,28 +49,11 @@ angular.module('starter.controllers', []) }; function successBuyHandler (result) { - /* - var strResult = ""; - if(typeof result === 'object') { - strResult = JSON.stringify(result); - } else { - strResult = result; - } - alert("SUCCESS: \r\n"+strResult ); - */ $timeout(consumesuccessHandler, 1000); } function successConsumeHandler (result) { - /* - var strResult = ""; - if(typeof result === 'object') { - strResult = JSON.stringify(result); - } else { - strResult = result; - } - alert("SUCCESS: \r\n"+strResult ); - */ + var link = 'http://api.raataar.de/rosen/kauf.php'; $http.post(link, {name : $scope.name, freitext: $scope.freitext, rosen: $scope.preis}).then(function (res){ @@ -82,25 +62,43 @@ angular.module('starter.controllers', []) // File for download var url = "http://api.raataar.de/rosen/" + $scope.filetodownload; - alert(url); // File name only var filename = url.split("/").pop(); - alert(filename); // Save location //var targetPath = cordova.file.externalRootDirectory + filename; var targetPath = cordova.file.applicationStorageDirectory + filename; + var targetpublicPath = cordova.file.externalRootDirectory + "/WolleRosenKaufen/" + filename; - alert(targetPath); $scope.targetPath=''; $scope.targetPath=targetPath; + $scope.targetpublicPath=targetpublicPath; + + $scope.filename=filename; + $cordovaFileTransfer.download(url, targetPath, {}, true).then(function (result) { - $scope.item={name: $scope.name, bild: $scope.targetPath}; + $scope.item={name: $scope.name, bild: $scope.targetpublicPath}; $scope.items.push($scope.item); - alert ($scope.targetPath); - $database.setBuys($scope.name,$scope.targetPath); + //itemName,itemBild,itemBildtext,itemKaufdatum,itemappimgpath,itemappimgpublicpath + $database.setBuys($scope.name,$scope.filename,$scope.freitext,'','', $scope.targetpublicPath); + //Ordner erstellen auf SD-Karte + $cordovaFile.createDir(cordova.file.externalRootDirectory, "WolleRosenKaufen", false) + .then(function (success) { + // success + }, function (error) { + // error + }); + + $cordovaFile.copyFile(cordova.file.applicationStorageDirectory, $scope.filename, cordova.file.externalRootDirectory + "/WolleRosenKaufen", $scope.filename) + .then(function (success) { + // success + }, function (error) { + // error + }); + + }, function (error) { console.log('Error'); @@ -116,6 +114,17 @@ angular.module('starter.controllers', []) } function errorBuyHandler (error) { + /* + var strResult = ""; + if(typeof error === 'object') { + strResult = JSON.stringify(error); + } else { + strResult = error; + } + alert("Feher: \r\n"+strResult ); + */ + + var alertPopup = $ionicPopup.alert({ title: 'Oh Nein', template: 'Der Kauf konnte nicht durchgeführt werden.' @@ -144,12 +153,13 @@ angular.module('starter.controllers', []) $scope.buyRose = function() { - //alert($scope.preis); if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") { if ($rootScope.storeinit==1){ - inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis); + //Wegenbug ausgehebelt + //inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis); + successConsumeHandler(); } else{ var alertPopup = $ionicPopup.alert({ diff --git a/platforms/android/assets/www/js/services.js b/platforms/android/assets/www/js/services.js index de43673..11cef67 100644 --- a/platforms/android/assets/www/js/services.js +++ b/platforms/android/assets/www/js/services.js @@ -61,9 +61,9 @@ angular.module('starter.services', []) console.log('Database opened'); return self.db; }, - setBuys: function(itemName,itemBild) { - query="INSERT INTO buys (Name, Bild) VALUES (?,?);"; - return $cordovaSQLite.execute(self.db,query,[itemName,itemBild]). + setBuys: function(itemName,itemBild,itemBildtext,itemKaufdatum,itemappimgpath,itemappimgpublicpath) { + query="INSERT INTO buys (Name, Bild, Bildtext, Kaufdatum, appimgpath, appimgpublicpath) VALUES (?,?,?,?,?,?);"; + return $cordovaSQLite.execute(self.db,query,[itemName,itemBild,itemBildtext,itemKaufdatum,itemappimgpath,itemappimgpublicpath]). then(function(result) { console.log("Gespeichert"); query=null; @@ -81,6 +81,10 @@ angular.module('starter.services', []) //console.log(result.rows.item(j)); List.name=result.rows.item(j).Name; List.bild=result.rows.item(j).Bild; + List.bildtext=result.rows.item(j).Bildtext; + List.kaufdatum=result.rows.item(j).Kaufdatum; + List.appimgpath=result.rows.item(j).appimgpath; + List.appimgpublicpath=result.rows.item(j).appimgpublicpath; ArrayQ.push(List); } //console.log(ArrayQ); diff --git a/platforms/android/assets/www/raataar_wrk.db b/platforms/android/assets/www/raataar_wrk.db index d9ea0b2..63f09fc 100644 Binary files a/platforms/android/assets/www/raataar_wrk.db and b/platforms/android/assets/www/raataar_wrk.db differ diff --git a/platforms/android/assets/www/templates/tab-buys.html b/platforms/android/assets/www/templates/tab-buys.html index 7cf44a5..d4e3e18 100644 --- a/platforms/android/assets/www/templates/tab-buys.html +++ b/platforms/android/assets/www/templates/tab-buys.html @@ -9,12 +9,12 @@
-
-

{{i.name}}

+
+

{{i.name}}

- {{i.freitext}} +
{{i.bildtext}}
diff --git a/platforms/android/build/intermediates/assets/debug/www/js/controllers.js b/platforms/android/build/intermediates/assets/debug/www/js/controllers.js index 18fe355..d268c1c 100644 --- a/platforms/android/build/intermediates/assets/debug/www/js/controllers.js +++ b/platforms/android/build/intermediates/assets/debug/www/js/controllers.js @@ -1,6 +1,6 @@ angular.module('starter.controllers', []) -.controller('DashCtrl', function($scope,$ionicPopup,$http, $database, $timeout,$rootScope, $cordovaFileTransfer) { +.controller('DashCtrl', function($scope,$ionicPopup,$http, $database, $timeout,$rootScope, $cordovaFileTransfer,$cordovaFile) { $scope.preis=""; $scope.name=""; @@ -8,9 +8,6 @@ angular.module('starter.controllers', []) $scope.items=[]; $scope.item=[]; - //db = Database.getDb(); - - //$scope.items=$localstorage.getObject('items'); $scope.validate = function() { @@ -52,28 +49,11 @@ angular.module('starter.controllers', []) }; function successBuyHandler (result) { - /* - var strResult = ""; - if(typeof result === 'object') { - strResult = JSON.stringify(result); - } else { - strResult = result; - } - alert("SUCCESS: \r\n"+strResult ); - */ $timeout(consumesuccessHandler, 1000); } function successConsumeHandler (result) { - /* - var strResult = ""; - if(typeof result === 'object') { - strResult = JSON.stringify(result); - } else { - strResult = result; - } - alert("SUCCESS: \r\n"+strResult ); - */ + var link = 'http://api.raataar.de/rosen/kauf.php'; $http.post(link, {name : $scope.name, freitext: $scope.freitext, rosen: $scope.preis}).then(function (res){ @@ -82,25 +62,43 @@ angular.module('starter.controllers', []) // File for download var url = "http://api.raataar.de/rosen/" + $scope.filetodownload; - alert(url); // File name only var filename = url.split("/").pop(); - alert(filename); // Save location //var targetPath = cordova.file.externalRootDirectory + filename; var targetPath = cordova.file.applicationStorageDirectory + filename; + var targetpublicPath = cordova.file.externalRootDirectory + "/WolleRosenKaufen/" + filename; - alert(targetPath); $scope.targetPath=''; $scope.targetPath=targetPath; + $scope.targetpublicPath=targetpublicPath; + + $scope.filename=filename; + $cordovaFileTransfer.download(url, targetPath, {}, true).then(function (result) { - $scope.item={name: $scope.name, bild: $scope.targetPath}; + $scope.item={name: $scope.name, bild: $scope.targetpublicPath}; $scope.items.push($scope.item); - alert ($scope.targetPath); - $database.setBuys($scope.name,$scope.targetPath); + //itemName,itemBild,itemBildtext,itemKaufdatum,itemappimgpath,itemappimgpublicpath + $database.setBuys($scope.name,$scope.filename,$scope.freitext,'','', $scope.targetpublicPath); + //Ordner erstellen auf SD-Karte + $cordovaFile.createDir(cordova.file.externalRootDirectory, "WolleRosenKaufen", false) + .then(function (success) { + // success + }, function (error) { + // error + }); + + $cordovaFile.copyFile(cordova.file.applicationStorageDirectory, $scope.filename, cordova.file.externalRootDirectory + "/WolleRosenKaufen", $scope.filename) + .then(function (success) { + // success + }, function (error) { + // error + }); + + }, function (error) { console.log('Error'); @@ -116,6 +114,17 @@ angular.module('starter.controllers', []) } function errorBuyHandler (error) { + /* + var strResult = ""; + if(typeof error === 'object') { + strResult = JSON.stringify(error); + } else { + strResult = error; + } + alert("Feher: \r\n"+strResult ); + */ + + var alertPopup = $ionicPopup.alert({ title: 'Oh Nein', template: 'Der Kauf konnte nicht durchgeführt werden.' @@ -144,12 +153,13 @@ angular.module('starter.controllers', []) $scope.buyRose = function() { - //alert($scope.preis); if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") { if ($rootScope.storeinit==1){ - inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis); + //Wegenbug ausgehebelt + //inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis); + successConsumeHandler(); } else{ var alertPopup = $ionicPopup.alert({ diff --git a/platforms/android/build/intermediates/assets/debug/www/js/services.js b/platforms/android/build/intermediates/assets/debug/www/js/services.js index de43673..11cef67 100644 --- a/platforms/android/build/intermediates/assets/debug/www/js/services.js +++ b/platforms/android/build/intermediates/assets/debug/www/js/services.js @@ -61,9 +61,9 @@ angular.module('starter.services', []) console.log('Database opened'); return self.db; }, - setBuys: function(itemName,itemBild) { - query="INSERT INTO buys (Name, Bild) VALUES (?,?);"; - return $cordovaSQLite.execute(self.db,query,[itemName,itemBild]). + setBuys: function(itemName,itemBild,itemBildtext,itemKaufdatum,itemappimgpath,itemappimgpublicpath) { + query="INSERT INTO buys (Name, Bild, Bildtext, Kaufdatum, appimgpath, appimgpublicpath) VALUES (?,?,?,?,?,?);"; + return $cordovaSQLite.execute(self.db,query,[itemName,itemBild,itemBildtext,itemKaufdatum,itemappimgpath,itemappimgpublicpath]). then(function(result) { console.log("Gespeichert"); query=null; @@ -81,6 +81,10 @@ angular.module('starter.services', []) //console.log(result.rows.item(j)); List.name=result.rows.item(j).Name; List.bild=result.rows.item(j).Bild; + List.bildtext=result.rows.item(j).Bildtext; + List.kaufdatum=result.rows.item(j).Kaufdatum; + List.appimgpath=result.rows.item(j).appimgpath; + List.appimgpublicpath=result.rows.item(j).appimgpublicpath; ArrayQ.push(List); } //console.log(ArrayQ); diff --git a/platforms/android/build/intermediates/assets/debug/www/raataar_wrk.db b/platforms/android/build/intermediates/assets/debug/www/raataar_wrk.db index d9ea0b2..63f09fc 100644 Binary files a/platforms/android/build/intermediates/assets/debug/www/raataar_wrk.db and b/platforms/android/build/intermediates/assets/debug/www/raataar_wrk.db differ diff --git a/platforms/android/build/intermediates/assets/debug/www/templates/tab-buys.html b/platforms/android/build/intermediates/assets/debug/www/templates/tab-buys.html index 7cf44a5..d4e3e18 100644 --- a/platforms/android/build/intermediates/assets/debug/www/templates/tab-buys.html +++ b/platforms/android/build/intermediates/assets/debug/www/templates/tab-buys.html @@ -9,12 +9,12 @@
-
-

{{i.name}}

+
+

{{i.name}}

- {{i.freitext}} +
{{i.bildtext}}
diff --git a/platforms/android/build/intermediates/res/resources-debug.ap_ b/platforms/android/build/intermediates/res/resources-debug.ap_ index b947627..d406cfc 100644 Binary files a/platforms/android/build/intermediates/res/resources-debug.ap_ and b/platforms/android/build/intermediates/res/resources-debug.ap_ differ diff --git a/platforms/android/build/outputs/apk/android-debug-unaligned.apk b/platforms/android/build/outputs/apk/android-debug-unaligned.apk index cf986ee..b2b8a75 100644 Binary files a/platforms/android/build/outputs/apk/android-debug-unaligned.apk and b/platforms/android/build/outputs/apk/android-debug-unaligned.apk differ diff --git a/platforms/android/build/outputs/apk/android-debug.apk b/platforms/android/build/outputs/apk/android-debug.apk index e15c951..0abcc2a 100644 Binary files a/platforms/android/build/outputs/apk/android-debug.apk and b/platforms/android/build/outputs/apk/android-debug.apk differ diff --git a/www/templates/tab-buys.html b/www/templates/tab-buys.html index 6703e67..d4e3e18 100644 --- a/www/templates/tab-buys.html +++ b/www/templates/tab-buys.html @@ -10,11 +10,11 @@
-

{{i.name}}

+

{{i.name}}

- {{i.bildtext}} +
{{i.bildtext}}