Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

cyanglaz
Copy link
Contributor

This PR turns on the flag to support engine to build app extension.
When building for app extension, the usage of sharedApplication API is removed.

fixes flutter/flutter#124286 and flutter/flutter#124289

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

draft

format

draf

draft

format

draft

fix bundle

format

fix

test
@cyanglaz cyanglaz marked this pull request as ready for review August 17, 2023 19:44
@cyanglaz cyanglaz changed the title [Draft] ios: remove shared_application and support app extension build ios: remove shared_application and support app extension build Aug 17, 2023

NSBundle* FLTGetApplicationBundle();

NSURL* FLTAssetsFromBundle(NSBundle* bundle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be given a more precise name? I'm assuming this is an assets directory, rather than actual assets?

return bundle;
NSBundle* FLTGetApplicationBundle() {
NSBundle* mainBundle = [NSBundle mainBundle];
// App extension bundle is in Runner.app/PlugIns/Extension.appex.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It's not necessarily "Runner.app", right? Maybe <AppName>.app/PlugiIns/Extension.appex?


NSBundle* FLTFrameworkBundleWithIdentifier(NSString* flutterBundleID) {
NSBundle* appBundle = FLTGetApplicationBundle();
NSBundle* bundle = FLTFrameworkBundleInternal(flutterBundleID, appBundle.privateFrameworksURL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

frameworkBundle (since it's confusing to have something just called bundle when there are two different bundles being tracked).

NSURL* FLTAssetsFromBundle(NSBundle* bundle) {
NSString* assetsPathFromInfoPlist = [bundle objectForInfoDictionaryKey:@"FLTAssetsPath"];
NSString* flutterAssetsName =
assetsPathFromInfoPlist != nil ? assetsPathFromInfoPlist : @"flutter_assets";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: You can use the Elvis operator extensions here (it's a style-guide-approved language extension): assetsPathFromInfoPlist ?: @"flutter_assets";

constexpr char kTextPlainFormat[] = "text/plain";
const UInt32 kKeyPressClickSoundId = 1306;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ifdef these pragmas to make it clearer why it's needed?

currentInterfaceOrientation = 1 << windowScene.interfaceOrientation;
} else {
#if APPLICATION_EXTENSION_API_ONLY
FML_LOG(ERROR) << "Applicatioin based status bar orentiation update is not supported in "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Application

@cyanglaz cyanglaz force-pushed the remove_shared_application branch from f168f89 to 4b5c020 Compare August 22, 2023 19:13
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with comment nits.

NSBundle* FLTFrameworkBundleWithIdentifier(NSString* bundleID);
NSBundle* FLTFrameworkBundleWithIdentifier(NSString* flutterFrameworkBundleID);

// Find the bundle of the application.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Finds

// This returns [NSBundle mainBundle] if the current running process is the application.
NSBundle* FLTGetApplicationBundle();

// Find the Flutter asset directory from `bundle`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Finds


// Find the bundle of the application.
//
// This returns [NSBundle mainBundle] if the current running process is the application.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "This returns" -> "Returns"

// The raw path can be set by the application via info.plist's `FLTAssetsPath` key.
// If the key is not set, `flutter_assets` is used as the raw path value.
//
// If no valid asset is found under the raw path, return nil.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: returns

@cyanglaz cyanglaz added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 25, 2023
@auto-submit auto-submit bot merged commit 6ef35bb into flutter:main Aug 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 25, 2023
@cyanglaz cyanglaz deleted the remove_shared_application branch August 25, 2023 22:47
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 25, 2023
…133362)

flutter/engine@1ec7b89...53595c9

2023-08-25 [email protected] [Impeller] Fix mask blurs and the Gaussian blur coverage hint. (flutter/engine#45079)
2023-08-25 [email protected] ios: remove shared_application and support app extension build (flutter/engine#44732)
2023-08-25 [email protected] Roll Skia from 76672468e8d7 to 40f4e01fca40 (3 revisions) (flutter/engine#45126)
2023-08-25 [email protected] Roll Fuchsia Mac SDK from 4LHUJjNlDT21v_pdT... to Qj4BGsKtF7EJssKIK... (flutter/engine#45127)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from 4LHUJjNlDT21 to Qj4BGsKtF7EJ

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
XilaiZhang added a commit that referenced this pull request Aug 29, 2023
auto-submit bot pushed a commit that referenced this pull request Aug 29, 2023
… extension build" (#45250)

Reverts #44732

context: b/297654739
Synced with Chris and the error message is related to the PR
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
…er#44732)

This PR turns on the flag to support engine to build app extension. 
When building for app extension, the usage of sharedApplication API is removed.

fixes flutter/flutter#124286 and flutter/flutter#124289

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
… extension build" (flutter#45250)

Reverts flutter#44732

context: b/297654739
Synced with Chris and the error message is related to the PR
auto-submit bot pushed a commit that referenced this pull request Sep 1, 2023
…#44732" (#45351)

Relands #44732 with fix. 

The original PR returns nil when the assets is not reachable, in some cases, the assets are not loaded yet but will be loaded later, so we should return the asset URL regardless. 

Also added a fallback to main bundle to match the previous implementation. 

The original PR was failed in internal tests in b/297654739
Now with the fix, all tests passed: cl/561449914

fixes flutter/flutter#124289

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

affects: desktop autosubmit Merge PR when tree becomes green via auto submit App platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[app_extension_safe] engine build flag to expose an extension safe Flutter.framework/FlutterMacOS.framework

2 participants