Skip to content

Commit

Permalink
Fix Log Issues
Browse files Browse the repository at this point in the history
- The initialize showLog property was buggy, always return true.
- Wrap all the logs with If showLog.
  • Loading branch information
justtal committed Jul 17, 2014
1 parent e5fa36b commit 535aa6b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions v3/www/inappbilling.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ InAppBilling.prototype.init = function (success, fail, options, skus) {
options || (options = {});

this.options = {
showLog: options.showLog || true
showLog: options.showLog !== false
};

if (this.options.showLog) {
Expand All @@ -30,11 +30,15 @@ InAppBilling.prototype.init = function (success, fail, options, skus) {
if (skus.length > 0) {
if (typeof skus[0] !== 'string') {
var msg = 'invalid productIds: ' + JSON.stringify(skus);
log(msg);
if (this.options.showLog) {
log(msg);
}
fail(msg);
return;
}
log('load ' + JSON.stringify(skus));
if (this.options.showLog) {
log('load ' + JSON.stringify(skus));
}
hasSKUs = true;
}
}
Expand Down Expand Up @@ -94,10 +98,11 @@ InAppBilling.prototype.getProductDetails = function (success, fail, skus) {
fail(msg);
return;
}
log('load ' + JSON.stringify(skus));

if (this.options.showLog) {
log('load ' + JSON.stringify(skus));
}
return cordova.exec(success, fail, "InAppBillingPlugin", "getProductDetails", [skus]);
}
};

module.exports = new InAppBilling();
module.exports = new InAppBilling();

0 comments on commit 535aa6b

Please sign in to comment.