Open vinifig opened 5 months ago
+1
Temporarily I've made this script with many more to adjust flavorizr to our internal processes and necessities:
import 'dart:io';
import 'package:flutter_flavorizr/src/parser/parser.dart';
import 'package:yaml/yaml.dart';
Future<void> main() async {
await _fixLaunchIcons();
}
List<FlavorizrData> getFlavorizrData() {
Parser parser = const Parser(
pubspecPath: 'pubspec.yaml',
flavorizrPath: flavorizrPath,
);
final config = parser.parse();
return config.flavors.entries.map(_extractFlavorData).toList();
}
Future<void> _fixLaunchIcons() async {
final flavors = getFlavorizrData();
final contentsJSON = await File(
'ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json',
).readAsString();
for (final flavor in flavors) {
final flavorName = flavor.name;
await File(
'ios/Runner/Assets.xcassets/${flavorName}AppIcon.appiconset/Contents.json',
).writeAsString(contentsJSON);
}
}
if it's of any help to any of you, run it after running flavorizr (be it on the ci or your local machine that will solve your problem whilst it's not fixed on the lib)
Expected with contents.json:
Actual without contents.json:
Causing: