From effe13307c41368d53cdda0c01d789f423d5ff18 Mon Sep 17 00:00:00 2001 From: Abdulrahman Bashir <52699770+abdul-alaa@users.noreply.github.com> Date: Sat, 20 Jun 2026 01:35:48 +0400 Subject: [PATCH 2/3] Migrate testing_app to UIScene lifecycle (#2836) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary [![talabat.com contributions](https://img.shields.io/badge/talabat.com-contributions-FF5A00?style=flat&logo=flutter&logoColor=white)](https://www.talabat.com) [![Talabat Flutter PRs](https://img.shields.io/badge/Talabat_Flutter_PRs-26%20merged-97ca00?style=flat&logo=flutter&logoColor=white)](https://github.com/search?q=org%3Aflutter+talabat&type=pullrequests) - Migrate `testing_app` iOS project to the UIScene lifecycle as per the [migration guide](https://docs.flutter.dev/release/breaking-changes/uiscenedelegate) - Update `AppDelegate.swift` to use `@main`, `FlutterImplicitEngineDelegate`, and move plugin registration to `didInitializeImplicitFlutterEngine` - Add `UIApplicationSceneManifest` to `Info.plist` Part of flutter/flutter#176957 ## Test plan - [x] Ran `testing_app` on iOS simulator — app launches and works correctly --------- Co-authored-by: Eric Windmill --- compass_app/app/lib/routing/router.dart | 3 +- .../lib/pedometer_bindings_generated.dart | 4 +-- pubspec.yaml | 4 +-- testing_app/ios/Runner/AppDelegate.swift | 11 ++++--- testing_app/ios/Runner/Info.plist | 29 ++++++++++++++++--- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/compass_app/app/lib/routing/router.dart b/compass_app/app/lib/routing/router.dart index 05cad62b0..284706850 100644 --- a/compass_app/app/lib/routing/router.dart +++ b/compass_app/app/lib/routing/router.dart @@ -14,7 +14,8 @@ import '../ui/auth/login/widgets/login_screen.dart'; import '../ui/auth/logout/view_models/logout_viewmodel.dart'; import '../ui/booking/view_models/booking_viewmodel.dart'; import '../ui/booking/widgets/booking_screen.dart'; -import '../ui/home/widgets/home_screen_container.dart'; +import '../ui/home/view_models/home_viewmodel.dart'; +import '../ui/home/widgets/home_screen.dart'; import '../ui/results/view_models/results_viewmodel.dart'; import '../ui/results/widgets/results_screen.dart'; import '../ui/search_form/view_models/search_form_viewmodel.dart'; diff --git a/pedometer/lib/pedometer_bindings_generated.dart b/pedometer/lib/pedometer_bindings_generated.dart index eb567657b..91c38f28a 100644 --- a/pedometer/lib/pedometer_bindings_generated.dart +++ b/pedometer/lib/pedometer_bindings_generated.dart @@ -45993,9 +45993,7 @@ class ObjCBlock_ffiVoid_ObjCObject_ffiUnsignedLong_bool extends _ObjCBlockBase { ffi.UnsignedLong, ffi.Pointer, ) - >( - _ObjCBlock_ffiVoid_ObjCObject_ffiUnsignedLong_bool_closureTrampoline, - ) + >(_ObjCBlock_ffiVoid_ObjCObject_ffiUnsignedLong_bool_closureTrampoline) .cast(), _ObjCBlock_ffiVoid_ObjCObject_ffiUnsignedLong_bool_registerClosure( ( diff --git a/pubspec.yaml b/pubspec.yaml index a4a3adbf4..813d5cac6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,8 +50,8 @@ skip_ci: - add_to_app/multiple_flutters/multiple_flutters_module - add_to_app/plugin/flutter_module_using_plugin - add_to_app/prebuilt_module/flutter_module - # remove after 3.44 release - cupertino_gallery skip_ci_beta: - - material_3_demo + # - sample_name_to_skip + diff --git a/testing_app/ios/Runner/AppDelegate.swift b/testing_app/ios/Runner/AppDelegate.swift index 70693e4a8..c30b367ec 100644 --- a/testing_app/ios/Runner/AppDelegate.swift +++ b/testing_app/ios/Runner/AppDelegate.swift @@ -1,13 +1,16 @@ -import UIKit import Flutter +import UIKit -@UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { +@main +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } } diff --git a/testing_app/ios/Runner/Info.plist b/testing_app/ios/Runner/Info.plist index 0f22db4b2..434734531 100644 --- a/testing_app/ios/Runner/Info.plist +++ b/testing_app/ios/Runner/Info.plist @@ -2,6 +2,8 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -24,6 +26,29 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneConfigurationName + flutter + UISceneDelegateClassName + FlutterSceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -43,9 +68,5 @@ UIViewControllerBasedStatusBarAppearance - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - From 659acd06908b386b56eb6576c43d23298e26328c Mon Sep 17 00:00:00 2001 From: Harsh Yadav Date: Sat, 20 Jun 2026 03:13:13 +0530 Subject: [PATCH 3/3] refactor: remove redundant notifyListeners in HomeViewModel deleteBooking (#2839) Removes redundant notifyListeners() call from _deleteBooking(). The method is executed through Command, which already manages its own notifyListeners lifecycle. This change ensures that HomeViewModel only notifies listeners when its internal state (_bookings) changes, avoiding unnecessary updates. Fixes https://github.com/flutter/samples/issues/2746 ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] recently, and have followed its advice. - [x] I signed the [CLA]. - [ ] I have added sample code updates to the [changelog]. - [ ] I updated/added relevant documentation (doc comments with `///`). [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [changelog]: ./CHANGELOG.md Co-authored-by: Eric Windmill --- .../ui/home/view_models/home_viewmodel.dart | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/compass_app/app/lib/ui/home/view_models/home_viewmodel.dart b/compass_app/app/lib/ui/home/view_models/home_viewmodel.dart index df4a2e479..fba990528 100644 --- a/compass_app/app/lib/ui/home/view_models/home_viewmodel.dart +++ b/compass_app/app/lib/ui/home/view_models/home_viewmodel.dart @@ -65,31 +65,27 @@ class HomeViewModel extends ChangeNotifier { } Future> _deleteBooking(int id) async { - try { - final resultDelete = await _bookingRepository.delete(id); - switch (resultDelete) { - case Ok(): - _log.fine('Deleted booking $id'); - case Error(): - _log.warning('Failed to delete booking $id', resultDelete.error); - return resultDelete; - } - - // After deleting the booking, we need to reload the bookings list. - // BookingRepository is the source of truth for bookings. - final resultLoadBookings = await _bookingRepository.getBookingsList(); - switch (resultLoadBookings) { - case Ok>(): - _bookings = resultLoadBookings.value; - _log.fine('Loaded bookings'); - case Error>(): - _log.warning('Failed to load bookings', resultLoadBookings.error); - return resultLoadBookings; - } + final resultDelete = await _bookingRepository.delete(id); + switch (resultDelete) { + case Ok(): + _log.fine('Deleted booking $id'); + case Error(): + _log.warning('Failed to delete booking $id', resultDelete.error); + return resultDelete; + } - return resultLoadBookings; - } finally { - notifyListeners(); + // After deleting the booking, reload the bookings list. + final resultLoadBookings = await _bookingRepository.getBookingsList(); + switch (resultLoadBookings) { + case Ok>(): + _bookings = resultLoadBookings.value; + _log.fine('Loaded bookings'); + notifyListeners(); // notify only when data changes + case Error>(): + _log.warning('Failed to load bookings', resultLoadBookings.error); + return resultLoadBookings; } + + return resultLoadBookings; } }