From e831320c6b1b5636e3c06f83321134ba578b5efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E6=B4=B5=E9=94=8B?= Date: Fri, 1 Dec 2023 08:54:12 +0800 Subject: [PATCH] [CP] Fix not being able to hide iOS status bar via setEnabledSystemUIMode (#48403) Original PR: https://github.com/flutter/engine/pull/48271 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../Source/FlutterPlatformPluginTest.mm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPluginTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPluginTest.mm index 59388eadbe..7d98e82c93 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPluginTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPluginTest.mm @@ -453,12 +453,12 @@ - (void)testStatusBarHiddenUpdate { OCMStub([mockApplication sharedApplication]).andReturn(mockApplication); // Enabling system UI overlays to update status bar. - FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"test" project:nil]; + FlutterEngine* engine = [[[FlutterEngine alloc] initWithName:@"test" project:nil] autorelease]; [engine runWithEntrypoint:nil]; FlutterViewController* flutterViewController = - [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - std::unique_ptr> _weakFactory = - std::make_unique>(engine); + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; + std::unique_ptr> _weakFactory = + std::make_unique>(engine); // Update to hidden. FlutterPlatformPlugin* plugin = [engine platformPlugin]; @@ -504,12 +504,12 @@ - (void)testStatusBarStyle { id mockApplication = OCMClassMock([UIApplication class]); OCMStub([mockApplication sharedApplication]).andReturn(mockApplication); - FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"test" project:nil]; + FlutterEngine* engine = [[[FlutterEngine alloc] initWithName:@"test" project:nil] autorelease]; [engine runWithEntrypoint:nil]; FlutterViewController* flutterViewController = - [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - std::unique_ptr> _weakFactory = - std::make_unique>(engine); + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; + std::unique_ptr> _weakFactory = + std::make_unique>(engine); XCTAssertFalse(flutterViewController.prefersStatusBarHidden); FlutterPlatformPlugin* plugin = [engine platformPlugin];