initial offline mode, hive setup, home display, mzansi rofile display completed

This commit is contained in:
yaso 2026-06-24 11:52:53 +02:00
parent 3d5fdde322
commit f19a316be8
20 changed files with 981 additions and 304 deletions

View file

@ -98,6 +98,24 @@ class MihBusinessDetailsServices {
}
}
Future<Business?> getBusinessDetailsByUserV2() async {
String app_id = await SuperTokens.getUserId();
var response = await http.get(
Uri.parse("${AppEnviroment.baseApiUrl}/business/app_id/$app_id"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
);
if (response.statusCode == 200) {
String body = response.body;
var jsonBody = jsonDecode(body);
Business? business = Business.fromJson(jsonBody);
return business;
} else {
return null;
}
}
Future<Business?> getBusinessDetailsByBusinessId(
String business_id,
) async {

View file

@ -32,6 +32,24 @@ class MihMyBusinessUserServices {
}
}
Future<BusinessUser?> getBusinessUserV2() async {
String app_id = await SuperTokens.getUserId();
var response = await http.get(
Uri.parse("${AppEnviroment.baseApiUrl}/business-user/$app_id"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
);
if (response.statusCode == 200) {
// KenLogger.success(response.body);
BusinessUser? businessUser =
BusinessUser.fromJson(jsonDecode(response.body));
return businessUser;
} else {
return null;
}
}
Future<int> createBusinessUser(
String business_id,
String app_id,

View file

@ -43,6 +43,21 @@ class MihProfileLinksServices {
}
}
static Future<List<ProfileLink>> getUserProfileLinksV2(
String app_id,
) async {
final response = await http.get(
Uri.parse("${AppEnviroment.baseApiUrl}/profile-links/user/$app_id"));
if (response.statusCode == 200) {
Iterable l = jsonDecode(response.body);
List<ProfileLink> myLinks =
List<ProfileLink>.from(l.map((model) => ProfileLink.fromJson(model)));
return myLinks;
} else {
throw Exception('failed to fecth user profile links');
}
}
static Future<List<ProfileLink>> getBusinessProfileLinksMD(
String business_id,
) async {

View file

@ -21,6 +21,19 @@ class MihUserConsentServices {
}
}
Future<UserConsent?> getUserConsentStatusV2() async {
var app_id = await SuperTokens.getUserId();
final response = await http.get(
Uri.parse("${AppEnviroment.baseApiUrl}/user-consent/user/$app_id"));
if (response.statusCode == 200) {
Map<String, dynamic> userMap = jsonDecode(response.body);
UserConsent userConsent = UserConsent.fromJson(userMap);
return userConsent;
} else {
return null;
}
}
Future<int> insertUserConsentStatus(
String latestPrivacyPolicyDate,
String latestTermOfServiceDate,

View file

@ -154,6 +154,23 @@ class MihUserServices {
}
}
Future<AppUser?> getMyUserDetailsV2() async {
String app_id = await SuperTokens.getUserId();
var response = await http.get(
Uri.parse("${AppEnviroment.baseApiUrl}/user/$app_id"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
);
if (response.statusCode == 200) {
String body = response.body;
var jsonBody = jsonDecode(body);
return AppUser.fromJson(jsonBody);
} else {
return null;
}
}
Future<int> updateUserV2(
AppUser signedInUser,
String firstName,