Store InApp-Kauf verbessert

This commit is contained in:
Carsten Hilmer 2016-01-07 23:08:12 +01:00
parent a2b2b6b37e
commit 4e31f6eda6
2 changed files with 26 additions and 11 deletions

View File

@ -19,11 +19,7 @@ angular.module('starter.controllers', [])
}; };
function buysuccessHandler (result) { function successBuyHandler (result) {
inappbilling.consumePurchase(successHandler, errorHandler, $scope.preis);
}
function successHandler (result) {
var strResult = ""; var strResult = "";
if(typeof result === 'object') { if(typeof result === 'object') {
strResult = JSON.stringify(result); strResult = JSON.stringify(result);
@ -33,16 +29,35 @@ angular.module('starter.controllers', [])
alert("SUCCESS: \r\n"+strResult ); 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 ); 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") { if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") {
inappbilling.buy(buysuccessHandler, errorHandler, $scope.preis); inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis);
} }
} }

View File

@ -40,7 +40,7 @@
<div class="row"> <div class="row">
<div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-disabled="!$parent.preis || !$parent.name || !$parent.freitext" ng-click="validate()">Vorschau</button></div> <div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-disabled="!$parent.preis || !$parent.name || !$parent.freitext" ng-click="validate()">Vorschau</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-disabled="!$parent.preis || !$parent.freitext || !$parent.name" ng-click="buyAdFree()">Jetzt Kaufen</button></div> <div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-disabled="!$parent.preis || !$parent.freitext || !$parent.name" ng-click="buyRose()">Jetzt Kaufen</button></div>
</div> </div>