11/20/2
This commit is contained in:
@@ -7,21 +7,30 @@ import 'package:ride/main.dart';
|
||||
import 'box_name.dart';
|
||||
import 'char_map.dart';
|
||||
|
||||
class AppCredintials {
|
||||
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(),
|
||||
);
|
||||
class AC {
|
||||
gAK() async {
|
||||
if (box.read(BoxName.apiKeyRun).toString() != 'run') {
|
||||
var res = await CRUD().get(link: AppLink.getApiKey, payload: {});
|
||||
var decod = jsonDecode(res);
|
||||
// print(decod);
|
||||
// Map<String, dynamic> jsonData = {};
|
||||
for (var i = 0; i < decod['message'].length; i++) {
|
||||
String retrievedString =
|
||||
r(decod['message'][i]['hashed_key'].toString(), charMap);
|
||||
await storage.write(
|
||||
key: decod['message'][i]['name'].toString(),
|
||||
value: retrievedString.toString(),
|
||||
);
|
||||
//
|
||||
// String name = decod['message'][i]['name'].toString();
|
||||
// String value = decod['message'][i]['hashed_key'].toString();
|
||||
|
||||
// jsonData[name] = value;
|
||||
}
|
||||
// String jsonString = json.encode(jsonData);
|
||||
// print(jsonString);
|
||||
box.write(BoxName.apiKeyRun, 'run');
|
||||
}
|
||||
box.write(BoxName.apiKeyRun, 'run');
|
||||
}
|
||||
|
||||
String q(String b, String c) {
|
||||
|
||||
@@ -4,20 +4,20 @@ import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/controller/functions/launch.dart';
|
||||
import 'package:ride/controller/home/captin/map_driver_controller.dart';
|
||||
import 'package:ride/controller/home/map_passenger_controller.dart';
|
||||
import 'package:ride/views/home/profile/promos_passenger_page.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/credential.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/home/profile/promos_passenger_page.dart';
|
||||
import '../../views/orderCaptin/order_request_page.dart';
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/launch.dart';
|
||||
import '../home/captin/map_driver_controller.dart';
|
||||
import '../home/map_passenger_controller.dart';
|
||||
|
||||
class FirebaseMessagesController extends GetxController {
|
||||
final fcmToken = FirebaseMessaging.instance;
|
||||
@@ -406,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=${storage.read(key: BoxName.serverAPI)}'
|
||||
'Authorization': 'key=${Env.serverAPI}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
@@ -464,7 +464,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
|
||||
'Authorization': 'key=${Env.serverAPI}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
@@ -501,7 +501,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
|
||||
'Authorization': 'key=${Env.serverAPI}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
@@ -540,7 +540,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
|
||||
'Authorization': 'key=${Env.serverAPI}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
|
||||
@@ -3,7 +3,9 @@ import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/char_map.dart';
|
||||
import '../../constant/credential.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
|
||||
class CRUD {
|
||||
@@ -22,7 +24,8 @@ class CRUD {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
'Basic ${base64Encode(utf8.encode(AC().r(Env.basicAuthCredentials, charMap)))}',
|
||||
// 'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
print("--------------" + response.request.toString());
|
||||
@@ -52,7 +55,7 @@ class CRUD {
|
||||
body: payload,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization': 'Bearer ${secretKey.toString()}',
|
||||
'Authorization': 'Bearer ${AC().r(Env.secretKey, charMap)}',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -74,7 +77,7 @@ class CRUD {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
'Basic ${base64Encode(utf8.encode(AC().r(Env.basicAuthCredentials, charMap)))}',
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
@@ -109,7 +112,7 @@ class CRUD {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
'Basic ${base64Encode(utf8.encode(AC().r(Env.basicAuthCredentials, charMap)))}',
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
@@ -166,7 +169,7 @@ class CRUD {
|
||||
body: json.encode(data),
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
'Basic ${base64Encode(utf8.encode(AC().r(Env.basicAuthCredentials, charMap)))}',
|
||||
},
|
||||
);
|
||||
return json.decode(response.body);
|
||||
@@ -183,7 +186,7 @@ class CRUD {
|
||||
url,
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
'Basic ${base64Encode(utf8.encode(AC().r(Env.basicAuthCredentials, charMap)))}',
|
||||
},
|
||||
);
|
||||
return json.decode(response.body);
|
||||
|
||||
@@ -7,17 +7,18 @@ 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';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'constant/char_map.dart';
|
||||
import 'constant/credential.dart';
|
||||
import 'constant/info.dart';
|
||||
import 'controller/firebase/firbase_messge.dart';
|
||||
import 'controller/local/local_controller.dart';
|
||||
import 'controller/local/translations.dart';
|
||||
import 'env/env.dart';
|
||||
import 'firebase_options.dart';
|
||||
import 'models/db_sql.dart';
|
||||
import 'splash_screen_page.dart';
|
||||
|
||||
final box = GetStorage();
|
||||
const storage = FlutterSecureStorage();
|
||||
@@ -34,12 +35,10 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await GetStorage.init();
|
||||
if (box.read(BoxName.apiKeyRun).toString() != 'run') {
|
||||
await AppCredintials().getApiKey();
|
||||
}
|
||||
String? stripePublishableKey =
|
||||
await storage.read(key: BoxName.stripePublishableKey);
|
||||
Stripe.publishableKey = stripePublishableKey ?? '';
|
||||
await AC().gAK();
|
||||
|
||||
Stripe.publishableKey = AC().r(Env.stripePublishableKe, charMap);
|
||||
|
||||
//StripeKey.publishableKey;
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await Firebase.initializeApp(
|
||||
|
||||
@@ -18,6 +18,7 @@ import 'package:ride/views/widgets/my_scafold.dart';
|
||||
import '../../../constant/char_map.dart';
|
||||
import '../../../constant/credential.dart';
|
||||
import '../../../controller/auth/login_controller.dart';
|
||||
import '../../../env/env.dart';
|
||||
import '../../widgets/mycircular.dart';
|
||||
|
||||
class LoginCaptin extends StatelessWidget {
|
||||
@@ -193,29 +194,30 @@ class LoginCaptin extends StatelessWidget {
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
String v = await storage.read(
|
||||
key: BoxName.basicAuthCredentials) ??
|
||||
'';
|
||||
print(v);
|
||||
// String v = await storage.read(
|
||||
// key: BoxName.basicAuthCredentials) ??
|
||||
// '';
|
||||
// print(v);
|
||||
// sql.deleteAllData(TableName.faceDetectTimes);
|
||||
AppCredintials credentials = AppCredintials();
|
||||
String apiKey = 'hamzaayedphp:malDEV@2101';
|
||||
AC credentials = AC();
|
||||
// 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);
|
||||
// credentials.getApiKey();
|
||||
// String? apiKeyf = '0pALdqDDYHvzp73Q59SIgbzjG7Z2zkhJXr';
|
||||
// // await storage.read(key: 'basicAuthCredentials');
|
||||
// // print(apiKeyf);
|
||||
// String convertedString = credentials.c(apiKeyf, charMap);
|
||||
// print('Converted String: $convertedString');
|
||||
//
|
||||
// //
|
||||
// String retrievedString =
|
||||
// credentials.r(convertedString, charMap);
|
||||
// print('Retrieved String: $retrievedString');
|
||||
//
|
||||
// if (retrievedString == apiKey) {
|
||||
|
||||
// if (retrievedString == apiKeyf) {
|
||||
// print('same');
|
||||
// }
|
||||
print(AC().r(Env.chatGPTkey, charMap)); //
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.close,
|
||||
|
||||
Reference in New Issue
Block a user