Habib Wallet & Lakum data updates

pull/376/head
haroon amjad 2 months ago
parent 621cbdb165
commit e96f2c3ecd

@ -31,6 +31,7 @@ class HabibWalletViewModel extends ChangeNotifier {
num walletRechargeAmount = 0; num walletRechargeAmount = 0;
String notesText = ""; String notesText = "";
bool isWalletAmountToBeLoaded = false; bool isWalletAmountToBeLoaded = false;
bool isLakumInfoToBeLoaded = false;
// ── Balance visibility (show/hide like a password field) ────────────────── // ── Balance visibility (show/hide like a password field) ──────────────────
bool isWalletAmountHidden = true; bool isWalletAmountHidden = true;
@ -55,7 +56,7 @@ class HabibWalletViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
// On first unhide, fetch the data if not already fetched. // On first unhide, fetch the data if not already fetched.
if (!isLakumPointsHidden && !isLakumInfoFetched) { if (!isLakumPointsHidden && !isLakumInfoFetched) {
isWalletAmountToBeLoaded = true; isLakumInfoToBeLoaded = true;
getLakumAccountInformation(); getLakumAccountInformation();
} }
} }
@ -358,6 +359,8 @@ class HabibWalletViewModel extends ChangeNotifier {
if (isWalletAmountToBeLoaded) { if (isWalletAmountToBeLoaded) {
isWalletAmountLoading = true; isWalletAmountLoading = true;
habibWalletAmount = 0; habibWalletAmount = 0;
}
if (isLakumInfoToBeLoaded) {
isLakumAccountInfoLoading = true; isLakumAccountInfoLoading = true;
yahalaAccountNumber = ""; yahalaAccountNumber = "";
} }
@ -429,6 +432,11 @@ class HabibWalletViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
setIsLakumInfoToBeLoaded(bool value) {
isLakumInfoToBeLoaded = value;
notifyListeners();
}
String getSelectedRechargeTypeValue() { String getSelectedRechargeTypeValue() {
switch (selectedRechargeType) { switch (selectedRechargeType) {
case 1: case 1:
@ -571,7 +579,7 @@ class HabibWalletViewModel extends ChangeNotifier {
} }
Future<void> getLakumAccountInformation({Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> getLakumAccountInformation({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isWalletAmountToBeLoaded) { if (!isLakumInfoToBeLoaded) {
return; return;
} }
@ -586,6 +594,8 @@ class HabibWalletViewModel extends ChangeNotifier {
(failure) async { (failure) async {
yahalaAccountNumber = "0"; yahalaAccountNumber = "0";
isLakumAccountInfoLoading = false; isLakumAccountInfoLoading = false;
isLakumInfoFetched = true;
isLakumInfoToBeLoaded = false;
notifyListeners(); // 675534 notifyListeners(); // 675534
}, },
(apiResponse) async { (apiResponse) async {
@ -613,6 +623,7 @@ class HabibWalletViewModel extends ChangeNotifier {
} }
isLakumAccountInfoLoading = false; isLakumAccountInfoLoading = false;
isLakumInfoFetched = true; isLakumInfoFetched = true;
isLakumInfoToBeLoaded = false;
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);

@ -76,6 +76,7 @@ class _AppLanguageChangeState extends State<AppLanguageChange> {
myAppointmentsViewModel.getPatientAppointments(true, false); myAppointmentsViewModel.getPatientAppointments(true, false);
habibWalletVM.setIsWalletAmountToBeLoaded(true); habibWalletVM.setIsWalletAmountToBeLoaded(true);
habibWalletVM.setIsLakumInfoToBeLoaded(true);
habibWalletVM.initHabibWalletProvider(); habibWalletVM.initHabibWalletProvider();
habibWalletVM.getPatientBalanceAmount(); habibWalletVM.getPatientBalanceAmount();
habibWalletVM.getLakumAccountInformation(); habibWalletVM.getLakumAccountInformation();

Loading…
Cancel
Save