diff --git a/www/js/controllers.js b/www/js/controllers.js index ede80bd..5458c10 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -19,11 +19,7 @@ angular.module('starter.controllers', []) }; - function buysuccessHandler (result) { - inappbilling.consumePurchase(successHandler, errorHandler, $scope.preis); - } - - function successHandler (result) { + function successBuyHandler (result) { var strResult = ""; if(typeof result === 'object') { strResult = JSON.stringify(result); @@ -33,16 +29,35 @@ angular.module('starter.controllers', []) alert("SUCCESS: \r\n"+strResult ); } - function errorHandler (error) { + function successConsumeHandler (result) { + var strResult = ""; + if(typeof result === 'object') { + strResult = JSON.stringify(result); + } else { + strResult = result; + } + alert("SUCCESS: \r\n"+strResult ); + } + + function errorBuyHandler (error) { alert("ERROR: \r\n"+error ); - } + } - $scope.buyAdFree = function() { + function errorConsumeHandler (error) { + alert("ERROR: \r\n"+error ); + } - alert($scope.preis); + + function buysuccessHandler (result) { + inappbilling.consumePurchase(successConsumeHandler, errorConsumeHandler, $scope.preis); + } + + $scope.buyRose = function() { + + //alert($scope.preis); if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") { - inappbilling.buy(buysuccessHandler, errorHandler, $scope.preis); + inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis); } } diff --git a/www/templates/tab-dash.html b/www/templates/tab-dash.html index 58e55ac..b0be4e8 100644 --- a/www/templates/tab-dash.html +++ b/www/templates/tab-dash.html @@ -40,7 +40,7 @@
-
+