Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI {
threadLabel.UTF8String, // label
shell::ThreadHost::Type::UI | shell::ThreadHost::Type::GPU | shell::ThreadHost::Type::IO};

bool embedded_views_preview_enabled = [[[NSBundle mainBundle]
objectForInfoDictionaryKey:@(shell::kEmbeddedViewsPreview)] boolValue];
// Lambda captures by pointers to ObjC objects are fine here because the
// create call is
// synchronous.
Expand All @@ -310,7 +308,7 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI {
return std::make_unique<shell::Rasterizer>(shell.GetTaskRunners());
};

if (embedded_views_preview_enabled) {
if (shell::IsIosEmbeddedViewsPreviewEnabled()) {
// Embedded views requires the gpu and the platform views to be the same.
// The plan is to eventually dynamically merge the threads when there's a
// platform view in the layer tree.
Expand Down
5 changes: 3 additions & 2 deletions shell/platform/darwin/ios/ios_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

namespace shell {

// The name of the Info.plist flag to enable the embedded iOS views preview.
const char* const kEmbeddedViewsPreview = "io.flutter.embedded_views_preview";
// Returns true if the app explicitly specified to use the iOS view embedding
// mechanism which is still in a release preview.
bool IsIosEmbeddedViewsPreviewEnabled();

class IOSSurface {
public:
Expand Down
7 changes: 7 additions & 0 deletions shell/platform/darwin/ios/ios_surface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@

namespace shell {

// The name of the Info.plist flag to enable the embedded iOS views preview.
const char* const kEmbeddedViewsPreview = "io.flutter.embedded_views_preview";

bool IsIosEmbeddedViewsPreviewEnabled() {
return [[[NSBundle mainBundle] objectForInfoDictionaryKey:@(kEmbeddedViewsPreview)] boolValue];
}

IOSSurface::IOSSurface(FlutterPlatformViewsController* platform_views_controller)
: platform_views_controller_(platform_views_controller) {}

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/darwin/ios/ios_surface_gl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
}

flow::ExternalViewEmbedder* IOSSurfaceGL::GetExternalViewEmbedder() {
if ([[[NSBundle mainBundle] objectForInfoDictionaryKey:@(kEmbeddedViewsPreview)] boolValue]) {
if (IsIosEmbeddedViewsPreviewEnabled()) {
return this;
} else {
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/darwin/ios/ios_surface_software.mm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
}

flow::ExternalViewEmbedder* IOSSurfaceSoftware::GetExternalViewEmbedder() {
if ([[[NSBundle mainBundle] objectForInfoDictionaryKey:@(kEmbeddedViewsPreview)] boolValue]) {
if (IsIosEmbeddedViewsPreviewEnabled()) {
return this;
} else {
return nullptr;
Expand Down