Update: 2026-06-12 01:23:54

This commit is contained in:
Hamza-Ayed
2026-06-12 01:23:54 +03:00
parent 7049c7468c
commit ef6b52d2e3
47 changed files with 1480 additions and 1472 deletions

View File

@@ -3,54 +3,108 @@ import 'package:siro_rider/main.dart';
class AppLink {
static const String appDomain = 'siromove.com';
///https://walletintaleq.intaleq.xyz/v1/main
static String get paymentServer => 'https://walletintaleq.intaleq.xyz/v2/main';
///https://api.intaleq.xyz/siro/ride/location
static String get location => 'https://api.intaleq.xyz/siro_v3/ride/location';
/// هذا الرابط خاص برحلات الركاب، ويستخدمه السيرفر الجانبي للرحلات (Ride Server Side) للتعامل مع عمليات إلغاء الرحلات وتحديث حالة الرحلات وغيرها من العمليات المتعلقة بالرحلات.
/// https://routesy.intaleq.xyz for syria
/// for jordan https://routesjo.intaleq.xyz
static String get routesOsm => 'https://routesy.intaleq.xyz';
static String get mapSaasRoute => 'https://map-saas.intaleqapp.com/api/maps/route';
static String get reverseGeocoding =>
'https://map-saas.intaleqapp.com/api/geocoding/reverse';
static String get searchGeocoding =>
'https://map-saas.intaleqapp.com/api/geocoding/search';
static String get mapSaasPlaces =>
'https://map-saas.intaleqapp.com/api/geocoding/places';
///https://location.intaleq.xyz/siro/ride/location
///locationServerSide هو السيرفر الجانبي الخاص بموقع السائقين، حيث يتم إرسال تحديثات الموقع من التطبيق إلى هذا السيرفر، ومن ثم يقوم هذا السيرفر بتوزيع هذه التحديثات إلى الركاب المتصلين الذين يتابعون السائق في الوقت الحقيقي.
static String get locationServerSide =>
'https://location.intaleq.xyz/siro/ride/location';
static String get currentCountry => box.read(BoxName.countryCode) ?? 'Jordan';
///https://api.intaleq.xyz/siro
static String get endPoint => server;
/// هذا الرابط خاص برحلات الركاب، ويستخدمه السيرفر الجانبي للرحلات (Ride Server Side) للتعامل مع عمليات إلغاء الرحلات وتحديث حالة الرحلات وغيرها من العمليات المتعلقة بالرحلات.
/// https://rides.intaleq.xyz/siro
static String get rideServerSide => 'https://rides.intaleq.xyz/siro';
/// main api link for all api calls except rides and location
static String get server {
static String get paymentServer {
switch (currentCountry) {
case 'Syria':
return 'https://api-syria.siromove.com/siro_v3';
case 'Egypt':
return 'https://api-egypt.siromove.com/siro_v3';
case 'Jordan':
default:
return 'https://api-jordan.siromove.com/siro_v3';
case 'Syria': return 'https://wallet-syria.siromove.com/v1/main';
case 'Egypt': return 'https://wallet-egypt.siromove.com/v1/main';
case 'Jordan': return 'https://wallet-jordan.siromove.com/v1/main';
default: return 'https://wallet.siromove.com/v1/main';
}
}
///https://rides.intaleq.xyz
/// هذا الرابط خاص برحلات الركاب، ويستخدمه السيرفر الجانبي للرحلات (Ride Server Side) للتعامل مع عمليات إلغاء الرحلات وتحديث حالة الرحلات وغيرها من العمليات المتعلقة بالرحلات.
static String get serverSocket => 'https://rides.intaleq.xyz';
static String get location {
switch (currentCountry) {
case 'Syria': return 'https://api-syria.siromove.com/siro_v3/ride/location';
case 'Egypt': return 'https://api-egypt.siromove.com/siro_v3/ride/location';
case 'Jordan': return 'https://api-jordan.siromove.com/siro_v3/ride/location';
default: return 'https://api.siromove.com/siro_v3/ride/location';
}
}
static String get locationServerSide {
switch (currentCountry) {
case 'Syria': return 'https://location-syria.siromove.com/siro/ride/location';
case 'Egypt': return 'https://location-egypt.siromove.com/siro/ride/location';
case 'Jordan': return 'https://location-jordan.siromove.com/siro/ride/location';
default: return 'https://location.siromove.com/siro/ride/location';
}
}
static String get routesOsm {
switch (currentCountry) {
case 'Syria': return 'https://routes-syria.siromove.com';
case 'Egypt': return 'https://routes-egypt.siromove.com';
case 'Jordan': return 'https://routes-jordan.siromove.com';
default: return 'https://routes.siromove.com';
}
}
static String get mapSaasRoute {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/maps/route';
case 'Egypt': return 'https://map-egypt.siromove.com/api/maps/route';
case 'Jordan': return 'https://map-jordan.siromove.com/api/maps/route';
default: return 'https://map-saas.intaleqapp.com/api/maps/route';
}
}
static String get reverseGeocoding {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/reverse';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/reverse';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/reverse';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/reverse';
}
}
static String get searchGeocoding {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/search';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/search';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/search';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/search';
}
}
static String get mapSaasPlaces {
switch (currentCountry) {
case 'Syria': return 'https://map-syria.siromove.com/api/geocoding/places';
case 'Egypt': return 'https://map-egypt.siromove.com/api/geocoding/places';
case 'Jordan': return 'https://map-jordan.siromove.com/api/geocoding/places';
default: return 'https://map-saas.intaleqapp.com/api/geocoding/places';
}
}
static String get endPoint => server;
static String get rideServerSide {
switch (currentCountry) {
case 'Syria': return 'https://api-syria.siromove.com/siro';
case 'Egypt': return 'https://api-egypt.siromove.com/siro';
case 'Jordan': return 'https://api-jordan.siromove.com/siro';
default: return 'https://api.siromove.com/siro';
}
}
static String get server {
switch (currentCountry) {
case 'Syria': return 'https://api-syria.siromove.com/siro_v3';
case 'Egypt': return 'https://api-egypt.siromove.com/siro_v3';
case 'Jordan': return 'https://api-jordan.siromove.com/siro_v3';
default: return 'https://api.siromove.com/siro_v3';
}
}
static String get serverSocket {
switch (currentCountry) {
case 'Syria': return 'https://api-syria.siromove.com';
case 'Egypt': return 'https://api-egypt.siromove.com';
case 'Jordan': return 'https://api-jordan.siromove.com';
default: return 'https://api.siromove.com';
}
}
///
static String get googleMapsLink => 'https://maps.googleapis.com/maps/api/';

View File

@@ -1,149 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../constant/box_name.dart';
import '../../constant/links.dart';
import '../../main.dart';
import '../../print.dart';
import '../functions/crud.dart';
import '../../onbording_page.dart';
import 'login_controller.dart';
class GoogleSignInHelper {
// ✅ GoogleSignIn singleton
static final GoogleSignIn _signIn = GoogleSignIn.instance;
static GoogleSignInAccount? _lastUser;
/// 👇 استدعها في main() مرة واحدة
static Future<void> init() async {
await _signIn.initialize(
serverClientId:
'594687661098-2u640akrb3k7sak5t0nqki6f4v6hq1bq.apps.googleusercontent.com',
);
// Events listener
_signIn.authenticationEvents.listen((event) async {
if (event is GoogleSignInAuthenticationEventSignIn) {
_lastUser = event.user;
await _handleSignUp(event.user);
} else if (event is GoogleSignInAuthenticationEventSignOut) {
_lastUser = null;
}
});
// silent login if possible
try {
await _signIn.attemptLightweightAuthentication();
} catch (e) {
Log.print("Error: $e");
}
}
/// ✅ تسجيل دخول عادي
static Future<GoogleSignInAccount?> signIn() async {
try {
final user =
await _signIn.authenticate(scopeHint: const ['email', 'profile']);
_lastUser = user;
await _handleSignUp(user);
// اطبع القيم (للتأكد)
Log.print("Google ID: ${user.id}");
Log.print("Email: ${user.email}");
Log.print("Name: ${user.displayName}");
Log.print("Photo: ${user.photoUrl}");
return user;
} on PlatformException catch (e) {
if (e.code == 'sign_in_required') {
await showGooglePlayServicesError();
}
return null;
} catch (e) {
await addError("Google Sign-In error: $e", "signIn()");
return null;
}
}
/// ✅ تسجيل دخول مخصص لشاشة Login (مع استدعاء الكنترولر)
static Future<GoogleSignInAccount?> signInFromLogin() async {
await init();
final user = await signIn();
if (user != null) {
await Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(),
box.read(BoxName.email).toString(),
);
}
return user;
}
/// ✅ طلب سكوبات إضافية (بديل withScopes القديم)
static Future<void> requestExtraScopes(List<String> scopes) async {
final user = _lastUser;
if (user == null) return;
await user.authorizationClient.authorizeScopes(scopes);
}
/// ✅ تسجيل خروج
static Future<void> signOut() async {
await _signIn.signOut();
await _handleSignOut();
}
static GoogleSignInAccount? getCurrentUser() => _lastUser;
// ================= Helpers ==================
static Future<void> _handleSignUp(GoogleSignInAccount user) async {
box.write(BoxName.passengerID, user.id);
box.write(BoxName.email, user.email);
box.write(BoxName.name, user.displayName ?? '');
box.write(BoxName.passengerPhotoUrl, user.photoUrl ?? '');
}
static Future<void> _handleSignOut() async {
box.erase();
Get.offAll(OnBoardingPage());
}
static Future<void> addError(String error, String where) async {
await CRUD().post(link: AppLink.addError, payload: {
'error': error,
'userId': box.read(BoxName.driverID) ?? box.read(BoxName.passengerID),
'userType': box.read(BoxName.driverID) != null ? 'Driver' : 'Passenger',
'phone': box.read(BoxName.phone) ?? box.read(BoxName.phoneDriver),
'device': where,
});
}
static Future<void> showGooglePlayServicesError() async {
const playStoreUrl =
'https://play.google.com/store/apps/details?id=com.google.android.gms&hl=en_US';
final uri = Uri.parse(playStoreUrl);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
} else {
showDialog(
context: Get.context!,
builder: (context) => AlertDialog(
title: Text('Error'.tr),
content: Text(
'Could not open the Google Play Store. Please update Google Play Services manually.'
.tr,
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text('Close'.tr),
),
],
),
);
}
}
}

View File

@@ -1,50 +1,50 @@
import 'dart:convert';
import 'package:googleapis_auth/auth_io.dart';
// import 'dart:convert';
// import 'package:googleapis_auth/auth_io.dart';
class AccessTokenManager {
static final AccessTokenManager _instance = AccessTokenManager._internal();
late final String serviceAccountJsonKey;
AccessToken? _accessToken;
DateTime? _expiryDate;
// class AccessTokenManager {
// static final AccessTokenManager _instance = AccessTokenManager._internal();
// late final String serviceAccountJsonKey;
// AccessToken? _accessToken;
// DateTime? _expiryDate;
AccessTokenManager._internal();
// AccessTokenManager._internal();
factory AccessTokenManager(String jsonKey) {
if (_instance._isServiceAccountKeyInitialized()) {
// Prevent re-initialization
return _instance;
}
_instance.serviceAccountJsonKey = jsonKey;
return _instance;
}
// factory AccessTokenManager(String jsonKey) {
// if (_instance._isServiceAccountKeyInitialized()) {
// // Prevent re-initialization
// return _instance;
// }
// _instance.serviceAccountJsonKey = jsonKey;
// return _instance;
// }
bool _isServiceAccountKeyInitialized() {
try {
serviceAccountJsonKey; // Access to check if initialized
return true;
} catch (e) {
return false;
}
}
// bool _isServiceAccountKeyInitialized() {
// try {
// serviceAccountJsonKey; // Access to check if initialized
// return true;
// } catch (e) {
// return false;
// }
// }
Future<String> getAccessToken() async {
if (_accessToken != null && DateTime.now().isBefore(_expiryDate!)) {
return _accessToken!.data;
}
try {
final serviceAccountCredentials = ServiceAccountCredentials.fromJson(
json.decode(serviceAccountJsonKey));
final client = await clientViaServiceAccount(
serviceAccountCredentials,
['https://www.googleapis.com/auth/firebase.messaging'],
);
// Future<String> getAccessToken() async {
// if (_accessToken != null && DateTime.now().isBefore(_expiryDate!)) {
// return _accessToken!.data;
// }
// try {
// final serviceAccountCredentials = ServiceAccountCredentials.fromJson(
// json.decode(serviceAccountJsonKey));
// final client = await clientViaServiceAccount(
// serviceAccountCredentials,
// ['https://www.googleapis.com/auth/firebase.messaging'],
// );
_accessToken = client.credentials.accessToken;
_expiryDate = client.credentials.accessToken.expiry;
client.close();
return _accessToken!.data;
} catch (e) {
throw Exception('Failed to obtain access token');
}
}
}
// _accessToken = client.credentials.accessToken;
// _expiryDate = client.credentials.accessToken.expiry;
// client.close();
// return _accessToken!.data;
// } catch (e) {
// throw Exception('Failed to obtain access token');
// }
// }
// }

View File

@@ -15,7 +15,6 @@ import '../../print.dart';
import '../../views/Rate/rate_captain.dart';
import '../../views/home/map_page_passenger.dart';
import '../../views/home/profile/promos_passenger_page.dart';
import '../auth/google_sign.dart';
import 'package:siro_rider/controller/voice_call_controller.dart';
import '../home/map/ride_lifecycle_controller.dart';
import '../home/map/ride_state.dart';
@@ -159,7 +158,7 @@ class FirebaseMessagesController extends GetxController {
if (Platform.isAndroid) {
notificationController.showNotification(title, body, 'cancel');
}
GoogleSignInHelper.signOut();
box.remove(BoxName.jwt);
} else if (category == 'Driver Is Going To Passenger') {
// <-- كان 'Driver Is Going To Passenger'
Get.find<RideLifecycleController>().isDriverInPassengerWay = true;
@@ -253,9 +252,7 @@ class FirebaseMessagesController extends GetxController {
rideIdVal: rideId.toString(),
);
}
}
else if (category == 'Order Applied') {
} else if (category == 'Order Applied') {
if (Platform.isAndroid) {
notificationController.showNotification(
'The order Accepted by another Driver'.tr,
@@ -317,7 +314,7 @@ class FirebaseMessagesController extends GetxController {
// notificationController.showNotification(
// 'token change'.tr, 'token change'.tr, 'cancel');
// }
// GoogleSignInHelper.signOut();
// // GoogleSignInHelper.signOut();
// } else if (message.notification!.title! == 'Driver Is Going To Passenger') {
// Get.find<RideLifecycleController>().isDriverInPassengerWay = true;
// Get.find<RideLifecycleController>().update();

View File

@@ -1,12 +1,12 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:get/get.dart';
import '../../constant/links.dart';
import '../../print.dart'; // للترجمة .tr
class NotificationService {
static const String _serverUrl =
'https://api.intaleq.xyz/siro/ride/firebase/send_fcm.php';
static String get _serverUrl => '${AppLink.server}/ride/firebase/send_fcm.php';
static Future<void> sendNotification({
required String target,

View File

@@ -19,7 +19,6 @@ import flutter_secure_storage_darwin
import flutter_tts
import flutter_webrtc
import geolocator_apple
import google_sign_in_ios
import just_audio
import local_auth_darwin
import location
@@ -49,7 +48,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))

View File

@@ -885,14 +885,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.3"
google_cloud:
dependency: transitive
description:
name: google_cloud
sha256: b385e20726ef5315d302c5933bfb728103116c5be2d3d17094b01a82da538c1f
url: "https://pub.dev"
source: hosted
version: "0.5.0"
google_fonts:
dependency: "direct main"
description:
@@ -901,62 +893,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.1.0"
google_identity_services_web:
dependency: transitive
description:
name: google_identity_services_web
sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454"
url: "https://pub.dev"
source: hosted
version: "0.3.3+1"
google_sign_in:
dependency: "direct main"
description:
name: google_sign_in
sha256: "521031b65853b4409b8213c0387d57edaad7e2a949ce6dea0d8b2afc9cb29763"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
google_sign_in_android:
dependency: transitive
description:
name: google_sign_in_android
sha256: df5c15533814ed20b7d9e1c5a40a73f174e5d5017bd2669b1c72fb6596fde812
url: "https://pub.dev"
source: hosted
version: "7.2.11"
google_sign_in_ios:
dependency: transitive
description:
name: google_sign_in_ios
sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950
url: "https://pub.dev"
source: hosted
version: "6.3.0"
google_sign_in_platform_interface:
dependency: transitive
description:
name: google_sign_in_platform_interface
sha256: "7f59208c42b415a3cca203571128d6f84f885fead2d5b53eb65a9e27f2965bb5"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
google_sign_in_web:
dependency: transitive
description:
name: google_sign_in_web
sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14
url: "https://pub.dev"
source: hosted
version: "1.1.3"
googleapis_auth:
dependency: "direct main"
description:
name: googleapis_auth
sha256: "2a8895c3885197f96bb2fd91ee0ae77b53ff3874c7b1f1eadb6566248e880958"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
graphs:
dependency: transitive
description:

View File

@@ -59,12 +59,10 @@ dependencies:
webview_flutter_wkwebview: ^3.14.0
just_audio: ^0.10.5
# share: ^2.0.4
google_sign_in: ^7.2.0
sign_in_with_apple: ^7.0.1
firebase_auth: ^6.1.4
device_info_plus: ^12.1.0
# uni_links: ^0.5.1
googleapis_auth: ^2.0.0
flutter_confetti: ^0.5.1
# intl_phone_field: ^3.1.0
flutter_contacts: ^1.1.9+2