-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIAPKit.cpp
62 lines (47 loc) · 1.04 KB
/
IAPKit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// IAPKit.cpp
// Maw Kit
//
// Created by Lluís Ulzurrun de Asanza Sàez on 18/02/16.
//
//
#include "IAPKit.hpp"
#include "_IAPKit.hpp"
#include "Features.hpp"
#include "KVDatabase.hpp"
#include "AppDelegate.h"
#include <functional>
namespace MK {
namespace IAPKit {
void init( const std::vector<ProductID> &products, std::function<void( void )> callback )
{
if ( !enabled() ) return;
_init( products, callback );
}
void buyIfPossible( const ProductID productIdentifier, std::function<void( bool )> callback )
{
if ( !enabled() ) {
callback( false );
return;
}
_buyIfPossible( productIdentifier, callback );
}
const std::string buyButtonTitleForProduct( const ProductID productIdentifier )
{
if ( !enabled() ) return "";
return _buyButtonTitleForProduct( productIdentifier );
}
void restorePurchases( std::function<void( bool )> callback )
{
if ( !enabled() ) {
callback( false );
return;
}
_restorePurchases( callback );
}
const bool enabled()
{
return MK::Features::IAPKit;
}
}; // namespace IAPKit
}; // namespace MK