Bug Fixes

faiz_development
FaizHashmi 3 weeks ago
parent f444c55232
commit 60a7af735a

@ -39,7 +39,7 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
@ -90,5 +90,16 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<!-- Disable Flutter's built-in auto-deep-link route push: without this, FlutterActivity
forwards the raw VIEW intent URI (e.g. "mowatercustomer://ad/1541") straight to the
Navigator as a route name on cold start, before AdDeepLinkService ever runs. Since
that string isn't a registered route, it collides with the app's own bootstrap
navigation (splash to login flow), confirmed on a real device: this caused an
"_elements.contains(element)" crash in debug and a silent black screen hang in
release. app_links + AdDeepLinkService already handle every deep link deliberately,
so the native auto-forwarding must stay off. -->
<meta-data
android:name="flutter_deeplinking_enabled"
android:value="false" />
</application>
</manifest>

@ -10,6 +10,7 @@ import 'package:mc_common_app/repositories/request_repo.dart';
import 'package:mc_common_app/repositories/setting_options_repo.dart';
import 'package:mc_common_app/services/ad_deep_link_service.dart';
import 'package:mc_common_app/services/firebase_service.dart';
import 'package:mc_common_app/views/splash/splash_page.dart';
import 'package:mc_common_app/utils/location/Location.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:mc_common_app/view_models/chat_view_model.dart';
@ -177,11 +178,45 @@ class _MyAppState extends State<MyApp> {
locale: context.locale,
initialRoute: AppRoutes.initialRoute,
routes: CustomerAppRoutes.routes,
navigatorObservers: [AdDeepLinkService.routeObserver],
// Confirmed on a real device, two different unknown-route cases land here:
// 1) Cold-start restoration can try to regenerate a bare "/" instead of
// respecting initialRoute -- uncaught, that's a "Could not find a generator
// for route" crash before AdDeepLinkService ever runs. Splash is a real,
// correct landing page for this one.
// 2) On an ALREADY-RUNNING app, Android's Flutter embedding auto-forwards the
// incoming deep-link intent's path as its own route push (e.g. "/1541" from
// mowatercustomer://ad/1541) independently of app_links/AdDeepLinkService,
// which already handles that same uri correctly. Since "/1541" isn't a real
// route, it used to fall into case 1 and push Splash right over whatever
// screen (e.g. the dashboard) was already showing -- looking exactly like the
// app had restarted. Anything other than bare "/" must be a no-op here: push
// something inert that removes itself immediately instead of a real page.
onUnknownRoute: (settings) {
if (settings.name == '/') {
return MaterialPageRoute(builder: (_) => const SplashPage());
}
// Remove THIS specific route once inserted, not just "whatever is on top" --
// AdDeepLinkService's own (legitimate) push can land after this one, and a
// plain Navigator.pop() would close that instead of this inert placeholder.
late final PageRoute<void> route;
route = PageRouteBuilder<void>(
settings: const RouteSettings(name: AdDeepLinkService.ignoredPlaceholderRouteName),
opaque: false,
transitionDuration: Duration.zero,
reverseTransitionDuration: Duration.zero,
pageBuilder: (context, __, ___) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (route.isActive) route.navigator?.removeRoute(route);
});
return const SizedBox.shrink();
},
);
return route;
},
),
);
},
);
}
}

@ -36,10 +36,10 @@ dependencies:
cupertino_icons: ^1.0.2
mc_common_app:
# path: /Users/faiz-hashmi/StudioProjects/mowater_apps/car_common_app
# path: /Volumes/Data/Projects/Flutter_Projects/mowater_apps/car_common_app
# path: /Users/faizhashmi/Development/Projects/MyProjects/CloudSolutions/car_common_app
path: ../car_common_app
# path: /Users/faiz-hashmi/StudioProjects/mowater_apps/car_common_app
# path: /Volumes/Data/Projects/Flutter_Projects/mowater_apps/car_common_app
# path: /Users/faizhashmi/Development/Projects/MyProjects/CloudSolutions/car_common_app
path: ../car_common_app

Loading…
Cancel
Save