25-8-4-1
This commit is contained in:
@@ -14,6 +14,7 @@ import 'package:path_provider/path_provider.dart' as path_provider;
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
@@ -310,17 +311,20 @@ class ImageController extends GetxController {
|
||||
Log.print('request: ${request}');
|
||||
var length = await file.length();
|
||||
var stream = http.ByteStream(file.openRead());
|
||||
final headers = {
|
||||
'Authorization':
|
||||
'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}',
|
||||
'X-HMAC-Auth': '${box.read(BoxName.hmac)}',
|
||||
};
|
||||
var multipartFile = http.MultipartFile(
|
||||
'image',
|
||||
stream,
|
||||
length,
|
||||
filename: basename(file.path),
|
||||
);
|
||||
request.headers.addAll({
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||
});
|
||||
request.headers.addAll(headers);
|
||||
// Set the file name to the driverID
|
||||
|
||||
request.files.add(
|
||||
http.MultipartFile(
|
||||
'image',
|
||||
@@ -418,14 +422,11 @@ class ImageController extends GetxController {
|
||||
try {
|
||||
await uploadImage(
|
||||
compressedImage,
|
||||
{
|
||||
'driverID':
|
||||
(box.read(BoxName.driverID)) ?? (box.read(BoxName.passengerID)),
|
||||
'imageType': imageType
|
||||
},
|
||||
{'driverID': (box.read(BoxName.driverID)), 'imageType': imageType},
|
||||
link,
|
||||
);
|
||||
} catch (e) {
|
||||
Log.print('e: ${e}');
|
||||
mySnackeBarError('Image Upload Failed'.tr);
|
||||
// Get.snackbar('Image Upload Failed'.tr, e.toString(),
|
||||
// backgroundColor: AppColor.redColor);
|
||||
|
||||
Reference in New Issue
Block a user