mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-12-04 06:01:26 +09:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94f721a4c2 | ||
|
|
41add0f8c7 | ||
|
|
c8aacc9fed | ||
|
|
ca5a7fb9d4 | ||
|
|
8ee2ccddc3 | ||
|
|
732fa60937 |
No files matched your search
+1
-1
@@ -32,7 +32,7 @@ set(RELEASE_DATE "${CURRENT_DATE}")
|
||||
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
||||
|
||||
# bump by 2 on every release, because we're releasing two versions on the play store
|
||||
set(APP_ANDROID_VERSION_CODE 2161)
|
||||
set(APP_ANDROID_VERSION_CODE 2168)
|
||||
if(DEFINED APP_ANDROID_VERSION_CODE_OFFSET)
|
||||
math(EXPR APP_ANDROID_VERSION_CODE "${APP_ANDROID_VERSION_CODE} + ${APP_ANDROID_VERSION_CODE_OFFSET}")
|
||||
endif()
|
||||
|
||||
@@ -149,6 +149,9 @@ class BillingProvider(context: Context) : AutoCloseable {
|
||||
val pricingPhases = JSONArray().also { offer.put("pricingPhases", it) }
|
||||
offerDetails.pricingPhases.pricingPhaseList.forEach { phase ->
|
||||
val billingMonths = billingPeriodToMonths(phase.billingPeriod)
|
||||
val perMonth = displayPricePerMonth(phase.priceAmountMicros, phase.priceCurrencyCode, billingMonths)
|
||||
Log.d(TAG, "[Billing][TEST] basePlanId=${offerDetails.basePlanId} billingPeriod=${phase.billingPeriod} " +
|
||||
"billingMonths=$billingMonths currencyCode=${phase.priceCurrencyCode} displayPricePerMonth=$perMonth")
|
||||
JSONObject().also { pricingPhases.put(it) }
|
||||
.put("billingCycleCount", phase.billingCycleCount)
|
||||
.put("billingPeriod", phase.billingPeriod)
|
||||
@@ -157,7 +160,7 @@ class BillingProvider(context: Context) : AutoCloseable {
|
||||
.put("recurrenceMode", phase.recurrenceMode)
|
||||
.put("subscriptionBillingMonths", billingMonths)
|
||||
.apply {
|
||||
displayPricePerMonth(phase.priceAmountMicros, phase.priceCurrencyCode, billingMonths)?.let {
|
||||
perMonth?.let {
|
||||
put("displayPricePerMonth", it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,6 +320,7 @@ ErrorCode ServicesCatalogController::fillAvailableServices(QJsonObject &services
|
||||
|
||||
QByteArray responseBody;
|
||||
ErrorCode errorCode = executeRequest(QString("%1v1/services"), apiPayload, responseBody);
|
||||
qInfo().noquote() << "[ServicesCatalog] errorCode:" << static_cast<int>(errorCode) << "response:" << responseBody;
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
if (!responseBody.contains(apiDefs::key::services.data())) {
|
||||
errorCode = ErrorCode::ApiServicesMissingError;
|
||||
|
||||
@@ -145,6 +145,7 @@ ErrorCode StorePurchaseController::importServiceFromMarket(const QString &userCo
|
||||
qInfo() << "[Billing][importServiceFromMarket] endpoint:" << endpoint << "isTestPurchase:" << isTestPurchase;
|
||||
ErrorCode errorCode = executeRequest(QString("%1") + endpoint, apiPayload, responseBody, isTestPurchase);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
qWarning().noquote() << "[IAP] Request" << endpoint << "failed, errorCode =" << static_cast<int>(errorCode);
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
@@ -523,9 +524,13 @@ ErrorCode StorePurchaseController::processAppStoreTransactionUpdate(const QStrin
|
||||
ErrorCode errorCode = importServiceFromMarket(userCountryCode, serviceType, serviceProtocol, protocolData,
|
||||
originalTransactionId, isTestPurchase, duplicateServerIndex,
|
||||
QStringLiteral("v1/restore_subscription"));
|
||||
if (errorCode == ErrorCode::ApiNotFoundError || errorCode == ErrorCode::ApiConfigDownloadError) {
|
||||
qInfo().noquote() << "[IAP] Gateway has no record of this purchase, registering it instead of restoring";
|
||||
errorCode = importServiceFromMarket(userCountryCode, serviceType, serviceProtocol, protocolData,
|
||||
originalTransactionId, isTestPurchase, duplicateServerIndex,
|
||||
QStringLiteral("v1/subscriptions"));
|
||||
}
|
||||
|
||||
// On validation failure the transaction is left unfinished so it is redelivered
|
||||
// by the Transaction.updates listener on the next app launch
|
||||
if (errorCode == ErrorCode::NoError || errorCode == ErrorCode::ApiConfigAlreadyAdded) {
|
||||
IosController::Instance()->finishStoreTransaction(transactionId);
|
||||
}
|
||||
@@ -689,6 +694,12 @@ bool StorePurchaseController::processUnacknowledgedPlayPurchases(const QJsonArra
|
||||
|
||||
ErrorCode errorCode = finalizePlayPurchase(userCountryCode, serviceType, serviceProtocol,
|
||||
purchaseToken, false, nullptr, QStringLiteral("v1/restore_subscription"));
|
||||
if (errorCode == ErrorCode::ApiNotFoundError || errorCode == ErrorCode::ApiConfigDownloadError) {
|
||||
qInfo().noquote() << "[Billing] Gateway has no record of this purchase, registering it instead of restoring";
|
||||
errorCode = finalizePlayPurchase(userCountryCode, serviceType, serviceProtocol,
|
||||
purchaseToken, false, nullptr, QStringLiteral("v1/subscriptions"));
|
||||
}
|
||||
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
installedNewConfig = true;
|
||||
} else if (errorCode != ErrorCode::ApiConfigAlreadyAdded) {
|
||||
|
||||
@@ -117,6 +117,7 @@ amnezia::ErrorCode apiUtils::checkNetworkReplyErrors(const QList<QSslError> &ssl
|
||||
{
|
||||
const int httpStatusCodeConflict = 409;
|
||||
const int httpStatusCodeNotFound = 404;
|
||||
const int httpStatusCodeGone = 410;
|
||||
const int httpStatusCodeNotImplemented = 501;
|
||||
const int httpStatusCodePaymentRequired = 402;
|
||||
const int httpStatusCodeTooManyRequests = 429;
|
||||
@@ -151,7 +152,7 @@ amnezia::ErrorCode apiUtils::checkNetworkReplyErrors(const QList<QSslError> &ssl
|
||||
}
|
||||
return amnezia::ErrorCode::ApiConfigLimitError;
|
||||
}
|
||||
if (httpStatusFromBody == httpStatusCodeNotFound) {
|
||||
if (httpStatusFromBody == httpStatusCodeNotFound || httpStatusFromBody == httpStatusCodeGone) {
|
||||
return amnezia::ErrorCode::ApiNotFoundError;
|
||||
}
|
||||
if (httpStatusFromBody == httpStatusCodeRequestTimeout) {
|
||||
|
||||
Reference in new issue
Block a user