Adjusted some parameter names for api, show toasts on ui thread

pull/14/head
Sam Bosley 12 years ago
parent 70de62ddff
commit 4cb212e941

@ -962,7 +962,7 @@ public final class ActFmSyncService {
String purchaseToken = Preferences.getStringValue(BillingConstants.PREF_PURCHASE_TOKEN); String purchaseToken = Preferences.getStringValue(BillingConstants.PREF_PURCHASE_TOKEN);
String productId = Preferences.getStringValue(BillingConstants.PREF_PRODUCT_ID); String productId = Preferences.getStringValue(BillingConstants.PREF_PRODUCT_ID);
try { try {
actFmInvoker.invoke("premium_update_android", "purchaseToken", purchaseToken, "productId", productId); actFmInvoker.invoke("premium_update_android", "purchase_token", purchaseToken, "product_id", productId);
Preferences.setBoolean(BillingConstants.PREF_NEEDS_SERVER_UPDATE, false); Preferences.setBoolean(BillingConstants.PREF_NEEDS_SERVER_UPDATE, false);
if (onSuccess != null) if (onSuccess != null)
onSuccess.run(); onSuccess.run();

@ -235,15 +235,25 @@ public class BillingActivity extends Activity {
@Override @Override
public void run() { public void run() {
Preferences.setBoolean(ActFmPreferenceService.PREF_PREMIUM, true); Preferences.setBoolean(ActFmPreferenceService.PREF_PREMIUM, true);
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(BillingActivity.this, R.string.premium_success, Toast.LENGTH_LONG).show(); Toast.makeText(BillingActivity.this, R.string.premium_success, Toast.LENGTH_LONG).show();
} }
});
}
}, new Runnable() { }, new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
Toast.makeText(BillingActivity.this, R.string.premium_success_with_server_error, Toast.LENGTH_LONG).show(); Toast.makeText(BillingActivity.this, R.string.premium_success_with_server_error, Toast.LENGTH_LONG).show();
} }
}); });
} }
});
}
}.start(); }.start();
} else if (purchaseState == PurchaseState.REFUNDED || purchaseState == PurchaseState.EXPIRED) { } else if (purchaseState == PurchaseState.REFUNDED || purchaseState == PurchaseState.EXPIRED) {
new Thread() { new Thread() {

Loading…
Cancel
Save