This commit is contained in:
Hamza-Ayed
2024-09-17 00:31:50 +03:00
parent c24eee9e1d
commit 1b50de9a7c
12 changed files with 199 additions and 157 deletions

View File

@@ -25,6 +25,7 @@
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:enableOnBackInvokedCallback="true"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<meta-data <meta-data
android:name="io.flutter.embedding.android.NormalTheme" android:name="io.flutter.embedding.android.NormalTheme"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
<array> <array>
<dict> <dict>
@@ -19,7 +19,7 @@
<string>comgooglemaps</string> <string>comgooglemaps</string>
</array> </array>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>CADisableMinimumFrameDurationOnPhone</key>
<true/> <true />
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
@@ -49,7 +49,7 @@
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string></string> <string></string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true />
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>Sefer app requires access to your camera in order to scan QR codes and capture <string>Sefer app requires access to your camera in order to scan QR codes and capture
images for uploading and access to connect to a call.</string> images for uploading and access to connect to a call.</string>
@@ -71,7 +71,7 @@
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>Explanation of why your app needs access to the photo library.</string> <string>Explanation of why your app needs access to the photo library.</string>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true/> <true />
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>
<string>fetch</string> <string>fetch</string>
@@ -96,6 +96,6 @@
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false />
</dict> </dict>
</plist> </plist>

View File

@@ -25,6 +25,7 @@ class BoxName {
static const String sosPhoneDriver = "sosPhoneDriver"; static const String sosPhoneDriver = "sosPhoneDriver";
static const String passengerID = "pasengerID"; static const String passengerID = "pasengerID";
static const String phone = "phone"; static const String phone = "phone";
static const String phoneWallet = "phoneWallet";
static const String phoneDriver = "phoneDriver"; static const String phoneDriver = "phoneDriver";
static const String dobDriver = "dobDriver"; static const String dobDriver = "dobDriver";
static const String sexDriver = "sexDriver"; static const String sexDriver = "sexDriver";

View File

@@ -246,10 +246,10 @@ class LoginController extends GetxController {
void onInit() async { void onInit() async {
// permissionLocation = await Permission.locationWhenInUse.isGranted; // permissionLocation = await Permission.locationWhenInUse.isGranted;
await getAppTester(AppInformation.appName); await getAppTester(AppInformation.appName);
if (isTest == 0 && box.read(BoxName.passengerID) != null) { // if (isTest == 0 && box.read(BoxName.passengerID) != null) {
await loginUsingCredentials( // await loginUsingCredentials(
box.read(BoxName.passengerID), box.read(BoxName.email)); // box.read(BoxName.passengerID), box.read(BoxName.email));
} // }
super.onInit(); super.onInit();
} }
} }

View File

@@ -232,9 +232,10 @@ class RegisterController extends GetxController {
print('WhatsApp message sent to non-Egyptian phone number: $phoneNumber'); print('WhatsApp message sent to non-Egyptian phone number: $phoneNumber');
} }
isLoading = false; isLoading = false;
update();
isSent = true; isSent = true;
remainingTime = 300; // Reset to 5 minutes remainingTime = 300;
update(); // Reset to 5 minutes
startTimer(); startTimer();
} }

View File

@@ -495,34 +495,70 @@ class FirebaseMessagesController extends GetxController {
void sendNotificationToPassengerToken( void sendNotificationToPassengerToken(
String title, body, token, List<String> map, String tone) async { String title, body, token, List<String> map, String tone) async {
try { try {
String serviceAccountKeyJson = '''{
"type": "service_account",
"project_id": "ride-b1bd8",
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSL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iIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
'''; // As defined above
// Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken();
// Log.print('accessToken: ${accessToken}');
// Send the notification
final response = await http.post( final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'), Uri.parse(
'https://fcm.googleapis.com/v1/projects/ride-b1bd8/messages:send'),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': 'key=${AK.serverAPI}' 'Authorization': 'Bearer $accessToken',
}, },
body: jsonEncode({ body: jsonEncode({
'notification': <String, dynamic>{ 'message': {
'token': token,
'notification': {
'title': title, 'title': title,
'body': body, 'body': body,
'sound': tone
}, },
'data': { 'android': {
'passengerList': map, 'notification': {
'sound': tone,
},
},
'apns': {
'payload': {
'aps': {
'sound': tone,
},
},
},
}, },
'priority': 'high',
'to': token,
}), }),
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
// Notification sent successfully print(
'Notification sent successfully. Status code: ${response.statusCode}');
print('Response body: ${response.body}');
} else { } else {
// Handle error response print(
'Failed to send notification. Status code: ${response.statusCode}'; 'Failed to send notification. Status code: ${response.statusCode}');
print('Response body: ${response.body}');
} }
} catch (e) { } catch (e) {
// Handle other exceptions print('Error sending notification: $e');
} }
} }

View File

@@ -1769,7 +1769,7 @@ class MapPassengerController extends GetxController {
'northeastLon': bounds.northeast.longitude.toString(), 'northeastLon': bounds.northeast.longitude.toString(),
}); });
break; break;
case 'Balash': case 'Awfar Car':
res = await CRUD() res = await CRUD()
.get(link: AppLink.getCarsLocationByPassengerBalash, payload: { .get(link: AppLink.getCarsLocationByPassengerBalash, payload: {
'southwestLat': bounds.southwest.latitude.toString(), 'southwestLat': bounds.southwest.latitude.toString(),

View File

@@ -7,6 +7,7 @@ class MyTranslation extends Translations {
"Update Available": "تحديث متوفر", "Update Available": "تحديث متوفر",
'Phone number must be exactly 11 digits long': 'Phone number must be exactly 11 digits long':
"رقم الهاتف يجب أن يكون بطول 11 رقماً", "رقم الهاتف يجب أن يكون بطول 11 رقماً",
'Insert Wallet phone number': 'أدخل رقم هاتف المحفظة',
"Phone number isn't an Egyptian phone number": "Phone number isn't an Egyptian phone number":
"رقم الهاتف ليس رقم هاتف مصري", "رقم الهاتف ليس رقم هاتف مصري",
"A new version of the app is available. Please update to the latest version.": "A new version of the app is available. Please update to the latest version.":

View File

@@ -31,6 +31,7 @@ class PaymentController extends GetxController {
bool isPromoSheetDialogue = false; bool isPromoSheetDialogue = false;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
final promo = TextEditingController(); final promo = TextEditingController();
final walletphoneController = TextEditingController();
double totalPassenger = Get.find<MapPassengerController>().totalPassenger; double totalPassenger = Get.find<MapPassengerController>().totalPassenger;
int? selectedAmount = 0; int? selectedAmount = 0;
List<dynamic> totalPassengerWalletDetails = []; List<dynamic> totalPassengerWalletDetails = [];
@@ -762,7 +763,7 @@ class PaymentController extends GetxController {
billingData: PaymobBillingData(), billingData: PaymobBillingData(),
onPayment: (PaymobResponse response) {}, onPayment: (PaymobResponse response) {},
); );
if (response!.success == true && response.responseCode == '200') {
if (response!.responseCode == 'APPROVED') { if (response!.responseCode == 'APPROVED') {
Get.defaultDialog( Get.defaultDialog(
barrierDismissible: false, barrierDismissible: false,
@@ -802,6 +803,7 @@ class PaymentController extends GetxController {
); );
} }
} }
}
} catch (e) { } catch (e) {
Get.defaultDialog( Get.defaultDialog(
title: 'Error'.tr, title: 'Error'.tr,

View File

@@ -144,7 +144,7 @@ class PaymobPaymentWallet {
}) async { }) async {
final Map<String, dynamic> data = { final Map<String, dynamic> data = {
"source": { "source": {
"identifier": box.read(BoxName.phone).toString(), "identifier": box.read(BoxName.phoneWallet).toString(),
"subtype": "WALLET", "subtype": "WALLET",
}, },
"payment_token": paymentToken, "payment_token": paymentToken,
@@ -269,7 +269,7 @@ class PaymobBillingDataWallet {
"email": box.read(BoxName.email) ?? box.read(BoxName.emailDriver), "email": box.read(BoxName.email) ?? box.read(BoxName.emailDriver),
"first_name": box.read(BoxName.name) ?? box.read(BoxName.nameDriver), "first_name": box.read(BoxName.name) ?? box.read(BoxName.nameDriver),
"last_name": box.read(BoxName.name) ?? box.read(BoxName.nameDriver), "last_name": box.read(BoxName.name) ?? box.read(BoxName.nameDriver),
"phone_number": box.read(BoxName.phone) ?? box.read(BoxName.phoneDriver), "phone_number": box.read(BoxName.phoneWallet),
"apartment": apartment ?? "NA", "apartment": apartment ?? "NA",
"floor": floor ?? "NA", "floor": floor ?? "NA",
"building": building ?? "NA", "building": building ?? "NA",

View File

@@ -77,9 +77,9 @@ void main() async {
userTokenExpiration: 200, userTokenExpiration: 200,
iFrameID: 837992, iFrameID: 837992,
); );
PaymobPaymentWallet.instance.initialize( PaymobPaymentWallet.instance.initialize(
apiKey: AK apiKey: AK.payMobApikey,
.payMobApikey, // from dashboard Select Settings -> Account Info -> API Key
integrationID: int.parse(AK.integrationIdPayMobWallet), integrationID: int.parse(AK.integrationIdPayMobWallet),
userTokenExpiration: 200, userTokenExpiration: 200,
iFrameID: 837992, iFrameID: 837992,

View File

@@ -27,7 +27,7 @@ class MyTextForm extends StatelessWidget {
children: [ children: [
Text( Text(
label.tr, label.tr,
style: TextStyle( style: const TextStyle(
color: CupertinoColors.label, color: CupertinoColors.label,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,