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

Add overloads for lookup that lets you specify a bundle#8007

Merged
dnfield merged 5 commits intoflutter:masterfrom
dnfield:ios_asset_bundle
Mar 2, 2019
Merged

Add overloads for lookup that lets you specify a bundle#8007
dnfield merged 5 commits intoflutter:masterfrom
dnfield:ios_asset_bundle

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Mar 1, 2019

Some customers want to package up the App.framework into a separate bundle from the main one. This lets them look up flutter asset keys in whatever bundle they desire.

fixes flutter/flutter#28739

/cc @AlbertWang0116

}

+ (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package {
return [self lookupKeyForAsset:[NSString stringWithFormat:@"packages/%@/%@", package, asset]];
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer leveraging lookupKeyForAsset:fromPackage:fromBundle: here. Duplicating [NSBundle mainBundle] seems less error-prone than duplicating [NSString stringWithFormat:@"packages/%@/%@", package, asset].

Otherwise looks good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this and another spot where there was duplicated code.


+ (NSString*)lookupKeyForAsset:(NSString*)asset {
return [self lookupKeyForAsset fromBundle:[NSBundle mainBundle]];
NSBundle* bundle = [NSBundle bundleWithIdnetifier:[FlutterDartProject defaultBundleIdentifier]];
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI on this: it is mainly for allowing the documented way (https://flutter.dev/docs/development/ui/assets-and-images#ios) to work with the default setting of Flutter iOS app, which has default bundle id but may have different bundle name.

Copy link
Contributor

@jamesderlin jamesderlin left a comment

Choose a reason for hiding this comment

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

This will slightly change the existing behavior by making the existing versions of lookupKeyForAsset check [FlutterDartProject defaultBundleIdentifier] first, but I assume that's ok.

LGTM (aside from the typo).


+ (NSString*)flutterAssetsName:(NSBundle*)bundle {
if (bundle == nil) {
bundle = [NSBundle bundleWithIdnetifier:[FlutterDartProject defaultBundleIdentifier]];
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in bundleWithIdentifier

@dnfield dnfield merged commit 13064ae into flutter:master Mar 2, 2019
@dnfield dnfield deleted the ios_asset_bundle branch March 2, 2019 18:01
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 2, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 2, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 3, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 3, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Mar 3, 2019
flutter/engine@39c46de...a28329c

git log 39c46de..a28329c --no-merges --oneline
a28329c Roll src/third_party/skia 58a75383a70b..c97b0672a73f (1 commits) (flutter/engine#8018)
cdc1410 Roll src/third_party/skia 0d7012a80c17..58a75383a70b (1 commits) (flutter/engine#8017)
01d8a1f Roll src/third_party/skia c945f0e31a53..0d7012a80c17 (1 commits) (flutter/engine#8016)
75cd4df Roll src/third_party/skia 9159c8ef83b2..c945f0e31a53 (1 commits) (flutter/engine#8015)
13064ae Add overloads for lookup that lets you specify a bundle (flutter/engine#8007)
130cf77 Build engine for iOS on presubmit (flutter/engine#8011)
7234cc4 Roll src/third_party/skia 705e67347962..9159c8ef83b2 (1 commits) (flutter/engine#8014)
8a0b054 Roll src/third_party/skia 09198525261a..705e67347962 (7 commits) (flutter/engine#8013)
36cdd2e Roll src/third_party/skia 436d47d5bde9..09198525261a (6 commits) (flutter/engine#8012)
9bef73a Roll src/third_party/skia e1f5b644656f..436d47d5bde9 (3 commits) (flutter/engine#8009)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff ([email protected]), and stop
the roller if necessary.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS embedding should look at the framework info.plist in addition to checking the root bundle info.plist

4 participants