fix user counter and optimise profile picture getting
This commit is contained in:
parent
62eafaf766
commit
1438dd6b5a
8 changed files with 39 additions and 85 deletions
|
|
@ -39,29 +39,11 @@ class MihFileApi {
|
|||
return fileUrl;
|
||||
}
|
||||
|
||||
static Future<String> getMinioFileUrlV2(
|
||||
static String getMinioFileUrlV2(
|
||||
String filePath,
|
||||
) async {
|
||||
String fileUrl = "";
|
||||
try {
|
||||
var url =
|
||||
"${AppEnviroment.baseApiUrl}/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
||||
var response = await http.get(Uri.parse(url));
|
||||
if (response.statusCode == 200) {
|
||||
var decodedData = jsonDecode(response.body);
|
||||
fileUrl = decodedData['minioURL'];
|
||||
} else {}
|
||||
} catch (e) {
|
||||
KenLogger.error("Error getting url");
|
||||
} finally {}
|
||||
if (AppEnviroment.getEnv() == "Dev" && kIsWeb) {
|
||||
fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
||||
} else if (AppEnviroment.getEnv() == "Dev" && Platform.isIOS) {
|
||||
fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
||||
} else if (AppEnviroment.getEnv() == "Dev" && Platform.isLinux) {
|
||||
fileUrl = fileUrl.replaceAll("10.0.2.2", "127.0.0.1");
|
||||
}
|
||||
return fileUrl;
|
||||
) {
|
||||
if (filePath.isEmpty) return "";
|
||||
return "${AppEnviroment.baseApiUrl}/v2/minio/pull/file/$filePath";
|
||||
}
|
||||
|
||||
static Future<int> uploadFile(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue