|
|
|
@ -65,6 +65,15 @@ class UserVM extends BaseVM {
|
|
|
|
_loginOtherAccount = value;
|
|
|
|
_loginOtherAccount = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isImagepUploading = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool get getIsImagepUploading => isImagepUploading;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set setIsImagepUploading(bool value) {
|
|
|
|
|
|
|
|
isImagepUploading = value;
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Country? userCountries;
|
|
|
|
Country? userCountries;
|
|
|
|
Cities? userCities;
|
|
|
|
Cities? userCities;
|
|
|
|
|
|
|
|
|
|
|
|
@ -198,11 +207,13 @@ class UserVM extends BaseVM {
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> performCompleteProfile(BuildContext context, {
|
|
|
|
Future<void> performCompleteProfile(
|
|
|
|
|
|
|
|
BuildContext context, {
|
|
|
|
required String password,
|
|
|
|
required String password,
|
|
|
|
required String confirmPassword,
|
|
|
|
required String confirmPassword,
|
|
|
|
required String firstName,
|
|
|
|
required String firstName,
|
|
|
|
required String lastName,
|
|
|
|
required String lastName,
|
|
|
|
|
|
|
|
required String companyName,
|
|
|
|
required String email,
|
|
|
|
required String email,
|
|
|
|
required String? userId,
|
|
|
|
required String? userId,
|
|
|
|
bool isNeedToPassToken = false,
|
|
|
|
bool isNeedToPassToken = false,
|
|
|
|
@ -212,15 +223,7 @@ class UserVM extends BaseVM {
|
|
|
|
if (Utils.passwordValidateStructure(password)) {
|
|
|
|
if (Utils.passwordValidateStructure(password)) {
|
|
|
|
if (password == confirmPassword) {
|
|
|
|
if (password == confirmPassword) {
|
|
|
|
Utils.showLoading(context);
|
|
|
|
Utils.showLoading(context);
|
|
|
|
RegisterUserRespModel user = await userRepo.basicComplete(
|
|
|
|
RegisterUserRespModel user = await userRepo.basicComplete(userId ?? "", firstName, lastName, companyName, email, password, cityID, genderID, isNeedToPassToken: isNeedToPassToken);
|
|
|
|
userId ?? "",
|
|
|
|
|
|
|
|
firstName,
|
|
|
|
|
|
|
|
lastName,
|
|
|
|
|
|
|
|
email,
|
|
|
|
|
|
|
|
password,
|
|
|
|
|
|
|
|
cityID,
|
|
|
|
|
|
|
|
genderID,
|
|
|
|
|
|
|
|
isNeedToPassToken: isNeedToPassToken);
|
|
|
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
if (user.messageStatus == 1) {
|
|
|
|
if (user.messageStatus == 1) {
|
|
|
|
Utils.showToast(LocaleKeys.successfullyRegistered.tr());
|
|
|
|
Utils.showToast(LocaleKeys.successfullyRegistered.tr());
|
|
|
|
@ -242,6 +245,7 @@ class UserVM extends BaseVM {
|
|
|
|
required String password,
|
|
|
|
required String password,
|
|
|
|
required String? firstName,
|
|
|
|
required String? firstName,
|
|
|
|
required String? lastName,
|
|
|
|
required String? lastName,
|
|
|
|
|
|
|
|
required String? companyName,
|
|
|
|
required String? email,
|
|
|
|
required String? email,
|
|
|
|
required DropValue? city,
|
|
|
|
required DropValue? city,
|
|
|
|
required DropValue? gender,
|
|
|
|
required DropValue? gender,
|
|
|
|
@ -255,6 +259,11 @@ class UserVM extends BaseVM {
|
|
|
|
Utils.showToast(LocaleKeys.surnameNameMandatory.tr());
|
|
|
|
Utils.showToast(LocaleKeys.surnameNameMandatory.tr());
|
|
|
|
//("Surname is mandatory");
|
|
|
|
//("Surname is mandatory");
|
|
|
|
isValid = false;
|
|
|
|
isValid = false;
|
|
|
|
|
|
|
|
} else if (companyName!.isEmpty) {
|
|
|
|
|
|
|
|
if (AppState().currentAppType == AppType.provider) {
|
|
|
|
|
|
|
|
Utils.showToast(LocaleKeys.companyNameMandatory.tr());
|
|
|
|
|
|
|
|
isValid = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (email!.isNotEmpty) {
|
|
|
|
} else if (email!.isNotEmpty) {
|
|
|
|
if (!Utils.isEmailValid(email)) {
|
|
|
|
if (!Utils.isEmailValid(email)) {
|
|
|
|
Utils.showToast(LocaleKeys.enterValidEmail.tr());
|
|
|
|
Utils.showToast(LocaleKeys.enterValidEmail.tr());
|
|
|
|
@ -585,6 +594,7 @@ class UserVM extends BaseVM {
|
|
|
|
? phoneNum
|
|
|
|
? phoneNum
|
|
|
|
: phoneNum,
|
|
|
|
: phoneNum,
|
|
|
|
password);
|
|
|
|
password);
|
|
|
|
|
|
|
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
LoginPasswordRespModel user = LoginPasswordRespModel.fromJson(jsonDecode(response.body));
|
|
|
|
LoginPasswordRespModel user = LoginPasswordRespModel.fromJson(jsonDecode(response.body));
|
|
|
|
if (user.messageStatus == 1) {
|
|
|
|
if (user.messageStatus == 1) {
|
|
|
|
@ -683,9 +693,22 @@ class UserVM extends BaseVM {
|
|
|
|
Future<void> updateUserImage(BuildContext context) async {
|
|
|
|
Future<void> updateUserImage(BuildContext context) async {
|
|
|
|
File? myPick = await commanServices.pickFile(context, fileType: FileType.image);
|
|
|
|
File? myPick = await commanServices.pickFile(context, fileType: FileType.image);
|
|
|
|
if (myPick != null) {
|
|
|
|
if (myPick != null) {
|
|
|
|
await userRepo.updateUserImage(encodeBase64Image(myPick));
|
|
|
|
setIsImagepUploading = true;
|
|
|
|
AppState().getUser.data!.userInfo!.userLocalImage = myPick;
|
|
|
|
ImageResponse image = await userRepo.updateUserImage(encodeBase64Image(myPick));
|
|
|
|
|
|
|
|
print(image.message);
|
|
|
|
|
|
|
|
print(image.messageStatus);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (image.messageStatus == 1) {
|
|
|
|
|
|
|
|
UserInfo user = AppState().getUser.data!.userInfo!;
|
|
|
|
|
|
|
|
user.userLocalImage = myPick;
|
|
|
|
|
|
|
|
AppState().setUser = User(data: UserData(userInfo: user));
|
|
|
|
|
|
|
|
setIsImagepUploading = false;
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Utils.showToast(image.message!);
|
|
|
|
|
|
|
|
setIsImagepUploading = false;
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -718,13 +741,8 @@ class UserVM extends BaseVM {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void changeLanguage(BuildContext context) {
|
|
|
|
void changeLanguage(BuildContext context) {
|
|
|
|
print("${EasyLocalization
|
|
|
|
print("${EasyLocalization.of(context)?.currentLocale}");
|
|
|
|
.of(context)
|
|
|
|
if (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA") {
|
|
|
|
?.currentLocale}");
|
|
|
|
|
|
|
|
if (EasyLocalization
|
|
|
|
|
|
|
|
.of(context)
|
|
|
|
|
|
|
|
?.currentLocale
|
|
|
|
|
|
|
|
?.countryCode == "SA") {
|
|
|
|
|
|
|
|
context.setLocale(const Locale("en", "US"));
|
|
|
|
context.setLocale(const Locale("en", "US"));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
context.setLocale(const Locale('ar', 'SA'));
|
|
|
|
context.setLocale(const Locale('ar', 'SA'));
|
|
|
|
@ -749,13 +767,8 @@ class UserVM extends BaseVM {
|
|
|
|
AppState().setUser = null;
|
|
|
|
AppState().setUser = null;
|
|
|
|
if (AppState().currentAppType == AppType.provider) {
|
|
|
|
if (AppState().currentAppType == AppType.provider) {
|
|
|
|
AppState().setproviderSubscription = null;
|
|
|
|
AppState().setproviderSubscription = null;
|
|
|
|
context
|
|
|
|
context.read<SubscriptionsVM>().mySubscriptionsBySp.clear();
|
|
|
|
.read<SubscriptionsVM>()
|
|
|
|
context.read<SubscriptionsVM>().allSubscriptions = SubscriptionModel();
|
|
|
|
.mySubscriptionsBySp
|
|
|
|
|
|
|
|
.clear();
|
|
|
|
|
|
|
|
context
|
|
|
|
|
|
|
|
.read<SubscriptionsVM>()
|
|
|
|
|
|
|
|
.allSubscriptions = SubscriptionModel();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.registerSelection);
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.registerSelection);
|
|
|
|
|