Add td_api::suggestedActionRestorePremium.
This commit is contained in:
parent
38efb6d673
commit
aa42602701
@ -5073,6 +5073,9 @@ suggestedActionSetPassword authorization_delay:int32 = SuggestedAction;
|
|||||||
//@description Suggests the user to upgrade the Premium subscription from monthly payments to annual payments
|
//@description Suggests the user to upgrade the Premium subscription from monthly payments to annual payments
|
||||||
suggestedActionUpgradePremium = SuggestedAction;
|
suggestedActionUpgradePremium = SuggestedAction;
|
||||||
|
|
||||||
|
//@description Suggests the user to restore a recently expired Premium subscription
|
||||||
|
suggestedActionRestorePremium = SuggestedAction;
|
||||||
|
|
||||||
//@description Suggests the user to subscribe to the Premium subscription with annual payments
|
//@description Suggests the user to subscribe to the Premium subscription with annual payments
|
||||||
suggestedActionSubscribeToAnnualPremium = SuggestedAction;
|
suggestedActionSubscribeToAnnualPremium = SuggestedAction;
|
||||||
|
|
||||||
|
@ -557,6 +557,7 @@ void assign_app_store_transaction(Td *td, const string &receipt,
|
|||||||
if (purpose != nullptr && purpose->get_id() == td_api::storePaymentPurposePremiumSubscription::ID) {
|
if (purpose != nullptr && purpose->get_id() == td_api::storePaymentPurposePremiumSubscription::ID) {
|
||||||
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::UpgradePremium}, Promise<Unit>());
|
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::UpgradePremium}, Promise<Unit>());
|
||||||
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::SubscribeToAnnualPremium}, Promise<Unit>());
|
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::SubscribeToAnnualPremium}, Promise<Unit>());
|
||||||
|
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::RestorePremium}, Promise<Unit>());
|
||||||
}
|
}
|
||||||
td->create_handler<AssignAppStoreTransactionQuery>(std::move(promise))->send(receipt, std::move(purpose));
|
td->create_handler<AssignAppStoreTransactionQuery>(std::move(promise))->send(receipt, std::move(purpose));
|
||||||
}
|
}
|
||||||
@ -568,6 +569,7 @@ void assign_play_market_transaction(Td *td, const string &package_name, const st
|
|||||||
if (purpose != nullptr && purpose->get_id() == td_api::storePaymentPurposePremiumSubscription::ID) {
|
if (purpose != nullptr && purpose->get_id() == td_api::storePaymentPurposePremiumSubscription::ID) {
|
||||||
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::UpgradePremium}, Promise<Unit>());
|
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::UpgradePremium}, Promise<Unit>());
|
||||||
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::SubscribeToAnnualPremium}, Promise<Unit>());
|
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::SubscribeToAnnualPremium}, Promise<Unit>());
|
||||||
|
dismiss_suggested_action(SuggestedAction{SuggestedAction::Type::RestorePremium}, Promise<Unit>());
|
||||||
}
|
}
|
||||||
td->create_handler<AssignPlayMarketTransactionQuery>(std::move(promise))
|
td->create_handler<AssignPlayMarketTransactionQuery>(std::move(promise))
|
||||||
->send(package_name, store_product_id, purchase_token, std::move(purpose));
|
->send(package_name, store_product_id, purchase_token, std::move(purpose));
|
||||||
|
@ -42,6 +42,8 @@ SuggestedAction::SuggestedAction(Slice action_str) {
|
|||||||
init(Type::UpgradePremium);
|
init(Type::UpgradePremium);
|
||||||
} else if (action_str == Slice("PREMIUM_ANNUAL")) {
|
} else if (action_str == Slice("PREMIUM_ANNUAL")) {
|
||||||
init(Type::SubscribeToAnnualPremium);
|
init(Type::SubscribeToAnnualPremium);
|
||||||
|
} else if (action_str == Slice("PREMIUM_RESTORE")) {
|
||||||
|
init(Type::RestorePremium);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +93,9 @@ SuggestedAction::SuggestedAction(const td_api::object_ptr<td_api::SuggestedActio
|
|||||||
case td_api::suggestedActionSubscribeToAnnualPremium::ID:
|
case td_api::suggestedActionSubscribeToAnnualPremium::ID:
|
||||||
init(Type::SubscribeToAnnualPremium);
|
init(Type::SubscribeToAnnualPremium);
|
||||||
break;
|
break;
|
||||||
|
case td_api::suggestedActionRestorePremium::ID:
|
||||||
|
init(Type::RestorePremium);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -114,6 +119,8 @@ string SuggestedAction::get_suggested_action_str() const {
|
|||||||
return "PREMIUM_UPGRADE";
|
return "PREMIUM_UPGRADE";
|
||||||
case Type::SubscribeToAnnualPremium:
|
case Type::SubscribeToAnnualPremium:
|
||||||
return "PREMIUM_ANNUAL";
|
return "PREMIUM_ANNUAL";
|
||||||
|
case Type::RestorePremium:
|
||||||
|
return "PREMIUM_RESTORE";
|
||||||
default:
|
default:
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
@ -139,6 +146,8 @@ td_api::object_ptr<td_api::SuggestedAction> SuggestedAction::get_suggested_actio
|
|||||||
return td_api::make_object<td_api::suggestedActionUpgradePremium>();
|
return td_api::make_object<td_api::suggestedActionUpgradePremium>();
|
||||||
case Type::SubscribeToAnnualPremium:
|
case Type::SubscribeToAnnualPremium:
|
||||||
return td_api::make_object<td_api::suggestedActionSubscribeToAnnualPremium>();
|
return td_api::make_object<td_api::suggestedActionSubscribeToAnnualPremium>();
|
||||||
|
case Type::RestorePremium:
|
||||||
|
return td_api::make_object<td_api::suggestedActionRestorePremium>();
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -199,6 +208,7 @@ void dismiss_suggested_action(SuggestedAction action, Promise<Unit> &&promise) {
|
|||||||
case SuggestedAction::Type::ViewChecksHint:
|
case SuggestedAction::Type::ViewChecksHint:
|
||||||
case SuggestedAction::Type::UpgradePremium:
|
case SuggestedAction::Type::UpgradePremium:
|
||||||
case SuggestedAction::Type::SubscribeToAnnualPremium:
|
case SuggestedAction::Type::SubscribeToAnnualPremium:
|
||||||
|
case SuggestedAction::Type::RestorePremium:
|
||||||
return send_closure_later(G()->config_manager(), &ConfigManager::dismiss_suggested_action, std::move(action),
|
return send_closure_later(G()->config_manager(), &ConfigManager::dismiss_suggested_action, std::move(action),
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
case SuggestedAction::Type::ConvertToGigagroup:
|
case SuggestedAction::Type::ConvertToGigagroup:
|
||||||
|
@ -25,7 +25,8 @@ struct SuggestedAction {
|
|||||||
CheckPassword,
|
CheckPassword,
|
||||||
SetPassword,
|
SetPassword,
|
||||||
UpgradePremium,
|
UpgradePremium,
|
||||||
SubscribeToAnnualPremium
|
SubscribeToAnnualPremium,
|
||||||
|
RestorePremium
|
||||||
};
|
};
|
||||||
Type type_ = Type::Empty;
|
Type type_ = Type::Empty;
|
||||||
DialogId dialog_id_;
|
DialogId dialog_id_;
|
||||||
|
Loading…
Reference in New Issue
Block a user