mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-12-04 06:01:26 +09:00
* Add Google Play Billing Library * Disable Qt debugger sleep * Add billing module, provide a separate build for Google Play * Add a method to detect Google Play build * Add method to get the list of offers * Add methods to verify and purchase subscriptions * refactor: modify response json * feat: add purchase to UI * feat: add test purchase android * fix: merge with new structure, fix payment flow * fix: build flow for new conan structure * fix: add build android via Win * fix: fix multi-ABI filter * fix: split payment to detect payment type * fix: add artifact apk * fix: add check purchase on restore * fix: release keystore * fix: copy apk to right path * fix: separate oss/play build * fix: simply build AAB * fix: add custom target for Play billing * fix: add logs billing * fix: add support market types, add logs * fix: revert market field, up android GP version, fix subscription plan parser * fix: add support getSubscriptionInfo and subscriptions/restore * fix: update api endpoint and pay logic * fix: add logs and rename restore func * fix: add ios logs * fix: rename restore function, fix icon resource error * fix: double purchase android * fix: update Google Play Billing Library to 8.0.0 * fix: prefer free trial subscription offer on Android purchase Bump APP version to 2137. * fix: up kotlin version compiler * fix: sync price for PlayMarket from GP * fix: add logs for Google Play price merge * fix: show App Store intro offer discount price in catalog * feat: add trial support for multi platform, redesign PageSetupWizardApiPremiumInfo * feat: add logs android * fix: tighten spacing Change plan and test period tag * fix: UI text changes * fix: upgrade existing android subscription and add renew logic * feat: add support upgrade CP plan without call subscription * fix: add billing logs for plan * fix: show upgrade success as notification * fix: call getSubscriptionInfo/importServiceFromMarket on upgrade instead of skipping * fix: restore ios prod var * fix: remove noisy debug logs * chore: up version code * fix: getSubscriptionInfo used removed GatewayRequestData after rebase * fix: aab in sep tasks * fix: warn before subscription upgrade/downgrade purchase * chore: add acknowledgePlayPurchase * refactor: add store purchase controller * feat: use same acknowledge method as appstore * fix: IOS add upgrade * fix: change QML warn message * refactor: dedupe Play purchase validation and startup billing query * chore: log purchaseToken through the Android purchase flow * fix: resolve Android active plan by base plan id * fix: remove comment * fix: subscribe to Transaction.updates before Transaction.unfinished * fix: update days values * fix: genuine restore failure when another transaction was a duplicate * fix: remove debug lines and comment * chore: cleanup logs --------- Co-authored-by: albexk <albexk@proton.me> Co-authored-by: vkamn <vk@amnezia.org>
32 lines
806 B
C++
32 lines
806 B
C++
#ifndef ANDROID_UTILS_H
|
|
#define ANDROID_UTILS_H
|
|
|
|
#include <QEventLoop>
|
|
#include <QFutureWatcher>
|
|
#include <QJniObject>
|
|
#include <QtConcurrent>
|
|
|
|
namespace AndroidUtils
|
|
{
|
|
QJniObject getActivity();
|
|
|
|
QString convertJString(JNIEnv *env, jstring data);
|
|
|
|
void runOnAndroidThreadSync(const std::function<void()> &runnable);
|
|
void runOnAndroidThreadAsync(const std::function<void()> &runnable);
|
|
|
|
template <typename Func>
|
|
auto runOnWorkerThread(Func &&func)
|
|
{
|
|
using Result = std::invoke_result_t<std::decay_t<Func>>;
|
|
QFutureWatcher<Result> watcher;
|
|
QEventLoop loop;
|
|
QObject::connect(&watcher, &QFutureWatcher<Result>::finished, &loop, &QEventLoop::quit);
|
|
watcher.setFuture(QtConcurrent::run(std::forward<Func>(func)));
|
|
loop.exec();
|
|
return watcher.result();
|
|
}
|
|
};
|
|
|
|
#endif // ANDROID_UTILS_H
|