Commit 682ab1de authored by DatHV's avatar DatHV
Browse files

fix bug.

parent 1edd930e
{
"flavor":"pro",
"baseUrl":"https://api.mypoint.com.vn/8854/gup2start/rest",
"t3Token":"runner-env-t3Token-pro",
"enableLogging":false
"flavor":"dev",
"baseUrl":"https://api.sandbox.mypoint.com.vn/8854/gup2start/rest",
"t3Token":"runner-env-flavor-dev",
"enableLogging":true
}
......@@ -738,6 +738,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
......@@ -753,7 +754,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.icom.vn.MyPoint;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "MyPoint development";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "MyPoint Adhoc Distribution";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
......
......@@ -114,10 +114,13 @@ extension RestfulAPIClientAllRequest on RestfulAPIClient {
);
}
Future<BaseResponseModel<CreateOTPResponseModel>> verifyDeleteAccount(String otp) async {
Future<BaseResponseModel<OTPVerifyResponseModel>> verifyDeleteAccount(String otp) async {
String? token = DataPreference.instance.token ?? "";
return requestNormal(APIPaths.verifyDeleteAccount, Method.POST, {
"otp": otp,
}, (data) => CreateOTPResponseModel.fromJson(data as Json));
"access_token": token,
"lang": "vi",
}, (data) => OTPVerifyResponseModel.fromJson(data as Json));
}
Future<BaseResponseModel<EmptyCodable>> signup(String phone, String password) async {
......
......@@ -80,7 +80,7 @@ class XAppSDKService {
final errorMessage = message?.toString();
final tokenString = data?.toString().orEmpty ?? '';
final isPlaceholder = tokenString.trim().toLowerCase().contains("tokenex.tokenex");
print('🔍 XAppSDKService: getToken result - status: $status, token length: ${tokenString}, isPlaceholder: $isPlaceholder');
print('🔍 XAppSDKService: getToken result - status: $status, token: ${tokenString}, isPlaceholder: $isPlaceholder');
if (status == 'success' && data != null && tokenString.isNotEmpty && !isPlaceholder) {
_cachedToken = tokenString;
_lastError = null;
......
......@@ -34,7 +34,7 @@ class _AffiliateTabScreenState extends BaseState<AffiliateTabScreen> with BasicS
super.initState();
final args = Get.arguments;
if (args is Map) {
_canBackButton = args['can_back_button'] as bool;
_canBackButton = args['can_back_button'] as bool? ?? false;
}
viewModel.onShowAffiliateBrandPopup = (data) {
if (!mounted) return;
......
......@@ -21,6 +21,7 @@ class CreatePasswordScreen extends StatelessWidget {
return Scaffold(
body: SafeArea(
top: false,
child: Stack(
children: [
GestureDetector(
......
......@@ -21,6 +21,10 @@ class CreatePasswordViewModel extends GetxController {
}
void _validate() {
if (newPassword.value.length != 6) {
isButtonEnabled.value = false;
return;
}
if (newPassword.value.isEmpty || confirmPassword.value.isEmpty) {
errorMessage.value = "";
isButtonEnabled.value = false;
......
......@@ -10,7 +10,7 @@ class DailyCheckInViewModel extends RestfulApiViewModel {
void Function(SubmitCheckInData? data)? submitDataResponse;
bool get todayIsChecked {
final counter = checkInData.value?.counters?.first;
final counter = checkInData.value?.dailyCounter;
final items = counter?.values ?? [];
return (items.firstOrNull?.counterValue ?? '') == '1';
}
......
......@@ -60,8 +60,9 @@ class _DeviceManagerScreenState extends BaseState<DeviceManagerScreen> with Basi
if (logoutDisplayDevices.isNotEmpty)
Center(
child: TextButton(
onPressed: () {
Get.to(() => LoggedOutDeviceScreen());
onPressed: () async {
await Get.to(() => LoggedOutDeviceScreen());
_refresh();
},
child: Text(
'Xem tất cả thiết bị đã đăng xuất (${logoutDevices.length})',
......
......@@ -32,7 +32,7 @@ class _GameTabScreenState extends BaseState<GameTabScreen> with BasicState, Popu
super.initState();
final args = Get.arguments;
if (args is Map) {
_canBackButton = args['can_back_button'] as bool;
_canBackButton = args['can_back_button'] as bool? ?? false;
}
_viewModel.getGames();
_viewModel.onShowAlertError = (message) {
......
......@@ -66,13 +66,18 @@ class HomeGreetingHeader extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: _onProfileTap,
child: Text(
'Xin chào $name!',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.black87),
Expanded(
child: GestureDetector(
onTap: _onProfileTap,
child: Text(
'Xin chào $name!',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.black87),
),
),
),
const SizedBox(width: 8),
Row(
children: [
GestureDetector(
......
......@@ -94,4 +94,5 @@ class HeaderHomeViewModel extends GetxController {
}
Future<void> freshData() => _repository._load(withLoading: false);
Future<void> fetchNotificationUnread() => _repository._fetchNotificationUnread();
}
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:mypoint_flutter_app/shared/navigation/directional_screen.dart';
import '../../features/home/custom_widget/header_home_widget.dart';
import '../../features/home/custom_widget/product_grid_widget.dart';
import '../../features/pipi/pipi_detail_screen.dart';
......@@ -203,6 +204,8 @@ class _HomeScreenState extends BaseState<HomeScreen> with PopupOnInit, BasicStat
}
void _handleHoverViewTap() {
// final direction = DirectionalScreen.buildByName(name: DirectionalScreenName.campaignSevenDayScreen, clickActionParam: "0");
// direction?.begin();
final result = _viewModel.hoverData.value?.direction?.begin();
if (result != true) {
showModalBottomSheet(
......@@ -250,6 +253,7 @@ class _HomeScreenState extends BaseState<HomeScreen> with PopupOnInit, BasicStat
@override
void onRouteDidAppear() {
super.onRouteDidAppear();
_headerHomeVM.fetchNotificationUnread();
if (_viewModel.hoverDismissed) return;
_viewModel.loadDataPiPiHome();
}
......
......@@ -106,6 +106,8 @@ class _InterestCategoriesScreenState extends BaseState<InterestCategoriesScreen>
}
Widget _buildBottomButton() {
final bool hasSelection = _viewModel.selectedIds.isNotEmpty;
final bool canSubmit = _onChange && hasSelection;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
decoration: const BoxDecoration(
......@@ -116,13 +118,13 @@ class _InterestCategoriesScreenState extends BaseState<InterestCategoriesScreen>
top: false,
child: ElevatedButton(
onPressed:
_onChange
canSubmit
? () {
_viewModel.submitInterestedCategories();
}
: null,
style: ElevatedButton.styleFrom(
backgroundColor: _onChange ? BaseColor.primary500 : Colors.grey,
backgroundColor: canSubmit ? BaseColor.primary500 : Colors.grey,
minimumSize: const Size.fromHeight(52),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
),
......@@ -130,7 +132,7 @@ class _InterestCategoriesScreenState extends BaseState<InterestCategoriesScreen>
'Cập nhật',
style: TextStyle(
fontSize: 16,
color: _onChange ? Colors.white : Colors.black87,
color: canSubmit ? Colors.white : Colors.black87,
fontWeight: FontWeight.w700,
),
),
......@@ -169,9 +171,10 @@ class _InterestCard extends StatelessWidget {
Positioned(
bottom: 10,
left: 12,
right: 12,
child: Text(
title,
maxLines: 2,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w700),
),
......
......@@ -29,6 +29,13 @@ class _MainTabScreenState extends State<MainTabScreen> {
@override
void initState() {
super.initState();
final args = Get.arguments;
if (args is Map) {
final requestedIndex = args['tabIndex'];
if (requestedIndex is int && requestedIndex >= 0 && requestedIndex < _pages.length) {
_currentIndex = requestedIndex;
}
}
final viewModel = Get.put(HeaderHomeViewModel());
viewModel.freshData();
}
......
......@@ -46,24 +46,28 @@ class MemberLevelHeaderWidget extends StatelessWidget {
placeholderAsset: "assets/images/ic_logo_rank_member.png",
),
const SizedBox(width: 6),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
name.toUpperCase(),
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white),
),
const SizedBox(height: 4),
if ((level?.levelName ?? "").isNotEmpty)
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20)),
child: Text(
(level?.levelName ?? "").capitalizeWords(),
style: TextStyle(color: BaseColor.primary800, fontSize: 14, fontWeight: FontWeight.bold),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
name.toUpperCase(),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white),
),
],
const SizedBox(height: 4),
if ((level?.levelName ?? "").isNotEmpty)
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20)),
child: Text(
(level?.levelName ?? "").capitalizeWords(),
style: TextStyle(color: BaseColor.primary800, fontSize: 14, fontWeight: FontWeight.bold),
),
),
],
),
),
],
),
......
......@@ -65,6 +65,7 @@ class _NewsListScreenState extends State<NewsListScreen> {
);
}),
),
const SizedBox(height: 16),
],
),
);
......
......@@ -157,7 +157,7 @@ class _NotificationScreenState extends BaseState<NotificationScreen> with BasicS
void _confirmDeleteAllNotifications() {
final dataAlert = DataAlertModel(
title: "Xoá tất cả",
// title: "Xoá tất cả",
description: "Bạn có muốn xoá hết tất cả thông báo không? \nLưu ý: bạn sẽ không thể xem lại thông báo đã xoá",
localHeaderImage: "assets/images/ic_pipi_03.png",
buttons: [
......
......@@ -51,6 +51,7 @@ class NotificationViewModel extends RestfulApiViewModel {
onShowAlertError?.call(msg);
},
onComplete: () {
isLoading.value = false;
fetchNotifications(refresh: true);
},
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment