This commit is contained in:
Hamza-Ayed
2024-10-11 08:43:49 +03:00
parent 9b0caf3bed
commit 9854f80971
9 changed files with 295 additions and 98 deletions

View File

@@ -54,8 +54,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23 minSdk = 23
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = 107 versionCode = 108
versionName = '1.5.07' versionName = '1.5.08'
multiDexEnabled =true multiDexEnabled =true
} }

View File

@@ -2,6 +2,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>LSMinimumSystemVersion</key>
<string>12.0</string>
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>
<string>fetch</string> <string>fetch</string>
@@ -33,7 +35,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>66</string> <string>67</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@@ -48,7 +50,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4.0.66</string> <string>4.0.67</string>
<key>FirebaseAppDelegateProxyEnabled</key> <key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string> <string>NO</string>
<key>GMSApiKey</key> <key>GMSApiKey</key>

View File

@@ -10,7 +10,8 @@ class BoxName {
static const String bodyOrder = "bodyOrder"; static const String bodyOrder = "bodyOrder";
static const String gender = "gender"; static const String gender = "gender";
static const String phoneWallet = "phoneWallet"; static const String phoneWallet = "phoneWallet";
static const String IsSavedPhones = "IsSavedPhones"; static const String isSavedPhones = "IsSavedPhones";
static const String isTest = "isTest";
static const String carType = "carType"; static const String carType = "carType";
static const String carTypeOfDriver = "carTypeOfDriver"; static const String carTypeOfDriver = "carTypeOfDriver";
static const String isFirstTime = "isFirstTime"; static const String isFirstTime = "isFirstTime";

View File

@@ -1,6 +1,6 @@
class AppInformation { class AppInformation {
static const String companyName = 'SEFER LLC'; static const String companyName = 'SEFER LLC';
static const String appName = 'SEFER'; static const String appName = 'SEFER DRIVER';
static const String appVersion = 'SEFER Captain'; static const String appVersion = 'SEFER Captain';
static const String phoneNumber = '962798583052'; static const String phoneNumber = '962798583052';
static const String linkedInProfile = static const String linkedInProfile =

View File

@@ -148,6 +148,8 @@ class AppLink {
static String deleteApiKey = "$ride/apiKey/delete.php"; static String deleteApiKey = "$ride/apiKey/delete.php";
static String checkPhoneNumberISVerfiedDriver = static String checkPhoneNumberISVerfiedDriver =
"$auth/checkPhoneNumberISVerfiedDriver.php"; "$auth/checkPhoneNumberISVerfiedDriver.php";
static String getTesterApp = "$auth/Tester/getTesterApp.php";
static String updateTesterApp = "$auth/Tester/updateTesterApp.php";
//-----------------healthInsuranceProvider------------------ //-----------------healthInsuranceProvider------------------
static String addHealthInsuranceProvider = "$server/driver_assurance/add.php"; static String addHealthInsuranceProvider = "$server/driver_assurance/add.php";

View File

@@ -16,6 +16,7 @@ import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart'; import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart';
import 'package:location/location.dart'; import 'package:location/location.dart';
import '../../../constant/info.dart';
import '../../../views/auth/captin/cards/egypt_card_a_i.dart'; import '../../../views/auth/captin/cards/egypt_card_a_i.dart';
import '../../firebase/firbase_messge.dart'; import '../../firebase/firbase_messge.dart';
@@ -26,6 +27,7 @@ class LoginDriverController extends GetxController {
TextEditingController passwordController = TextEditingController(); TextEditingController passwordController = TextEditingController();
bool isAgreeTerms = false; bool isAgreeTerms = false;
bool isloading = false; bool isloading = false;
late int isTest = 1;
final FlutterSecureStorage _storage = const FlutterSecureStorage(); final FlutterSecureStorage _storage = const FlutterSecureStorage();
final location = Location(); final location = Location();
void changeAgreeTerm() { void changeAgreeTerm() {
@@ -33,6 +35,35 @@ class LoginDriverController extends GetxController {
update(); update();
} }
@override
void onInit() async {
box.read(BoxName.isTest) == null ||
box.read(BoxName.isTest).toString() == '0'
? await getAppTester()
: null;
super.onInit();
}
getAppTester() async {
var res = await CRUD().get(
link: AppLink.getTesterApp,
payload: {'appPlatform': AppInformation.appName});
if (res != 'failure') {
var d = jsonDecode(res);
isTest = d['message'][0]['isTest'];
update();
} else {
return false;
}
}
updateAppTester(String appPlatform) async {
await CRUD().post(
link: AppLink.updateTesterApp, payload: {'appPlatform': appPlatform});
}
void saveAgreementTerms() { void saveAgreementTerms() {
box.write(BoxName.agreeTerms, 'agreed'); box.write(BoxName.agreeTerms, 'agreed');
update(); update();
@@ -75,6 +106,8 @@ class LoginDriverController extends GetxController {
if (jsonDecoeded['status'] == 'success' && if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['is_verified'].toString() == '1') { jsonDecoeded['data'][0]['is_verified'].toString() == '1') {
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']); box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
box.write(BoxName.isTest, '1');
box.write(BoxName.gender, jsonDecoeded['data'][0]['gender']); box.write(BoxName.gender, jsonDecoeded['data'][0]['gender']);
box.write(BoxName.phoneVerified, box.write(BoxName.phoneVerified,
jsonDecoeded['data'][0]['is_verified'].toString()); jsonDecoeded['data'][0]['is_verified'].toString());
@@ -110,9 +143,7 @@ class LoginDriverController extends GetxController {
2002) { 2002) {
box.write(BoxName.carTypeOfDriver, 'Awfar Car'); box.write(BoxName.carTypeOfDriver, 'Awfar Car');
} }
updateAppTester(AppInformation.appName);
Log.print(
' box.write(BoxName.carTypeOfDriver: ${box.read(BoxName.carTypeOfDriver)}');
var token = await CRUD().get( var token = await CRUD().get(
link: AppLink.getDriverToken, link: AppLink.getDriverToken,

View File

@@ -178,6 +178,11 @@ class MyTranslation extends Translations {
"Enter phone": "أدخل رقم الهاتف", "Enter phone": "أدخل رقم الهاتف",
"Send Invite": "إرسال دعوة", "Send Invite": "إرسال دعوة",
"Show Invitations": "عرض الدعوات", "Show Invitations": "عرض الدعوات",
'We need access to your location to match you with nearby passengers and ensure accurate navigation.':
'نحتاج إلى الوصول إلى موقعك لمطابقتك مع الركاب القريبين وضمان التنقل الدقيق.',
'Please allow location access at all times to receive ride requests and ensure smooth service.':
'يرجى السماح بالوصول إلى الموقع في جميع الأوقات لتلقي طلبات الرحلات وضمان خدمة سلسة.',
"No invitation found yet!": "لم يتم العثور على دعوات حتى الآن!", "No invitation found yet!": "لم يتم العثور على دعوات حتى الآن!",
"Trip": "رحلة", "Trip": "رحلة",
"Your Passenger Referral Code": "رمز الإحالة الخاص بالراكب", "Your Passenger Referral Code": "رمز الإحالة الخاص بالراكب",

View File

@@ -42,15 +42,13 @@ class InviteScreen extends StatelessWidget {
), ),
child: SegmentedButton<int>( child: SegmentedButton<int>(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: backgroundColor: WidgetStateProperty.resolveWith<Color>(
MaterialStateProperty.resolveWith<Color>( (states) => states.contains(WidgetState.selected)
(states) => states.contains(MaterialState.selected)
? CupertinoColors.white ? CupertinoColors.white
: Colors.transparent, : Colors.transparent,
), ),
foregroundColor: foregroundColor: WidgetStateProperty.resolveWith<Color>(
MaterialStateProperty.resolveWith<Color>( (states) => states.contains(WidgetState.selected)
(states) => states.contains(MaterialState.selected)
? AppColor.blueColor ? AppColor.blueColor
: CupertinoColors.label, : CupertinoColors.label,
), ),
@@ -175,9 +173,9 @@ class InviteScreen extends StatelessWidget {
onPressed: () async { onPressed: () async {
await controller.pickContacts(); await controller.pickContacts();
if (controller.contacts.isNotEmpty) { if (controller.contacts.isNotEmpty) {
if (box.read(BoxName.IsSavedPhones) == null) { if (box.read(BoxName.isSavedPhones) == null) {
controller.savePhoneToServer(); controller.savePhoneToServer();
box.write(BoxName.IsSavedPhones, true); box.write(BoxName.isSavedPhones, true);
} }
_showContactsDialog(Get.context!); _showContactsDialog(Get.context!);
} }

View File

@@ -5,6 +5,7 @@ import 'package:SEFER/views/auth/captin/contact_us_page.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@@ -21,6 +22,7 @@ import '../../../controller/functions/overlay_permisssion.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../widgets/elevated_btn.dart'; import '../../widgets/elevated_btn.dart';
import '../../widgets/my_scafold.dart'; import '../../widgets/my_scafold.dart';
import '../../widgets/mycircular.dart';
import '../country_widget.dart'; import '../country_widget.dart';
class LoginCaptin extends StatelessWidget { class LoginCaptin extends StatelessWidget {
@@ -196,40 +198,202 @@ class LoginCaptin extends StatelessWidget {
width: Get.width * .3, width: Get.width * .3,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
Container( Platform.isIOS && controller.isTest == 0
decoration: AppStyle.boxDecoration1, ? Container(
height: Get.height * .3, decoration: AppStyle.boxDecoration,
width: Get.width * .8, child: Column(
child: Center( children: [
child: Text( Form(
'Sign in with Google for easier email and name entry' key: controller.formKey,
.tr, child: Padding(
textAlign: TextAlign.center, padding: const EdgeInsets.all(16.0),
style: AppStyle.title, child: SingleChildScrollView(
child: Column(
children: [
TextFormField(
keyboardType: TextInputType
.emailAddress,
controller: controller
.emailController,
decoration: InputDecoration(
focusedBorder:
OutlineInputBorder(
borderSide:
const BorderSide(
color: AppColor
.primaryColor,
width: 2.0,
),
borderRadius:
BorderRadius
.circular(10),
),
fillColor:
AppColor.accentColor,
hoverColor:
AppColor.accentColor,
focusColor:
AppColor.accentColor,
border: const OutlineInputBorder(
borderRadius:
BorderRadius.all(
Radius
.circular(
12))),
labelText: 'Email'.tr,
hintText:
'Enter your email address'
.tr,
),
validator: (value) {
if (value!.isEmpty ||
(!value.contains(
'@') ||
!value.contains(
'.'))) {
return 'Please enter Your Email.'
.tr;
}
return null;
},
),
const SizedBox(
height: 15,
),
TextFormField(
obscureText: true,
keyboardType: TextInputType
.emailAddress,
controller: controller
.passwordController,
decoration: InputDecoration(
focusedBorder:
OutlineInputBorder(
borderSide:
const BorderSide(
color: AppColor
.primaryColor,
width: 2.0,
),
borderRadius:
BorderRadius
.circular(10),
),
fillColor:
AppColor.accentColor,
hoverColor:
AppColor.accentColor,
focusColor:
AppColor.accentColor,
border: const OutlineInputBorder(
borderRadius:
BorderRadius.all(
Radius
.circular(
12))),
labelText: 'Password'.tr,
hintText:
'Please enter your phone number.'
.tr,
),
validator: (value) {
if (value!.isEmpty) {
return 'Please enter Your Password.'
.tr;
}
if (value.length < 6) {
return 'Password must br at least 6 character.'
.tr;
}
return null;
},
),
GetBuilder<
LoginDriverController>(
builder: (controller) =>
controller.isloading
? const MyCircularProgressIndicator()
: MyElevatedButton(
onPressed:
() async {
if (controller
.formKey
.currentState!
.validate()) {
await Get.find<
LoginDriverController>()
.loginUsingCredentials(
controller
.passwordController
.text,
controller
.emailController
.text,
);
}
},
title:
'Submit'.tr,
),
)
],
),
),
),
),
const SizedBox(
height: 10,
),
],
),
)
: Container(
decoration: AppStyle.boxDecoration1,
height: Get.height * .3,
width: Get.width * .8,
child: Center(
child: Text(
'Sign in with Google for easier email and name entry'
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
),
),
),
GestureDetector(
onTap: () async {
await GoogleSignInHelper().signInFromLogin();
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 10),
decoration: BoxDecoration(
color: AppColor.redColor,
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
FontAwesome.google,
color: AppColor.blueColor,
),
const SizedBox(width: 8),
Text(
'Sign In by Google'.tr,
style: const TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
],
), ),
), ),
), ),
MyElevatedButton(
title: 'Sign In by Google'.tr,
onPressed: () async {
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 !Platform.isAndroid
? MyElevatedButton( ? GestureDetector(
title: 'Sign In by Apple'.tr, onTap: () async {
onPressed: () async {
User? user = await authController User? user = await authController
.signInWithApple(); .signInWithApple();
if (user != null) { if (user != null) {
@@ -246,19 +410,38 @@ class LoginCaptin extends StatelessWidget {
// Navigate to another screen or perform other actions // Navigate to another screen or perform other actions
} else {} } else {}
}, },
kolor: AppColor.primaryColor, child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 10),
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.apple,
color: Colors.white,
size: 24,
),
const SizedBox(width: 8),
Text(
'Sign in with Apple'.tr,
style: const TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
],
),
),
) )
: const SizedBox(), : const SizedBox(),
// MyElevatedButton(
// title: 'Sign In by Google'.tr,
// onPressed: () async {
// },
// kolor: AppColor.redColor,
// ),
], ],
), ),
))), ))),
GestureDetector( GestureDetector(
onTap: () => Get.to(() => ContactUsPage()), onTap: () => Get.to(() => ContactUsPage()),
child: Text( child: Text(
@@ -267,40 +450,6 @@ class LoginCaptin extends StatelessWidget {
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
), ),
// AnimatedTextKit(
// onTap: () => Get.to(() => const RegisterCaptin()),
// animatedTexts: [
// TypewriterAnimatedText(
// 'Register as Driver'.tr,
// textStyle: AppStyle.headTitle2,
// speed: const Duration(milliseconds: 200),
// ),
// ],
// totalRepeatCount: 4,
// pause: const Duration(milliseconds: 200),
// displayFullTextOnTap: true,
// stopPauseOnTap: true,
// ),
// // IconButton(
// onPressed: () async {
// AC credentials = AC();
// String apiKey = AK.payMobApikey;
// String convertedStringN = credentials.c(
// credentials.c(credentials.c(apiKey, cs), cC), cn);
//
// String retrievedStringS = credentials.r(
// credentials.r(
// credentials.r(convertedStringN, cn), cC),
// cs);
// //
// if (retrievedStringS == apiKey) {
// }
// },
// icon: const Icon(
// Icons.close,
// color: AppColor.blueColor,
// ),
// ),
], ],
), ),
) )
@@ -414,13 +563,13 @@ class LoginCaptin extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Text( Text(
'We use location to get accurate and nearest passengers for you' 'We need access to your location to match you with nearby passengers and ensure accurate navigation.'
.tr, .tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: AppStyle.title, style: AppStyle.title,
), ),
Text( Text(
'You will choose allow all the time to be ready receive orders' 'Please allow location access at all times to receive ride requests and ensure smooth service.'
.tr, .tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: AppStyle.title.copyWith(color: AppColor.greenColor), style: AppStyle.title.copyWith(color: AppColor.greenColor),
@@ -428,22 +577,31 @@ class LoginCaptin extends StatelessWidget {
MyElevatedButton( MyElevatedButton(
title: "Allow Location Access".tr, title: "Allow Location Access".tr,
onPressed: () async { onPressed: () async {
// await Get.put(LocationBackgroundController()); ////// // Request location permissions
PermissionStatus status = PermissionStatus status =
await Permission.location.status; await Permission.location.status;
if (!status.isGranted) { if (!status.isGranted) {
// WidgetsBinding.instance.addPostFrameCallback((_) { getLocationPermission(); // Function to request permission
// getPermissionLocation();
// getPermissionLocation();
getLocationPermission();
// });
return; return;
} }
// Save permission status to local storage
box.write(BoxName.locationPermission, 'true'); box.write(BoxName.locationPermission, 'true');
controller.update(); controller.update();
}, },
kolor: AppColor.greenColor, kolor: AppColor.greenColor,
) ),
TextButton(
onPressed: () {
// Optionally, navigate to app settings for manual permission control
openAppSettings();
},
child: Text(
"Open Settings".tr,
style: const TextStyle(color: AppColor.blueColor),
),
),
], ],
), ),
), ),