mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
Move the embedded view preview flag check to a common function. (#6813)
This commit is contained in:
@@ -296,8 +296,6 @@
|
||||
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.
|
||||
@@ -310,7 +308,7 @@
|
||||
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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ bool IOSSurfaceGL::GLContextPresent() {
|
||||
}
|
||||
|
||||
flow::ExternalViewEmbedder* IOSSurfaceGL::GetExternalViewEmbedder() {
|
||||
if ([[[NSBundle mainBundle] objectForInfoDictionaryKey:@(kEmbeddedViewsPreview)] boolValue]) {
|
||||
if (IsIosEmbeddedViewsPreviewEnabled()) {
|
||||
return this;
|
||||
} else {
|
||||
return nullptr;
|
||||
|
||||
@@ -127,7 +127,7 @@ bool IOSSurfaceSoftware::PresentBackingStore(sk_sp<SkSurface> backing_store) {
|
||||
}
|
||||
|
||||
flow::ExternalViewEmbedder* IOSSurfaceSoftware::GetExternalViewEmbedder() {
|
||||
if ([[[NSBundle mainBundle] objectForInfoDictionaryKey:@(kEmbeddedViewsPreview)] boolValue]) {
|
||||
if (IsIosEmbeddedViewsPreviewEnabled()) {
|
||||
return this;
|
||||
} else {
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user