Commit 994bf738e1f6be01e2e981c0033bb73c97bcc723

Authored by 刘宏哲
1 parent e76e2067

feat(app): update ui

@@ -376,7 +376,7 @@ class _LegalNotes extends StatelessWidget { @@ -376,7 +376,7 @@ class _LegalNotes extends StatelessWidget {
376 _LegalText( 376 _LegalText(
377 prefix: '1. ', 377 prefix: '1. ',
378 text: context.l10n.purchaseNoteSubscription, 378 text: context.l10n.purchaseNoteSubscription,
379 - linkText: '了解更多', 379 + linkText: context.l10n.purchaseLinkLearnMore,
380 linkSuffix: '。', 380 linkSuffix: '。',
381 onLinkTap: showRefundExplanationBottomSheet, 381 onLinkTap: showRefundExplanationBottomSheet,
382 ), 382 ),
@@ -392,9 +392,9 @@ class _LegalNotes extends StatelessWidget { @@ -392,9 +392,9 @@ class _LegalNotes extends StatelessWidget {
392 const SizedBox(height: 12), 392 const SizedBox(height: 12),
393 */ 393 */
394 _LegalText( 394 _LegalText(
395 - prefix: '3. ', 395 + prefix: '2. ',
396 text: context.l10n.purchaseNoteContact, 396 text: context.l10n.purchaseNoteContact,
397 - linkText: '联系我们', 397 + linkText: context.l10n.purchaseLinkContactUs,
398 linkSuffix: '。', 398 linkSuffix: '。',
399 onLinkTap: controller.openContactUs, 399 onLinkTap: controller.openContactUs,
400 ), 400 ),
@@ -187,6 +187,10 @@ class PurchaseController extends GetxController { @@ -187,6 +187,10 @@ class PurchaseController extends GetxController {
187 .where((product) => _nonEmpty(product.appleId) != null) 187 .where((product) => _nonEmpty(product.appleId) != null)
188 .toList(); 188 .toList();
189 plans.assignAll(products.map(_buildPlan)); 189 plans.assignAll(products.map(_buildPlan));
  190 + final defaultProductIndex = products.indexWhere(
  191 + (product) => product.content?.isDefaultProduct() ?? false,
  192 + );
  193 + selectedIndex.value = defaultProductIndex >= 0 ? defaultProductIndex : 0;
190 isLoadingProducts.value = false; 194 isLoadingProducts.value = false;
191 195
192 await Future.wait( 196 await Future.wait(
@@ -256,14 +256,14 @@ class _LegalNotes extends StatelessWidget { @@ -256,14 +256,14 @@ class _LegalNotes extends StatelessWidget {
256 _LegalText( 256 _LegalText(
257 prefix: '1. ', 257 prefix: '1. ',
258 text: context.l10n.purchaseNoteSubscription, 258 text: context.l10n.purchaseNoteSubscription,
259 - linkText: '了解更多', 259 + linkText: context.l10n.purchaseLinkLearnMore,
260 linkSuffix: '。', 260 linkSuffix: '。',
261 onLinkTap: controller.openRefundExplanation, 261 onLinkTap: controller.openRefundExplanation,
262 ), 262 ),
263 const SizedBox(height: 12), 263 const SizedBox(height: 12),
264 /* 264 /*
265 _LegalText( 265 _LegalText(
266 - prefix: '2. ', 266 + prefix: '3. ',
267 text: context.l10n.purchaseNoteRestore, 267 text: context.l10n.purchaseNoteRestore,
268 linkText: context.l10n.purchaseRestore, 268 linkText: context.l10n.purchaseRestore,
269 linkSuffix: '。', 269 linkSuffix: '。',
@@ -272,9 +272,9 @@ class _LegalNotes extends StatelessWidget { @@ -272,9 +272,9 @@ class _LegalNotes extends StatelessWidget {
272 const SizedBox(height: 12), 272 const SizedBox(height: 12),
273 */ 273 */
274 _LegalText( 274 _LegalText(
275 - prefix: '3. ', 275 + prefix: '2. ',
276 text: context.l10n.purchaseNoteContact, 276 text: context.l10n.purchaseNoteContact,
277 - linkText: '联系我们', 277 + linkText: context.l10n.purchaseLinkContactUs,
278 linkSuffix: '。', 278 linkSuffix: '。',
279 onLinkTap: controller.openContactUs, 279 onLinkTap: controller.openContactUs,
280 ), 280 ),
@@ -87,6 +87,7 @@ class PayProductContent { @@ -87,6 +87,7 @@ class PayProductContent {
87 this.label, 87 this.label,
88 this.description, 88 this.description,
89 this.isForever, 89 this.isForever,
  90 + this.isDefault,
90 this.share, 91 this.share,
91 }); 92 });
92 93
@@ -95,6 +96,7 @@ class PayProductContent { @@ -95,6 +96,7 @@ class PayProductContent {
95 final String? label; 96 final String? label;
96 final String? description; 97 final String? description;
97 final int? isForever; 98 final int? isForever;
  99 + final int? isDefault;
98 final int? share; 100 final int? share;
99 101
100 factory PayProductContent.fromJson(Map<String, dynamic> json) { 102 factory PayProductContent.fromJson(Map<String, dynamic> json) {
@@ -104,6 +106,7 @@ class PayProductContent { @@ -104,6 +106,7 @@ class PayProductContent {
104 label: json['label'] as String?, 106 label: json['label'] as String?,
105 description: json['description'] as String?, 107 description: json['description'] as String?,
106 isForever: json['is_forever'] as int?, 108 isForever: json['is_forever'] as int?,
  109 + isDefault: json['is_default'] as int?,
107 share: json['share'] as int?, 110 share: json['share'] as int?,
108 ); 111 );
109 } 112 }
@@ -115,6 +118,7 @@ class PayProductContent { @@ -115,6 +118,7 @@ class PayProductContent {
115 if (label != null) val['label'] = label; 118 if (label != null) val['label'] = label;
116 if (description != null) val['description'] = description; 119 if (description != null) val['description'] = description;
117 if (isForever != null) val['is_forever'] = isForever; 120 if (isForever != null) val['is_forever'] = isForever;
  121 + if (isDefault != null) val['is_default'] = isDefault;
118 if (share != null) val['share'] = share; 122 if (share != null) val['share'] = share;
119 return val; 123 return val;
120 } 124 }
@@ -126,6 +130,10 @@ class PayProductContent { @@ -126,6 +130,10 @@ class PayProductContent {
126 int baseUnit() { 130 int baseUnit() {
127 return isYearProduct() ? 12 : 1; 131 return isYearProduct() ? 12 : 1;
128 } 132 }
  133 +
  134 + bool isDefaultProduct() {
  135 + return isDefault == 1;
  136 + }
129 } 137 }
130 138
131 class CreatePayOrderRequest { 139 class CreatePayOrderRequest {
@@ -489,9 +489,11 @@ @@ -489,9 +489,11 @@
489 "purchaseBenefitSleepAnalysis": "Sleep analysis", 489 "purchaseBenefitSleepAnalysis": "Sleep analysis",
490 "purchaseBenefitFutureFeatures": "Free access to future premium features", 490 "purchaseBenefitFutureFeatures": "Free access to future premium features",
491 "purchaseNotesTitle": "Notes", 491 "purchaseNotesTitle": "Notes",
492 - "purchaseNoteSubscription": "After you confirm and pay, the subscription will renew automatically through your iTunes account. Your Apple account will be charged within 24 hours before the current period ends, and the subscription will renew for another period. To cancel, turn off auto-renewal in your iTunes/Apple ID subscription settings at least 24 hours before the current period ends.\n\nDoubleFeel Pro is a virtual product. Purchases are non-refundable except through the App Store refund process. Tap Learn More for additional information.", 492 + "purchaseNoteSubscription": "After you confirm and pay, the subscription will renew automatically through your iTunes account. Your Apple account will be charged within 24 hours before the current period ends, and the subscription will renew for another period. To cancel, turn off auto-renewal in your iTunes/Apple ID subscription settings at least 24 hours before the current period ends.\n\nDoubleFeel Pro is a virtual product. Purchases are non-refundable except through the App Store refund process. Tap ",
  493 + "purchaseLinkLearnMore": "Learn More",
493 "purchaseNoteRestore": "If your purchase does not take effect, tap Restore Purchases.", 494 "purchaseNoteRestore": "If your purchase does not take effect, tap Restore Purchases.",
494 - "purchaseNoteContact": "Contact us if you have any other questions.", 495 + "purchaseNoteContact": "If you have any other questions, ",
  496 + "purchaseLinkContactUs": "Contact Us",
495 "reportBottomSlogan": "FEEL MORE, STRESS LESS", 497 "reportBottomSlogan": "FEEL MORE, STRESS LESS",
496 "refundExplanationTitle": "Refund Information", 498 "refundExplanationTitle": "Refund Information",
497 "refundAppStoreReviewTitle": "Refunds are reviewed by the App Store", 499 "refundAppStoreReviewTitle": "Refunds are reviewed by the App Store",
@@ -865,9 +865,11 @@ @@ -865,9 +865,11 @@
865 "purchaseBenefitSleepAnalysis": "睡眠分析", 865 "purchaseBenefitSleepAnalysis": "睡眠分析",
866 "purchaseBenefitFutureFeatures": "未来更多高级权益免费获取", 866 "purchaseBenefitFutureFeatures": "未来更多高级权益免费获取",
867 "purchaseNotesTitle": "说明", 867 "purchaseNotesTitle": "说明",
868 - "purchaseNoteSubscription": "确认购买并支付后,将通过您的 iTunes 账号自动续订。苹果 iTunes 账户会在到期前24小时内扣费,扣费成功后订阅周期顺延一个订阅周期。如需取消续订,请在当前订阅周期到期前24小时以前,手动在 iTunes/Apple ID 设置管理中关闭自动续费功能。本服务由您自主选择是否取消,若您选择不取消,将为您开通下个计费周期的续费服务。\n\nDoubleFeel Pro 会员属于虚拟物品,购买后,除 App Store 渠道退款外,不支持其他形式退款。如有需要,可以点击了解更多。", 868 + "purchaseNoteSubscription": "确认购买并支付后,将通过您的 iTunes 账号自动续订。苹果 iTunes 账户会在到期前24小时内扣费,扣费成功后订阅周期顺延一个订阅周期。如需取消续订,请在当前订阅周期到期前24小时以前,手动在 iTunes/Apple ID 设置管理中关闭自动续费功能。本服务由您自主选择是否取消,若您选择不取消,将为您开通下个计费周期的续费服务。\n\nDoubleFeel Pro 会员属于虚拟物品,购买后,除 App Store 渠道退款外,不支持其他形式退款。如有需要,可以点击",
  869 + "purchaseLinkLearnMore": "了解更多",
869 "purchaseNoteRestore": "如果购买后未生效,请点击恢复购买。", 870 "purchaseNoteRestore": "如果购买后未生效,请点击恢复购买。",
870 - "purchaseNoteContact": "如果有更多其他问题,请联系我们。", 871 + "purchaseNoteContact": "如果有更多其他问题,请",
  872 + "purchaseLinkContactUs": "联系我们",
871 "reportBottomSlogan": "双倍感知 压力减半", 873 "reportBottomSlogan": "双倍感知 压力减半",
872 "refundExplanationTitle": "退费说明", 874 "refundExplanationTitle": "退费说明",
873 "@refundExplanationTitle": { 875 "@refundExplanationTitle": {
@@ -3036,9 +3036,15 @@ abstract class AppLocalizations { @@ -3036,9 +3036,15 @@ abstract class AppLocalizations {
3036 /// No description provided for @purchaseNoteSubscription. 3036 /// No description provided for @purchaseNoteSubscription.
3037 /// 3037 ///
3038 /// In zh, this message translates to: 3038 /// In zh, this message translates to:
3039 - /// **'确认购买并支付后,将通过您的 iTunes 账号自动续订。苹果 iTunes 账户会在到期前24小时内扣费,扣费成功后订阅周期顺延一个订阅周期。如需取消续订,请在当前订阅周期到期前24小时以前,手动在 iTunes/Apple ID 设置管理中关闭自动续费功能。本服务由您自主选择是否取消,若您选择不取消,将为您开通下个计费周期的续费服务。\n\nDoubleFeel Pro 会员属于虚拟物品,购买后,除 App Store 渠道退款外,不支持其他形式退款。如有需要,可以点击了解更多。'** 3039 + /// **'确认购买并支付后,将通过您的 iTunes 账号自动续订。苹果 iTunes 账户会在到期前24小时内扣费,扣费成功后订阅周期顺延一个订阅周期。如需取消续订,请在当前订阅周期到期前24小时以前,手动在 iTunes/Apple ID 设置管理中关闭自动续费功能。本服务由您自主选择是否取消,若您选择不取消,将为您开通下个计费周期的续费服务。\n\nDoubleFeel Pro 会员属于虚拟物品,购买后,除 App Store 渠道退款外,不支持其他形式退款。如有需要,可以点击'**
3040 String get purchaseNoteSubscription; 3040 String get purchaseNoteSubscription;
3041 3041
  3042 + /// No description provided for @purchaseLinkLearnMore.
  3043 + ///
  3044 + /// In zh, this message translates to:
  3045 + /// **'了解更多'**
  3046 + String get purchaseLinkLearnMore;
  3047 +
3042 /// No description provided for @purchaseNoteRestore. 3048 /// No description provided for @purchaseNoteRestore.
3043 /// 3049 ///
3044 /// In zh, this message translates to: 3050 /// In zh, this message translates to:
@@ -3048,9 +3054,15 @@ abstract class AppLocalizations { @@ -3048,9 +3054,15 @@ abstract class AppLocalizations {
3048 /// No description provided for @purchaseNoteContact. 3054 /// No description provided for @purchaseNoteContact.
3049 /// 3055 ///
3050 /// In zh, this message translates to: 3056 /// In zh, this message translates to:
3051 - /// **'如果有更多其他问题,请联系我们。'** 3057 + /// **'如果有更多其他问题,请'**
3052 String get purchaseNoteContact; 3058 String get purchaseNoteContact;
3053 3059
  3060 + /// No description provided for @purchaseLinkContactUs.
  3061 + ///
  3062 + /// In zh, this message translates to:
  3063 + /// **'联系我们'**
  3064 + String get purchaseLinkContactUs;
  3065 +
3054 /// No description provided for @reportBottomSlogan. 3066 /// No description provided for @reportBottomSlogan.
3055 /// 3067 ///
3056 /// In zh, this message translates to: 3068 /// In zh, this message translates to:
@@ -1696,15 +1696,20 @@ class AppLocalizationsEn extends AppLocalizations { @@ -1696,15 +1696,20 @@ class AppLocalizationsEn extends AppLocalizations {
1696 1696
1697 @override 1697 @override
1698 String get purchaseNoteSubscription => 1698 String get purchaseNoteSubscription =>
1699 - 'After you confirm and pay, the subscription will renew automatically through your iTunes account. Your Apple account will be charged within 24 hours before the current period ends, and the subscription will renew for another period. To cancel, turn off auto-renewal in your iTunes/Apple ID subscription settings at least 24 hours before the current period ends.\n\nDoubleFeel Pro is a virtual product. Purchases are non-refundable except through the App Store refund process. Tap Learn More for additional information.'; 1699 + 'After you confirm and pay, the subscription will renew automatically through your iTunes account. Your Apple account will be charged within 24 hours before the current period ends, and the subscription will renew for another period. To cancel, turn off auto-renewal in your iTunes/Apple ID subscription settings at least 24 hours before the current period ends.\n\nDoubleFeel Pro is a virtual product. Purchases are non-refundable except through the App Store refund process. Tap ';
  1700 +
  1701 + @override
  1702 + String get purchaseLinkLearnMore => 'Learn More';
1700 1703
1701 @override 1704 @override
1702 String get purchaseNoteRestore => 1705 String get purchaseNoteRestore =>
1703 'If your purchase does not take effect, tap Restore Purchases.'; 1706 'If your purchase does not take effect, tap Restore Purchases.';
1704 1707
1705 @override 1708 @override
1706 - String get purchaseNoteContact =>  
1707 - 'Contact us if you have any other questions.'; 1709 + String get purchaseNoteContact => 'If you have any other questions, ';
  1710 +
  1711 + @override
  1712 + String get purchaseLinkContactUs => 'Contact Us';
1708 1713
1709 @override 1714 @override
1710 String get reportBottomSlogan => 'FEEL MORE, STRESS LESS'; 1715 String get reportBottomSlogan => 'FEEL MORE, STRESS LESS';
@@ -1617,13 +1617,19 @@ class AppLocalizationsZh extends AppLocalizations { @@ -1617,13 +1617,19 @@ class AppLocalizationsZh extends AppLocalizations {
1617 1617
1618 @override 1618 @override
1619 String get purchaseNoteSubscription => 1619 String get purchaseNoteSubscription =>
1620 - '确认购买并支付后,将通过您的 iTunes 账号自动续订。苹果 iTunes 账户会在到期前24小时内扣费,扣费成功后订阅周期顺延一个订阅周期。如需取消续订,请在当前订阅周期到期前24小时以前,手动在 iTunes/Apple ID 设置管理中关闭自动续费功能。本服务由您自主选择是否取消,若您选择不取消,将为您开通下个计费周期的续费服务。\n\nDoubleFeel Pro 会员属于虚拟物品,购买后,除 App Store 渠道退款外,不支持其他形式退款。如有需要,可以点击了解更多。'; 1620 + '确认购买并支付后,将通过您的 iTunes 账号自动续订。苹果 iTunes 账户会在到期前24小时内扣费,扣费成功后订阅周期顺延一个订阅周期。如需取消续订,请在当前订阅周期到期前24小时以前,手动在 iTunes/Apple ID 设置管理中关闭自动续费功能。本服务由您自主选择是否取消,若您选择不取消,将为您开通下个计费周期的续费服务。\n\nDoubleFeel Pro 会员属于虚拟物品,购买后,除 App Store 渠道退款外,不支持其他形式退款。如有需要,可以点击';
  1621 +
  1622 + @override
  1623 + String get purchaseLinkLearnMore => '了解更多';
1621 1624
1622 @override 1625 @override
1623 String get purchaseNoteRestore => '如果购买后未生效,请点击恢复购买。'; 1626 String get purchaseNoteRestore => '如果购买后未生效,请点击恢复购买。';
1624 1627
1625 @override 1628 @override
1626 - String get purchaseNoteContact => '如果有更多其他问题,请联系我们。'; 1629 + String get purchaseNoteContact => '如果有更多其他问题,请';
  1630 +
  1631 + @override
  1632 + String get purchaseLinkContactUs => '联系我们';
1627 1633
1628 @override 1634 @override
1629 String get reportBottomSlogan => '双倍感知 压力减半'; 1635 String get reportBottomSlogan => '双倍感知 压力减半';