11/20/1
This commit is contained in:
@@ -99,6 +99,8 @@ class CameraClassController extends GetxController {
|
||||
}
|
||||
|
||||
Future<String> uploadImage(File imageFile) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(AppLink.uploadImage),
|
||||
@@ -111,7 +113,7 @@ class CameraClassController extends GetxController {
|
||||
request.headers.addAll({
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
});
|
||||
|
||||
// Add the driverID to the request
|
||||
|
||||
@@ -2,13 +2,17 @@ import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/credential.dart';
|
||||
import '../../main.dart';
|
||||
|
||||
class CRUD {
|
||||
Future<dynamic> get({
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
@@ -18,7 +22,7 @@ class CRUD {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
print("--------------" + response.request.toString());
|
||||
@@ -26,7 +30,7 @@ class CRUD {
|
||||
if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
print(jsonData);
|
||||
// print(jsonData);
|
||||
|
||||
return response.body;
|
||||
}
|
||||
@@ -39,6 +43,7 @@ class CRUD {
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
String? secretKey = await storage.read(key: BoxName.secretKey);
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
@@ -47,7 +52,7 @@ class CRUD {
|
||||
body: payload,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization': 'Bearer ${StripeKey.secretKey}',
|
||||
'Authorization': 'Bearer ${secretKey.toString()}',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -58,6 +63,8 @@ class CRUD {
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
@@ -67,7 +74,7 @@ class CRUD {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
@@ -91,6 +98,8 @@ class CRUD {
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
@@ -100,7 +109,7 @@ class CRUD {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
@@ -149,13 +158,15 @@ class CRUD {
|
||||
required Map<String, dynamic> data,
|
||||
required String id,
|
||||
}) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var url = Uri.parse('$endpoint/$id');
|
||||
var response = await http.put(
|
||||
url,
|
||||
body: json.encode(data),
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
return json.decode(response.body);
|
||||
@@ -165,12 +176,14 @@ class CRUD {
|
||||
required String endpoint,
|
||||
required String id,
|
||||
}) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var url = Uri.parse('$endpoint/$id');
|
||||
var response = await http.delete(
|
||||
url,
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
return json.decode(response.body);
|
||||
|
||||
@@ -284,6 +284,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
///
|
||||
|
||||
Future<void> scanDocumentsByApi() async {
|
||||
String? visionApi = await storage.read(key: BoxName.visionApi);
|
||||
// Pick an image from the camera or gallery
|
||||
image = await imagePicker.pickImage(source: ImageSource.camera);
|
||||
|
||||
@@ -294,7 +295,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
|
||||
isLoading = true;
|
||||
update();
|
||||
var headers = {'X-BLOBR-KEY': AppCredintials.visionApi};
|
||||
var headers = {'X-BLOBR-KEY': visionApi.toString()};
|
||||
var request = http.MultipartRequest('POST',
|
||||
Uri.parse('https://api.faceonlive.com/j2y3q25y1b6maif1/api/iddoc'));
|
||||
request.files.add(await http.MultipartFile.fromPath('image', image!.path));
|
||||
@@ -398,6 +399,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
|
||||
Map res = {};
|
||||
Future matchFaceApi() async {
|
||||
String? visionApi = await storage.read(key: BoxName.visionApi);
|
||||
imageFace = await imagePicker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
preferredCameraDevice: CameraDevice.front,
|
||||
@@ -409,7 +411,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
}
|
||||
final imageFile = File(imageFace!.path);
|
||||
// Uint8List imageBytes = await imageFile.readAsBytes();
|
||||
var headers = {'X-BLOBR-KEY': AppCredintials.visionApi};
|
||||
var headers = {'X-BLOBR-KEY': visionApi.toString()};
|
||||
var request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(
|
||||
@@ -484,6 +486,8 @@ class ScanDocumentsByApi extends GetxController {
|
||||
// Todo upload images and fields
|
||||
|
||||
Future<String> uploadImage(File imageFile) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(AppLink.uploadImage),
|
||||
@@ -496,7 +500,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
request.headers.addAll({
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
});
|
||||
|
||||
// Add the driverID to the request
|
||||
|
||||
Reference in New Issue
Block a user