9/29/1
This commit is contained in:
@@ -54,8 +54,8 @@ android {
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdk = 23
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = 94
|
||||
versionName = '1.5.94'
|
||||
versionCode = 95
|
||||
versionName = '1.5.95'
|
||||
multiDexEnabled =true
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@ flutter {
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
// implementation platform('com.google.firebase:firebase-bom:32.1.1')
|
||||
// implementation 'com.facebook.android:facebook-login:12.3.0'
|
||||
implementation 'com.facebook.android:facebook-login:latest.release'
|
||||
|
||||
implementation 'com.stripe:paymentsheet:20.47.0'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
|
||||
|
||||
|
||||
@@ -33,6 +33,22 @@
|
||||
android:icon="@mipmap/launcher_icon"
|
||||
android:label="Sefer Driver"
|
||||
android:theme="@style/LaunchTheme">
|
||||
<meta-data android:name="com.facebook.sdk.ApplicationId"
|
||||
android:value="@string/facebook_app_id" />
|
||||
|
||||
<activity android:name="com.facebook.FacebookActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
||||
android:label="@string/app_name" />
|
||||
<activity
|
||||
android:name="com.facebook.CustomTabActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="@string/fb_login_protocol_scheme" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<service
|
||||
android:name=".MyFirebaseMessagingService"
|
||||
android:exported="false"></service>
|
||||
@@ -59,6 +75,7 @@
|
||||
android:name="com.yalantis.ucrop.UCropActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="@string/api_key" />
|
||||
@@ -74,14 +91,7 @@
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="location" />
|
||||
|
||||
|
||||
<!-- <service
|
||||
android:name=".java.MyFirebaseMessagingService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service> -->
|
||||
<!-- Firebase Messaging Service -->
|
||||
<service
|
||||
android:name="com.google.firebase.messaging.FirebaseMessagingService"
|
||||
android:exported="false"
|
||||
@@ -90,43 +100,23 @@
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service
|
||||
android:name="com.phan_tech.flutter_overlay_apps.OverlayService"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name="flutter.overlay.window.flutter_overlay_window.OverlayService"
|
||||
android:foregroundServiceType="specialUse">
|
||||
<property
|
||||
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="explanation_for_special_use" />
|
||||
</service>
|
||||
|
||||
<receiver
|
||||
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
|
||||
android:exported="true"
|
||||
android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
|
||||
<category android:name="com.sefer_driver" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Sign-In Service -->
|
||||
<service
|
||||
android:name="com.dsaved.bubblehead.bubble.BubbleHeadService"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="intent.bring.app.to.foreground" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<receiver
|
||||
<!-- <receiver
|
||||
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:exported="false" /> -->
|
||||
|
||||
<!-- <receiver
|
||||
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
@@ -135,10 +125,8 @@
|
||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".YourBroadcastReceiver"
|
||||
android:exported="false" />
|
||||
</application>
|
||||
</receiver> -->
|
||||
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -5,4 +5,11 @@
|
||||
<string name="api_key">AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0</string>
|
||||
<string name="channel_name">FCM Notifications</string>
|
||||
<string name="channel_description">Notifications from Firebase Cloud Messaging</string>
|
||||
|
||||
<!-- <string name="app_name">auth_app</string> -->
|
||||
<string name="facebook_app_id">1749628025888168</string>
|
||||
<string name="fb_login_protocol_scheme">fb1749628025888168</string>
|
||||
<string name="facebook_client_token">af5af0a2c8feffe25c27755977bb9ff7</string>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -13,6 +13,14 @@ PODS:
|
||||
- Flutter
|
||||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- FBAEMKit (17.0.3):
|
||||
- FBSDKCoreKit_Basics (= 17.0.3)
|
||||
- FBSDKCoreKit (17.0.3):
|
||||
- FBAEMKit (= 17.0.3)
|
||||
- FBSDKCoreKit_Basics (= 17.0.3)
|
||||
- FBSDKCoreKit_Basics (17.0.3)
|
||||
- FBSDKLoginKit (17.0.3):
|
||||
- FBSDKCoreKit (= 17.0.3)
|
||||
- Firebase/Auth (10.28.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseAuth (~> 10.28.0)
|
||||
@@ -63,6 +71,9 @@ PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_contacts (0.0.1):
|
||||
- Flutter
|
||||
- flutter_facebook_auth (7.0.1):
|
||||
- FBSDKLoginKit (~> 17.0.2)
|
||||
- Flutter
|
||||
- flutter_image_compress_common (1.0.0):
|
||||
- Flutter
|
||||
- Mantle
|
||||
@@ -286,6 +297,7 @@ DEPENDENCIES:
|
||||
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_contacts (from `.symlinks/plugins/flutter_contacts/ios`)
|
||||
- flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)
|
||||
- flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`)
|
||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||
@@ -317,6 +329,10 @@ DEPENDENCIES:
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- AppAuth
|
||||
- FBAEMKit
|
||||
- FBSDKCoreKit
|
||||
- FBSDKCoreKit_Basics
|
||||
- FBSDKLoginKit
|
||||
- Firebase
|
||||
- FirebaseAppCheckInterop
|
||||
- FirebaseAuth
|
||||
@@ -374,6 +390,8 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter
|
||||
flutter_contacts:
|
||||
:path: ".symlinks/plugins/flutter_contacts/ios"
|
||||
flutter_facebook_auth:
|
||||
:path: ".symlinks/plugins/flutter_facebook_auth/ios"
|
||||
flutter_image_compress_common:
|
||||
:path: ".symlinks/plugins/flutter_image_compress_common/ios"
|
||||
flutter_local_notifications:
|
||||
@@ -435,6 +453,10 @@ SPEC CHECKSUMS:
|
||||
background_location: 1b80c1fe3abd9912bca298618f6e365abf6f588f
|
||||
camera_avfoundation: dd002b0330f4981e1bbcb46ae9b62829237459a4
|
||||
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
|
||||
FBAEMKit: 9900b2edd99a2d21629a6277e6166f14c6215799
|
||||
FBSDKCoreKit: 0791f8f68a8630931a4c12aa23a56cc021551596
|
||||
FBSDKCoreKit_Basics: 46d6b472c0dd0a5a7e972c025033d1c567f54eb4
|
||||
FBSDKLoginKit: b4a4eba1d62eb452544411824f41689adabd5bd2
|
||||
Firebase: 5121c624121af81cbc81df3bda414b3c28c4f3c3
|
||||
firebase_auth: e778ee89483b86fe4200d1f8e9a1c52aa5fb64a8
|
||||
firebase_core: a9d0180d5285527884d07a41eb4a9ec9ed12cdb6
|
||||
@@ -447,6 +469,7 @@ SPEC CHECKSUMS:
|
||||
FirebaseMessaging: 087a7c7cadef7b9239f005bc4db823894844f323
|
||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||
flutter_contacts: edb1c5ce76aa433e20e6cb14c615f4c0b66e0983
|
||||
flutter_facebook_auth: 4fa1dc3fa624284a5ddfdf9e4a2b7945b3835949
|
||||
flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e
|
||||
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
|
||||
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
||||
|
||||
@@ -281,6 +281,7 @@ class AppLink {
|
||||
static String getPassengerDetails = "$server/Admin/getPassengerDetails.php";
|
||||
static String getPassengerbyEmail = "$server/Admin/getPassengerbyEmail.php";
|
||||
static String addAdminUser = "$server/Admin/adminUser/add.php";
|
||||
static String addError = "$server/Admin/errorApp.php";
|
||||
static String getAdminUser = "$server/Admin/adminUser/get.php";
|
||||
static String getCaptainDetailsByEmailOrIDOrPhone =
|
||||
"$server/Admin/AdminCaptain/getCaptainDetailsByEmailOrIDOrPhone.php";
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/controller/functions/location_background_controller.dart';
|
||||
import 'package:SEFER/print.dart';
|
||||
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
|
||||
import 'package:SEFER/views/auth/captin/login_captin.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
@@ -134,6 +135,7 @@ class LoginDriverController extends GetxController {
|
||||
}
|
||||
|
||||
Get.off(() => HomeCaptain());
|
||||
// Get.off(() => LoginCaptin());
|
||||
} else {
|
||||
Get.offAll(() => SmsSignupEgypt());
|
||||
// Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
|
||||
|
||||
@@ -160,85 +160,126 @@ class RegisterCaptainController extends GetxController {
|
||||
// isLoading = false;
|
||||
// update();
|
||||
// }
|
||||
DateTime? lastOtpSentTime; // Store the last OTP sent time
|
||||
int otpResendInterval = 300; // 5 minutes in seconds
|
||||
|
||||
// Main function to handle OTP sending
|
||||
sendOtpMessage() async {
|
||||
SmsEgyptController smsEgyptController = Get.put(SmsEgyptController());
|
||||
if (_isOtpResendAllowed()) {
|
||||
isLoading = true;
|
||||
update();
|
||||
|
||||
int randomNumber = Random().nextInt(100000) + 1;
|
||||
isLoading = true;
|
||||
update();
|
||||
|
||||
// Get the current time and the last OTP time (if it exists)
|
||||
DateTime currentTime = DateTime.now();
|
||||
DateTime? lastOtpTime = box.read(BoxName.lastOtpTime);
|
||||
|
||||
// Check if the last OTP was sent within 5 minutes (300 seconds)
|
||||
if (lastOtpTime != null &&
|
||||
currentTime.difference(lastOtpTime).inSeconds < 300) {
|
||||
Get.snackbar(
|
||||
'Please wait'.tr, 'You can send another OTP after 5 minutes.'.tr,
|
||||
backgroundColor: AppColor.redColor);
|
||||
isLoading = false;
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
if (formKey3.currentState!.validate()) {
|
||||
if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||
if (isValidEgyptianPhoneNumber(phoneController.text)) {
|
||||
var responseCheker = await CRUD()
|
||||
.post(link: AppLink.checkPhoneNumberISVerfiedDriver, payload: {
|
||||
'phone_number': '+2${phoneController.text}',
|
||||
});
|
||||
String countryCode = box.read(BoxName.countryCode);
|
||||
String phoneNumber = phoneController.text;
|
||||
|
||||
if (responseCheker != 'failure') {
|
||||
var d = jsonDecode(responseCheker);
|
||||
if (d['message'][0]['is_verified'].toString() == '1') {
|
||||
Get.snackbar('Phone number is verified before'.tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
if (countryCode == 'Egypt' && isValidEgyptianPhoneNumber(phoneNumber)) {
|
||||
await _checkAndSendOtp(phoneNumber);
|
||||
} else {
|
||||
_showErrorMessage('Phone Number is not Egypt phone '.tr);
|
||||
}
|
||||
}
|
||||
isLoading = false;
|
||||
update();
|
||||
} else {
|
||||
_showCooldownMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the resend OTP request is allowed (5 minutes cooldown)
|
||||
bool _isOtpResendAllowed() {
|
||||
if (lastOtpSentTime == null) return true;
|
||||
|
||||
final int elapsedTime =
|
||||
DateTime.now().difference(lastOtpSentTime!).inSeconds;
|
||||
return elapsedTime >= otpResendInterval;
|
||||
}
|
||||
|
||||
// Show message when user tries to resend OTP too soon
|
||||
void _showCooldownMessage() {
|
||||
int remainingTime = otpResendInterval -
|
||||
DateTime.now().difference(lastOtpSentTime!).inSeconds;
|
||||
Get.snackbar(
|
||||
'Please wait ${remainingTime ~/ 60}:${(remainingTime % 60).toString().padLeft(2, '0')} minutes before requesting again',
|
||||
'',
|
||||
backgroundColor: AppColor.redColor,
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the phone number has been verified, and send OTP if not verified
|
||||
_checkAndSendOtp(String phoneNumber) async {
|
||||
var responseChecker = await CRUD().post(
|
||||
link: AppLink.checkPhoneNumberISVerfiedDriver,
|
||||
payload: {
|
||||
'phone_number': '+2$phoneNumber',
|
||||
},
|
||||
);
|
||||
|
||||
if (responseChecker != 'failure') {
|
||||
var responseData = jsonDecode(responseChecker);
|
||||
if (_isPhoneVerified(responseData)) {
|
||||
_handleAlreadyVerified();
|
||||
} else {
|
||||
await _sendOtpAndSms(phoneNumber);
|
||||
}
|
||||
} else {
|
||||
await _sendOtpAndSms(phoneNumber);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the phone number is already verified
|
||||
bool _isPhoneVerified(dynamic responseData) {
|
||||
return responseData['message'][0]['is_verified'].toString() == '1';
|
||||
}
|
||||
|
||||
// Handle case where phone number is already verified
|
||||
_handleAlreadyVerified() {
|
||||
Get.snackbar(
|
||||
'Phone number is already verified'.tr,
|
||||
'',
|
||||
backgroundColor: AppColor.greenColor,
|
||||
);
|
||||
box.write(BoxName.phoneVerified, '1');
|
||||
box.write(BoxName.phone, '+2${phoneController.text}');
|
||||
await Get.put(LoginDriverController()).loginUsingCredentials(
|
||||
Get.put(LoginDriverController()).loginUsingCredentials(
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.emailDriver).toString(),
|
||||
);
|
||||
} else {
|
||||
await _sendOtp(randomNumber, smsEgyptController);
|
||||
}
|
||||
} else {
|
||||
await _sendOtp(randomNumber, smsEgyptController);
|
||||
}
|
||||
} else {
|
||||
Get.snackbar('Phone Number wrong'.tr, '',
|
||||
backgroundColor: AppColor.redColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
// Send OTP and SMS
|
||||
_sendOtpAndSms(String phoneNumber) async {
|
||||
SmsEgyptController smsEgyptController = Get.put(SmsEgyptController());
|
||||
int randomNumber = Random().nextInt(100000) + 1;
|
||||
|
||||
_sendOtp(int randomNumber, SmsEgyptController smsEgyptController) async {
|
||||
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
|
||||
'phone_number': '+2${phoneController.text}',
|
||||
await CRUD().post(
|
||||
link: AppLink.sendVerifyOtpMessage,
|
||||
payload: {
|
||||
'phone_number': '+2$phoneNumber',
|
||||
'token_code': randomNumber.toString(),
|
||||
"driverId": box.read(BoxName.driverID),
|
||||
"email": box.read(BoxName.emailDriver),
|
||||
});
|
||||
'driverId': box.read(BoxName.driverID),
|
||||
'email': box.read(BoxName.emailDriver),
|
||||
},
|
||||
);
|
||||
|
||||
await smsEgyptController.sendSmsEgypt(
|
||||
phoneController.text.toString(), randomNumber.toString());
|
||||
|
||||
// Save the current time as the last OTP time
|
||||
box.write(BoxName.lastOtpTime, DateTime.now());
|
||||
// Get.snackbar('', '');
|
||||
// await smsEgyptController.sendSmsEgypt(phoneNumber, randomNumber.toString());
|
||||
|
||||
lastOtpSentTime = DateTime.now(); // Update the last OTP sent time
|
||||
isSent = true;
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
// Show error message in case of invalid phone number
|
||||
void _showErrorMessage(String message) {
|
||||
Get.snackbar(
|
||||
message.tr,
|
||||
'',
|
||||
backgroundColor: AppColor.redColor,
|
||||
);
|
||||
}
|
||||
|
||||
verifySMSCode() async {
|
||||
if (formKey3.currentState!.validate()) {
|
||||
var res = await CRUD().post(link: AppLink.verifyOtpDriver, payload: {
|
||||
|
||||
30
lib/controller/auth/facebook_login.dart
Normal file
30
lib/controller/auth/facebook_login.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
|
||||
|
||||
class FacebookSignIn {
|
||||
Future<UserCredential?> signInWithFacebook() async {
|
||||
final LoginResult result = await FacebookAuth.instance.login();
|
||||
if (result.status == LoginStatus.success) {
|
||||
// Create a credential from the access token
|
||||
final OAuthCredential credential =
|
||||
FacebookAuthProvider.credential(result.accessToken!.tokenString);
|
||||
// Once signed in, return the UserCredential
|
||||
return await FirebaseAuth.instance.signInWithCredential(credential);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await FacebookAuth.instance.logOut();
|
||||
print('Facebook Sign Out Successful');
|
||||
} catch (e) {
|
||||
print('Error during Facebook Sign Out: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> isSignedIn() async {
|
||||
final accessToken = await FacebookAuth.instance.accessToken;
|
||||
return accessToken != null;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/controller/auth/captin/login_captin_controller.dart';
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
|
||||
import 'package:SEFER/views/home/on_boarding_page.dart';
|
||||
@@ -83,7 +85,7 @@ class GoogleSignInHelper {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
static Future<GoogleSignInAccount?> signInFromLogin() async {
|
||||
Future<GoogleSignInAccount?> signInFromLogin() async {
|
||||
try {
|
||||
final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
|
||||
|
||||
@@ -106,11 +108,27 @@ class GoogleSignInHelper {
|
||||
} catch (error) {
|
||||
Get.snackbar('Google Sign-In error', '$error',
|
||||
backgroundColor: AppColor.redColor);
|
||||
addError(error.toString(), 'GoogleSignInAccount?> signInFromLogin()');
|
||||
print('Google Sign-In error: $error');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
addError(String error, where) async {
|
||||
CRUD().post(link: AppLink.addError, payload: {
|
||||
'error': error.toString(), // Example error description
|
||||
'userId': box.read(BoxName.driverID) ??
|
||||
box.read(BoxName.passengerID), // Example user ID
|
||||
'userType': box.read(BoxName.driverID) != null
|
||||
? 'Driver'
|
||||
: 'passenger', // Example user type
|
||||
'phone': box.read(BoxName.phone) ??
|
||||
box.read(BoxName.phoneDriver), // Example phone number
|
||||
|
||||
'device': where
|
||||
});
|
||||
}
|
||||
|
||||
// Method to handle Google Sign-Out
|
||||
static Future<void> signOut() async {
|
||||
try {
|
||||
|
||||
@@ -135,7 +135,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
});
|
||||
} else if (message.notification!.title == 'Cancel Trip') {
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController().showNotification(
|
||||
NotificationController1().showNotification(
|
||||
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel', '');
|
||||
}
|
||||
cancelTripDialog();
|
||||
@@ -143,7 +143,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
var myListString = message.data['DriverList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController()
|
||||
NotificationController1()
|
||||
.showNotification('VIP Order'.tr, '', 'order', '');
|
||||
}
|
||||
MyDialog().getDialog('VIP Order'.tr, 'midTitle', () {
|
||||
@@ -159,13 +159,13 @@ class FirebaseMessagesController extends GetxController {
|
||||
} else if (message.notification!.title == 'Cancel') {
|
||||
cancelTripDialog1();
|
||||
} else if (message.notification!.title! == 'token change') {
|
||||
// NotificationController()
|
||||
// .showNotification('token change'.tr, 'token change', 'cancel');
|
||||
NotificationController1()
|
||||
.showNotification('token change'.tr, 'token change', 'cancel', '');
|
||||
// GoogleSignInHelper.signOut();
|
||||
GoogleSignInHelper.signOut();
|
||||
} else if (message.notification!.title! == 'message From passenger') {
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController()
|
||||
NotificationController1()
|
||||
.showNotification('message From passenger'.tr, ''.tr, 'tone2', '');
|
||||
}
|
||||
passengerDialog(message.notification!.body!);
|
||||
|
||||
@@ -61,7 +61,7 @@ class NotificationController extends GetxController {
|
||||
priority: Priority.high,
|
||||
styleInformation: bigTextStyleInformation,
|
||||
playSound: true,
|
||||
sound: RawResourceAndroidNotificationSound(tone),
|
||||
sound: RawResourceAndroidNotificationSound(tone == '' ? 'ding' : tone),
|
||||
// audioAttributesUsage: AudioAttributesUsage.alarm,
|
||||
visibility: NotificationVisibility.public,
|
||||
autoCancel: false,
|
||||
|
||||
@@ -16,6 +16,7 @@ import '../../constant/colors.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/toast.dart';
|
||||
import 'paymob/paymob_wallet.dart';
|
||||
@@ -588,25 +589,31 @@ class PaymentController extends GetxController {
|
||||
billingData: PaymobBillingDataWallet(),
|
||||
onPayment: (PaymobResponseWallet response) {},
|
||||
);
|
||||
|
||||
if (response!.success == true && response.responseCode == '200') {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Payment Successful'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Text(
|
||||
'The payment was approved.'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
// Log.print('message: ${response!.message}');
|
||||
// Log.print('responseCode: ${response.responseCode}');
|
||||
// Log.print('success: ${response.success}');
|
||||
// Log.print('transactionID: ${response.transactionID}');
|
||||
if (response!.responseCode == '200' && response.success == true) {
|
||||
// Log.print('transactionID wewer: ${response.transactionID}');
|
||||
Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor);
|
||||
method();
|
||||
},
|
||||
),
|
||||
);
|
||||
// Get.defaultDialog(
|
||||
// barrierDismissible: false,
|
||||
// title: 'Payment Successful'.tr,
|
||||
// titleStyle: AppStyle.title,
|
||||
// content: Text(
|
||||
// 'The payment was approved.'.tr,
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'OK'.tr,
|
||||
// kolor: AppColor.greenColor,
|
||||
// onPressed: () async {
|
||||
// Get.back();
|
||||
// method();
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
|
||||
@@ -313,6 +313,70 @@ class PaymobIFrameWallet extends StatefulWidget {
|
||||
State<PaymobIFrameWallet> createState() => _PaymobIFrameState();
|
||||
}
|
||||
|
||||
// class _PaymobIFrameState extends State<PaymobIFrameWallet> {
|
||||
// WebViewController? controller;
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// controller = WebViewController()
|
||||
// ..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
// ..setNavigationDelegate(
|
||||
// NavigationDelegate(
|
||||
// onNavigationRequest: (NavigationRequest request) {
|
||||
// Log.print('request.url: ${request.url}');
|
||||
// if (request.url.contains('txn_response_code') &&
|
||||
// request.url.contains('success') &&
|
||||
// request.url.contains('id')) {
|
||||
// final params = _getParamFromURL(request.url);
|
||||
// final response = PaymobResponseWallet.fromJson(params);
|
||||
// if (widget.onPayment != null) {
|
||||
// widget.onPayment!(response);
|
||||
// }
|
||||
// Navigator.pop(context, response);
|
||||
// return NavigationDecision.prevent;
|
||||
// }
|
||||
// return NavigationDecision.navigate;
|
||||
// },
|
||||
// ),
|
||||
// )
|
||||
// ..loadRequest(Uri.parse(widget.redirectURL));
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// body: controller == null
|
||||
// ? const Center(
|
||||
// child: CircularProgressIndicator.adaptive(),
|
||||
// )
|
||||
// : SafeArea(
|
||||
// child: WebViewWidget(
|
||||
// controller: controller!,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
// Map<String, dynamic> _getParamFromURL(String url) {
|
||||
// final uri = Uri.parse(url);
|
||||
// final queryParams = uri.queryParameters;
|
||||
// final data = <String, dynamic>{};
|
||||
|
||||
// queryParams.forEach((key, value) {
|
||||
// if (key.contains('.')) {
|
||||
// final parts = key.split('.');
|
||||
// data.putIfAbsent(parts.first, () => <String, dynamic>{});
|
||||
// (data[parts.first] as Map<String, dynamic>)[parts.last] = value;
|
||||
// } else {
|
||||
// data[key] = value;
|
||||
// }
|
||||
// });
|
||||
|
||||
// return data;
|
||||
// }
|
||||
// }
|
||||
|
||||
class _PaymobIFrameState extends State<PaymobIFrameWallet> {
|
||||
WebViewController? controller;
|
||||
|
||||
@@ -323,16 +387,23 @@ class _PaymobIFrameState extends State<PaymobIFrameWallet> {
|
||||
..setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onNavigationRequest: (NavigationRequest request) {
|
||||
Log.print('request.url: ${request.url}');
|
||||
|
||||
if (request.url.contains('txn_response_code') &&
|
||||
// request.url.contains('successfully') &&
|
||||
request.url.contains('success') &&
|
||||
request.url.contains('id')) {
|
||||
final params = _getParamFromURL(request.url);
|
||||
final response = PaymobResponseWallet.fromJson(params);
|
||||
|
||||
if (widget.onPayment != null) {
|
||||
widget.onPayment!(response);
|
||||
}
|
||||
|
||||
Navigator.pop(context, response);
|
||||
|
||||
// Show a dialog after successful payment
|
||||
// _showSuccessDialog(response);
|
||||
|
||||
return NavigationDecision.prevent;
|
||||
}
|
||||
return NavigationDecision.navigate;
|
||||
@@ -375,4 +446,24 @@ class _PaymobIFrameState extends State<PaymobIFrameWallet> {
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void _showSuccessDialog(PaymobResponseWallet response) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('Payment Successful'),
|
||||
content: Text('Transaction ID: EGP'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Close the dialog
|
||||
},
|
||||
child: Text('OK'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:SEFER/views/home/Captin/orderCaptin/order_request_page.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
|
||||
import 'package:flutter_overlay_window/flutter_overlay_window.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
@@ -129,14 +130,14 @@ void main() async {
|
||||
await FirebaseMessagesController().requestFirebaseMessagingPermission();
|
||||
|
||||
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
|
||||
// NotificationController1().initNotifications();
|
||||
NotificationController().initNotifications();
|
||||
NotificationController1().initNotifications();
|
||||
|
||||
await Future.wait([
|
||||
FirebaseMessagesController().getNotificationSettings(),
|
||||
FirebaseMessagesController().getToken(),
|
||||
]);
|
||||
|
||||
// await FacebookAuth.instance.init();
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
@@ -145,6 +146,7 @@ void main() async {
|
||||
|
||||
PaymobPayment.instance.initialize(
|
||||
apiKey: AK.payMobApikey,
|
||||
// integrationID: 4556055,
|
||||
integrationID: int.parse(AK.integrationIdPayMob),
|
||||
userTokenExpiration: 200,
|
||||
iFrameID: 837992,
|
||||
@@ -152,6 +154,7 @@ void main() async {
|
||||
PaymobPaymentWallet.instance.initialize(
|
||||
apiKey: AK.payMobApikey,
|
||||
integrationID: int.parse(AK.integrationIdPayMobWallet),
|
||||
// integrationID: 4556056,
|
||||
userTokenExpiration: 200,
|
||||
iFrameID: 837992,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:SEFER/controller/auth/facebook_login.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -210,10 +211,20 @@ class LoginCaptin extends StatelessWidget {
|
||||
MyElevatedButton(
|
||||
title: 'Sign In by Google'.tr,
|
||||
onPressed: () async {
|
||||
await GoogleSignInHelper.signInFromLogin();
|
||||
await GoogleSignInHelper().signInFromLogin();
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
// Platform.isAndroid
|
||||
// ? MyElevatedButton(
|
||||
// title: 'Sign In by Facebook'.tr,
|
||||
// onPressed: () async {
|
||||
// await FacebookSignIn()
|
||||
// .signInWithFacebook();
|
||||
// },
|
||||
// kolor: AppColor.blueColor,
|
||||
// )
|
||||
// : const SizedBox(),
|
||||
!Platform.isAndroid
|
||||
? MyElevatedButton(
|
||||
title: 'Sign In by Apple'.tr,
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:SEFER/controller/firebase/local_notification.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart';
|
||||
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
|
||||
import 'package:SEFER/views/auth/captin/login_captin.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:bubble_head/bubble.dart';
|
||||
@@ -276,20 +277,20 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
// return IconButton(
|
||||
// onPressed: () async {
|
||||
// // FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
// // 'Order'.tr,
|
||||
// // 'from: ',
|
||||
// // // jsonDecode(value)['message'].toString(),
|
||||
// // 'dqK5wNrPTr20HQ8qa5KsgL:APA91bHwPW_XzCIxQtg_IkJmHg1JRd8NRMquvsgedBaHAIgErTs6Uzpw1IX0EIJqkTaZq5dxd1u2z7NVdLlvcmEzrpjjWt1pUsZaa5UU7Cpx6hUzJMUdXvhNlAYFGklM8bWUG4ZXSRf1',
|
||||
// // 'order.wav');
|
||||
// // NotificationController().showNotification(
|
||||
// // 'Order'.tr,
|
||||
// // 'We regret to inform you that another driver has accepted this order.'
|
||||
// // .tr,
|
||||
// // 'order',
|
||||
// // '');
|
||||
// // requestLocationPermission();
|
||||
// // Get.to(SmsSignupEgypt());
|
||||
// // print(box.read(BoxName.tokenDriver));
|
||||
// 'Order'.tr,
|
||||
// 'from: ',
|
||||
// // jsonDecode(value)['message'].toString(),
|
||||
// 'dqK5wNrPTr20HQ8qa5KsgL:APA91bHwPW_XzCIxQtg_IkJmHg1JRd8NRMquvsgedBaHAIgErTs6Uzpw1IX0EIJqkTaZq5dxd1u2z7NVdLlvcmEzrpjjWt1pUsZaa5UU7Cpx6hUzJMUdXvhNlAYFGklM8bWUG4ZXSRf1',
|
||||
// 'order.wav');
|
||||
// NotificationController1().showNotification(
|
||||
// 'sdf'.tr,
|
||||
// 'We regret to inform you that another driver has accepted this order.'
|
||||
// .tr,
|
||||
// '',
|
||||
// '');
|
||||
// requestLocationPermission();
|
||||
// Get.to(() => LoginCaptin());
|
||||
// print(box.read(BoxName.tokenDriver));
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// FontAwesome5.closed_captioning,
|
||||
|
||||
@@ -437,8 +437,12 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
title: 'I arrive you'.tr,
|
||||
kolor: AppColor.yellowColor,
|
||||
onPressed: () async {
|
||||
if (controller
|
||||
.calculateDistanceBetweenDriverAndPassengerLocation() <
|
||||
// Await the result of the distance calculation
|
||||
double distanceToArrive =
|
||||
await controller
|
||||
.calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (distanceToArrive <
|
||||
40) {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
|
||||
@@ -106,7 +106,7 @@ class PointsCaptain extends StatelessWidget {
|
||||
.getCaptainWalletFromBuyPoints();
|
||||
});
|
||||
}
|
||||
Get.back();
|
||||
// Get.back();
|
||||
}));
|
||||
},
|
||||
),
|
||||
|
||||
@@ -7,6 +7,7 @@ import Foundation
|
||||
|
||||
import audio_session
|
||||
import device_info_plus
|
||||
import facebook_auth_desktop
|
||||
import file_selector_macos
|
||||
import firebase_auth
|
||||
import firebase_core
|
||||
@@ -31,6 +32,7 @@ import wakelock_plus
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
FacebookAuthDesktopPlugin.register(with: registry.registrar(forPlugin: "FacebookAuthDesktopPlugin"))
|
||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||
|
||||
32
pubspec.lock
32
pubspec.lock
@@ -409,6 +409,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
facebook_auth_desktop:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: facebook_auth_desktop
|
||||
sha256: "219d559a33891e937c1913430505eae01fb946cb35729167bbdc747e3ebbd9ff"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -574,6 +582,30 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.8"
|
||||
flutter_facebook_auth:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_facebook_auth
|
||||
sha256: faa92fb7626c230837f30d02de7d92b6af334b77ba744867c63545d4ad7e171f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.1.0"
|
||||
flutter_facebook_auth_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_facebook_auth_platform_interface
|
||||
sha256: e04b8dbfa77702bea45a79993163ad5d20b2c0084109bec591fdc2b9ee505779
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.2"
|
||||
flutter_facebook_auth_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_facebook_auth_web
|
||||
sha256: "8a6890a98522604169ca9f958d7189c9f579dbf05ba4d3d7adf26eca4c4c4c93"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.1"
|
||||
flutter_font_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -85,6 +85,7 @@ dependencies:
|
||||
flutter_contacts: ^1.1.8
|
||||
flutter_overlay_window: ^0.4.4
|
||||
googleapis_auth: ^1.6.0
|
||||
flutter_facebook_auth: ^7.1.0
|
||||
# dash_bubble: ^2.0.0
|
||||
# bubble_head: ^0.0.4
|
||||
# google_mlkit_face_detection: ^0.11.0
|
||||
|
||||
Reference in New Issue
Block a user