7/16/1
This commit is contained in:
@@ -1431,7 +1431,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
var res = await CRUD().getTokenParent(
|
||||
link: AppLink.getTokenParent,
|
||||
payload: {'phone': '+2' + box.read(BoxName.sosPhonePassenger)});
|
||||
payload: {'phone': '+2${box.read(BoxName.sosPhonePassenger)}'});
|
||||
|
||||
// Check if `res` is already a map
|
||||
if (res is Map<String, dynamic>) {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/views/auth/login_page.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:uni_links/uni_links.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
@@ -29,10 +31,52 @@ class SplashScreenController extends GetxController
|
||||
update();
|
||||
}
|
||||
|
||||
StreamSubscription? _sub;
|
||||
Future<void> initUniLinks() async {
|
||||
// Handle initial URI if the app was launched from a link
|
||||
try {
|
||||
final initialUri = await getInitialUri();
|
||||
if (initialUri != null) {
|
||||
handleLink(initialUri);
|
||||
}
|
||||
} on PlatformException {
|
||||
// Handle exception by warning the user their action did not succeed
|
||||
print("Failed to get initial uri");
|
||||
}
|
||||
|
||||
// Listen to new links while the app is running
|
||||
_sub = uriLinkStream.listen((Uri? uri) {
|
||||
if (uri != null) {
|
||||
handleLink(uri);
|
||||
}
|
||||
}, onError: (Object err) {
|
||||
print('Error occurred: $err');
|
||||
});
|
||||
}
|
||||
|
||||
void handleLink(Uri uri) {
|
||||
if (uri.host == 'sefer.live' && uri.path == '/tripmonitor') {
|
||||
final rideId = uri.queryParameters['rideId'];
|
||||
final driverId = uri.queryParameters['driverId'];
|
||||
|
||||
if (rideId != null && driverId != null) {
|
||||
Get.toNamed('/tripmonitor', parameters: {
|
||||
'rideId': rideId,
|
||||
'driverId': driverId,
|
||||
});
|
||||
} else {
|
||||
// Handle the case where rideId or driverId is null
|
||||
print('Invalid parameters in the deep link');
|
||||
// You might want to show an error message to the user or handle this case differently
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
checkForUpdate();
|
||||
initUniLinks();
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(seconds: 4),
|
||||
|
||||
@@ -51,11 +51,18 @@ class TripMonitorController extends GetxController {
|
||||
});
|
||||
}
|
||||
|
||||
init() async {
|
||||
final arguments = Get.arguments;
|
||||
driverId = arguments['driverId'];
|
||||
rideId = arguments['rideId'];
|
||||
// init() async {
|
||||
// final arguments = Get.arguments;
|
||||
// driverId = arguments['driverId'];
|
||||
// rideId = arguments['rideId'];
|
||||
// await getLocationParent();
|
||||
// }
|
||||
|
||||
Future<void> init({String? rideId, String? driverId}) async {
|
||||
this.driverId = driverId!;
|
||||
this.rideId = rideId!;
|
||||
await getLocationParent();
|
||||
update();
|
||||
}
|
||||
|
||||
void addCustomCarIcon() {
|
||||
|
||||
Reference in New Issue
Block a user