Skip to content

Custom iOS plist file names#108

Open
rickcasson wants to merge 9 commits intoAngeloAvv:masterfrom
rickcasson:custom-iOSPList
Open

Custom iOS plist file names#108
rickcasson wants to merge 9 commits intoAngeloAvv:masterfrom
rickcasson:custom-iOSPList

Conversation

@rickcasson
Copy link
Copy Markdown

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
Copy Markdown

This would be big!

@eleomilagrosa
Copy link
Copy Markdown

any update?

@AmanMasipeddi
Copy link
Copy Markdown

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

@LinHaoLove
Copy link
Copy Markdown

I have the same needs!

@AngeloAvv
Copy link
Copy Markdown
Owner

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

@rickcasson
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Owner

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

@rickcasson
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

}

@JsonKey(disallowNullValue: true, defaultValue: [])
final List<String> iOSPListFiles;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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