Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAndroidDonations Class Reference

#include <KisAndroidDonations.h>

+ Inheritance diagram for KisAndroidDonations:

Public Types

enum class  State {
  Unknown = 0 , Checking = 1 , Unavailable = 2 , NoSupport = 3 ,
  LifetimeSupporter = 4
}
 

Public Slots

void slotStartDonationFlow ()
 

Signals

void sigStateChanged ()
 
void sigStateUpdateReceived (int state)
 

Public Member Functions

bool shouldShowDonationLink () const
 
bool shouldShowSupporterBadge () const
 

Static Public Member Functions

static KisAndroidDonationsinstance ()
 

Private Slots

void slotUpdateState (int state)
 

Private Member Functions

 KisAndroidDonations (QObject *parent=nullptr)
 
void syncState ()
 

Private Attributes

State m_state {State::Unknown}
 

Friends

class KisApplication
 

Detailed Description

Definition at line 12 of file KisAndroidDonations.h.

Member Enumeration Documentation

◆ State

enum class KisAndroidDonations::State
strong
Enumerator
Unknown 
Checking 
Unavailable 
NoSupport 
LifetimeSupporter 

Definition at line 19 of file KisAndroidDonations.h.

19 {
20 // Initial or error state. Assume in-app purchases are unavailable.
21 Unknown = 0,
22 // The billing code is still checking whether any products are available
23 // and if the user owns any of them.
24 Checking = 1,
25 // In-app purchases are unavailable. This may be because of an
26 // unexpected error, but may also be an expected condition, e.g. because
27 // the user is running a debug or nightly build, which have a different
28 // package name and therefore no products assigned to them.
29 Unavailable = 2,
30 // User does not own any support products, but they could purchase one.
31 NoSupport = 3,
32 // User purchased the (legacy) lifetime supporter badge.
34 };

Constructor & Destructor Documentation

◆ KisAndroidDonations()

KisAndroidDonations::KisAndroidDonations ( QObject * parent = nullptr)
explicitprivate

Definition at line 48 of file KisAndroidDonations.cpp.

49 : QObject(parent)
50{
51 // The state update can come from a different thread, so we'll use a queued connection.
52 connect(this, SIGNAL(sigStateUpdateReceived(int)), this, SLOT(slotUpdateState(int)), Qt::QueuedConnection);
53}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void sigStateUpdateReceived(int state)
void slotUpdateState(int state)

References connect(), sigStateUpdateReceived(), and slotUpdateState().

Member Function Documentation

◆ instance()

KisAndroidDonations * KisAndroidDonations::instance ( )
static

Definition at line 12 of file KisAndroidDonations.cpp.

13{
14 KisApplication *app = qobject_cast<KisApplication *>(KisApplication::instance());
15 if (app) {
16 return app->androidDonations();
17 } else {
18 return nullptr;
19 }
20}
Base class for the Krita app.

◆ shouldShowDonationLink()

bool KisAndroidDonations::shouldShowDonationLink ( ) const

Definition at line 22 of file KisAndroidDonations.cpp.

23{
24 // Normally, we'd want to show a donation link when the state is NoSupport.
25 // However, currently we only have the lifetime badge as a product and we
26 // don't want to continue offering that, so the link is disabled for now.
27 return false;
28}

◆ shouldShowSupporterBadge()

bool KisAndroidDonations::shouldShowSupporterBadge ( ) const

Definition at line 30 of file KisAndroidDonations.cpp.

References LifetimeSupporter, and m_state.

◆ sigStateChanged

void KisAndroidDonations::sigStateChanged ( )
signal

◆ sigStateUpdateReceived

void KisAndroidDonations::sigStateUpdateReceived ( int state)
signal

◆ slotStartDonationFlow

void KisAndroidDonations::slotStartDonationFlow ( )
slot

Definition at line 35 of file KisAndroidDonations.cpp.

36{
37 QAndroidJniObject::callStaticMethod<void>("org/krita/android/DonationHelper", "startBillingFlow", "()V");
38}

◆ slotUpdateState

void KisAndroidDonations::slotUpdateState ( int state)
privateslot

Definition at line 40 of file KisAndroidDonations.cpp.

41{
42 if (int(m_state) != state) {
43 m_state = State(state);
44 Q_EMIT sigStateChanged();
45 }
46}

References m_state, and sigStateChanged().

◆ syncState()

void KisAndroidDonations::syncState ( )
private

Definition at line 55 of file KisAndroidDonations.cpp.

56{
57 QAndroidJniObject::callStaticMethod<void>("org/krita/android/DonationHelper", "syncState", "()V");
58}

Friends And Related Symbol Documentation

◆ KisApplication

friend class KisApplication
friend

Definition at line 15 of file KisAndroidDonations.h.

Member Data Documentation

◆ m_state

State KisAndroidDonations::m_state {State::Unknown}
private

Definition at line 56 of file KisAndroidDonations.h.


The documentation for this class was generated from the following files: