Added params to subscriptions
This commit is contained in:
parent
3aff521ddc
commit
27315a87f9
1 changed files with 17 additions and 4 deletions
|
@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -505,7 +506,7 @@ public class InAppPurchaseHelper {
|
||||||
parameters.put("visibleName", hideUserName ? "" : userName);
|
parameters.put("visibleName", hideUserName ? "" : userName);
|
||||||
parameters.put("preferredCountry", countryDownloadName);
|
parameters.put("preferredCountry", countryDownloadName);
|
||||||
parameters.put("email", email);
|
parameters.put("email", email);
|
||||||
|
addUserInfo(parameters);
|
||||||
return AndroidNetworkUtils.sendRequest(ctx,
|
return AndroidNetworkUtils.sendRequest(ctx,
|
||||||
"https://osmand.net/subscription/register",
|
"https://osmand.net/subscription/register",
|
||||||
parameters, "Requesting userId...", true, true);
|
parameters, "Requesting userId...", true, true);
|
||||||
|
@ -618,9 +619,7 @@ public class InAppPurchaseHelper {
|
||||||
try {
|
try {
|
||||||
Map<String, String> parameters = new HashMap<>();
|
Map<String, String> parameters = new HashMap<>();
|
||||||
parameters.put("androidPackage", ctx.getPackageName());
|
parameters.put("androidPackage", ctx.getPackageName());
|
||||||
parameters.put("version", Version.getFullVersion(ctx));
|
addUserInfo(parameters);
|
||||||
parameters.put("lang", ctx.getLanguage() + "");
|
|
||||||
|
|
||||||
return AndroidNetworkUtils.sendRequest(ctx,
|
return AndroidNetworkUtils.sendRequest(ctx,
|
||||||
"https://osmand.net/api/subscriptions/active",
|
"https://osmand.net/api/subscriptions/active",
|
||||||
parameters, "Requesting active subscriptions...", false, false);
|
parameters, "Requesting active subscriptions...", false, false);
|
||||||
|
@ -672,6 +671,19 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("HardwareIds")
|
||||||
|
private void addUserInfo(Map<String, String> parameters) {
|
||||||
|
parameters.put("version", Version.getFullVersion(ctx));
|
||||||
|
parameters.put("lang", ctx.getLanguage() + "");
|
||||||
|
parameters.put("nd", ctx.getAppInitializer().getFirstInstalledDays() + "");
|
||||||
|
parameters.put("ns", ctx.getAppInitializer().getNumberOfStarts() + "");
|
||||||
|
try {
|
||||||
|
parameters.put("aid", Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Callback for when a purchase is finished
|
// Callback for when a purchase is finished
|
||||||
private OnIabPurchaseFinishedListener mPurchaseFinishedListener = new OnIabPurchaseFinishedListener() {
|
private OnIabPurchaseFinishedListener mPurchaseFinishedListener = new OnIabPurchaseFinishedListener() {
|
||||||
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
|
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
|
||||||
|
@ -789,6 +801,7 @@ public class InAppPurchaseHelper {
|
||||||
parameters.put("purchaseToken", purchase.getToken());
|
parameters.put("purchaseToken", purchase.getToken());
|
||||||
parameters.put("email", email);
|
parameters.put("email", email);
|
||||||
parameters.put("token", token);
|
parameters.put("token", token);
|
||||||
|
addUserInfo(parameters);
|
||||||
requests.add(new AndroidNetworkUtils.Request(url, parameters, userOperation, true, true));
|
requests.add(new AndroidNetworkUtils.Request(url, parameters, userOperation, true, true));
|
||||||
}
|
}
|
||||||
AndroidNetworkUtils.sendRequestsAsync(ctx, requests, new OnRequestResultListener() {
|
AndroidNetworkUtils.sendRequestsAsync(ctx, requests, new OnRequestResultListener() {
|
||||||
|
|
Loading…
Reference in a new issue