Habib Wallet & Lakum data updates

pull/376/head
haroon amjad 3 weeks ago
parent 621cbdb165
commit e96f2c3ecd

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

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

Loading…
Cancel
Save