Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAndroidDonations.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-or-later
3 */
4#ifndef __KISANDROIDDONATIONS_H_
5#define __KISANDROIDDONATIONS_H_
6
7#include <QObject>
8#include <QVector>
9
10#include "KisSupporterProduct.h"
11#include "kritaui_export.h"
12
13// See DonationHelper.java for notes!
14class KRITAUI_EXPORT KisAndroidDonations : public QObject
15{
16 Q_OBJECT
17 friend class KisApplication;
18
19public:
20 // Keep this in sync with the STATE_ constants in DonationHelper.java!
21 enum class State {
22 // Initial or error state. Assume in-app purchases are unavailable.
23 Unknown = 0,
24 // The billing code is still checking whether any products are available
25 // and if the user owns any of them.
26 Checking = 1,
27 // In-app purchases are unavailable. This may be because of an
28 // unexpected error, but may also be an expected condition, e.g. because
29 // the user is running a debug or nightly build, which have a different
30 // package name and therefore no products assigned to them.
31 Unavailable = 2,
32 // User does not own any support products, but they could purchase one.
33 NoSupport = 3,
34 // User owns at least some kind of supporter product.
35 Supporter = 4,
36 };
37
39
40 State state() const { return m_state; }
41
42 bool shouldShowSupporterBadge() const;
43
45 {
46 return m_showDonationManagementDialogPending;
47 }
48
49 void setShowDonationManagementDialogPending(bool pending);
50
51 QVector<KisSupporterProduct> getCurrentProducts() const;
52
53 void startBillingFlowFor(const QString &productId, const QString &offerToken);
54
55 static void setLoaded(bool loaded);
56 static void setLoadingText(const QString &text);
57 static void showDonationDialog(bool splash);
58
59public Q_SLOTS:
60 void slotStartDonationFlow();
61 void slotManageSubscriptions();
62 void slotManageSubscription(const QString &productId);
63
64private Q_SLOTS:
65 void slotUpdateState(int state, long long ownedProductFlags);
66
67Q_SIGNALS:
68 void sigStateUpdateReceived(int state, long long ownedProductFlags);
72
73private:
74 explicit KisAndroidDonations(QObject *parent = nullptr);
75
76 bool isProductOwned(const QString &productId) const;
77
78 void syncState();
79
80 State m_state{State::Unknown};
81 long long m_ownedProductFlags{0L};
82 bool m_showDonationManagementDialogPending{false};
83};
84
85#endif // __KISANDROIDDONATIONS_H
PythonPluginManager * instance
void sigSplashDialogDismissed()
void sigShowDonationManagementDialogRequested()
void sigStateUpdateReceived(int state, long long ownedProductFlags)
bool isShowDonationManagementDialogPending() const
Base class for the Krita app.
@ Unknown
Definition psd.h:44