[statistics][bookmarks] trial enabled event is added

This commit is contained in:
Arsentiy Milchakov 2020-07-27 11:55:23 +03:00 committed by Anatoliy V. Tomilov
parent fec48b34b1
commit b2f117f1c8
6 changed files with 16 additions and 13 deletions

View file

@ -2190,9 +2190,9 @@ Java_com_mapswithme_maps_Framework_nativeSetActiveSubscription(JNIEnv *, jclass,
auto const & purchase = frm()->GetPurchase();
if (purchase == nullptr)
return;
// TODO: @milchakov pass the 'isTrial' parameter to the purchase please.
purchase->SetSubscriptionEnabled(static_cast<SubscriptionType>(type),
static_cast<bool>(isActive));
purchase->SetSubscriptionEnabled(static_cast<SubscriptionType>(type), static_cast<bool>(isActive),
static_cast<bool>(isTrial));
}
JNIEXPORT jint JNICALL

View file

@ -194,15 +194,15 @@
}
+ (void)setAdsDisabled:(BOOL)disabled {
GetFramework().GetPurchase()->SetSubscriptionEnabled(SubscriptionType::RemoveAds, disabled);
GetFramework().GetPurchase()->SetSubscriptionEnabled(SubscriptionType::RemoveAds, disabled, false);
}
+ (void)setBookmarksSubscriptionActive:(BOOL)active {
GetFramework().GetPurchase()->SetSubscriptionEnabled(SubscriptionType::BookmarksSights, active);
GetFramework().GetPurchase()->SetSubscriptionEnabled(SubscriptionType::BookmarksSights, active, false);
}
+ (void)setAllPassSubscriptionActive:(BOOL)active {
GetFramework().GetPurchase()->SetSubscriptionEnabled(SubscriptionType::BookmarksAll, active);
GetFramework().GetPurchase()->SetSubscriptionEnabled(SubscriptionType::BookmarksAll, active, false);
}
#pragma mark - SKRequestDelegate

View file

@ -39,11 +39,6 @@ std::array<std::string, static_cast<size_t>(SubscriptionType::Count)> const kSub
"_BookmarksSights" // bookmarks city
};
std::array<std::string, static_cast<size_t>(SubscriptionType::Count)> const kTrialSuffix =
{
"_BookmarksAllTrial", // removeAds (empty string for back compatibility)
};
uint32_t constexpr kFirstWaitingTimeInSec = 1;
uint32_t constexpr kWaitingTimeScaleFactor = 2;
uint8_t constexpr kMaxAttemptIndex = 2;
@ -186,7 +181,7 @@ bool Purchase::IsSubscriptionActive(SubscriptionType type) const
return m_subscriptionData[base::Underlying(type)]->m_isActive;
}
void Purchase::SetSubscriptionEnabled(SubscriptionType type, bool isEnabled)
void Purchase::SetSubscriptionEnabled(SubscriptionType type, bool isEnabled, bool isTrialActive)
{
CHECK(type != SubscriptionType::Count, ());
@ -201,6 +196,11 @@ void Purchase::SetSubscriptionEnabled(SubscriptionType type, bool isEnabled)
listener->OnSubscriptionChanged(type, isEnabled);
auto const nowStr = GetPlatform().GetMarketingService().GetPushWooshTimestamp();
if (isTrialActive)
{
GetPlatform().GetMarketingService().SendPushWooshTag(
marketing::kSubscriptionBookmarksAllTrialEnabled, nowStr);
}
if (type == SubscriptionType::BookmarksSights)
{
GetPlatform().GetMarketingService().SendPushWooshTag(isEnabled ?

View file

@ -73,7 +73,7 @@ public:
void RegisterSubscription(SubscriptionListener * listener);
bool IsSubscriptionActive(SubscriptionType type) const;
void SetSubscriptionEnabled(SubscriptionType type, bool isEnabled);
void SetSubscriptionEnabled(SubscriptionType type, bool isEnabled, bool isTrialActive);
void SetValidationCallback(ValidationCallback && callback);
void Validate(ValidationInfo const & validationInfo, std::string const & accessToken);

View file

@ -37,6 +37,8 @@ char const * const kSubscriptionBookmarksSightsDisabled =
char const * const kRemoveAdsSubscriptionEnabled = "remove_ads_subscription_enabled";
char const * const kRemoveAdsSubscriptionDisabled = "remove_ads_subscription_disabled";
char const * const kSubscriptionContentDeleted = "bookmark_catalog_subscription_content_deleted";
char const * const kSubscriptionBookmarksAllTrialEnabled =
"bookmark_catalog_subscription_city_outdoor_trial_enabled";
// Events.
char const * const kDownloaderMapActionFinished = "Downloader_Map_action_finished";

View file

@ -37,6 +37,7 @@ extern char const * const kSubscriptionBookmarksSightsDisabled;
extern char const * const kRemoveAdsSubscriptionEnabled;
extern char const * const kRemoveAdsSubscriptionDisabled;
extern char const * const kSubscriptionContentDeleted;
extern char const * const kSubscriptionBookmarksAllTrialEnabled;
// Events.
extern char const * const kDownloaderMapActionFinished;