Skip to content

Custom iOS plist file names #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

rickcasson
Copy link

The utility currently is only compatible with projects that use the default Info.plist file name. This PR allows the user to specify a custom list of plist files or specify an individual custom plist using the INFOPLIST_FILE build setting:

flavorizr:
  app:
    android:

    ios:
      iOSPListFiles:
        - "ios/Runner/Info-Debug.plist"
        - "ios/Runner/Info-Profile.plist"
        - "ios/Runner/Info-Release.plist"

or

flavorizr:
  app:
    android:
      
    ios:
      buildSettings:
         INFOPLIST_FILE: "ios/Runner/Info-Debug.plist"

@h-unterp
Copy link

This would be big!

@eleomilagrosa
Copy link

any update?

@AmanMasipeddi
Copy link

This would be a nice feature. Hoping it would rollout soon.

@LinHaoLove
Copy link

I have the same needs!

@AngeloAvv
Copy link
Owner

Hey @rickcasson . What's the purpose of having multiple Info.plist files instead of using variables?

@rickcasson
Copy link
Author

Hi @AngeloAvv, it became necessary to separate the Debug and Release Info.plist files to properly debug and hot reload on iOS14+. Here is the official Flutter documentation: https://docs.flutter.dev/add-to-app/ios/project-setup#local-network-privacy-permissions

@TheFabbiusCorp
Copy link

Hey @rickcasson . What's the purpose of having multiple Info.plist files instead of using variables?

Hi @AngeloAvv, I'm not sure we can use variables in this case:

image

And as @rickcasson pointed out, we need to define separate plist files for different targets over the same flavor.

@AngeloAvv
Copy link
Owner

Hey @rickcasson , are you still interested in developing this feature?
I have some suggestions for you

@rickcasson
Copy link
Author

Hi @AngeloAvv, I'm no longer working on the project that needed this, but would still be happy to make any necessary changes so others can use this

android:
flavorDimensions: "flavor-type"
ios:
iOSPListFiles:
Copy link
Owner

Choose a reason for hiding this comment

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

Can we rename it to infoFiles?

Suggested change
iOSPListFiles:
infoFiles:

IOS({Map<String, dynamic> buildSettings = const {}}) {
IOS(
{Map<String, dynamic> buildSettings = const {},
this.iOSPListFiles = const []}) {
Copy link
Owner

Choose a reason for hiding this comment

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

I prefer we set the default Info.plist path file here

this.buildSettings = BuildSettingsMixin.iosDefaultBuildSettings;
this.buildSettings.addAll(buildSettings);
}

@JsonKey(disallowNullValue: true, defaultValue: [])
final List<String> iOSPListFiles;
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
final List<String> iOSPListFiles;
final List<String> infoFiles;

@@ -30,10 +30,15 @@ part 'ios.g.dart';

@JsonSerializable(anyMap: true, createToJson: false)
class IOS with BuildSettingsMixin {
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should extend this feature to macos also

Comment on lines +253 to +274
'ios:plist': () => (flavorizr.app?.ios?.iOSPListFiles != null &&
flavorizr.app!.ios!.iOSPListFiles.isNotEmpty
? QueueProcessor(
flavorizr.app!.ios!.iOSPListFiles
.map<ExistingFileStringProcessor>(
(String path) => ExistingFileStringProcessor(
path,
IOSPListProcessor(config: flavorizr),
config: flavorizr,
))
.toList(),
config: flavorizr,
)
: ExistingFileStringProcessor(
flavorizr.app?.ios != null &&
flavorizr.app!.ios!.buildSettings
.containsKey('INFOPLIST_FILE')
? flavorizr.app?.ios?.buildSettings['INFOPLIST_FILE']
: K.iOSPListPath,
IOSPListProcessor(config: flavorizr),
config: flavorizr,
)) as AbstractProcessor<void>,
Copy link
Owner

Choose a reason for hiding this comment

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

I honestly don't like putting too much logic here as it makes the processor file unreadable.

I think it would be better to create another processor that extends a QueueProcessor (you can follow this PR to better understand what I mean) and add the logic there.

If the user doesn't define a custom set of info files, the processor should process at least the default one.

Question: Why do we need INFOPLIST_FILE in the buildSettings? You should access infoFiles instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants