From 9821ebbaba5388d9c59269449ad3ff34e790c9ed Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 19 Sep 2023 11:34:51 -0700 Subject: [PATCH 1/2] make parent view controller hide status bar --- .../ios/Scenarios/Scenarios/AppDelegate.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m b/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m index d938a895373d0..f701f720fb1ff 100644 --- a/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m +++ b/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m @@ -9,6 +9,18 @@ #import "ScreenBeforeFlutter.h" #import "TextPlatformView.h" +// A UIViewController that sets YES for its preferedStatusBarHidden property. +@interface NoStatusBarViewController : UIViewController + +@end + +@implementation NoStatusBarViewController +- (BOOL)prefersStatusBarHidden { + return YES; +} +@end + +// The FlutterViewController version of NoStatusBarViewController @interface NoStatusBarFlutterViewController : FlutterViewController @end @@ -166,7 +178,7 @@ - (void)setupFlutterViewControllerTest:(NSString*)scenarioIdentifier { UIViewController* rootViewController = flutterViewController; // Make Flutter View's origin x/y not 0. if ([scenarioIdentifier isEqualToString:@"non_full_screen_flutter_view_platform_view"]) { - rootViewController = [UIViewController new]; + rootViewController = [[NoStatusBarViewController alloc] init]; [rootViewController.view addSubview:flutterViewController.view]; flutterViewController.view.frame = CGRectMake(150, 150, 500, 500); } From 7e4ace86a48a55bdf52d9582dc1ddf4f1c5c3bcd Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 19 Sep 2023 12:57:32 -0700 Subject: [PATCH 2/2] Update AppDelegate.m --- testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m b/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m index f701f720fb1ff..9aa3a0043063d 100644 --- a/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m +++ b/testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m @@ -10,6 +10,8 @@ #import "TextPlatformView.h" // A UIViewController that sets YES for its preferedStatusBarHidden property. +// StatusBar includes current time, which is non-deterministic. This ViewController +// removes the StatusBar to make the screenshot deterministic. @interface NoStatusBarViewController : UIViewController @end