11/20/1
This commit is contained in:
@@ -31,4 +31,17 @@ class BoxName {
|
||||
static const String passengerWalletFound = "passengerWalletFound";
|
||||
static const String periods = 'periods';
|
||||
static const String onBoarding = 'onBoarding';
|
||||
static const String stripePublishableKey = 'stripe_publishableKe';
|
||||
static const String apiKeyRun = 'apiKeyRun';
|
||||
static const String serverAPI = 'serverAPI';
|
||||
static const String secretKey = 'secretKey';
|
||||
static const String basicAuthCredentials = 'basicAuthCredentials';
|
||||
static const String mapAPIKEY = 'mapAPIKEY';
|
||||
static const String twilloRecoveryCode = 'twilloRecoveryCode';
|
||||
static const String accountSIDTwillo = 'accountSIDTwillo';
|
||||
static const String authTokenTwillo = 'authTokenTwillo';
|
||||
static const String chatGPTkey = 'chatGPTkey';
|
||||
static const String chatGPTkeySefer = 'chatGPTkeySefer';
|
||||
static const String transactionCloude = 'transactionCloude';
|
||||
static const String visionApi = 'visionApi';
|
||||
}
|
||||
|
||||
28
lib/constant/char_map.dart
Normal file
28
lib/constant/char_map.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
Map<String, String> charMap = {
|
||||
"a": "q",
|
||||
"b": "x",
|
||||
"c": "f",
|
||||
"d": "y",
|
||||
"e": "j",
|
||||
"f": "u",
|
||||
"g": "k",
|
||||
"h": "w",
|
||||
"i": "o",
|
||||
"j": "e",
|
||||
"k": "g",
|
||||
"l": "r",
|
||||
"m": "n",
|
||||
"n": "b",
|
||||
"o": "i",
|
||||
"p": "v",
|
||||
"q": "a",
|
||||
"r": "l",
|
||||
"s": "z",
|
||||
"t": "c",
|
||||
"u": "h",
|
||||
"v": "p",
|
||||
"w": "t",
|
||||
"x": "d",
|
||||
"y": "s",
|
||||
"z": "m"
|
||||
};
|
||||
@@ -1,69 +1,134 @@
|
||||
import 'dart:convert';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/main.dart';
|
||||
|
||||
import 'box_name.dart';
|
||||
import 'char_map.dart';
|
||||
|
||||
class AppCredintials {
|
||||
static const String basicAuthCredentials = 'hamzaayedphp:malDEV@2101';
|
||||
static const String serverAPI =
|
||||
'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH';
|
||||
// AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0
|
||||
static const String mapAPIKEY = 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0';
|
||||
static const String twilloRecoveryCode = 'TQF13XUVU2NJ3VFU8JWBWYBS';
|
||||
static const String accountSIDTwillo = 'ACb4ad857efe0903bfd6238a763a2ce4d1';
|
||||
static const String authTokenTwillo = '14f39ef4628bb8a4f18469f462f8af75';
|
||||
static const String publishablekey = '14f39ef4628bb8a4f18469f462f8af75';
|
||||
static const String chatGPTkey =
|
||||
'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';
|
||||
static const String chatGPTkeySefer =
|
||||
'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';
|
||||
// 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
|
||||
String getBasicAuthCredentials() {
|
||||
return base64Encode(utf8.encode(basicAuthCredentials));
|
||||
getApiKey() async {
|
||||
var res = await CRUD().get(link: AppLink.getApiKey, payload: {});
|
||||
var decod = jsonDecode(res);
|
||||
print(decod);
|
||||
for (var i = 0; i < decod['message'].length; i++) {
|
||||
print(i);
|
||||
String retrievedString =
|
||||
r(decod['message'][i]['hashed_key'].toString(), charMap);
|
||||
await storage.write(
|
||||
key: decod['message'][i]['name'].toString(),
|
||||
value: retrievedString.toString(),
|
||||
);
|
||||
}
|
||||
box.write(BoxName.apiKeyRun, 'run');
|
||||
}
|
||||
|
||||
static const String transactionCloude =
|
||||
'Authorization:API_EMDJX6BHQ67DBGT6WV:DG2XPU7YEN02M0VJ2F';
|
||||
static const String visionApi = '0vQRyaYYDWpsv73A5CZOknseK7S2sgwE';
|
||||
}
|
||||
String q(String b, String c) {
|
||||
final d = utf8.encode(c);
|
||||
final e = utf8.encode(b);
|
||||
|
||||
class StripeKey {
|
||||
static const String publishableKey =
|
||||
'pk_test_51O4WTODMEVrOCA5SN5e6b8pAvF5CPDC3c3Pif18q74NEQApU5AfmZZEN9X2WIayfIrUTjju1pUavmgoeLgb3FR5k00pn4oMHGO';
|
||||
static const String secretKey =
|
||||
'sk_test_51O4WTODMEVrOCA5SBgaoSS69nNFRyfZx2Tl5ODswYyjqLpc0RxBHW3hhcP38Tp78TZ1PQoZo7eHFllRiQd3rMHPN00Lr9WD3n2';
|
||||
}
|
||||
final f = Hmac(sha256, d);
|
||||
final g = f.convert(e);
|
||||
|
||||
//
|
||||
class MyClass {
|
||||
static const String mapAPIKEY = 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0';
|
||||
static const String twilloRecoveryCode = 'TQF13XUVU2NJ3VFU8JWBWYBS';
|
||||
static const String accountSIDTwillo = 'ACb4ad857efe0903bfd6238a763a2ce4d1';
|
||||
static const String authTokenTwillo = '14f39ef4628bb8a4f18469f462f8af75';
|
||||
static const String additionalText = 'additional text';
|
||||
|
||||
String getBasicAuthCredentials() {
|
||||
return base64Encode(utf8.encode(mapAPIKEY));
|
||||
final h = g.bytes;
|
||||
final i = base64Url.encode(h);
|
||||
return i;
|
||||
}
|
||||
|
||||
String removeAddedText(String apiKey, String addedText) {
|
||||
final hashedText = sha256.convert(utf8.encode(addedText)).toString();
|
||||
return apiKey.replaceAll(hashedText, '');
|
||||
String j(String k, String l) {
|
||||
final m = utf8.encode(l);
|
||||
final n = base64Url.decode(k);
|
||||
|
||||
final o = Hmac(sha256, m);
|
||||
final p = o.convert(n);
|
||||
|
||||
final q = utf8.decode(p.bytes);
|
||||
return q;
|
||||
}
|
||||
|
||||
String addTextToAPIKey(String apiKey, String textToAdd) {
|
||||
final hashedText = sha256.convert(utf8.encode(textToAdd)).toString();
|
||||
final midIndex = apiKey.length ~/ 2;
|
||||
final firstHalf = apiKey.substring(0, midIndex);
|
||||
final secondHalf = apiKey.substring(midIndex);
|
||||
return '$firstHalf$hashedText$secondHalf';
|
||||
String a(String b, String c) {
|
||||
int d = b.length;
|
||||
int e = d ~/ 4;
|
||||
|
||||
List<String> f = [];
|
||||
for (int g = 0; g < d; g += e) {
|
||||
int h = g + e;
|
||||
if (h > d) {
|
||||
h = d;
|
||||
}
|
||||
String i = b.substring(g, h);
|
||||
f.add(i);
|
||||
}
|
||||
|
||||
void exampleUsage() {
|
||||
String modifiedAPIKey = addTextToAPIKey(mapAPIKEY, additionalText);
|
||||
print('Modified API Key: $modifiedAPIKey');
|
||||
print(f);
|
||||
Map<String, String> j = {};
|
||||
j['birinci'] = f[4];
|
||||
j['ikinci'] = f[2];
|
||||
j['üçüncü'] = c + f[1];
|
||||
j['dördüncü'] = f[0];
|
||||
j['beş'] = f[3];
|
||||
|
||||
String finalAPIKey = removeAddedText(modifiedAPIKey, additionalText);
|
||||
print('Final API Key: $finalAPIKey');
|
||||
String k = '';
|
||||
j.forEach((l, m) {
|
||||
k += m;
|
||||
});
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
Map<String, String> n(String o, String c) {
|
||||
String p = o.replaceAll(c, '');
|
||||
|
||||
Map<String, String> q = {};
|
||||
q['birinci'] = p[p.length - 5] + p[p.length - 3];
|
||||
q['ikinci'] = p[p.length - 1] + p[p.length - 15];
|
||||
q['üçüncü'] = p[p.length - 9] + p[p.length - 12];
|
||||
q['dördüncü'] = p[p.length - 11] + p[p.length - 6];
|
||||
q['beş'] = p[p.length - 2] + p[p.length - 8];
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
String c(String a, Map<String, String> b) {
|
||||
StringBuffer c = StringBuffer();
|
||||
c.write(a);
|
||||
|
||||
String d = "Bl";
|
||||
c.write(b[d] ?? d);
|
||||
|
||||
StringBuffer e = StringBuffer();
|
||||
String f = c.toString();
|
||||
|
||||
for (int g = 0; g < f.length; g++) {
|
||||
String h = f[g];
|
||||
e.write(b[h] ?? h);
|
||||
}
|
||||
|
||||
return e.toString();
|
||||
}
|
||||
|
||||
String r(String a, Map<String, String> b) {
|
||||
StringBuffer c = StringBuffer();
|
||||
String d = "Bl";
|
||||
int e = d.length;
|
||||
|
||||
for (int f = 0; f < a.length; f++) {
|
||||
String g = a[f];
|
||||
String h = b.keys.firstWhere(
|
||||
(i) => b[i] == g,
|
||||
orElse: () => g,
|
||||
);
|
||||
|
||||
c.write(h);
|
||||
}
|
||||
|
||||
String j = c.toString();
|
||||
|
||||
if (j.endsWith(d)) {
|
||||
j = j.substring(0, j.length - e);
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
}
|
||||
// Modified API Key: AIzaSyCyfwRXTwSTLOFc57cb9e210a21def772cad3cd9ef83247e70bed77da89a64c9a5e91e7f3348dbQSQgN5p7QZgGJVZnEKq0
|
||||
// I/flutter ( 5490): Final API Key: AIzaSyCyfwRXTwSTLOFc57cb9e210a21def772cad3cd9ef83247e70bed77da89a64c9a5e91e7f3348dbQSQgN5p7QZgGJVZnEKq0
|
||||
|
||||
@@ -43,6 +43,11 @@ class AppLink {
|
||||
static const String addDriverpayment = "$ride/payment/add.php";
|
||||
static const String getDriverpaymentToday = "$ride/payment/get.php";
|
||||
static const String getAllPayment = "$ride/payment/getAllPayment.php";
|
||||
//-----------------Api Key------------------
|
||||
static const String addApiKey = "$ride/apiKey/add.php";
|
||||
static const String getApiKey = "$ride/apiKey/get.php";
|
||||
static const String updateApiKey = "$ride/apiKey/update.php";
|
||||
static const String deleteApiKey = "$ride/apiKey/delete.php";
|
||||
|
||||
//-----------------Feed Back------------------
|
||||
static const String addFeedBack = "$ride/feedBack/add.php";
|
||||
|
||||
@@ -12,13 +12,15 @@ class TokenController extends GetxController {
|
||||
bool isloading = false;
|
||||
|
||||
Future addToken() async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
isloading = true;
|
||||
update();
|
||||
var res = await http.post(
|
||||
Uri.parse(AppLink.addTokens),
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
body: {
|
||||
'token': box.read(BoxName.tokenFCM.toString()),
|
||||
|
||||
@@ -64,11 +64,13 @@ class FirebaseMessagesController extends GetxController {
|
||||
}
|
||||
|
||||
Future getTokens() async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var res = await http.post(
|
||||
Uri.parse(AppLink.getTokens),
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
body: {},
|
||||
);
|
||||
@@ -94,7 +96,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
} else {
|
||||
box.write(BoxName.tokenFCM, token);
|
||||
}
|
||||
print(token);
|
||||
// print(token);
|
||||
});
|
||||
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
@@ -120,7 +122,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
driverID = myList[2].toString();
|
||||
|
||||
Get.snackbar(
|
||||
'Captin Applied the Ride for You'.tr,
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
'message',
|
||||
colorText: AppColor.greenColor,
|
||||
duration: const Duration(seconds: 11),
|
||||
@@ -131,7 +133,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
style: const TextStyle(color: AppColor.redColor),
|
||||
),
|
||||
messageText: Text(
|
||||
'Captin Applied the Ride for You'.tr,
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
icon: const Icon(Icons.approval),
|
||||
@@ -221,17 +223,17 @@ class FirebaseMessagesController extends GetxController {
|
||||
onPressed: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
|
||||
print(mapUrl);
|
||||
// print(mapUrl);
|
||||
launchUrl1(mapUrl);
|
||||
},
|
||||
icon: const Icon(Icons.map),
|
||||
label: Text('Rouats of Trip'.tr)),
|
||||
label: Text('Routs of Trip'.tr)),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Tatal From Passenger is '.tr +
|
||||
'Total From Passenger is '.tr +
|
||||
double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
@@ -239,7 +241,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Tatal For You is '.tr +
|
||||
'Total For You is '.tr +
|
||||
double.parse(myList[3]).toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
@@ -315,7 +317,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
Get.snackbar(
|
||||
'Captin Applied the Ride for You'.tr,
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
'message',
|
||||
colorText: AppColor.greenColor,
|
||||
duration: const Duration(seconds: 11),
|
||||
@@ -326,7 +328,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
style: const TextStyle(color: AppColor.redColor),
|
||||
),
|
||||
messageText: Text(
|
||||
'Captin Applied the Ride for You'.tr,
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
icon: const Icon(Icons.approval),
|
||||
@@ -404,7 +406,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
@@ -432,7 +434,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// .post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
// headers: <String, String>{
|
||||
// 'Content-Type': 'application/json',
|
||||
// 'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||
// 'Authorization': 'key=${storage.read(key: BoxName.serverAPI}'
|
||||
// },
|
||||
// body: jsonEncode({
|
||||
// 'notification': <String, dynamic>{
|
||||
@@ -462,7 +464,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
@@ -499,7 +501,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
@@ -538,7 +540,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -59,6 +59,7 @@ class MapDriverController extends GetxController {
|
||||
String stringRemainingTimeRideBegin = '';
|
||||
double progressTimerRideBegin = 0;
|
||||
late Timer timer;
|
||||
String? mapAPIKEY;
|
||||
|
||||
void onMapCreated(GoogleMapController controller) {
|
||||
LocationController locationController = Get.find<LocationController>();
|
||||
@@ -315,7 +316,7 @@ class MapDriverController extends GetxController {
|
||||
update();
|
||||
|
||||
var url =
|
||||
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AppCredintials.mapAPIKEY}');
|
||||
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${mapAPIKEY}');
|
||||
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
data = response['routes'][0]['legs'];
|
||||
@@ -359,7 +360,8 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
void onInit() async {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
// Get the passenger location from the arguments.
|
||||
passengerLocation = Get.arguments['passengerLocation'];
|
||||
duration = Get.arguments['Duration'];
|
||||
|
||||
@@ -89,6 +89,7 @@ class MapPassengerController extends GetxController {
|
||||
bool isPassengerChosen = false;
|
||||
late String driverToken;
|
||||
int carsOrder = 0;
|
||||
String? mapAPIKEY;
|
||||
|
||||
void onChangedPassengerCount(int newValue) {
|
||||
selectedPassengerCount = newValue;
|
||||
@@ -596,8 +597,8 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
Future getPlaces() async {
|
||||
var url =
|
||||
// '${AppLink.googleMapsLink}place/nearbysearch/json?location=${mylocation.longitude}&radius=25000&language=ar&keyword=&key=${placeController.text}${AppCredintials.mapAPIKEY}';
|
||||
'${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${placeController.text}&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=ar&key=${AppCredintials.mapAPIKEY}';
|
||||
// '${AppLink.googleMapsLink}place/nearbysearch/json?location=${mylocation.longitude}&radius=25000&language=ar&keyword=&key=${placeController.text}${mapAPIKEY}';
|
||||
'${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${placeController.text}&location=${myLocation.latitude},${myLocation.longitude}&radius=50000&language=ar&key=${mapAPIKEY.toString()}';
|
||||
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
|
||||
@@ -811,7 +812,7 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
// Make API request to get exact distance and duration
|
||||
String apiUrl =
|
||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${myLocation.latitude},${myLocation.longitude}&units=metric&key=${AppCredintials.mapAPIKEY}';
|
||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${myLocation.latitude},${myLocation.longitude}&units=metric&key=${mapAPIKEY}';
|
||||
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||
if (response['status'] == "OK") {
|
||||
var data = response;
|
||||
@@ -872,7 +873,7 @@ class MapPassengerController extends GetxController {
|
||||
// print(carsLocationByPassenger);
|
||||
|
||||
var url =
|
||||
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AppCredintials.mapAPIKEY}');
|
||||
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${mapAPIKEY}');
|
||||
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
data = response['routes'][0]['legs'];
|
||||
@@ -1157,6 +1158,7 @@ class MapPassengerController extends GetxController {
|
||||
String? cardNumber;
|
||||
@override
|
||||
void onInit() async {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
await getLocation();
|
||||
await getCarsLocationByPassenger();
|
||||
getNearestDriverByPassengerLocation();
|
||||
|
||||
@@ -3,9 +3,11 @@ import 'dart:io';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/credential.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/splash_screen_page.dart';
|
||||
@@ -18,6 +20,7 @@ import 'firebase_options.dart';
|
||||
import 'models/db_sql.dart';
|
||||
|
||||
final box = GetStorage();
|
||||
const storage = FlutterSecureStorage();
|
||||
DbSql sql = DbSql.instance;
|
||||
@pragma('vm:entry-point')
|
||||
Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
@@ -31,7 +34,13 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await GetStorage.init();
|
||||
Stripe.publishableKey = StripeKey.publishableKey;
|
||||
if (box.read(BoxName.apiKeyRun).toString() != 'run') {
|
||||
await AppCredintials().getApiKey();
|
||||
}
|
||||
String? stripePublishableKey =
|
||||
await storage.read(key: BoxName.stripePublishableKey);
|
||||
Stripe.publishableKey = stripePublishableKey ?? '';
|
||||
//StripeKey.publishableKey;
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
@@ -51,6 +60,7 @@ void main() async {
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ import 'package:ride/views/auth/captin/register_captin.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../../constant/char_map.dart';
|
||||
import '../../../constant/credential.dart';
|
||||
import '../../../controller/auth/login_controller.dart';
|
||||
import '../../widgets/mycircular.dart';
|
||||
|
||||
@@ -190,11 +192,33 @@ class LoginCaptin extends StatelessWidget {
|
||||
stopPauseOnTap: true,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
sql.deleteAllData(TableName.faceDetectTimes);
|
||||
onPressed: () async {
|
||||
String v = await storage.read(
|
||||
key: BoxName.basicAuthCredentials) ??
|
||||
'';
|
||||
print(v);
|
||||
// sql.deleteAllData(TableName.faceDetectTimes);
|
||||
AppCredintials credentials = AppCredintials();
|
||||
String apiKey = 'hamzaayedphp:malDEV@2101';
|
||||
// // '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';
|
||||
// AppCredintials credentials = AppCredintials();
|
||||
credentials.getApiKey();
|
||||
// String? apiKeyf =
|
||||
// await storage.read(key: 'basicAuthCredentials');
|
||||
// print(apiKeyf);
|
||||
// String convertedString = credentials.c(apiKey, charMap);
|
||||
// print('Converted String: $convertedString');
|
||||
//
|
||||
// String retrievedString =
|
||||
// credentials.r(convertedString, charMap);
|
||||
// print('Retrieved String: $retrievedString');
|
||||
//
|
||||
// if (retrievedString == apiKey) {
|
||||
// print('same');
|
||||
// }
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.delete,
|
||||
Icons.close,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user