-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Expand file tree
/
Copy pathdata_credits.h
More file actions
170 lines (152 loc) · 4 KB
/
Copy pathdata_credits.h
File metadata and controls
170 lines (152 loc) · 4 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_subscriptions.h"
namespace Data {
struct UniqueGift;
struct UniqueGiftValue;
struct CreditTopupOption final {
uint64 credits = 0;
QString product;
QString currency;
uint64 amount = 0;
bool extended = false;
uint64 giftBarePeerId = 0;
};
using CreditTopupOptions = std::vector<CreditTopupOption>;
enum class CreditsHistoryMediaType {
Photo,
Video,
};
struct CreditsHistoryMedia {
CreditsHistoryMediaType type = CreditsHistoryMediaType::Photo;
uint64 id = 0;
};
struct CreditsHistoryEntry final {
explicit operator bool() const {
return !id.isEmpty();
}
[[nodiscard]] bool isLiveStoryReaction() const {
return paidMessagesCount && reaction && !bareMsgId;
}
using PhotoId = uint64;
enum class PeerType {
Peer,
AppStore,
PlayMarket,
Fragment,
Unsupported,
PremiumBot,
Ads,
API,
};
QString id;
QString title;
TextWithEntities description;
QDateTime date;
QDateTime firstSaleDate;
QDateTime lastSaleDate;
PhotoId photoId = 0;
std::vector<CreditsHistoryMedia> extended;
CreditsAmount credits;
uint64 bareMsgId = 0;
uint64 barePeerId = 0;
uint64 bareGiveawayMsgId = 0;
uint64 bareGiftStickerId = 0;
uint64 bareGiftOwnerId = 0;
uint64 bareGiftHostId = 0;
uint64 bareGiftReleasedById = 0;
uint64 bareGiftResaleRecipientId = 0;
uint64 bareGiftMessageAuthorId = 0;
uint64 bareActorId = 0;
uint64 bareEntryOwnerId = 0;
uint64 giftChannelSavedId = 0;
uint64 stargiftId = 0;
QString giftPrepayUpgradeHash;
QString giftTitle;
std::shared_ptr<UniqueGift> uniqueGift;
Fn<std::vector<CreditsHistoryEntry>()> pinnedSavedGifts;
uint64 nextToUpgradeStickerId = 0;
Fn<void()> nextToUpgradeShow;
Fn<void()> craftAnotherCallback;
CreditsAmount starrefAmount;
int starrefCommission = 0;
uint64 starrefRecipientId = 0;
PeerType peerType;
QDateTime subscriptionUntil;
// Currency properties.
QDateTime adsProceedsToDate;
QString provider; // Unused.
QDateTime successDate;
QString successLink;
int paidMessagesCount = 0;
CreditsAmount paidMessagesAmount;
int paidMessagesCommission = 0;
int limitedCount = 0;
int limitedLeft = 0;
int starsConverted = 0;
int starsToUpgrade = 0;
int starsUpgradedBySender = 0;
int starsForDetailsRemove = 0;
int premiumMonthsForStars = 0;
int floodSkip = 0;
int giftNumber = 0;
bool converted : 1 = false;
bool anonymous : 1 = false;
bool stargift : 1 = false;
bool auction : 1 = false;
bool postsSearch : 1 = false;
bool giftTransferred : 1 = false;
bool giftRefunded : 1 = false;
bool giftUpgraded : 1 = false;
bool giftUpgradeSeparate : 1 = false;
bool giftUpgradeGifted : 1 = false;
bool giftResale : 1 = false;
bool giftOffer : 1 = false;
bool giftResaleForceTon : 1 = false;
bool giftPinned : 1 = false;
bool giftCrafted : 1 = false;
bool savedToProfile : 1 = false;
bool fromGiftsList : 1 = false;
bool fromGiftSlug : 1 = false;
bool soldOutInfo : 1 = false;
bool canUpgradeGift : 1 = false;
bool hasGiftComment : 1 = false;
bool reaction : 1 = false;
bool refunded : 1 = false;
bool pending : 1 = false;
bool failed : 1 = false;
bool in : 1 = false;
bool gift : 1 = false;
};
struct CreditsStatusSlice final {
using OffsetToken = QString;
std::vector<CreditsHistoryEntry> list;
std::vector<SubscriptionEntry> subscriptions;
CreditsAmount balance;
uint64 subscriptionsMissingBalance = 0;
bool allLoaded = false;
OffsetToken token;
OffsetToken tokenSubscriptions;
};
struct CreditsGiveawayOption final {
struct Winner final {
int users = 0;
uint64 perUserStars = 0;
bool isDefault = false;
};
std::vector<Winner> winners;
QString storeProduct;
QString currency;
uint64 amount = 0;
uint64 credits = 0;
int yearlyBoosts = 0;
bool isExtended = false;
bool isDefault = false;
};
using CreditsGiveawayOptions = std::vector<CreditsGiveawayOption>;
} // namespace Data