remove old file get api use
This commit is contained in:
parent
8912e77b03
commit
d7e4ac134d
19 changed files with 80 additions and 109 deletions
|
|
@ -11,7 +11,6 @@ import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profi
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:redacted/redacted.dart';
|
import 'package:redacted/redacted.dart';
|
||||||
|
|
@ -531,12 +530,6 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||||
businessSearchResults = await MihBusinessDetailsServices()
|
businessSearchResults = await MihBusinessDetailsServices()
|
||||||
.searchBusinesses(directoryProvider.searchTerm,
|
.searchBusinesses(directoryProvider.searchTerm,
|
||||||
directoryProvider.businessTypeFilter, context);
|
directoryProvider.businessTypeFilter, context);
|
||||||
Map<String, Future<String>> busImagesUrl = {};
|
|
||||||
Future<String> businessLogoUrl;
|
|
||||||
for (var bus in businessSearchResults) {
|
|
||||||
businessLogoUrl = MihFileApi.getMinioFileUrl(bus.logo_path);
|
|
||||||
busImagesUrl[bus.business_id] = businessLogoUrl;
|
|
||||||
}
|
|
||||||
directoryProvider.setSearchedBusinesses(
|
directoryProvider.setSearchedBusinesses(
|
||||||
searchedBusinesses: businessSearchResults,
|
searchedBusinesses: businessSearchResults,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ class _MihLinuxInstallInstructionsState
|
||||||
MihSnackBar(
|
MihSnackBar(
|
||||||
child: Text('Command copied to clipboard!'),
|
child: Text('Command copied to clipboard!'),
|
||||||
),
|
),
|
||||||
// const SnackBar(
|
|
||||||
// content: Text('Command copied to clipboard!')),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
tooltip: 'Copy command',
|
tooltip: 'Copy command',
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.da
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|
@ -34,15 +33,11 @@ class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
||||||
directoryProvider,
|
directoryProvider,
|
||||||
);
|
);
|
||||||
List<Business> favBus = [];
|
List<Business> favBus = [];
|
||||||
Map<String, Future<String>> favBusImages = {};
|
|
||||||
Future<String> businessLogoUrl;
|
|
||||||
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||||
await MihBusinessDetailsServices()
|
await MihBusinessDetailsServices()
|
||||||
.getBusinessDetailsByBusinessId(bus.business_id)
|
.getBusinessDetailsByBusinessId(bus.business_id)
|
||||||
.then((business) async {
|
.then((business) async {
|
||||||
favBus.add(business!);
|
favBus.add(business!);
|
||||||
businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path);
|
|
||||||
favBusImages[business.business_id] = businessLogoUrl;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
directoryProvider.setFavouriteBusinesses(
|
directoryProvider.setFavouriteBusinesses(
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,11 @@ class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
||||||
directoryProvider,
|
directoryProvider,
|
||||||
);
|
);
|
||||||
List<Business> favBus = [];
|
List<Business> favBus = [];
|
||||||
Map<String, Future<String>> favBusImages = {};
|
|
||||||
Future<String> businessLogoUrl;
|
|
||||||
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||||
await MihBusinessDetailsServices()
|
await MihBusinessDetailsServices()
|
||||||
.getBusinessDetailsByBusinessId(bus.business_id)
|
.getBusinessDetailsByBusinessId(bus.business_id)
|
||||||
.then((business) async {
|
.then((business) async {
|
||||||
favBus.add(business!);
|
favBus.add(business!);
|
||||||
businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path);
|
|
||||||
favBusImages[business.business_id] = businessLogoUrl;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
directoryProvider.setFavouriteBusinesses(
|
directoryProvider.setFavouriteBusinesses(
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
||||||
bool successUpload =
|
bool successUpload =
|
||||||
await uploadFile(mzansiProfileProvider, newSelectedLogoPic);
|
await uploadFile(mzansiProfileProvider, newSelectedLogoPic);
|
||||||
if (successUpload) {
|
if (successUpload) {
|
||||||
String logoUrl = await MihFileApi.getMinioFileUrl(
|
String logoUrl = MihFileApi.getMinioFileUrlV2(
|
||||||
mzansiProfileProvider.business!.logo_path);
|
mzansiProfileProvider.business!.logo_path);
|
||||||
mzansiProfileProvider.setBusinessProfilePicUrl(logoUrl);
|
mzansiProfileProvider.setBusinessProfilePicUrl(logoUrl);
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
||||||
bool successUpload =
|
bool successUpload =
|
||||||
await uploadFile(mzansiProfileProvider, newSelectedSignaturePic);
|
await uploadFile(mzansiProfileProvider, newSelectedSignaturePic);
|
||||||
if (successUpload) {
|
if (successUpload) {
|
||||||
String sigUrl = await MihFileApi.getMinioFileUrl(
|
String sigUrl = MihFileApi.getMinioFileUrlV2(
|
||||||
mzansiProfileProvider.businessUser!.sig_path);
|
mzansiProfileProvider.businessUser!.sig_path);
|
||||||
mzansiProfileProvider.setBusinessUserSignatureUrl(sigUrl);
|
mzansiProfileProvider.setBusinessUserSignatureUrl(sigUrl);
|
||||||
String message =
|
String message =
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ class MihBusinessDetailsView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MihBusinessDetailsViewState extends State<MihBusinessDetailsView> {
|
class _MihBusinessDetailsViewState extends State<MihBusinessDetailsView> {
|
||||||
late Future<String> futureImageUrl;
|
|
||||||
PlatformFile? file;
|
PlatformFile? file;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -35,10 +34,6 @@ class _MihBusinessDetailsViewState extends State<MihBusinessDetailsView> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
MzansiDirectoryProvider directoryProvider =
|
|
||||||
context.read<MzansiDirectoryProvider>();
|
|
||||||
futureImageUrl = MihFileApi.getMinioFileUrl(
|
|
||||||
directoryProvider.selectedBusiness!.logo_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ class MihBusinessQrCode extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
||||||
late Future<String> futureImageUrl;
|
|
||||||
late Business business;
|
late Business business;
|
||||||
PlatformFile? file;
|
PlatformFile? file;
|
||||||
late String qrCodedata;
|
late String qrCodedata;
|
||||||
|
|
@ -313,7 +312,6 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
||||||
business = profileProvider.business!;
|
business = profileProvider.business!;
|
||||||
}
|
}
|
||||||
_checkUserSession();
|
_checkUserSession();
|
||||||
futureImageUrl = MihFileApi.getMinioFileUrl(business.logo_path);
|
|
||||||
qrCodedata = "${AppEnviroment.baseAppUrl}/business-profile/view/";
|
qrCodedata = "${AppEnviroment.baseAppUrl}/business-profile/view/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ class MihPersonalProfileView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MihPersonalProfileViewState extends State<MihPersonalProfileView> {
|
class _MihPersonalProfileViewState extends State<MihPersonalProfileView> {
|
||||||
late Future<String> futureImageUrl;
|
|
||||||
late Future<List<ProfileLink>> futureLinks;
|
late Future<List<ProfileLink>> futureLinks;
|
||||||
PlatformFile? file;
|
PlatformFile? file;
|
||||||
|
|
||||||
|
|
@ -40,8 +39,6 @@ class _MihPersonalProfileViewState extends State<MihPersonalProfileView> {
|
||||||
super.initState();
|
super.initState();
|
||||||
MzansiDirectoryProvider directoryProvider =
|
MzansiDirectoryProvider directoryProvider =
|
||||||
context.read<MzansiDirectoryProvider>();
|
context.read<MzansiDirectoryProvider>();
|
||||||
futureImageUrl = MihFileApi.getMinioFileUrl(
|
|
||||||
directoryProvider.selectedUser!.pro_pic_path);
|
|
||||||
futureLinks = MihProfileLinksServices.getUserProfileLinksMD(
|
futureLinks = MihProfileLinksServices.getUserProfileLinksMD(
|
||||||
directoryProvider, directoryProvider.selectedUser!.app_id);
|
directoryProvider, directoryProvider.selectedUser!.app_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ class MihPersonalQrCode extends StatefulWidget {
|
||||||
|
|
||||||
class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
|
class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
|
||||||
late AppUser user;
|
late AppUser user;
|
||||||
late Future<String> futureImageUrl;
|
|
||||||
PlatformFile? file;
|
PlatformFile? file;
|
||||||
int qrSize = 500;
|
int qrSize = 500;
|
||||||
ScreenshotController screenshotController = ScreenshotController();
|
ScreenshotController screenshotController = ScreenshotController();
|
||||||
|
|
@ -310,7 +309,6 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
|
||||||
user = profileProvider.user!;
|
user = profileProvider.user!;
|
||||||
}
|
}
|
||||||
_checkUserSession();
|
_checkUserSession();
|
||||||
futureImageUrl = MihFileApi.getMinioFileUrl(user.pro_pic_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
|
||||||
patientManagerProvider.myPaitentList![index].app_id, context)
|
patientManagerProvider.myPaitentList![index].app_id, context)
|
||||||
.then((user) async {
|
.then((user) async {
|
||||||
user;
|
user;
|
||||||
String url = await MihFileApi.getMinioFileUrl(user!.pro_pic_path);
|
String url = MihFileApi.getMinioFileUrlV2(user!.pro_pic_path);
|
||||||
patientManagerProvider.setSelectedPatientProfilePicUrl(url);
|
patientManagerProvider.setSelectedPatientProfilePicUrl(url);
|
||||||
});
|
});
|
||||||
patientProfileChoicePopUp(
|
patientProfileChoicePopUp(
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,16 @@ class _BuildClaimStatementFileListState
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
late StreamSubscription progressStream;
|
late StreamSubscription progressStream;
|
||||||
|
|
||||||
Future<String> getFileUrlApiCall(String filePath) async {
|
// Future<String> getFileUrlApiCall(String filePath) async {
|
||||||
String teporaryFileUrl = "";
|
// String teporaryFileUrl = "";
|
||||||
await MihFileApi.getMinioFileUrl(
|
// await MihFileApi.getMinioFileUrl(
|
||||||
filePath,
|
// filePath,
|
||||||
).then((value) {
|
// ).then((value) {
|
||||||
teporaryFileUrl = value;
|
// teporaryFileUrl = value;
|
||||||
});
|
// });
|
||||||
return teporaryFileUrl;
|
// return teporaryFileUrl;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String getFileName(String path) {
|
String getFileName(String path) {
|
||||||
//print(pdfLink.split(".")[1]);
|
//print(pdfLink.split(".")[1]);
|
||||||
return path.split("/").last;
|
return path.split("/").last;
|
||||||
|
|
@ -282,14 +282,13 @@ class _BuildClaimStatementFileListState
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
MihFileViewerProvider fileViewerProvider =
|
MihFileViewerProvider fileViewerProvider =
|
||||||
context.read<MihFileViewerProvider>();
|
context.read<MihFileViewerProvider>();
|
||||||
await getFileUrlApiCall(patientManagerProvider
|
String fileUrl = MihFileApi.getMinioFileUrlV2(
|
||||||
.patientClaimsDocuments![index].file_path)
|
patientManagerProvider
|
||||||
.then((urlHere) {
|
.patientClaimsDocuments![index].file_path);
|
||||||
//print(url);
|
//print(url);
|
||||||
fileViewerProvider.setFilePath(patientManagerProvider
|
fileViewerProvider.setFilePath(patientManagerProvider
|
||||||
.patientClaimsDocuments![index].file_path);
|
.patientClaimsDocuments![index].file_path);
|
||||||
fileViewerProvider.setFileLink(urlHere);
|
fileViewerProvider.setFileLink(fileUrl);
|
||||||
});
|
|
||||||
|
|
||||||
viewFilePopUp(
|
viewFilePopUp(
|
||||||
patientManagerProvider,
|
patientManagerProvider,
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,16 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
late StreamSubscription progressStream;
|
late StreamSubscription progressStream;
|
||||||
|
|
||||||
Future<String> getFileUrlApiCall(String filePath) async {
|
// Future<String> getFileUrlApiCall(String filePath) async {
|
||||||
String teporaryFileUrl = "";
|
// String teporaryFileUrl = "";
|
||||||
await MihFileApi.getMinioFileUrl(
|
// await MihFileApi.getMinioFileUrl(
|
||||||
filePath,
|
// filePath,
|
||||||
).then((value) {
|
// ).then((value) {
|
||||||
teporaryFileUrl = value;
|
// teporaryFileUrl = value;
|
||||||
});
|
// });
|
||||||
return teporaryFileUrl;
|
// return teporaryFileUrl;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String getFileName(String path) {
|
String getFileName(String path) {
|
||||||
//print(pdfLink.split(".")[1]);
|
//print(pdfLink.split(".")[1]);
|
||||||
return path.split("/").last;
|
return path.split("/").last;
|
||||||
|
|
@ -309,14 +309,13 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
MihFileViewerProvider fileViewerProvider =
|
MihFileViewerProvider fileViewerProvider =
|
||||||
context.read<MihFileViewerProvider>();
|
context.read<MihFileViewerProvider>();
|
||||||
await getFileUrlApiCall(patientManagerProvider
|
String fileUrl = MihFileApi.getMinioFileUrlV2(
|
||||||
.patientDocuments![index].file_path)
|
patientManagerProvider
|
||||||
.then((urlHere) {
|
.patientDocuments![index].file_path);
|
||||||
//print(url);
|
//print(url);
|
||||||
fileViewerProvider.setFilePath(patientManagerProvider
|
fileViewerProvider.setFilePath(patientManagerProvider
|
||||||
.patientDocuments![index].file_path);
|
.patientDocuments![index].file_path);
|
||||||
fileViewerProvider.setFileLink(urlHere);
|
fileViewerProvider.setFileLink(fileUrl);
|
||||||
});
|
|
||||||
viewFilePopUp(
|
viewFilePopUp(
|
||||||
patientManagerProvider,
|
patientManagerProvider,
|
||||||
patientManagerProvider.patientDocuments![index].file_name,
|
patientManagerProvider.patientDocuments![index].file_name,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
|
|
@ -61,12 +62,9 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
||||||
int statusCode =
|
int statusCode =
|
||||||
await MihPatientServices().addPatientFile(file, patientManagerProvider);
|
await MihPatientServices().addPatientFile(file, patientManagerProvider);
|
||||||
if (statusCode == 201) {
|
if (statusCode == 201) {
|
||||||
setState(() {
|
|
||||||
selectedFileController.clear();
|
|
||||||
});
|
|
||||||
var fname = file!.name.replaceAll(RegExp(r' '), '-');
|
var fname = file!.name.replaceAll(RegExp(r' '), '-');
|
||||||
// end loading circle
|
// end loading circle
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
String message =
|
String message =
|
||||||
"The file $fname has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use.";
|
"The file $fname has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use.";
|
||||||
successPopUp("Successfully Uplouded File", message);
|
successPopUp("Successfully Uplouded File", message);
|
||||||
|
|
@ -77,6 +75,8 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
||||||
|
|
||||||
Future<void> uploadSelectedFile(
|
Future<void> uploadSelectedFile(
|
||||||
PatientManagerProvider patientManagerProvider, PlatformFile? file) async {
|
PatientManagerProvider patientManagerProvider, PlatformFile? file) async {
|
||||||
|
KenLogger.success(
|
||||||
|
"Patient app id: ${patientManagerProvider.selectedPatient!.app_id}");
|
||||||
var response = await MihFileApi.uploadFile(
|
var response = await MihFileApi.uploadFile(
|
||||||
patientManagerProvider.selectedPatient!.app_id,
|
patientManagerProvider.selectedPatient!.app_id,
|
||||||
env,
|
env,
|
||||||
|
|
@ -84,6 +84,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
||||||
file,
|
file,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
KenLogger.success("Response code: $response");
|
||||||
if (response == 200) {
|
if (response == 200) {
|
||||||
await addPatientFileLocationToDB(patientManagerProvider, file);
|
await addPatientFileLocationToDB(patientManagerProvider, file);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -462,6 +463,9 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
|
setState(() {
|
||||||
|
selectedFileController.clear();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.primary(),
|
buttonColor: MihColors.primary(),
|
||||||
elevation: 10,
|
elevation: 10,
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class _PatientProfileState extends State<PatientProfile> {
|
||||||
AppUser? patientUserDetails = await MihUserServices().getMIHUserDetails(
|
AppUser? patientUserDetails = await MihUserServices().getMIHUserDetails(
|
||||||
patientManagerProvider.selectedPatient!.app_id, context);
|
patientManagerProvider.selectedPatient!.app_id, context);
|
||||||
String patientProPicUrl =
|
String patientProPicUrl =
|
||||||
await MihFileApi.getMinioFileUrl(patientUserDetails!.pro_pic_path);
|
MihFileApi.getMinioFileUrlV2(patientUserDetails!.pro_pic_path);
|
||||||
patientManagerProvider.setSelectedPatientProfilePicUrl(patientProPicUrl);
|
patientManagerProvider.setSelectedPatientProfilePicUrl(patientProPicUrl);
|
||||||
}
|
}
|
||||||
patientManagerProvider.setPersonalMode(mzansiProfileProvider.personalHome);
|
patientManagerProvider.setPersonalMode(mzansiProfileProvider.personalHome);
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ class MihBusinessDetailsServices {
|
||||||
businessMissionVision,
|
businessMissionVision,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
String newProPicUrl = await MihFileApi.getMinioFileUrl(filePath);
|
String newProPicUrl = MihFileApi.getMinioFileUrlV2(filePath);
|
||||||
provider.setBusinessProfilePicUrl(newProPicUrl);
|
provider.setBusinessProfilePicUrl(newProPicUrl);
|
||||||
return 200;
|
return 200;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
|
||||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -14,30 +11,30 @@ import 'package:supertokens_flutter/supertokens.dart';
|
||||||
class MihFileApi {
|
class MihFileApi {
|
||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
final baseAPI = AppEnviroment.baseApiUrl;
|
||||||
|
|
||||||
static Future<String> getMinioFileUrl(
|
// static Future<String> getMinioFileUrl(
|
||||||
String filePath,
|
// String filePath,
|
||||||
) async {
|
// ) async {network
|
||||||
String fileUrl = "";
|
// String fileUrl = "";
|
||||||
try {
|
// try {
|
||||||
var url =
|
// var url =
|
||||||
"${AppEnviroment.baseApiUrl}/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
// "${AppEnviroment.baseApiUrl}/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
||||||
var response = await http.get(Uri.parse(url));
|
// var response = await http.get(Uri.parse(url));
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
var decodedData = jsonDecode(response.body);
|
// var decodedData = jsonDecode(response.body);
|
||||||
fileUrl = decodedData['minioURL'];
|
// fileUrl = decodedData['minioURL'];
|
||||||
} else {}
|
// } else {}
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
KenLogger.error("Error getting url");
|
// KenLogger.error("Error getting url");
|
||||||
} finally {}
|
// } finally {}
|
||||||
if (AppEnviroment.getEnv() == "Dev" && kIsWeb) {
|
// if (AppEnviroment.getEnv() == "Dev" && kIsWeb) {
|
||||||
fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
// fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
||||||
} else if (AppEnviroment.getEnv() == "Dev" && Platform.isIOS) {
|
// } else if (AppEnviroment.getEnv() == "Dev" && Platform.isIOS) {
|
||||||
fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
// fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
||||||
} else if (AppEnviroment.getEnv() == "Dev" && Platform.isLinux) {
|
// } else if (AppEnviroment.getEnv() == "Dev" && Platform.isLinux) {
|
||||||
fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
// fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
||||||
}
|
// }
|
||||||
return fileUrl;
|
// return fileUrl;
|
||||||
}
|
// }
|
||||||
|
|
||||||
static String getMinioFileUrlV2(
|
static String getMinioFileUrlV2(
|
||||||
String filePath,
|
String filePath,
|
||||||
|
|
@ -63,8 +60,13 @@ class MihFileApi {
|
||||||
request.fields['app_id'] = app_id;
|
request.fields['app_id'] = app_id;
|
||||||
request.fields['env'] = env;
|
request.fields['env'] = env;
|
||||||
request.fields['folder'] = folderName;
|
request.fields['folder'] = folderName;
|
||||||
request.files.add(await http2.MultipartFile.fromBytes('file', file!.bytes!,
|
request.files.add(
|
||||||
filename: file.name.replaceAll(RegExp(r' '), '-')));
|
http2.MultipartFile.fromBytes(
|
||||||
|
'file',
|
||||||
|
await file!.readAsBytes(),
|
||||||
|
filename: file.name.replaceAll(RegExp(r' '), '-'),
|
||||||
|
),
|
||||||
|
);
|
||||||
var response = await request.send();
|
var response = await request.send();
|
||||||
context.pop(); // Pop loading dialog
|
context.pop(); // Pop loading dialog
|
||||||
return response.statusCode;
|
return response.statusCode;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
|
|
@ -22,9 +21,7 @@ class MIHLocationAPI {
|
||||||
MihAlertServices().locationPermissionAlert(context);
|
MihAlertServices().locationPermissionAlert(context);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
print("Before checkPermission"); // Debug
|
|
||||||
LocationPermission permission = await Geolocator.checkPermission();
|
LocationPermission permission = await Geolocator.checkPermission();
|
||||||
print("After checkPermission: $permission"); // Debug
|
|
||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
permission = await Geolocator.requestPermission();
|
permission = await Geolocator.requestPermission();
|
||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ class MihMyBusinessUserServices {
|
||||||
bUserAccess,
|
bUserAccess,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
String newProPicUrl = await MihFileApi.getMinioFileUrl(filePath);
|
String newProPicUrl = MihFileApi.getMinioFileUrlV2(filePath);
|
||||||
provider.setBusinessUserSignatureUrl(newProPicUrl);
|
provider.setBusinessUserSignatureUrl(newProPicUrl);
|
||||||
return 200;
|
return 200;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ class MihUserServices {
|
||||||
purpose,
|
purpose,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
String newProPicUrl = await MihFileApi.getMinioFileUrl(filePath);
|
String newProPicUrl = MihFileApi.getMinioFileUrlV2(filePath);
|
||||||
context.read<MzansiProfileProvider>().setUserProfilePicUrl(newProPicUrl);
|
context.read<MzansiProfileProvider>().setUserProfilePicUrl(newProPicUrl);
|
||||||
return response.statusCode;
|
return response.statusCode;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue