fix: Premium Preview

This commit is contained in:
xtaodada 2022-10-11 22:45:05 +08:00
parent 9fff7f9eda
commit 75b4710c72
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -1086,7 +1086,26 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
public void updatePremiumTiers() { public void updatePremiumTiers() {
subscriptionTiers.clear(); long pricePerYearMax = 0;
if (getMediaDataController().getPremiumPromo() != null) {
for (TLRPC.TL_premiumSubscriptionOption option : getMediaDataController().getPremiumPromo().period_options) {
SubscriptionTier subscriptionTier = new SubscriptionTier(option);
subscriptionTiers.add(subscriptionTier);
if (subscriptionTier.getPricePerYear() > pricePerYearMax) {
pricePerYearMax = subscriptionTier.getPricePerYear();
}
}
}
for (SubscriptionTier tier : subscriptionTiers) {
tier.setPricePerYearRegular(pricePerYearMax);
}
for (int i = 0; i < subscriptionTiers.size(); i++) {
SubscriptionTier tier = subscriptionTiers.get(i);
if (tier.getMonths() == 1) {
selectedTierIndex = i;
break;
}
}
// NekoX: remove // NekoX: remove
updateButtonText(false); updateButtonText(false);
tierListView.getAdapter().notifyDataSetChanged(); tierListView.getAdapter().notifyDataSetChanged();