1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-03 21:55:13 +00:00

Billing sync

This commit is contained in:
M66B 2021-10-15 08:32:17 +02:00
parent 9ccab629f0
commit 74b45d6322
2 changed files with 14 additions and 6 deletions

View file

@ -169,6 +169,10 @@ public class ActivityBilling extends ActivityBase implements /*PurchasesUpdatedL
private static String getChallenge(Context context) throws NoSuchAlgorithmException { private static String getChallenge(Context context) throws NoSuchAlgorithmException {
String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
if (android_id == null) {
Log.e("Android ID empty");
android_id = Long.toHexString(System.currentTimeMillis() / (24 * 3600 * 1000L));
}
return Helper.sha256(android_id); return Helper.sha256(android_id);
} }
@ -217,7 +221,7 @@ public class ActivityBilling extends ActivityBase implements /*PurchasesUpdatedL
if (ACTION_PURCHASE.equals(intent.getAction())) if (ACTION_PURCHASE.equals(intent.getAction()))
onPurchase(intent); onPurchase(intent);
else if (ACTION_PURCHASE_CONSUME.equals(intent.getAction())) else if (ACTION_PURCHASE_CONSUME.equals(intent.getAction()))
;//onPurchaseCheck(intent); ;//onPurchaseConsume(intent);
else if (ACTION_PURCHASE_ERROR.equals(intent.getAction())) else if (ACTION_PURCHASE_ERROR.equals(intent.getAction()))
;//onPurchaseError(intent); ;//onPurchaseError(intent);
} }
@ -277,9 +281,13 @@ public class ActivityBilling extends ActivityBase implements /*PurchasesUpdatedL
private void onPurchaseError(Intent intent) { private void onPurchaseError(Intent intent) {
String message = intent.getStringExtra("message"); String message = intent.getStringExtra("message");
boolean play = Helper.hasPlayStore(this);
Uri uri = Helper.getSupportUri(this); Uri uri = Helper.getSupportUri(this);
if (!TextUtils.isEmpty(message)) if (!TextUtils.isEmpty(message))
uri = uri.buildUpon().appendQueryParameter("message", "IAB: " + message).build(); uri = uri
.buildUpon()
.appendQueryParameter("message", "IAB: " + message + " Play: " + play)
.build();
Helper.view(this, uri, true); Helper.view(this, uri, true);
} }
@ -550,8 +558,6 @@ public class ActivityBilling extends ActivityBase implements /*PurchasesUpdatedL
message += " " + stage; message += " " + stage;
} }
if (BuildConfig.PLAY_STORE_RELEASE)
Log.e(message);
EntityLog.log(this, message); EntityLog.log(this, message);
if (result != null) { if (result != null) {

View file

@ -169,8 +169,10 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
private static String getChallenge(Context context) throws NoSuchAlgorithmException { private static String getChallenge(Context context) throws NoSuchAlgorithmException {
String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
if (android_id == null) if (android_id == null) {
android_id = Long.toHexString(System.currentTimeMillis() % (24 * 3600 * 1000L)); Log.e("Android ID empty");
android_id = Long.toHexString(System.currentTimeMillis() / (24 * 3600 * 1000L));
}
return Helper.sha256(android_id); return Helper.sha256(android_id);
} }