Showing
6 changed files
with
40 additions
and
14 deletions
| @@ -737,7 +737,7 @@ | @@ -737,7 +737,7 @@ | ||
| 737 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | 737 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 738 | CODE_SIGN_ENTITLEMENTS = "Runner/Runner-Debug.entitlements"; | 738 | CODE_SIGN_ENTITLEMENTS = "Runner/Runner-Debug.entitlements"; |
| 739 | CODE_SIGN_STYLE = Automatic; | 739 | CODE_SIGN_STYLE = Automatic; |
| 740 | - CURRENT_PROJECT_VERSION = " 80"; | 740 | + CURRENT_PROJECT_VERSION = " 81"; |
| 741 | DEVELOPMENT_TEAM = ZRPLMC329K; | 741 | DEVELOPMENT_TEAM = ZRPLMC329K; |
| 742 | ENABLE_PREVIEWS = YES; | 742 | ENABLE_PREVIEWS = YES; |
| 743 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; | 743 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; |
| @@ -816,7 +816,7 @@ | @@ -816,7 +816,7 @@ | ||
| 816 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | 816 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 817 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 817 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 818 | CODE_SIGN_STYLE = Automatic; | 818 | CODE_SIGN_STYLE = Automatic; |
| 819 | - CURRENT_PROJECT_VERSION = " 80"; | 819 | + CURRENT_PROJECT_VERSION = " 81"; |
| 820 | DEVELOPMENT_TEAM = ZRPLMC329K; | 820 | DEVELOPMENT_TEAM = ZRPLMC329K; |
| 821 | ENABLE_PREVIEWS = YES; | 821 | ENABLE_PREVIEWS = YES; |
| 822 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; | 822 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; |
| @@ -79,7 +79,9 @@ class TodayController extends GetMaterialController { | @@ -79,7 +79,9 @@ class TodayController extends GetMaterialController { | ||
| 79 | 79 | ||
| 80 | UserStateService get userStateService => _userStateService; | 80 | UserStateService get userStateService => _userStateService; |
| 81 | 81 | ||
| 82 | - late final DateTime firstSelectableDay; | 82 | + Rx<DateTime> firstSelectableDay = DateTime( |
| 83 | + DateTime.now().year, DateTime.now().month - 6, DateTime.now().day) | ||
| 84 | + .obs; | ||
| 83 | late final DateTime lastSelectableDay; | 85 | late final DateTime lastSelectableDay; |
| 84 | final selectedDate = DateTime.now().obs; | 86 | final selectedDate = DateTime.now().obs; |
| 85 | final focusedDay = DateTime.now().obs; | 87 | final focusedDay = DateTime.now().obs; |
| @@ -136,7 +138,9 @@ class TodayController extends GetMaterialController { | @@ -136,7 +138,9 @@ class TodayController extends GetMaterialController { | ||
| 136 | super.onInit(); | 138 | super.onInit(); |
| 137 | targetFriendInfo.value = _initialFriendInfo; | 139 | targetFriendInfo.value = _initialFriendInfo; |
| 138 | final today = DateUtils.dateOnly(DateTime.now()); | 140 | final today = DateUtils.dateOnly(DateTime.now()); |
| 139 | - firstSelectableDay = DateTime(today.year - 1); | 141 | + firstSelectableDay.value = DateUtils.dateOnly( |
| 142 | + DateTime(today.year, today.month - 6, today.day), | ||
| 143 | + ); | ||
| 140 | lastSelectableDay = today; | 144 | lastSelectableDay = today; |
| 141 | selectedDate.value = today; | 145 | selectedDate.value = today; |
| 142 | focusedDay.value = today; | 146 | focusedDay.value = today; |
| @@ -198,13 +202,19 @@ class TodayController extends GetMaterialController { | @@ -198,13 +202,19 @@ class TodayController extends GetMaterialController { | ||
| 198 | 202 | ||
| 199 | void changeDate(DateTime date, {DateTime? focused}) { | 203 | void changeDate(DateTime date, {DateTime? focused}) { |
| 200 | final normalizedDate = _clampDate(date); | 204 | final normalizedDate = _clampDate(date); |
| 205 | + if (!DateUtils.isSameDay(date, lastSelectableDay) && | ||
| 206 | + !_userStateService.isVip) { | ||
| 207 | + toPremiumPage(); | ||
| 208 | + return; | ||
| 209 | + } | ||
| 201 | selectedDate.value = normalizedDate; | 210 | selectedDate.value = normalizedDate; |
| 202 | focusedDay.value = _clampDate(focused ?? normalizedDate); | 211 | focusedDay.value = _clampDate(focused ?? normalizedDate); |
| 203 | } | 212 | } |
| 204 | 213 | ||
| 205 | DateTime _clampDate(DateTime date) { | 214 | DateTime _clampDate(DateTime date) { |
| 206 | final normalizedDate = DateUtils.dateOnly(date); | 215 | final normalizedDate = DateUtils.dateOnly(date); |
| 207 | - if (normalizedDate.isBefore(firstSelectableDay)) return firstSelectableDay; | 216 | + if (normalizedDate.isBefore(firstSelectableDay.value)) |
| 217 | + return firstSelectableDay.value; | ||
| 208 | if (normalizedDate.isAfter(lastSelectableDay)) return lastSelectableDay; | 218 | if (normalizedDate.isAfter(lastSelectableDay)) return lastSelectableDay; |
| 209 | return normalizedDate; | 219 | return normalizedDate; |
| 210 | } | 220 | } |
| @@ -406,6 +416,12 @@ class TodayController extends GetMaterialController { | @@ -406,6 +416,12 @@ class TodayController extends GetMaterialController { | ||
| 406 | v2ActivityTarget.value = null; | 416 | v2ActivityTarget.value = null; |
| 407 | } | 417 | } |
| 408 | } | 418 | } |
| 419 | + // Future.delayed(const Duration(milliseconds: 5000), () { | ||
| 420 | + // firstSelectableDay.value = DateUtils.dateOnly( | ||
| 421 | + // DateTime( | ||
| 422 | + // DateTime.now().year, DateTime.now().month, DateTime.now().day - 1), | ||
| 423 | + // ); | ||
| 424 | + // }); | ||
| 409 | } | 425 | } |
| 410 | 426 | ||
| 411 | void _clearRealTimeData() { | 427 | void _clearRealTimeData() { |
| @@ -536,7 +552,7 @@ class TodayController extends GetMaterialController { | @@ -536,7 +552,7 @@ class TodayController extends GetMaterialController { | ||
| 536 | final PlatformHostApi _platformHostApi = PlatformHostApi(); | 552 | final PlatformHostApi _platformHostApi = PlatformHostApi(); |
| 537 | 553 | ||
| 538 | Future<void> getProductList() async { | 554 | Future<void> getProductList() async { |
| 539 | - final result = await _payApi.getProductList(10); | 555 | + final result = await _payApi.getProductList(); |
| 540 | if (result is! AppSuccess<PayProductListResponse>) return; | 556 | if (result is! AppSuccess<PayProductListResponse>) return; |
| 541 | 557 | ||
| 542 | final products = (result.data.productList ?? const <PayProduct>[]) | 558 | final products = (result.data.productList ?? const <PayProduct>[]) |
| @@ -601,8 +617,12 @@ class TodayController extends GetMaterialController { | @@ -601,8 +617,12 @@ class TodayController extends GetMaterialController { | ||
| 601 | @override | 617 | @override |
| 602 | void didChangeAppLifecycleState(AppLifecycleState state) { | 618 | void didChangeAppLifecycleState(AppLifecycleState state) { |
| 603 | super.didChangeAppLifecycleState(state); | 619 | super.didChangeAppLifecycleState(state); |
| 604 | - checkAddFriendVisible(); | ||
| 605 | - checkHrvAdBannerVisible(); | ||
| 606 | - checkHealthDataAuthCardVisible(); | 620 | + |
| 621 | + if (state == AppLifecycleState.resumed) { | ||
| 622 | + checkAddFriendVisible(); | ||
| 623 | + checkHrvAdBannerVisible(); | ||
| 624 | + checkHealthDataAuthCardVisible(); | ||
| 625 | + unawaited(loadDataForDate(selectedDate.value)); | ||
| 626 | + } | ||
| 607 | } | 627 | } |
| 608 | } | 628 | } |
| @@ -323,7 +323,7 @@ class TodayTabBody extends StatelessWidget { | @@ -323,7 +323,7 @@ class TodayTabBody extends StatelessWidget { | ||
| 323 | daysOfWeekHeight: _weekRowsHeight / 2, | 323 | daysOfWeekHeight: _weekRowsHeight / 2, |
| 324 | rowHeight: _weekRowsHeight / 2, | 324 | rowHeight: _weekRowsHeight / 2, |
| 325 | focusedDay: controller.focusedDay.value, | 325 | focusedDay: controller.focusedDay.value, |
| 326 | - firstDay: controller.firstSelectableDay, | 326 | + firstDay: controller.firstSelectableDay.value, |
| 327 | lastDay: controller.lastSelectableDay, | 327 | lastDay: controller.lastSelectableDay, |
| 328 | currentDay: controller.lastSelectableDay, | 328 | currentDay: controller.lastSelectableDay, |
| 329 | locale: Localizations.localeOf(context).toString(), | 329 | locale: Localizations.localeOf(context).toString(), |
| @@ -370,11 +370,17 @@ class TodayTabBody extends StatelessWidget { | @@ -370,11 +370,17 @@ class TodayTabBody extends StatelessWidget { | ||
| 370 | const SizedBox(width: 12), | 370 | const SizedBox(width: 12), |
| 371 | GestureDetector( | 371 | GestureDetector( |
| 372 | onTap: () async { | 372 | onTap: () async { |
| 373 | + if (!Get.find<UserStateService>().isVip) { | ||
| 374 | + controller.toPremiumPage(); | ||
| 375 | + return; | ||
| 376 | + } | ||
| 373 | final picked = await showReportDatePickerSheet( | 377 | final picked = await showReportDatePickerSheet( |
| 374 | context: context, | 378 | context: context, |
| 375 | period: ReportPeriod.day, | 379 | period: ReportPeriod.day, |
| 376 | selectedDate: controller.selectedDate.value, | 380 | selectedDate: controller.selectedDate.value, |
| 377 | weekStart: controller.selectedDate.value, | 381 | weekStart: controller.selectedDate.value, |
| 382 | + maxDate: controller.lastSelectableDay, | ||
| 383 | + minDate: controller.firstSelectableDay.value, | ||
| 378 | ); | 384 | ); |
| 379 | if (picked != null) { | 385 | if (picked != null) { |
| 380 | controller.changeDate(picked); | 386 | controller.changeDate(picked); |
| @@ -168,7 +168,7 @@ class MembershipOfferController extends GetxController { | @@ -168,7 +168,7 @@ class MembershipOfferController extends GetxController { | ||
| 168 | final yearlyProductAppleInfo = Rxn<AppleProductInfo>(); | 168 | final yearlyProductAppleInfo = Rxn<AppleProductInfo>(); |
| 169 | 169 | ||
| 170 | Future<void> getProductList() async { | 170 | Future<void> getProductList() async { |
| 171 | - final result = await _payApi.getProductList(10); | 171 | + final result = await _payApi.getProductList(); |
| 172 | if (result is! AppSuccess<PayProductListResponse>) return; | 172 | if (result is! AppSuccess<PayProductListResponse>) return; |
| 173 | 173 | ||
| 174 | final products = (result.data.productList ?? const <PayProduct>[]) | 174 | final products = (result.data.productList ?? const <PayProduct>[]) |
| @@ -143,7 +143,7 @@ class PurchaseController extends GetxController { | @@ -143,7 +143,7 @@ class PurchaseController extends GetxController { | ||
| 143 | plans.clear(); | 143 | plans.clear(); |
| 144 | selectedIndex.value = 0; | 144 | selectedIndex.value = 0; |
| 145 | try { | 145 | try { |
| 146 | - final result = await _payApi.getProductList(1); | 146 | + final result = await _payApi.getProductList(); |
| 147 | if (result is! AppSuccess<PayProductListResponse>) return; | 147 | if (result is! AppSuccess<PayProductListResponse>) return; |
| 148 | 148 | ||
| 149 | final products = (result.data.productList ?? const <PayProduct>[]) | 149 | final products = (result.data.productList ?? const <PayProduct>[]) |
| @@ -11,13 +11,13 @@ class PayApi { | @@ -11,13 +11,13 @@ class PayApi { | ||
| 11 | 11 | ||
| 12 | final DioClient _dioClient; | 12 | final DioClient _dioClient; |
| 13 | 13 | ||
| 14 | - Future<AppResult<PayProductListResponse>> getProductList(int productType) { | 14 | + Future<AppResult<PayProductListResponse>> getProductList({int? productType}) { |
| 15 | return safeCall( | 15 | return safeCall( |
| 16 | call: () async { | 16 | call: () async { |
| 17 | final response = await _dioClient.dio.get( | 17 | final response = await _dioClient.dio.get( |
| 18 | ApiPaths.paymentProducts, | 18 | ApiPaths.paymentProducts, |
| 19 | queryParameters: { | 19 | queryParameters: { |
| 20 | - 'product_type': productType, | 20 | + 'product_type': productType ?? 1, |
| 21 | 'product_channel': 2, | 21 | 'product_channel': 2, |
| 22 | }, | 22 | }, |
| 23 | ); | 23 | ); |
-
Please register or login to post a comment