diff --git a/.github/workflows/main.yml b/.github/workflows/format-analyze-test.yml similarity index 84% rename from .github/workflows/main.yml rename to .github/workflows/format-analyze-test.yml index adab721..95c594b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/format-analyze-test.yml @@ -12,7 +12,7 @@ on: branches: [ master ] jobs: - build: + format-analyze-test: runs-on: ubuntu-latest steps: @@ -23,6 +23,9 @@ jobs: - name: Install dependencies run: dart pub get + - name: Generate package version + run: dart run build_runner build --delete-conflicting-outputs + - name: Verify formatting run: dart format --output=none --set-exit-if-changed . diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0969809..96be87d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: steps: - name: 'Checkout' uses: actions/checkout@v3 - + - name: '>> Dart package <<' uses: k-paxian/dart-package-publisher@master with: diff --git a/.gitignore b/.gitignore index 45ce92b..d1c38be 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ pubspec.lock # Directory created by dartdoc doc/api/ + +# example/test/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index fc4b219..a7df5d1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,15 +2,25 @@ "cSpell.words": [ "anydpi", "appiconset", + "hdpi", + "Hexa", + "imageset", + "lproj", "Mainifest", + "mdpi", "mipmap", "negatable", + "paxian", "pbxproj", "playstore", "pubspec", + "rgba", "unawaited", "writeln", "xcassets", - "xcodeproj" + "xcodeproj", + "xhdpi", + "xxhdpi", + "xxxhdpi" ] -} \ No newline at end of file +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f95f6a..b71ad48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,73 @@ # Changelog +## 2.0.0 + - Add web custom favicon support + - ## Config breaking changes: + + ```yaml + icons_launcher: + image_path: 'assets/ic_logo_border.png' + platforms: + android: + enable: true + image_path: 'assets/ic_logo_border.png' + # adaptive_background_color: '#ffffff' + adaptive_background_image: 'assets/ic_background.png' + adaptive_foreground_image: 'assets/ic_foreground.png' + adaptive_round_image: 'assets/ic_logo_round.png' + ios: + enable: true + image_path: 'assets/ic_logo_rectangle.png' + web: + enable: true + image_path: 'assets/ic_logo_border.png' + favicon_path: 'assets/ic_logo_round.png' + macos: + enable: false + image_path: 'assets/ic_logo_border.png' + windows: + enable: false + image_path: 'assets/ic_logo_border.png' + linux: + enable: false + image_path: 'assets/ic_logo_border.png' + ``` + +## 2.0.0-beta.2 + - Fixed auto remove image alpha channel for iOS platform to follow AppStore guideline + - Fixed iOS flavor + - Improved pub score + - Improved log + +## 2.0.0-beta.1 + - Rewrite and improve flavor support + - New flavor script (E.g. `icons_launcher-dev.yaml`) + ```sh + flutter pub run icons_launcher:create --flavor dev + ``` + - Add new config + - `color_adaptive_background` + - ## Breaking changes: + - Rename runner from `icons_launcher:main` to `icons_launcher:create` + + ```sh + flutter pub run icons_launcher:create + ``` + - Rename config from `flutter_icons:` to `icons_launcher:` + + ```yaml + icons_launcher: + image_path: 'icon.png' + android: true + ``` + - Rename config option: + - from `adaptive_icon_background` to `image_adaptive_background` + - from `adaptive_icon_foreground` to `image_adaptive_foreground` + - from `adaptive_icon_round` to `image_adaptive_round` + - Config option removed + - `remove_alpha_ios` + - `remove_alpha_macos` + ## 1.2.1 - Fixed bug windows platform icon list embedded @@ -29,7 +97,7 @@ ## 1.1.4 - Fixed android adaptive icon ([#3](https://github.com/mrrhak/icons_launcher/issues/3)) - Android files are generated to `mipmap` instead of `drawable` follow Android Studio - - New android config `adaptive_icon_round` + - New android config `image_adaptive_round` - New `ic_launcher-playstore.png` is generated in main folder - Update example app - Update README.md diff --git a/README.md b/README.md index ac11ff6..bdf8865 100644 --- a/README.md +++ b/README.md @@ -61,21 +61,27 @@ An example is shown below. More complex examples [here](https://github.com/mrrha ```yaml dev_dependencies: - icons_launcher: ^1.2.1 + icons_launcher: ^2.0.0 -flutter_icons: +icons_launcher: image_path: 'assets/ic_logo_border.png' - ios: true - android: true + platforms: + android: + enable: true + ios: + enable: true ``` #### Method 2: create icons_launcher.yaml at project root ```yaml -flutter_icons: +icons_launcher: image_path: 'assets/ic_logo_border.png' - ios: true - android: true + platforms: + android: + enable: true + ios: + enable: true ``` ### 2. Run the package @@ -91,7 +97,7 @@ If you name your configuration file something other than `icons_launcher.yaml` o ```sh flutter pub get -flutter pub run icons_launcher:create -f +flutter pub run icons_launcher:create --path ``` NOTE: If you are not using the existing `pubspec.yaml` your config file must still be located in the same directory as it. @@ -106,44 +112,70 @@ In the above configuration, the package is setup to replace the existing launche Shown below is the full list of attributes which you can specify within your Icons Launcher configuration. -- `android`/`ios`/`web`/`macos`/`windows`/`linux` - - `true`: Override the default existing Flutter launcher icon for the platform specified - - `false`: Ignore making launcher icons for this platform - - `icon/path/here.png`: This will generate a new launcher icons for the platform with the name you specify, without removing the old default existing icon launcher. +| Icons Launcher Option | Type | Default | Description | +| --- | --- | --- | --- | +| `image_path` | String | `null` | The image file path | +| `platforms` | Object | `null` | Use for specific platform to generate icons | -- `image_path`: The location of the icon image file which you want to use as the app launcher icon - -- `image_path_android`: The location of the icon image file specific for Android platform (optional - if not defined then the image_path is used) - -- `image_path_ios`: The location of the icon image file specific for iOS platform (optional - if not defined then the image_path is used) - -- `image_path_macos`: The location of the icon image file specific for MacOS platform (optional - if not defined then the image_path is used) - -- `image_path_windows`: The location of the icon image file specific for Windows platform (optional - if not defined then the image_path is used) - -- `image_path_linux`: The location of the icon image file specific for Linux platform (optional - if not defined then the image_path is used) - -- `image_path_web`: The location of the icon image file specific for Web platform (optional - if not defined then the image_path is used) - -The next three attributes are only used when generating Android adaptive launcher icon ([Read more](https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive)) - -- `adaptive_icon_background`: The color (E.g. `"#ffffff"`) or image asset (E.g. `"assets/ic_background.png"`) which will -be used to fill out the background of the adaptive icon. - -- `adaptive_icon_foreground`: The image asset which will be used for the icon foreground of the adaptive icon - -- `adaptive_icon_round`: The image asset which will be used for the round icon of the adaptive icon (optional) +--- -#### Note: -- _Android adaptive icon will generate if you provide `adaptive_icon_background` and `adaptive_icon_foreground`._ -- _`adaptive_icon_round` is optional, if you provide you must provide two config above also, the plugin will modify your `AndroidMainifest.xml` to add `android:roundIcon="@mipmap/ic_launcher_round` and create a new file `ic_launcher_round.xml` to` mipmap-anydpi-v26`_ -- _iOS icons should [fill the entire image](https://stackoverflow.com/questions/26014461/black-border-on-my-ios-icon) and not contain transparent borders._ +| Platforms Option | Type | Default | Description | +| --- | --- | --- | --- | +| `android` | Object | `null` | Use for specific android platform | +| `ios` | Object | `null` | Use for specific android platform | +| `macos` | Object | `null` | Use for specific android platform | +| `windows` | Object | `null` | Use for specific android platform | +| `web` | Object | `null` | Use for specific android platform | +| `linux` | Object | `null` | Use for specific android platform | + +| Android Option | Type | Default | Description | +| --- | --- | --- | --- | +| `enable` | Boolean | `false` | Use for enable android platform | +| `image_path` | String | `null` | The image file path | +| `adaptive_background_color` | String | `null` | Color for fill out the background of the adaptive icon (_"#ffffff"_) | +| `adaptive_background_image` | String | `null` | Image for fill out the background of the adaptive icon | +| `adaptive_foreground_image` | String | `null` | Image for the icon foreground of the adaptive icon | +| `adaptive_round_image` | String | `null` | Image for the round icon of the adaptive icon (optional) | + +| IOS Option | Type | Default | Description | +| --- | --- | --- | --- | +| `enable` | Boolean | `false` | Use for enable ios platform | +| `image_path` | String | `null` | The image file path | + +| Web Option | Type | Default | Description | +| --- | --- | --- | --- | +| `enable` | Boolean | `false` | Use for enable ios platform | +| `image_path` | String | `null` | The image file path | +| `favicon_path` | String | `null` | The image file path | + +| macOS Option | Type | Default | Description | +| --- | --- | --- | --- | +| `enable` | Boolean | `false` | Use for enable macos platform | +| `image_path` | String | `null` | The image file path | + +| Windows Option | Type | Default | Description | +| --- | --- | --- | --- | +| `enable` | Boolean | `false` | Use for enable windows platform | +| `image_path` | String | `null` | The image file path | + +| Linux Option | Type | Default | Description | +| --- | --- | --- | --- | +| `enable` | Boolean | `false` | Use for enable linux platform | +| `image_path` | String | `null` | The image file path | --- ## Flavor support Create a Icons Launcher configuration file for your flavor. The config file is called `icons_launcher-.yaml` by replacing `` by the name of your desired flavor. +Example: `icons_launcher-dev.yaml` + +Run with flavor: +```sh +flutter pub get +flutter pub run icons_launcher:create --flavor dev +``` + The configuration file format is the same. --- @@ -153,57 +185,63 @@ The configuration file format is the same. ```yaml dev_dependencies: - icons_launcher: ^1.2.1 - -flutter_icons: - # image_path: 'assets/ic_logo_border.png' - image_path_android: 'assets/ic_logo_border.png' - image_path_ios: 'assets/ic_logo_rectangle.png' - image_path_macos: 'assets/ic_logo_border.png' - image_path_windows: 'assets/ic_logo_border.png' - image_path_linux: 'assets/ic_logo_border.png' - image_path_web: 'assets/ic_logo_border.png' - adaptive_icon_background: 'assets/ic_background.png' - adaptive_icon_foreground: 'assets/ic_foreground.png' - adaptive_icon_round: 'assets/ic_logo_round.png' #! (Optional) - remove_alpha_ios: false - remove_alpha_macos: false - ios: true - android: true - macos: false - windows: false - linux: false - web: false + icons_launcher: ^2.0.0 + +icons_launcher: + image_path: 'assets/ic_logo_border.png' + platforms: + android: + enable: true + image_path: 'assets/ic_logo_border.png' + # adaptive_background_color: '#ffffff' + adaptive_background_image: 'assets/ic_background.png' + adaptive_foreground_image: 'assets/ic_foreground.png' + adaptive_round_image: 'assets/ic_logo_round.png' + ios: + enable: true + image_path: 'assets/ic_logo_rectangle.png' + web: + enable: true + image_path: 'assets/ic_logo_border.png' + favicon_path: 'assets/ic_logo_round.png' + macos: + enable: false + image_path: 'assets/ic_logo_border.png' + windows: + enable: false + image_path: 'assets/ic_logo_border.png' + linux: + enable: false + image_path: 'assets/ic_logo_border.png' ``` ### Or use in custom yaml (icons_launcher.yaml) ```yaml -flutter_icons: - # image_path: 'assets/ic_logo_border.png' - image_path_android: 'assets/ic_logo_border.png' - image_path_ios: 'assets/ic_logo_rectangle.png' - image_path_macos: 'assets/ic_logo_border.png' - image_path_windows: 'assets/ic_logo_border.png' - image_path_linux: 'assets/ic_logo_border.png' - image_path_web: 'assets/ic_logo_border.png' - adaptive_icon_background: 'assets/ic_background.png' - adaptive_icon_foreground: 'assets/ic_foreground.png' - adaptive_icon_round: 'assets/ic_logo_round.png' #! (Optional) - remove_alpha_ios: false - remove_alpha_macos: false - ios: true - android: true - macos: false - windows: false - linux: false - web: false +icons_launcher: + image_path: 'assets/ic_logo_border.png' + platforms: + android: + enable: true + image_path: 'assets/ic_logo_border.png' + # adaptive_background_color: '#ffffff' + adaptive_background_image: 'assets/ic_background.png' + adaptive_foreground_image: 'assets/ic_foreground.png' + adaptive_round_image: 'assets/ic_logo_round.png' + ios: + enable: true + image_path: 'assets/ic_logo_rectangle.png' + web: + enable: true + image_path: 'assets/ic_logo_border.png' + favicon_path: 'assets/ic_logo_round.png' + macos: + enable: false + image_path: 'assets/ic_logo_border.png' + windows: + enable: false + image_path: 'assets/ic_logo_border.png' + linux: + enable: false + image_path: 'assets/ic_logo_border.png' ``` - ---- - -
- - _This package is forked from flutter_launcher_icons which includes bugs fixed & adds more platform support._ -
- diff --git a/analysis_options.yaml b/analysis_options.yaml index 6087996..0d51954 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -39,6 +39,7 @@ analyzer: - 'lib/i18n/stock_messages_*.dart' - 'lib/src/http/**' - 'example/**' + - lib/src/version.dart linter: rules: @@ -178,3 +179,4 @@ linter: # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review - valid_regexps # - void_checks # not yet tested + - public_member_api_docs diff --git a/bin/create.dart b/bin/create.dart index d1ea4fa..f31945e 100644 --- a/bin/create.dart +++ b/bin/create.dart @@ -1,7 +1,17 @@ -import 'dart:async'; -import 'package:icons_launcher/main.dart' as icons_launcher; +import 'package:args/args.dart'; +import 'package:icons_launcher/cli_commands.dart'; +import 'package:icons_launcher/utils/constants.dart'; /// Run to create launcher icons void main(List arguments) { - unawaited(icons_launcher.createIconsFromArguments(arguments)); + print(START_MESSAGE); + final parser = ArgParser(); + + parser.addOption('path'); + parser.addOption('flavor'); + + final parsedArgs = parser.parse(arguments); + + createLauncherIcons(path: parsedArgs['path'], flavor: parsedArgs['flavor']); + print(END_MESSAGE); } diff --git a/bin/main.dart b/bin/main.dart deleted file mode 100644 index fecdb88..0000000 --- a/bin/main.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'create.dart' as create; - -/// Run the main app -/// Deprecated. Use `create` instead. -void main(List arguments) { - print( - "\n\n⚠️ This 'icons_launcher:main' is deprecated. Use 'icons_launcher:create' instead. ⚠️"); - - create.main(arguments); -} diff --git a/example/README.md b/example/README.md index 3f3bd6d..8b60ecd 100644 --- a/example/README.md +++ b/example/README.md @@ -8,45 +8,62 @@ flutter pub add --dev icons_launcher - Add config to `pubspec.yaml` or `create icons_launcher.yaml` at root of project. ```yaml -flutter_icons: +icons_launcher: image_path: 'assets/ic_logo_border.png' - ios: true - android: true + platforms: + android: + enable: true + ios: + enable: true ``` - Use different images for each platform ```yaml -flutter_icons: - # image_path: 'assets/ic_logo_border.png' - image_path_android: 'assets/ic_logo_border.png' - image_path_ios: 'assets/ic_logo_rectangle.png' - image_path_macos: 'assets/ic_logo_border.png' - image_path_windows: 'assets/ic_logo_border.png' - image_path_linux: 'assets/ic_logo_border.png' - image_path_web: 'assets/ic_logo_border.png' - adaptive_icon_background: 'assets/ic_background.png' - adaptive_icon_foreground: 'assets/ic_foreground.png' - adaptive_icon_round: 'assets/ic_logo_round.png' #! (Optional) - remove_alpha_ios: false - remove_alpha_macos: false - ios: true - android: true - macos: false - windows: false - linux: false - web: false +icons_launcher: + image_path: 'assets/ic_logo_border.png' + platforms: + android: + enable: true + image_path: 'assets/ic_logo_border.png' + # adaptive_background_color: '#ffffff' + adaptive_background_image: 'assets/ic_background.png' + adaptive_foreground_image: 'assets/ic_foreground.png' + adaptive_round_image: 'assets/ic_logo_round.png' + ios: + enable: true + image_path: 'assets/ic_logo_rectangle.png' + web: + enable: true + image_path: 'assets/ic_logo_border.png' + favicon_path: 'assets/ic_logo_round.png' + macos: + enable: false + image_path: 'assets/ic_logo_border.png' + windows: + enable: false + image_path: 'assets/ic_logo_border.png' + linux: + enable: false + image_path: 'assets/ic_logo_border.png' ``` -- After configured now you can run generation +After configured, now you can run generation ```sh flutter pub get flutter pub run icons_launcher:create ``` -Or with custom yaml file (like example for [Flavor App](https://github.com/mrrhak/icons_launcher/tree/master/example/flavor_app)) +Or with custom yaml file + +```sh +flutter pub get +flutter pub run icons_launcher:create --path +``` + +Or flavor app ([Example](https://github.com/mrrhak/icons_launcher/tree/master/example/flavor_app)) ```sh flutter pub get -flutter pub run icons_launcher:create -f +flutter pub run icons_launcher:create --flavor ``` diff --git a/example/flavor_app/.metadata b/example/flavor_app/.metadata index 95f73f5..ed0b518 100644 --- a/example/flavor_app/.metadata +++ b/example/flavor_app/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled. version: - revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + revision: cd41fdd495f6944ecd3506c21e94c6567b073278 channel: stable project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 - base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 - platform: android - create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 - base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 - platform: ios - create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 - base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 - platform: linux - create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 - base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 - platform: macos - create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 - base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 - platform: web - create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 - base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 - platform: windows - create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 - base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 + create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 + base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278 # User provided section diff --git a/example/flavor_app/android/app/src/dev/res/ic_launcher-playstore.png b/example/flavor_app/android/app/src/dev/res/ic_launcher-playstore.png new file mode 100644 index 0000000..7878c2c Binary files /dev/null and b/example/flavor_app/android/app/src/dev/res/ic_launcher-playstore.png differ diff --git a/example/flavor_app/android/app/src/dev/res/mipmap-hdpi/ic_launcher.png b/example/flavor_app/android/app/src/dev/res/mipmap-hdpi/ic_launcher.png index db77bb4..b1fb5b8 100644 Binary files a/example/flavor_app/android/app/src/dev/res/mipmap-hdpi/ic_launcher.png and b/example/flavor_app/android/app/src/dev/res/mipmap-hdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/dev/res/mipmap-mdpi/ic_launcher.png b/example/flavor_app/android/app/src/dev/res/mipmap-mdpi/ic_launcher.png index 17987b7..fa65e3d 100644 Binary files a/example/flavor_app/android/app/src/dev/res/mipmap-mdpi/ic_launcher.png and b/example/flavor_app/android/app/src/dev/res/mipmap-mdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/dev/res/mipmap-xhdpi/ic_launcher.png b/example/flavor_app/android/app/src/dev/res/mipmap-xhdpi/ic_launcher.png index 09d4391..e31fdf9 100644 Binary files a/example/flavor_app/android/app/src/dev/res/mipmap-xhdpi/ic_launcher.png and b/example/flavor_app/android/app/src/dev/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/dev/res/mipmap-xxhdpi/ic_launcher.png b/example/flavor_app/android/app/src/dev/res/mipmap-xxhdpi/ic_launcher.png index d5f1c8d..ae0059c 100644 Binary files a/example/flavor_app/android/app/src/dev/res/mipmap-xxhdpi/ic_launcher.png and b/example/flavor_app/android/app/src/dev/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/dev/res/mipmap-xxxhdpi/ic_launcher.png b/example/flavor_app/android/app/src/dev/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372e..6184f2f 100644 Binary files a/example/flavor_app/android/app/src/dev/res/mipmap-xxxhdpi/ic_launcher.png and b/example/flavor_app/android/app/src/dev/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/prod/res/ic_launcher-playstore.png b/example/flavor_app/android/app/src/prod/res/ic_launcher-playstore.png new file mode 100644 index 0000000..7878c2c Binary files /dev/null and b/example/flavor_app/android/app/src/prod/res/ic_launcher-playstore.png differ diff --git a/example/flavor_app/android/app/src/prod/res/mipmap-hdpi/ic_launcher.png b/example/flavor_app/android/app/src/prod/res/mipmap-hdpi/ic_launcher.png index db77bb4..b1fb5b8 100644 Binary files a/example/flavor_app/android/app/src/prod/res/mipmap-hdpi/ic_launcher.png and b/example/flavor_app/android/app/src/prod/res/mipmap-hdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/prod/res/mipmap-mdpi/ic_launcher.png b/example/flavor_app/android/app/src/prod/res/mipmap-mdpi/ic_launcher.png index 17987b7..fa65e3d 100644 Binary files a/example/flavor_app/android/app/src/prod/res/mipmap-mdpi/ic_launcher.png and b/example/flavor_app/android/app/src/prod/res/mipmap-mdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/prod/res/mipmap-xhdpi/ic_launcher.png b/example/flavor_app/android/app/src/prod/res/mipmap-xhdpi/ic_launcher.png index 09d4391..e31fdf9 100644 Binary files a/example/flavor_app/android/app/src/prod/res/mipmap-xhdpi/ic_launcher.png and b/example/flavor_app/android/app/src/prod/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/prod/res/mipmap-xxhdpi/ic_launcher.png b/example/flavor_app/android/app/src/prod/res/mipmap-xxhdpi/ic_launcher.png index d5f1c8d..ae0059c 100644 Binary files a/example/flavor_app/android/app/src/prod/res/mipmap-xxhdpi/ic_launcher.png and b/example/flavor_app/android/app/src/prod/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/example/flavor_app/android/app/src/prod/res/mipmap-xxxhdpi/ic_launcher.png b/example/flavor_app/android/app/src/prod/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372e..6184f2f 100644 Binary files a/example/flavor_app/android/app/src/prod/res/mipmap-xxxhdpi/ic_launcher.png and b/example/flavor_app/android/app/src/prod/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/flavor_app/icons_launcher-dev.yaml b/example/flavor_app/icons_launcher-dev.yaml index 1e2255e..3a52907 100644 --- a/example/flavor_app/icons_launcher-dev.yaml +++ b/example/flavor_app/icons_launcher-dev.yaml @@ -1,19 +1,29 @@ -flutter_icons: - # image_path: 'assets/ic_logo_border.png' - image_path_android: 'assets/ic_logo_border.png' - image_path_ios: 'assets/ic_logo_rectangle.png' - image_path_macos: 'assets/ic_logo_border.png' - image_path_windows: 'assets/ic_logo_border.png' - image_path_linux: 'assets/ic_logo_border.png' - image_path_web: 'assets/ic_logo_border.png' - adaptive_icon_background: 'assets/ic_background.png' # only available for Android 8.0 devices and above - adaptive_icon_foreground: 'assets/ic_foreground.png' # only available for Android 8.0 devices and above - adaptive_icon_round: 'assets/ic_logo_round.png' # only available for Android 8.0 devices and above #! (Optional) - remove_alpha_ios: false - remove_alpha_macos: false - android: true - ios: true - macos: false - windows: true - linux: false - web: true +# flutter pub run icons_launcher:create --flavor dev + +icons_launcher: + image_path: 'assets/ic_logo_border.png' + platforms: + android: + enable: true + image_path: 'assets/ic_logo_border.png' + # adaptive_background_color: '#ffffff' + adaptive_background_image: 'assets/ic_background.png' + adaptive_foreground_image: 'assets/ic_foreground.png' + adaptive_round_image: 'assets/ic_logo_round.png' + ios: + enable: true + image_path: 'assets/ic_logo_rectangle.png' + web: + enable: true + image_path: 'assets/ic_logo_border.png' + favicon_path: 'assets/ic_logo_round.png' + macos: + enable: false + image_path: 'assets/ic_logo_border.png' + windows: + enable: false + image_path: 'assets/ic_logo_border.png' + linux: + enable: false + image_path: 'assets/ic_logo_border.png' + diff --git a/example/flavor_app/icons_launcher-prod.yaml b/example/flavor_app/icons_launcher-prod.yaml index 1e2255e..00f42db 100644 --- a/example/flavor_app/icons_launcher-prod.yaml +++ b/example/flavor_app/icons_launcher-prod.yaml @@ -1,19 +1,28 @@ -flutter_icons: - # image_path: 'assets/ic_logo_border.png' - image_path_android: 'assets/ic_logo_border.png' - image_path_ios: 'assets/ic_logo_rectangle.png' - image_path_macos: 'assets/ic_logo_border.png' - image_path_windows: 'assets/ic_logo_border.png' - image_path_linux: 'assets/ic_logo_border.png' - image_path_web: 'assets/ic_logo_border.png' - adaptive_icon_background: 'assets/ic_background.png' # only available for Android 8.0 devices and above - adaptive_icon_foreground: 'assets/ic_foreground.png' # only available for Android 8.0 devices and above - adaptive_icon_round: 'assets/ic_logo_round.png' # only available for Android 8.0 devices and above #! (Optional) - remove_alpha_ios: false - remove_alpha_macos: false - android: true - ios: true - macos: false - windows: true - linux: false - web: true +# flutter pub run icons_launcher:create --flavor prod + +icons_launcher: + image_path: 'assets/ic_logo_border.png' + platforms: + android: + enable: true + image_path: 'assets/ic_logo_border.png' + # adaptive_background_color: '#ffffff' + adaptive_background_image: 'assets/ic_background.png' + adaptive_foreground_image: 'assets/ic_foreground.png' + adaptive_round_image: 'assets/ic_logo_round.png' + ios: + enable: true + image_path: 'assets/ic_logo_rectangle.png' + web: + enable: true + image_path: 'assets/ic_logo_border.png' + favicon_path: 'assets/ic_logo_round.png' + macos: + enable: false + image_path: 'assets/ic_logo_border.png' + windows: + enable: false + image_path: 'assets/ic_logo_border.png' + linux: + enable: false + image_path: 'assets/ic_logo_border.png' diff --git a/example/flavor_app/ios/Runner.xcodeproj/project.pbxproj b/example/flavor_app/ios/Runner.xcodeproj/project.pbxproj index 449b192..09b9975 100644 --- a/example/flavor_app/ios/Runner.xcodeproj/project.pbxproj +++ b/example/flavor_app/ios/Runner.xcodeproj/project.pbxproj @@ -8,11 +8,19 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 303C4C73CD1BF7D2DFDCEB6F /* prodRelease.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 841020640266C5658663FA47 /* prodRelease.xcconfig */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 58AA590633C0746FB8214593 /* prodDebug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 64793F633A1B4C8842CFA2F9 /* prodDebug.xcconfig */; }; + 63C00EB346E24003C2606A2E /* devDebug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 7B89CC50CEF32C35C9AFF69E /* devDebug.xcconfig */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 75C6B49A62C65284FAEC21BE /* devProfile.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 33D4D7AD10565371F5AAD2A8 /* devProfile.xcconfig */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + A6AE008FE48608AEA8EF2061 /* devLaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 03112234335B3AD5DA1D9384 /* devLaunchScreen.storyboard */; }; + A95ED4503B63A482AC8D79F8 /* prodProfile.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9B939FA0B5716DECC7996056 /* prodProfile.xcconfig */; }; + C5F614F7E2FB2A8DB3F5261C /* prodLaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90A8B5B67B2ED57E73F887BE /* prodLaunchScreen.storyboard */; }; + FA12B17D0DDC7D08242A0CF6 /* devRelease.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = AE4D5F16F284A420F0A6E597 /* devRelease.xcconfig */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -29,12 +37,18 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 03112234335B3AD5DA1D9384 /* devLaunchScreen.storyboard */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file.storyboard; name = devLaunchScreen.storyboard; path = Runner/devLaunchScreen.storyboard; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 33D4D7AD10565371F5AAD2A8 /* devProfile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = devProfile.xcconfig; path = Flutter/devProfile.xcconfig; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 64793F633A1B4C8842CFA2F9 /* prodDebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = prodDebug.xcconfig; path = Flutter/prodDebug.xcconfig; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7B89CC50CEF32C35C9AFF69E /* devDebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = devDebug.xcconfig; path = Flutter/devDebug.xcconfig; sourceTree = ""; }; + 841020640266C5658663FA47 /* prodRelease.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = prodRelease.xcconfig; path = Flutter/prodRelease.xcconfig; sourceTree = ""; }; + 90A8B5B67B2ED57E73F887BE /* prodLaunchScreen.storyboard */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file.storyboard; name = prodLaunchScreen.storyboard; path = Runner/prodLaunchScreen.storyboard; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -42,6 +56,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9B939FA0B5716DECC7996056 /* prodProfile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = prodProfile.xcconfig; path = Flutter/prodProfile.xcconfig; sourceTree = ""; }; + AE4D5F16F284A420F0A6E597 /* devRelease.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = devRelease.xcconfig; path = Flutter/devRelease.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -62,6 +78,12 @@ 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, + 7B89CC50CEF32C35C9AFF69E /* devDebug.xcconfig */, + 33D4D7AD10565371F5AAD2A8 /* devProfile.xcconfig */, + AE4D5F16F284A420F0A6E597 /* devRelease.xcconfig */, + 64793F633A1B4C8842CFA2F9 /* prodDebug.xcconfig */, + 9B939FA0B5716DECC7996056 /* prodProfile.xcconfig */, + 841020640266C5658663FA47 /* prodRelease.xcconfig */, ); name = Flutter; sourceTree = ""; @@ -72,6 +94,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 03112234335B3AD5DA1D9384 /* devLaunchScreen.storyboard */, + 90A8B5B67B2ED57E73F887BE /* prodLaunchScreen.storyboard */, ); sourceTree = ""; }; @@ -163,6 +187,14 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + 63C00EB346E24003C2606A2E /* devDebug.xcconfig in Resources */, + 75C6B49A62C65284FAEC21BE /* devProfile.xcconfig in Resources */, + FA12B17D0DDC7D08242A0CF6 /* devRelease.xcconfig in Resources */, + 58AA590633C0746FB8214593 /* prodDebug.xcconfig in Resources */, + A95ED4503B63A482AC8D79F8 /* prodProfile.xcconfig in Resources */, + 303C4C73CD1BF7D2DFDCEB6F /* prodRelease.xcconfig in Resources */, + A6AE008FE48608AEA8EF2061 /* devLaunchScreen.storyboard in Resources */, + C5F614F7E2FB2A8DB3F5261C /* prodLaunchScreen.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -302,6 +334,76 @@ }; name = Profile; }; + 82E67C9D5D873DAE2A1CCDB8 /* Release-dev */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AE4D5F16F284A420F0A6E597 /* devRelease.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.example.dev; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = "Release-dev"; + }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -452,6 +554,358 @@ }; name = Release; }; + B5F173A508C58DA80910C686 /* Release-prod */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 841020640266C5658663FA47 /* prodRelease.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.example.prod; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = "Release-prod"; + }; + BD75D8911AFA5BAA4D3BCEC7 /* Debug-prod */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 64793F633A1B4C8842CFA2F9 /* prodDebug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.example.prod; + SDKROOT = iphoneos; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Debug-prod"; + }; + C21AF1CE2D8A6B32F1CE6BEB /* Profile-dev */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33D4D7AD10565371F5AAD2A8 /* devProfile.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.example.dev; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = "Profile-dev"; + }; + DB07A7643658C2D218AB9352 /* Debug-dev */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7B89CC50CEF32C35C9AFF69E /* devDebug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.example.dev; + SDKROOT = iphoneos; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Debug-dev"; + }; + FFEAE541AD7763F36092F005 /* Profile-prod */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9B939FA0B5716DECC7996056 /* prodProfile.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.example.prod; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = "Profile-prod"; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -461,6 +915,12 @@ 97C147031CF9000F007C117D /* Debug */, 97C147041CF9000F007C117D /* Release */, 249021D3217E4FDB00AE95B9 /* Profile */, + DB07A7643658C2D218AB9352 /* Debug-dev */, + C21AF1CE2D8A6B32F1CE6BEB /* Profile-dev */, + 82E67C9D5D873DAE2A1CCDB8 /* Release-dev */, + BD75D8911AFA5BAA4D3BCEC7 /* Debug-prod */, + FFEAE541AD7763F36092F005 /* Profile-prod */, + B5F173A508C58DA80910C686 /* Release-prod */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/example/flavor_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/dev.xcscheme b/example/flavor_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/dev.xcscheme new file mode 100644 index 0000000..aba8edc --- /dev/null +++ b/example/flavor_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/dev.xcscheme @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/flavor_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/prod.xcscheme b/example/flavor_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/prod.xcscheme new file mode 100644 index 0000000..3cf80c8 --- /dev/null +++ b/example/flavor_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/prod.xcscheme @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-1024x1024@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-1024x1024@1x.png deleted file mode 100644 index df3b225..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-1024x1024@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@1x.png deleted file mode 100644 index 69c25fe..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@2x.png deleted file mode 100644 index d93e7fd..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@3x.png deleted file mode 100644 index 9fbc865..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-20x20@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@1x.png deleted file mode 100644 index 5f91155..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@2x.png deleted file mode 100644 index 06d76d7..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@3x.png deleted file mode 100644 index be40f97..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-29x29@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@1x.png deleted file mode 100644 index d93e7fd..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@2x.png deleted file mode 100644 index 8fa1963..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@3x.png deleted file mode 100644 index fc455d0..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-40x40@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-60x60@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-60x60@2x.png deleted file mode 100644 index fc455d0..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-60x60@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-60x60@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-60x60@3x.png deleted file mode 100644 index 42a4bb5..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-60x60@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-76x76@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-76x76@1x.png deleted file mode 100644 index b8005ef..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-76x76@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-76x76@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-76x76@2x.png deleted file mode 100644 index b997fd5..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-76x76@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-83.5x83.5@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-83.5x83.5@2x.png deleted file mode 100644 index ae3c8c0..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-83.5x83.5@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/Contents.json b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/Contents.json deleted file mode 100644 index 7f86512..0000000 --- a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/Contents.json +++ /dev/null @@ -1 +0,0 @@ -{"images":[{"size":"20x20","idiom":"iphone","filename":"AppIcon-dev-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"AppIcon-dev-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"AppIcon-dev-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"AppIcon-dev-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"AppIcon-dev-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"AppIcon-dev-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"AppIcon-dev-40x40@3x.png","scale":"3x"},{"size":"50x50","idiom":"iphone","filename":"AppIcon-dev-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"iphone","filename":"AppIcon-dev-50x50@2x.png","scale":"2x"},{"size":"57x57","idiom":"iphone","filename":"AppIcon-dev-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"AppIcon-dev-57x57@3x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"AppIcon-dev-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"AppIcon-dev-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"AppIcon-dev-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"AppIcon-dev-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"AppIcon-dev-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"AppIcon-dev-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"AppIcon-dev-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"AppIcon-dev-40x40@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"AppIcon-dev-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"AppIcon-dev-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"AppIcon-dev-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"AppIcon-dev-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"AppIcon-dev-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"AppIcon-dev-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} \ No newline at end of file diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-1024x1024@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-1024x1024@1x.png deleted file mode 100644 index df3b225..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-1024x1024@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@1x.png deleted file mode 100644 index 69c25fe..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@2x.png deleted file mode 100644 index d93e7fd..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@3x.png deleted file mode 100644 index 9fbc865..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-20x20@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@1x.png deleted file mode 100644 index 5f91155..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@2x.png deleted file mode 100644 index 06d76d7..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@3x.png deleted file mode 100644 index be40f97..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-29x29@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@1x.png deleted file mode 100644 index d93e7fd..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@2x.png deleted file mode 100644 index 8fa1963..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@3x.png deleted file mode 100644 index fc455d0..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-40x40@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-60x60@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-60x60@2x.png deleted file mode 100644 index fc455d0..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-60x60@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-60x60@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-60x60@3x.png deleted file mode 100644 index 42a4bb5..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-60x60@3x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-76x76@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-76x76@1x.png deleted file mode 100644 index b8005ef..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-76x76@1x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-76x76@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-76x76@2x.png deleted file mode 100644 index b997fd5..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-76x76@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-83.5x83.5@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-83.5x83.5@2x.png deleted file mode 100644 index ae3c8c0..0000000 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-83.5x83.5@2x.png and /dev/null differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/Contents.json b/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/Contents.json deleted file mode 100644 index 1a0e76c..0000000 --- a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/Contents.json +++ /dev/null @@ -1 +0,0 @@ -{"images":[{"size":"20x20","idiom":"iphone","filename":"AppIcon-prod-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"AppIcon-prod-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"AppIcon-prod-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"AppIcon-prod-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"AppIcon-prod-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"AppIcon-prod-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"AppIcon-prod-40x40@3x.png","scale":"3x"},{"size":"50x50","idiom":"iphone","filename":"AppIcon-prod-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"iphone","filename":"AppIcon-prod-50x50@2x.png","scale":"2x"},{"size":"57x57","idiom":"iphone","filename":"AppIcon-prod-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"AppIcon-prod-57x57@3x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"AppIcon-prod-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"AppIcon-prod-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"AppIcon-prod-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"AppIcon-prod-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"AppIcon-prod-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"AppIcon-prod-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"AppIcon-prod-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"AppIcon-prod-40x40@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"AppIcon-prod-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"AppIcon-prod-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"AppIcon-prod-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"AppIcon-prod-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"AppIcon-prod-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"AppIcon-prod-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} \ No newline at end of file diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-1024x1024@1x.png index dc9ada4..df3b225 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-1024x1024@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf0..69c25fe 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd9..d93e7fd 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b..9fbc865 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@1x.png index 4cde121..5f91155 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e..06d76d7 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@3x.png index dcdc230..be40f97 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd9..d93e7fd 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8..8fa1963 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b86..fc455d0 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-50x50@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-50x50@1x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-50x50@1x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-50x50@1x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-50x50@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-50x50@2x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-50x50@2x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-50x50@2x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-57x57@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-57x57@1x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-57x57@1x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-57x57@1x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-57x57@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-57x57@2x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-57x57@2x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-57x57@2x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b86..fc455d0 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@3x.png index 75b2d16..42a4bb5 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-72x72@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-72x72@1x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-72x72@1x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-72x72@1x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-72x72@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-72x72@2x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-dev.appiconset/AppIcon-dev-72x72@2x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-72x72@2x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d..b8005ef 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@2x.png index 6a84f41..b997fd5 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-83.5x83.5@2x.png index d0e1f58..ae3c8c0 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/devAppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-1024x1024@1x.png index dc9ada4..df3b225 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-1024x1024@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf0..69c25fe 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd9..d93e7fd 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b..9fbc865 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@1x.png index 4cde121..5f91155 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e..06d76d7 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@3x.png index dcdc230..be40f97 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd9..d93e7fd 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8..8fa1963 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b86..fc455d0 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-50x50@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-50x50@1x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-50x50@1x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-50x50@1x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-50x50@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-50x50@2x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-50x50@2x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-50x50@2x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-57x57@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-57x57@1x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-57x57@1x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-57x57@1x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-57x57@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-57x57@2x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-57x57@2x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-57x57@2x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b86..fc455d0 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@3x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@3x.png index 75b2d16..42a4bb5 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@3x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-72x72@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-72x72@1x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-72x72@1x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-72x72@1x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-72x72@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-72x72@2x.png similarity index 100% rename from example/flavor_app/ios/Runner/Assets.xcassets/AppIcon-prod.appiconset/AppIcon-prod-72x72@2x.png rename to example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-72x72@2x.png diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@1x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d..b8005ef 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@1x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@2x.png index 6a84f41..b997fd5 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-83.5x83.5@2x.png index d0e1f58..ae3c8c0 100644 Binary files a/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/example/flavor_app/ios/Runner/Assets.xcassets/prodAppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/flavor_app/lib/app.dart b/example/flavor_app/lib/app.dart index 3e56aca..5461412 100644 --- a/example/flavor_app/lib/app.dart +++ b/example/flavor_app/lib/app.dart @@ -5,8 +5,6 @@ import 'flavors.dart'; import 'pages/my_home_page.dart'; class App extends StatelessWidget { - const App({super.key}); - @override Widget build(BuildContext context) { return MaterialApp( @@ -15,7 +13,7 @@ class App extends StatelessWidget { primarySwatch: Colors.blue, ), home: _flavorBanner( - child: const MyHomePage(), + child: MyHomePage(), show: kDebugMode, ), ); @@ -27,15 +25,15 @@ class App extends StatelessWidget { }) => show ? Banner( + child: child, location: BannerLocation.topStart, message: F.name, color: Colors.green.withOpacity(0.6), - textStyle: const TextStyle( + textStyle: TextStyle( fontWeight: FontWeight.w700, fontSize: 12.0, letterSpacing: 1.0), textDirection: TextDirection.ltr, - child: child, ) : Container( child: child, diff --git a/example/flavor_app/lib/flavors.dart b/example/flavor_app/lib/flavors.dart index c2632b9..21557ae 100644 --- a/example/flavor_app/lib/flavors.dart +++ b/example/flavor_app/lib/flavors.dart @@ -1,6 +1,6 @@ enum Flavor { - dev, - prod, + DEV, + PROD, } class F { @@ -10,9 +10,9 @@ class F { static String get title { switch (appFlavor) { - case Flavor.dev: + case Flavor.DEV: return 'Dev App'; - case Flavor.prod: + case Flavor.PROD: return 'Prod App'; default: return 'title'; diff --git a/example/flavor_app/lib/main_dev.dart b/example/flavor_app/lib/main_dev.dart index ca3497e..e3558c1 100644 --- a/example/flavor_app/lib/main_dev.dart +++ b/example/flavor_app/lib/main_dev.dart @@ -3,6 +3,6 @@ import 'app.dart'; import 'flavors.dart'; void main() { - F.appFlavor = Flavor.dev; - runApp(const App()); + F.appFlavor = Flavor.DEV; + runApp(App()); } diff --git a/example/flavor_app/lib/main_prod.dart b/example/flavor_app/lib/main_prod.dart index 7a2744c..943cbb1 100644 --- a/example/flavor_app/lib/main_prod.dart +++ b/example/flavor_app/lib/main_prod.dart @@ -3,6 +3,6 @@ import 'app.dart'; import 'flavors.dart'; void main() { - F.appFlavor = Flavor.prod; - runApp(const App()); + F.appFlavor = Flavor.PROD; + runApp(App()); } diff --git a/example/flavor_app/lib/pages/my_home_page.dart b/example/flavor_app/lib/pages/my_home_page.dart index 50becaa..b6703ce 100644 --- a/example/flavor_app/lib/pages/my_home_page.dart +++ b/example/flavor_app/lib/pages/my_home_page.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import '../flavors.dart'; class MyHomePage extends StatelessWidget { - const MyHomePage({super.key}); - @override Widget build(BuildContext context) { return Scaffold( diff --git a/example/flavor_app/web/favicon.png b/example/flavor_app/web/favicon.png index 2338424..f023d85 100644 Binary files a/example/flavor_app/web/favicon.png and b/example/flavor_app/web/favicon.png differ diff --git a/example/simple_app/android/app/src/main/AndroidManifest.xml b/example/simple_app/android/app/src/main/AndroidManifest.xml index 744342a..f38c1f7 100644 --- a/example/simple_app/android/app/src/main/AndroidManifest.xml +++ b/example/simple_app/android/app/src/main/AndroidManifest.xml @@ -4,7 +4,7 @@ android:label="simple_app" android:name="${applicationName}" android:icon="@mipmap/ic_launcher" - android:roundIcon="@mipmap/ic_launcher_round"> + android:roundIcon="@mipmap/ic_launcher_round"> + + #FFFFFFFF + \ No newline at end of file diff --git a/example/simple_app/icons_launcher.yaml b/example/simple_app/icons_launcher.yaml index 3b0d52b..1e9c2e4 100644 --- a/example/simple_app/icons_launcher.yaml +++ b/example/simple_app/icons_launcher.yaml @@ -1,19 +1,28 @@ -flutter_icons: - # image_path: 'assets/ic_logo_border.png' - image_path_android: 'assets/ic_logo_border.png' - image_path_ios: 'assets/ic_logo_rectangle.png' - image_path_macos: 'assets/ic_logo_border.png' - image_path_windows: 'assets/ic_logo_border.png' - image_path_linux: 'assets/ic_logo_border.png' - image_path_web: 'assets/ic_logo_border.png' - adaptive_icon_background: 'assets/ic_background.png' # only available for Android 8.0 devices and above - adaptive_icon_foreground: 'assets/ic_foreground.png' # only available for Android 8.0 devices and above - adaptive_icon_round: 'assets/ic_logo_round.png' # only available for Android 8.0 devices and above #! (Optional) - remove_alpha_ios: false - remove_alpha_macos: false - android: true - ios: true - macos: false - windows: true - linux: true - web: true +# flutter pub run icons_launcher:create + +icons_launcher: + image_path: 'assets/ic_logo_border.png' + platforms: + android: + enable: true + image_path: 'assets/ic_logo_border.png' + # adaptive_background_color: '#ffffff' + adaptive_background_image: 'assets/ic_background.png' + adaptive_foreground_image: 'assets/ic_foreground.png' + adaptive_round_image: 'assets/ic_logo_round.png' + ios: + enable: true + image_path: 'assets/ic_logo_rectangle.png' + web: + enable: true + image_path: 'assets/ic_logo_border.png' + favicon_path: 'assets/ic_logo_round.png' + macos: + enable: false + image_path: 'assets/ic_logo_border.png' + windows: + enable: false + image_path: 'assets/ic_logo_border.png' + linux: + enable: false + image_path: 'assets/ic_logo_border.png' diff --git a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png index 3c4935a..d119f4c 100644 Binary files a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png index ed4cc16..7e9d0da 100644 Binary files a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png index 483be61..2338424 100644 Binary files a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png index bcbf36d..a0a06e7 100644 Binary files a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png index 9c0a652..05a2e1c 100644 Binary files a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png index e71a726..7878c2c 100644 Binary files a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png index 8a31fe2..f96b18a 100644 Binary files a/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and b/example/simple_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/example/simple_app/web/favicon.png b/example/simple_app/web/favicon.png index 2338424..f023d85 100644 Binary files a/example/simple_app/web/favicon.png and b/example/simple_app/web/favicon.png differ diff --git a/lib/cli_commands.dart b/lib/cli_commands.dart new file mode 100644 index 0000000..71dd551 --- /dev/null +++ b/lib/cli_commands.dart @@ -0,0 +1,421 @@ +library icons_launcher_cli; + +import 'package:icons_launcher/utils/cli_logger.dart'; +import 'package:icons_launcher/utils/constants.dart'; +import 'package:icons_launcher/utils/icon.dart'; +import 'package:path/path.dart' as p; +import 'package:universal_io/io.dart'; +import 'package:yaml/yaml.dart'; +import 'utils/template.dart'; +import 'utils/utils.dart'; +part 'utils/flavor_helper.dart'; +part 'src/android.dart'; +part 'src/ios.dart'; +part 'src/macos.dart'; +part 'src/web.dart'; +part 'src/windows.dart'; +part 'src/linux.dart'; + +late _FlavorHelper _flavorHelper; + +/// Create launcher icons +void createLauncherIcons({String? path, String? flavor}) { + if (flavor != null) { + print('📱 Flavor $flavor detected! (Android, iOS)\n'); + } + _flavorHelper = _FlavorHelper(flavor); + final config = _getConfig(configFile: path); + _checkConfig(config); + _createIconsByConfig(config); +} + +/// Get config file +Map _getConfig({String? configFile}) { + String filePath; + if (configFile != null) { + if (File(configFile).existsSync()) { + filePath = configFile; + } else { + CliLogger.error('The config file `$configFile` was not found.'); + exit(1); + } + } else if (_flavorHelper.flavor != null) { + filePath = 'icons_launcher-${_flavorHelper.flavor}.yaml'; + } else if (File('icons_launcher.yaml').existsSync()) { + filePath = 'icons_launcher.yaml'; + } else { + filePath = 'pubspec.yaml'; + } + + final Map yamlMap = loadYaml(File(filePath).readAsStringSync()) as Map; + + if (yamlMap['icons_launcher'] is! Map) { + CliLogger.error( + "Your $filePath file does not contain a 'icons_launcher' section."); + exit(1); + } + + // yamlMap has the type YamlMap, which has several unwanted side effects + return _yamlToMap(yamlMap['icons_launcher'] as YamlMap); +} + +/// Convert yaml to map +Map _yamlToMap(YamlMap yamlMap) { + final Map map = {}; + for (final MapEntry entry in yamlMap.entries) { + if (entry.value is YamlList) { + final list = []; + for (final value in entry.value as YamlList) { + if (value is String) { + list.add(value); + } + } + map[entry.key as String] = list; + } else if (entry.value is YamlMap) { + map[entry.key as String] = _yamlToMap(entry.value as YamlMap); + } else { + map[entry.key as String] = entry.value; + } + } + return map; +} + +/// Validate config options +void _checkConfig(Map config) { + if (!hasPlatformConfig(config)) { + CliLogger.error('Please add a `platforms` target to your config file.'); + exit(1); + } + final List errors = []; + final globalImagePath = + _checkImageExists(config: config, parameter: 'image_path'); + + final platforms = config['platforms'] as Map; + + // ANDROID + if (isNeedingNewAndroidIcon(platforms)) { + final androidConfig = platforms['android'] as Map; + final androidImagePath = + _checkImageExists(config: androidConfig, parameter: 'image_path') ?? + globalImagePath; + if (androidImagePath == null) { + errors.add('Please add a `image_path` for Android to your config file.'); + } + + if (androidConfig.containsKey('adaptive_foreground_image') && + !androidConfig.containsKey('adaptive_background_image') && + !androidConfig.containsKey('adaptive_background_color')) { + errors.add( + 'Please add an `adaptive_background_image` or `adaptive_background_color` for Android to your config file.'); + } + + if (!androidConfig.containsKey('adaptive_foreground_image') && + (androidConfig.containsKey('adaptive_background_image') || + androidConfig.containsKey('adaptive_background_color'))) { + errors.add( + 'Please add an `adaptive_foreground_image` for Android to your config file.'); + } + + if (androidConfig.containsKey('adaptive_background_image') && + androidConfig.containsKey('adaptive_background_color')) { + errors.add('Your Android platform can not contain both ' + '`adaptive_background_image` and `adaptive_background_color`.'); + } + } + + // IOS + if (isNeedingNewIosIcon(platforms)) { + final iosConfig = platforms['ios'] as Map; + final iosImagePath = + _checkImageExists(config: iosConfig, parameter: 'image_path') ?? + globalImagePath; + if (iosImagePath == null) { + errors.add('Please add a `image_path` for IOS to your config file.'); + } + } + + // MACOS + if (isNeedingNewMacOSIcon(platforms)) { + final macosConfig = platforms['macos'] as Map; + final macosImagePath = + _checkImageExists(config: macosConfig, parameter: 'image_path') ?? + globalImagePath; + if (macosImagePath == null) { + errors.add('Please add a `image_path` for MacOS to your config file.'); + } + } + + // WEB + if (isNeedingNewWebIcon(platforms)) { + final webConfig = platforms['web'] as Map; + final webImagePath = + _checkImageExists(config: webConfig, parameter: 'image_path') ?? + globalImagePath; + if (webImagePath == null) { + errors.add('Please add a `image_path` for Web to your config file.'); + } + } + + // WINDOWS + if (isNeedingNewWindowsIcon(platforms)) { + final windowsConfig = platforms['windows'] as Map; + final windowsImagePath = + _checkImageExists(config: windowsConfig, parameter: 'image_path') ?? + globalImagePath; + if (windowsImagePath == null) { + errors.add('Please add a `image_path` for Windows to your config file.'); + } + } + + // LINUX + if (isNeedingNewLinuxIcon(platforms)) { + final linuxConfig = platforms['linux'] as Map; + final linuxImagePath = + _checkImageExists(config: linuxConfig, parameter: 'image_path') ?? + globalImagePath; + if (linuxImagePath == null) { + errors.add('Please add a `image_path` for Linux to your config file.'); + } + } + + if (errors.isNotEmpty) { + errors.forEach(CliLogger.error); + exit(1); + } +} + +/// Create icons base on config +void _createIconsByConfig(Map config) { + // Global image path + final imagePath = _checkImageExists(config: config, parameter: 'image_path'); + final platforms = config['platforms'] as Map; + + String? imagePathAndroid = imagePath; + if (isNeedingNewAndroidIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['android'], + parameter: 'image_path', + ); + if (newImagePath != null) { + imagePathAndroid = newImagePath; + } + if (imagePathAndroid == null) { + CliLogger.error('Could not find image path for Android'); + exit(1); + } + } + + String? imagePathIos = imagePath; + if (isNeedingNewIosIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['ios'], + parameter: 'image_path', + ); + if (newImagePath != null) { + imagePathIos = newImagePath; + } + if (imagePathIos == null) { + CliLogger.error('Could not find image path for iOS'); + exit(1); + } + } + + String? imagePathMacos = imagePath; + if (isNeedingNewMacOSIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['macos'], + parameter: 'image_path', + ); + if (newImagePath != null) { + imagePathMacos = newImagePath; + } + if (imagePathMacos == null) { + CliLogger.error('Could not find image path for macOS'); + exit(1); + } + } + + String? imagePathWindows = imagePath; + if (isNeedingNewWindowsIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['windows'], + parameter: 'image_path', + ); + if (newImagePath != null) { + imagePathWindows = newImagePath; + } + if (imagePathWindows == null) { + CliLogger.error('Could not find image path for Windows'); + exit(1); + } + } + + String? imagePathLinux = imagePath; + if (isNeedingNewLinuxIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['linux'], + parameter: 'image_path', + ); + if (newImagePath != null) { + imagePathLinux = newImagePath; + } + if (imagePathLinux == null) { + CliLogger.error('Could not find image path for Linux'); + exit(1); + } + } + + String? imagePathWeb = imagePath; + if (isNeedingNewWebIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['web'], + parameter: 'image_path', + ); + if (newImagePath != null) { + imagePathWeb = newImagePath; + } + if (imagePathWeb == null) { + CliLogger.error('Could not find image path for Web'); + exit(1); + } + } + + String? faviconPathWeb = imagePathWeb; + if (isNeedingNewWebIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['web'], + parameter: 'favicon_path', + ); + if (newImagePath != null) { + faviconPathWeb = newImagePath; + } + } + + String? adaptiveBgImage; + if (isNeedingNewAndroidIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['android'], + parameter: 'adaptive_background_image', + ); + if (newImagePath != null) { + adaptiveBgImage = newImagePath; + } + } + + String? adaptiveFgImage; + if (isNeedingNewAndroidIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['android'], + parameter: 'adaptive_foreground_image', + ); + if (newImagePath != null) { + adaptiveFgImage = newImagePath; + } + } + + String? adaptiveRoundImage; + if (isNeedingNewAndroidIcon(platforms)) { + final newImagePath = _checkImageExists( + config: platforms['android'], + parameter: 'adaptive_round_image', + ); + if (newImagePath != null) { + adaptiveRoundImage = newImagePath; + } + } + + //! Android + if (isNeedingNewAndroidIcon(platforms) && imagePathAndroid != null) { + _createAndroidIcons(imagePath: imagePathAndroid); + } + + String? adaptiveBg; + if (platforms['android'].containsKey('adaptive_background_color')) { + final adaptiveBgColor = + platforms['android']['adaptive_background_color'].toString(); + adaptiveBg = adaptiveBgColor; + } else if (adaptiveBgImage != null) { + adaptiveBg = adaptiveBgImage; + } + + //! Android Adaptive + final isAdaptiveIconExists = adaptiveBg != null && adaptiveFgImage != null; + if (hasAndroidAdaptiveConfig(platforms) && isAdaptiveIconExists) { + final int minSdk = _minSdk(); + if (minSdk == 0) { + CliLogger.error( + 'Can not find minSdk from android/app/build.gradle or android/local.properties', + level: CliLoggerLevel.two); + exit(1); + } + if (minSdk < 26 && imagePathAndroid == null) { + CliLogger.error( + 'Adaptive icon config found but no regular Android config. API 26 the regular Android config is required', + level: CliLoggerLevel.two); + exit(1); + } + _createAndroidAdaptiveIcon( + background: adaptiveBg, + foreground: adaptiveFgImage, + round: adaptiveRoundImage, + ); + } + + //! iOS + if (isNeedingNewIosIcon(platforms) && imagePathIos != null) { + _createIosIcons(imagePath: imagePathIos); + } + + //! macOS + if (isNeedingNewMacOSIcon(platforms) && imagePathMacos != null) { + _createMacOSIcons(imagePath: imagePathMacos); + } + + //! Web + if (isNeedingNewWebIcon(platforms)) { + if (imagePathWeb != null) { + _createWebIcons(imagePath: imagePathWeb); + } + if (faviconPathWeb != null) { + _createWebFavicon(imagePath: faviconPathWeb); + } + } + + //! Windows + if (isNeedingNewWindowsIcon(platforms) && imagePathWindows != null) { + _createWindowsIcons(imagePath: imagePathWindows); + } + + //! Linux + if (isNeedingNewLinuxIcon(platforms) && imagePathLinux != null) { + _createLinuxIcons(imagePath: imagePathLinux); + } +} + +/// Check image exists +String? _checkImageExists({ + required Map config, + required String parameter, +}) { + final String? image = config[parameter]?.toString(); + if (image != null) { + if (image.isNotEmpty && !File(image).existsSync()) { + CliLogger.error( + 'The file "$image" set as the parameter "$parameter" was not found.', + ); + exit(1); + } + + final imageExtension = p.extension(image).toLowerCase(); + if (imageExtension != '.png' && + imageExtension != '.jpg' && + imageExtension != '.jpeg') { + CliLogger.error( + 'Unsupported file format: $image Your image must be a JPG, JPEG or PNG file.', + ); + exit(1); + } + } + + return image == '' ? null : image; +} diff --git a/lib/constants.dart b/lib/constants.dart deleted file mode 100644 index 0966f25..0000000 --- a/lib/constants.dart +++ /dev/null @@ -1,63 +0,0 @@ -const String flutterSdkGradleFile = - '/packages/flutter_tools/gradle/flutter.gradle'; -String androidMainFolder(String? flavor) => - "android/app/src/${flavor ?? 'main'}/"; -String androidResFolder(String? flavor) => - "android/app/src/${flavor ?? 'main'}/res/"; -String androidColorsFile(String? flavor) => - "android/app/src/${flavor ?? 'main'}/res/values/colors.xml"; -const String androidLocalProperties = 'android/local.properties'; -const String androidManifestFile = 'android/app/src/main/AndroidManifest.xml'; -const String androidGradleFile = 'android/app/build.gradle'; -const String androidFileName = 'ic_launcher.png'; -const String androidRoundFileName = 'ic_launcher_round.png'; -const String androidAdaptiveForegroundFileName = 'ic_launcher_foreground.png'; -const String androidAdaptiveBackgroundFileName = 'ic_launcher_background.png'; -const String androidPlayStoreFileName = 'ic_launcher-playstore.png'; -String androidAdaptiveXmlFolder(String? flavor) => - androidResFolder(flavor) + 'mipmap-anydpi-v26/'; -const String androidDefaultIconName = 'ic_launcher'; -const String androidDefaultRoundIconName = 'ic_launcher_round'; - -const String iosDefaultIconFolder = - 'ios/Runner/Assets.xcassets/AppIcon.appiconset/'; -const String iosAssetFolder = 'ios/Runner/Assets.xcassets/'; -const String iosConfigFile = 'ios/Runner.xcodeproj/project.pbxproj'; -const String iosDefaultIconName = 'Icon-App'; - -const String macosDefaultIconFolder = - 'macos/Runner/Assets.xcassets/AppIcon.appiconset/'; -const String macosAssetFolder = 'macos/Runner/Assets.xcassets/'; -const String macosConfigFile = 'macos/Runner.xcodeproj/project.pbxproj'; -const String macosDefaultIconName = 'app_icon'; - -const String windowsDefaultIconFolder = 'windows/runner/resources/'; -const String windowsDefaultIconName = 'app_icon'; - -const String linuxDefaultIconFolder = 'snap/gui/'; -const String linuxDefaultIconName = 'app_icon'; - -const String webDefaultFaviconFolder = 'web/'; -const String webDefaultIconFolder = 'web/icons/'; - -const String errorMissingImagePath = - 'Missing "image_path" or "image_path_android" + "image_path_ios" within configuration'; -const String errorMissingPlatform = - 'No platform specified within config to generate icons for.'; -const String errorMissingRegularAndroid = - 'Adaptive icon config found but no regular Android config. ' - 'Below API 26 the regular Android config is required'; -const String errorIncorrectIconName = - 'The icon name must contain only lowercase a-z, 0-9, or underscore: ' - 'E.g. "ic_my_new_icon"'; -const String errorMissingMinSdk = - 'Cannot not find minSdkVersion from android/app/build.gradle or android/local.properties' - 'Specify minSdkVersion in either android/app/build.gradle or android/local.properties'; - -String introMessage() { - return '''\n -═════════════════════════════════════════════ - ✨ ICONS LAUNCHER STARTING ✨ - v1.2.1 -═════════════════════════════════════════════\n'''; -} diff --git a/lib/custom_exceptions.dart b/lib/custom_exceptions.dart deleted file mode 100644 index ae9ac08..0000000 --- a/lib/custom_exceptions.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:icons_launcher/utils.dart'; - -class InvalidAndroidIconNameException implements Exception { - const InvalidAndroidIconNameException([this.message]); - final String? message; - - @override - String toString() { - return generateError(this, message); - } -} - -class InvalidConfigException implements Exception { - const InvalidConfigException([this.message]); - final String? message; - - @override - String toString() { - return generateError(this, message); - } -} - -class NoConfigFoundException implements Exception { - const NoConfigFoundException([this.message]); - final String? message; - - @override - String toString() { - return generateError(this, message); - } -} - -class NoDecoderForImageFormatException implements Exception { - const NoDecoderForImageFormatException([this.message]); - final String? message; - - @override - String toString() { - return generateError(this, message); - } -} diff --git a/lib/main.dart b/lib/main.dart deleted file mode 100644 index 35a9dc2..0000000 --- a/lib/main.dart +++ /dev/null @@ -1,292 +0,0 @@ -import 'package:args/args.dart'; -import 'package:icons_launcher/constants.dart'; -import 'package:icons_launcher/custom_exceptions.dart'; -import 'package:icons_launcher/src/android.dart' as android_icons_launcher; -import 'package:icons_launcher/src/ios.dart' as ios_icons_launcher; -import 'package:icons_launcher/src/linux.dart' as linux_icons_launcher; -import 'package:icons_launcher/src/macos.dart' as macos_icons_launcher; -import 'package:icons_launcher/src/web.dart' as web_icons_launcher; -import 'package:icons_launcher/src/windows.dart' as windows_icons_launcher; -import 'package:path/path.dart' as path; -import 'package:universal_io/io.dart'; -import 'package:yaml/yaml.dart'; - -const String fileOption = 'file'; -const String helpFlag = 'help'; -const String defaultConfigFile = 'icons_launcher.yaml'; -const String flavorConfigFilePattern = r'^icons_launcher-(.*).yaml$'; -String flavorConfigFile(String flavor) => 'icons_launcher-$flavor.yaml'; - -/// Returns a list of all the flavors found in the config file. -List getFlavors() { - final List flavors = []; - for (var item in Directory('.').listSync()) { - if (item is File) { - final name = path.basename(item.path); - final match = RegExp(flavorConfigFilePattern).firstMatch(name); - if (match != null) { - flavors.add(match.group(1)!); - } - } - } - return flavors; -} - -/// Creates icons from the arguments passed to the program. -Future createIconsFromArguments(List arguments) async { - print(introMessage()); - - final ArgParser parser = ArgParser(allowTrailingOptions: true); - parser.addFlag(helpFlag, abbr: 'h', help: 'Usage help', negatable: false); - // Make default null to differentiate when it is explicitly set - parser.addOption(fileOption, - abbr: 'f', help: 'Config file (default: $defaultConfigFile)'); - final ArgResults argResults = parser.parse(arguments); - - if (argResults[helpFlag]) { - stdout.writeln('Generates icons for iOS and Android'); - stdout.writeln(parser.usage); - exit(0); - } - - // Flavors management - final flavors = getFlavors(); - final hasFlavors = flavors.isNotEmpty; - - // Load the config file - final Map? yamlConfig = - loadConfigFileFromArgResults(argResults, verbose: true); - - if (yamlConfig == null) { - throw const NoConfigFoundException(); - } - - // Create icons - if (!hasFlavors) { - try { - await createIconsFromConfig(yamlConfig); - print('\n✓ Successfully generated launcher icons'); - } catch (e) { - stderr.writeln('\n✕ Could not generate launcher icons'); - stderr.writeln(e); - exit(2); - } - } else { - try { - for (String flavor in flavors) { - print('\nFlavor: $flavor'); - final Map yamlConfig = - loadConfigFile(flavorConfigFile(flavor), flavorConfigFile(flavor)); - await createIconsFromConfig(yamlConfig, flavor); - } - print('\n✓ Successfully generated launcher icons for flavors'); - } catch (e) { - stderr.writeln('\n✕ Could not generate launcher icons for flavors'); - stderr.writeln(e); - exit(2); - } - } -} - -/// Loads the config file from the arguments passed to the program. -/// Generate launcher icons base on config file. -Future createIconsFromConfig(Map config, - [String? flavor]) async { - if (!isImagePathInConfig(config)) { - throw const InvalidConfigException(errorMissingImagePath); - } - if (!hasPlatformConfig(config)) { - throw const InvalidConfigException(errorMissingPlatform); - } - - if (isNeedingNewAndroidIcon(config) || hasAndroidAdaptiveConfig(config)) { - final int minSdk = android_icons_launcher.minSdk(); - if (minSdk == 0) { - throw const InvalidConfigException(errorMissingMinSdk); - } - if (minSdk < 26 && - hasAndroidAdaptiveConfig(config) && - !hasAndroidConfig(config)) { - throw const InvalidConfigException(errorMissingRegularAndroid); - } - } - - if (isNeedingNewAndroidIcon(config)) { - android_icons_launcher.createDefaultIcons(config, flavor); - } - if (hasAndroidAdaptiveConfig(config)) { - android_icons_launcher.createAdaptiveIcons(config, flavor); - } - if (isNeedingNewIOSIcon(config)) { - ios_icons_launcher.createIcons(config, flavor); - } - - if (isNeedingNewMacOSIcon(config)) { - macos_icons_launcher.createIcons(config, flavor); - } - - if (isNeedingNewWindowsIcon(config)) { - windows_icons_launcher.createIcons(config, flavor); - } - - if (isNeedingNewLinuxIcon(config)) { - linux_icons_launcher.createIcons(config, flavor); - } - - if (isNeedingNewWebIcon(config)) { - web_icons_launcher.createIcons(config, flavor); - } -} - -/// Loads the config file from the arguments passed to the program. -Map? loadConfigFileFromArgResults(ArgResults argResults, - {bool verbose = false}) { - final String? configFile = argResults[fileOption]; - final String? fileOptionResult = argResults[fileOption]; - - // if icon is given, try to load icon - if (configFile != null && configFile != defaultConfigFile) { - try { - return loadConfigFile(configFile, fileOptionResult); - } catch (e) { - if (verbose) { - stderr.writeln(e); - } - - return null; - } - } - - // If none set try icons_launcher.yaml first then pubspec.yaml - // for compatibility - try { - return loadConfigFile(defaultConfigFile, fileOptionResult); - } catch (e) { - // Try pubspec.yaml for compatibility - if (configFile == null) { - try { - return loadConfigFile('pubspec.yaml', fileOptionResult); - } catch (_) {} - } - - // if nothing got returned, print error - if (verbose) { - stderr.writeln(e); - } - } - - return null; -} - -/// Load the config file from the given path. -Map loadConfigFile(String path, String? fileOptionResult) { - final File file = File(path); - final String yamlString = file.readAsStringSync(); - // ignore: always_specify_types - final Map yamlMap = loadYaml(yamlString); - - if (!(yamlMap['flutter_icons'] is Map)) { - stderr.writeln(NoConfigFoundException('Check that your config file ' - '`${fileOptionResult ?? defaultConfigFile}`' - ' has a `flutter_icons` section')); - exit(1); - } - - // yamlMap has the type YamlMap, which has several unwanted side effects - final Map config = {}; - for (MapEntry entry in yamlMap['flutter_icons'].entries) { - config[entry.key] = entry.value; - } - - return config; -} - -/// Checks if the config image path. -bool isImagePathInConfig(Map flutterIconsConfig) { - return flutterIconsConfig.containsKey('image_path') || - (flutterIconsConfig.containsKey('image_path_android') && - flutterIconsConfig.containsKey('image_path_ios')); -} - -/// Checks if the config platform. -bool hasPlatformConfig(Map flutterIconsConfig) { - return hasAndroidConfig(flutterIconsConfig) || - hasIOSConfig(flutterIconsConfig) || - hasMacOSConfig(flutterIconsConfig) || - hasWebConfig(flutterIconsConfig) || - hasWindowsConfig(flutterIconsConfig) || - hasLinuxConfig(flutterIconsConfig); -} - -/// Checks if the config has android. -bool hasAndroidConfig(Map iconsLauncher) { - return iconsLauncher.containsKey('android'); -} - -/// Checks if the config need android. -bool isNeedingNewAndroidIcon(Map iconsLauncherConfig) { - return hasAndroidConfig(iconsLauncherConfig) && - iconsLauncherConfig['android'] != false; -} - -/// Checks if the config has android adaptive. -bool hasAndroidAdaptiveConfig(Map iconsLauncherConfig) { - return isNeedingNewAndroidIcon(iconsLauncherConfig) && - iconsLauncherConfig.containsKey('adaptive_icon_background') && - iconsLauncherConfig.containsKey('adaptive_icon_foreground'); -} - -/// Checks if the config has ios. -bool hasIOSConfig(Map iconsLauncherConfig) { - return iconsLauncherConfig.containsKey('ios'); -} - -/// Checks if the config need ios. -bool isNeedingNewIOSIcon(Map iconsLauncherConfig) { - return hasIOSConfig(iconsLauncherConfig) && - iconsLauncherConfig['ios'] != false; -} - -/// Checks if the config has macos. -bool hasMacOSConfig(Map iconsLauncherConfig) { - return iconsLauncherConfig.containsKey('macos'); -} - -/// Checks if the config need macos. -bool isNeedingNewMacOSIcon(Map iconsLauncherConfig) { - return hasMacOSConfig(iconsLauncherConfig) && - iconsLauncherConfig['macos'] != false; -} - -/// Checks if the config has windows. -bool hasWindowsConfig(Map iconsLauncherConfig) { - return iconsLauncherConfig.containsKey('windows'); -} - -/// Checks if the config need windows. -bool isNeedingNewWindowsIcon(Map iconsLauncherConfig) { - return hasWindowsConfig(iconsLauncherConfig) && - iconsLauncherConfig['windows'] != false; -} - -/// Checks if the config has linux. -bool hasLinuxConfig(Map iconsLauncherConfig) { - return iconsLauncherConfig.containsKey('linux'); -} - -/// Checks if the config need linux. -bool isNeedingNewLinuxIcon(Map iconsLauncherConfig) { - return hasLinuxConfig(iconsLauncherConfig) && - iconsLauncherConfig['linux'] != false; -} - -/// Checks if the config has web. -bool hasWebConfig(Map iconsLauncherConfig) { - return iconsLauncherConfig.containsKey('web'); -} - -/// Checks if the config need linux. -bool isNeedingNewWebIcon(Map iconsLauncherConfig) { - return hasWebConfig(iconsLauncherConfig) && - iconsLauncherConfig['web'] != false; -} diff --git a/lib/src/android.dart b/lib/src/android.dart index 15e2574..1e06392 100644 --- a/lib/src/android.dart +++ b/lib/src/android.dart @@ -1,537 +1,455 @@ -import 'package:icons_launcher/constants.dart' as constants; -import 'package:icons_launcher/custom_exceptions.dart'; -import 'package:icons_launcher/utils.dart'; -import 'package:icons_launcher/xml_templates.dart' as xml_template; -import 'package:universal_io/io.dart'; - -import '../icon.dart'; - -/// Class android icon template model -class AndroidIconTemplate { - AndroidIconTemplate({required this.size, required this.directoryName}); - - final String directoryName; - final int size; -} - -/// List of android adaptive icon templates -final List adaptiveForegroundIcons = [ - AndroidIconTemplate(directoryName: 'mipmap-mdpi', size: 108), - AndroidIconTemplate(directoryName: 'mipmap-hdpi', size: 162), - AndroidIconTemplate(directoryName: 'mipmap-xhdpi', size: 216), - AndroidIconTemplate(directoryName: 'mipmap-xxhdpi', size: 324), - AndroidIconTemplate(directoryName: 'mipmap-xxxhdpi', size: 432), +part of icons_launcher_cli; + +/// Android icons template +final androidIcons = [ + AndroidMipMapIconTemplate(directoryName: 'mipmap-mdpi', size: 48), + AndroidMipMapIconTemplate(directoryName: 'mipmap-hdpi', size: 72), + AndroidMipMapIconTemplate(directoryName: 'mipmap-xhdpi', size: 96), + AndroidMipMapIconTemplate(directoryName: 'mipmap-xxhdpi', size: 144), + AndroidMipMapIconTemplate(directoryName: 'mipmap-xxxhdpi', size: 192), ]; -/// List of android icon templates -List androidIcons = [ - AndroidIconTemplate(directoryName: 'mipmap-mdpi', size: 48), - AndroidIconTemplate(directoryName: 'mipmap-hdpi', size: 72), - AndroidIconTemplate(directoryName: 'mipmap-xhdpi', size: 96), - AndroidIconTemplate(directoryName: 'mipmap-xxhdpi', size: 144), - AndroidIconTemplate(directoryName: 'mipmap-xxxhdpi', size: 192), +/// Android adaptive icons template +final adaptiveIcons = [ + AndroidMipMapIconTemplate(directoryName: 'mipmap-mdpi', size: 108), + AndroidMipMapIconTemplate(directoryName: 'mipmap-hdpi', size: 162), + AndroidMipMapIconTemplate(directoryName: 'mipmap-xhdpi', size: 216), + AndroidMipMapIconTemplate(directoryName: 'mipmap-xxhdpi', size: 324), + AndroidMipMapIconTemplate(directoryName: 'mipmap-xxxhdpi', size: 432), ]; -/// Create default icons -void createDefaultIcons( - Map iconsLauncherConfig, String? flavor) { - printStatus('Creating default icons Android'); - final String filePath = getAndroidIconPath(iconsLauncherConfig); - final image = Icon.loadFile(filePath); +/// Start create Android icons +void _createAndroidIcons({required String imagePath}) { + CliLogger.info('Creating Android icons...'); + + final image = Icon.loadFile(imagePath); if (image == null) { - return; + CliLogger.error('The file $imagePath could not be read.', + level: CliLoggerLevel.two); + exit(1); } - final File androidManifestFile = File(constants.androidManifestFile); - if (isCustomAndroidFile(iconsLauncherConfig)) { - printStatus('Adding a new Android launcher icon'); - final String iconName = getNewIconName(iconsLauncherConfig); - isAndroidIconNameCorrectFormat(iconName); - final String iconPath = '$iconName.png'; - for (AndroidIconTemplate template in androidIcons) { - saveNewImages(template, image, iconPath, flavor); - } - overwriteAndroidManifestWithNewIconLauncher(iconName, androidManifestFile); - if (isConfigAdaptiveRoundIcon(iconsLauncherConfig)) { - overwriteAndroidManifestWithNewRoundIconLauncher( - iconName, androidManifestFile); - } - } else { - printStatus( - 'Overwriting the default Android launcher icon with a new icon'); - for (AndroidIconTemplate template in androidIcons) { - overwriteExistingIcons( - template, image, constants.androidFileName, flavor); - } - overwriteAndroidManifestWithNewIconLauncher( - constants.androidDefaultIconName, androidManifestFile); - if (isConfigAdaptiveRoundIcon(iconsLauncherConfig)) { - overwriteAndroidManifestWithNewRoundIconLauncher( - constants.androidDefaultRoundIconName, androidManifestFile); - } + + for (final template in androidIcons) { + _saveImageAndroid(template, image, ANDROID_ICON_FILE_NAME); } - // Create play store icon - createPlayStoreIcon(image, flavor); - removeConflictDir(); + CliLogger.success( + 'Generated launcher icon images', + level: CliLoggerLevel.two, + ); + + _createPlayStoreIcon(image); + _updateAndroidManifestIconLauncher(); } -void removeConflictDir() { - try { - final dir = Directory('android/app/src/main/res/drawable-anydpi-v21'); - dir.deleteSync(recursive: true); - } catch (_) {} +/// Save the image to the Android directory +void _saveImageAndroid( + AndroidMipMapIconTemplate template, + Icon image, + String fileName, +) { + // When the flavor value is not specified we will place all the data inside the main directory. + // However if the flavor value is specified, we need to place the data in the correct directory. + // Default: android/app/src/main/res/ + // With a flavor: android/app/src/[flavor name]/res/ + final filePath = + '${_flavorHelper.androidResFolder}${template.directoryName}/$fileName'; + image.saveResizedPng(template.size, filePath); } -/// Create play store icon -void createPlayStoreIcon(Icon image, String? flavor) { - final template = AndroidIconTemplate( - directoryName: constants.androidMainFolder(flavor), size: 512); +/// Create the play store icon +void _createPlayStoreIcon(Icon image) { + final template = AndroidMipMapIconTemplate( + directoryName: _flavorHelper.androidResFolder, + size: 512, + ); image.saveResizedPng(template.size, - template.directoryName + constants.androidPlayStoreFileName); + '${template.directoryName}/$ANDROID_PLAYSTORE_ICON_FILE_NAME'); } -/// Ensures that the Android icon name is in the correct format -bool isAndroidIconNameCorrectFormat(String iconName) { - // assure the icon only consists of lowercase letters, numbers and underscore - if (!RegExp(r'^[a-z0-9_]+$').hasMatch(iconName)) { - throw const InvalidAndroidIconNameException( - constants.errorIncorrectIconName); - } - return true; +/// Update the Android manifest with the new launcher icon +void _updateAndroidManifestIconLauncher() { + final androidManifestFile = File(ANDROID_MANIFEST_FILE); + final androidManifestString = androidManifestFile.readAsStringSync(); + final manifestLines = androidManifestString.split('\n'); + + final androidManifestUpdated = manifestLines.map((String line) { + if (line.contains('android:icon')) { + // Using RegExp replace the value of android:icon to point to the new icon + // anything but a quote of any length: [^"]* + // an escaped quote: \\" (escape slash, because it exists regex) + // quote, no quote / quote with things behind : \"[^"]* + // repeat as often as wanted with no quote at start: [^"]*(\"[^"]*)* + // escaping the slash to place in string: [^"]*(\\"[^"]*)*" + // result: any string which does only include escaped quotes + return line.replaceAll(RegExp(r'android:icon="[^"]*(\\"[^"]*)*"'), + 'android:icon="@mipmap/$ANDROID_ICON_NAME"'); + } else { + return line; + } + }).toList(); + + androidManifestFile.writeAsStringSync(androidManifestUpdated.join('\n')); + CliLogger.success( + 'Updated android manifest launcher icon', + level: CliLoggerLevel.two, + ); } -/// Create adaptive icons -void createAdaptiveIcons( - Map iconsLauncherConfig, String? flavor) { - printStatus('Creating adaptive icons Android'); - - // Retrieve the necessary launcher icons configuration from the pubspec.yaml file - final String backgroundConfig = - iconsLauncherConfig['adaptive_icon_background']; - final String foregroundImagePath = - iconsLauncherConfig['adaptive_icon_foreground']; - final String? roundImagePath = iconsLauncherConfig['adaptive_icon_round']; - final foregroundImage = Icon.loadFile(foregroundImagePath); - if (foregroundImage == null) { - return; +/// Start android adaptive icons +void _createAndroidAdaptiveIcon({ + required String background, + required String foreground, + String? round, +}) { + String message = 'Creating Android adaptive icons...'; + if (round != null) { + message = 'Creating Android adaptive icons with round...'; } + CliLogger.info(message); - // Create adaptive icon foreground images - for (AndroidIconTemplate androidIcon in adaptiveForegroundIcons) { - overwriteExistingIcons(androidIcon, foregroundImage, - constants.androidAdaptiveForegroundFileName, flavor); + _createAdaptiveForeground(adaptiveIcons, foreground); + _createAdaptiveBackground(adaptiveIcons, background); + if (round != null) { + _createAdaptiveRound(androidIcons, round); + } else { + _removeAndroidManifestIconLauncherRound(); } +} - // Create adaptive icon background - if (isAdaptiveIconConfigPngFile(backgroundConfig)) { - createAdaptiveBackgrounds(iconsLauncherConfig, backgroundConfig, flavor); +/// Create the adaptive background +void _createAdaptiveBackground( + List adaptiveIcons, + String background, +) { + // Check background is hexa color or image + if (isValidHexaCode(background)) { + _handleColorsXmlFile(background); + _createIcLauncherColorXmlFile(); } else { - createAdaptiveIconMipMapXmlFile(iconsLauncherConfig, flavor); - if (isConfigAdaptiveRoundIcon(iconsLauncherConfig)) { - createAdaptiveRoundIconMipMapXmlFile(iconsLauncherConfig, flavor); - } - updateColorsXmlFile(backgroundConfig, flavor); - } + try { + final backgroundImage = Icon.loadFile(background); + if (backgroundImage == null) { + CliLogger.error( + 'The file $background could not be read.', + level: CliLoggerLevel.two, + ); + exit(1); + } - if (roundImagePath != null) { - final roundImage = Icon.loadFile(roundImagePath); - if (roundImage != null) { - for (AndroidIconTemplate androidIcon in androidIcons) { - overwriteExistingRoundIcons( - androidIcon, roundImage, constants.androidRoundFileName, flavor); + for (final template in adaptiveIcons) { + _saveImageAndroid( + template, + backgroundImage, + ANDROID_ADAPTIVE_BACKGROUND_ICON_FILE_NAME, + ); } + CliLogger.success( + 'Generated adaptive background images', + level: CliLoggerLevel.two, + ); + _createIcLauncherMipMapXmlFile(); + } catch (e) { + CliLogger.error( + 'Incorrect `$background` of `adaptive_background_color` or `adaptive_background_image`', + level: CliLoggerLevel.two, + ); + exit(1); } } } -/// Retrieves the colors.xml file for the project. -/// -/// If the colors.xml file is found, it is updated with a new color item for the -/// adaptive icon background. -/// -/// If not, the colors.xml file is created and a color item for the adaptive icon -/// background is included in the new colors.xml file. -void updateColorsXmlFile(String backgroundConfig, String? flavor) { - final File colorsXml = File(constants.androidColorsFile(flavor)); - if (colorsXml.existsSync()) { - printStatus('Updating colors.xml with color for adaptive icon background'); - updateColorsFile(colorsXml, backgroundConfig); - } else { - printStatus('No colors.xml file found in your Android project'); - printStatus( - 'Creating colors.xml file and adding it to your Android project'); - createNewColorsFile(backgroundConfig, flavor); +/// Create the adaptive foreground +void _createAdaptiveForeground( + List adaptiveIcons, + String foreground, +) { + final foregroundImage = Icon.loadFile(foreground); + if (foregroundImage == null) { + CliLogger.error( + 'The file $foreground could not be read.', + level: CliLoggerLevel.two, + ); + exit(1); } -} -/// Creates the xml file required for the adaptive launcher icon -/// FILE LOCATED HERE: res/mipmap-anydpi/{icon-name-from-yaml-config}.xml -void createAdaptiveIconMipMapXmlFile( - Map iconsLauncherConfig, String? flavor) { - if (isCustomAndroidFile(iconsLauncherConfig)) { - File(constants.androidAdaptiveXmlFolder(flavor) + - getNewIconName(iconsLauncherConfig) + - '.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherXml); - }); - } else { - File(constants.androidAdaptiveXmlFolder(flavor) + - constants.androidDefaultIconName + - '.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherXml); - }); + for (final template in adaptiveIcons) { + _saveImageAndroid( + template, + foregroundImage, + ANDROID_ADAPTIVE_FOREGROUND_ICON_FILE_NAME, + ); } + CliLogger.success( + 'Generated adaptive foreground images', + level: CliLoggerLevel.two, + ); } -/// Creates the xml file for the adaptive launcher round icon -/// FILE LOCATED HERE: res/mipmap-anydpi/{icon-name-from-yaml-config}.xml -void createAdaptiveRoundIconMipMapXmlFile( - Map iconsLauncherConfig, String? flavor) { - if (isCustomAndroidFile(iconsLauncherConfig)) { - File(constants.androidAdaptiveXmlFolder(flavor) + - getNewIconName(iconsLauncherConfig) + - '_round.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherRoundXml); - }); - } else { - File(constants.androidAdaptiveXmlFolder(flavor) + - constants.androidDefaultIconName + - '_round.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherRoundXml); - }); +/// Create the adaptive round +void _createAdaptiveRound( + List adaptiveIcons, + String round, +) { + final roundImage = Icon.loadFile(round); + if (roundImage == null) { + CliLogger.error( + 'The file $round could not be read.', + level: CliLoggerLevel.two, + ); + exit(1); } -} -/// creates adaptive background using png image -void createAdaptiveBackgrounds(Map yamlConfig, - String adaptiveIconBackgroundImagePath, String? flavor) { - final String filePath = adaptiveIconBackgroundImagePath; - final image = Icon.loadFile(filePath); - if (image == null) { - return; + for (final template in adaptiveIcons) { + _saveImageAndroid( + template, + roundImage, + ANDROID_ADAPTIVE_ROUND_ICON_FILE_NAME, + ); } + CliLogger.success( + 'Generated adaptive round images', + level: CliLoggerLevel.two, + ); + _createIcLauncherRoundMipMapXmlFile(); + _createAndroidManifestIconLauncherRound(); +} - // creates a png image (ic_adaptive_background.png) for the adaptive icon background in each of the locations - // it is required - for (AndroidIconTemplate androidIcon in adaptiveForegroundIcons) { - saveNewImages(androidIcon, image, - constants.androidAdaptiveBackgroundFileName, flavor); +/// Handle colors.xml file +void _handleColorsXmlFile(String backgroundColor) { + final File colorsXml = + File('${_flavorHelper.androidResFolder}$ANDROID_COLOR_FILE'); + if (colorsXml.existsSync()) { + CliLogger.success( + 'Updated colors.xml with color `$backgroundColor`', + level: CliLoggerLevel.two, + ); + _updateColorsFile(colorsXml, backgroundColor); + } else { + CliLogger.success( + 'Created colors.xml with color `$backgroundColor`', + level: CliLoggerLevel.two, + ); + _createColorsFile(backgroundColor); } +} - // Creates the xml file required for the adaptive launcher icon - // FILE LOCATED HERE: res/mipmap-anydpi/{icon-name-from-yaml-config}.xml - if (isCustomAndroidFile(yamlConfig)) { - File(constants.androidAdaptiveXmlFolder(flavor) + - getNewIconName(yamlConfig) + - '.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherMipMapXml); - }); - - if (isConfigAdaptiveRoundIcon(yamlConfig)) { - File(constants.androidAdaptiveXmlFolder(flavor) + - getNewIconName(yamlConfig) + - '_round.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherRoundMipMapXml); - }); - } +/// Create colors.xml file +void _createColorsFile(String backgroundColor) { + String color = backgroundColor; + + if ((color.length == 4 || color.length == 7) && color.length != 9) { + color = '#FF' + backgroundColor.replaceAll('#', ''); } else { - File(constants.androidAdaptiveXmlFolder(flavor) + - constants.androidDefaultIconName + - '.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherMipMapXml); - }); - if (isConfigAdaptiveRoundIcon(yamlConfig)) { - File(constants.androidAdaptiveXmlFolder(flavor) + - constants.androidDefaultIconName + - '_round.xml') - .create(recursive: true) - .then((File adaptiveIcon) { - adaptiveIcon.writeAsString(xml_template.icLauncherRoundMipMapXml); - }); - } + CliLogger.error( + 'Incorrect `$backgroundColor` of `adaptive_background_color`', + level: CliLoggerLevel.two, + ); + exit(1); } -} -/// Creates a colors.xml file if it was missing from android/app/src/main/res/values/colors.xml -void createNewColorsFile(String backgroundColor, String? flavor) { - File(constants.androidColorsFile(flavor)) - .create(recursive: true) - .then((File colorsFile) { - colorsFile.writeAsString(xml_template.colorsXml).then((File file) { - updateColorsFile(colorsFile, backgroundColor); - }); - }); + final file = File('${_flavorHelper.androidResFolder}$ANDROID_COLOR_FILE'); + file.createSync(recursive: true); + file.writeAsStringSync(getColorXmlContent(color)); } -/// Updates the colors.xml with the new adaptive launcher icon color -void updateColorsFile(File colorsFile, String backgroundColor) { - // Write foreground color - final List lines = colorsFile.readAsLinesSync(); +// Update colors.xml file +void _updateColorsFile(File colorsXml, String backgroundColor) { + String color = backgroundColor; + + if ((color.length == 4 || color.length == 7) && color.length != 9) { + color = '#FF' + backgroundColor.replaceAll('#', ''); + } else { + CliLogger.error( + 'Incorrect `$backgroundColor` of `adaptive_background_color`', + level: CliLoggerLevel.two, + ); + exit(1); + } + + final List lines = colorsXml.readAsLinesSync(); bool foundExisting = false; for (int x = 0; x < lines.length; x++) { String line = lines[x]; if (line.contains('name="ic_launcher_background"')) { foundExisting = true; // replace anything between tags which does not contain another tag - line = line.replaceAll(RegExp(r'>([^><]*)<'), '>$backgroundColor<'); + line = line.replaceAll(RegExp(r'>([^><]*)<'), '>${color.toUpperCase()}<'); lines[x] = line; break; } } - // Add new line if we didn't find an existing value if (!foundExisting) { lines.insert(lines.length - 1, - '\t$backgroundColor'); + '\t${color.toUpperCase()}'); } - - colorsFile.writeAsStringSync(lines.join('\n')); + colorsXml.writeAsStringSync(lines.join('\n')); } -/// Check to see if specified Android config is a string or bool -/// String - Generate new launcher icon with the string specified -/// bool - override the default flutter project icon -bool isCustomAndroidFile(Map config) { - final dynamic androidConfig = config['android']; - return androidConfig is String; -} - -/// Check to see if specified Android adaptive round icon -bool isConfigAdaptiveRoundIcon(Map config) { - final String? roundImagePath = config['adaptive_icon_round']; - return roundImagePath != null; -} - -/// return the new launcher icon file name -String getNewIconName(Map config) { - return config['android']; -} - -/// Overrides the existing launcher icons in the project -/// Note: Do not change interpolation unless you end up with better results (see issue for result when using cubic -/// interpolation) -void overwriteExistingIcons( - AndroidIconTemplate template, - Icon image, - String filename, - String? flavor, -) { - image.saveResizedPng( - template.size, - constants.androidResFolder(flavor) + - template.directoryName + - '/' + - filename, +/// Create ic_launcher_color.xml file +void _createIcLauncherColorXmlFile() { + final icLauncherXml = File( + '${_flavorHelper.androidResFolder}$ANDROID_ADAPTIVE_XML_DIR/$ANDROID_ADAPTIVE_XML_FILE_NAME'); + icLauncherXml.createSync(recursive: true); + icLauncherXml.writeAsStringSync(IC_LAUNCHER_BACKGROUND_COLOR_XML); + CliLogger.success( + 'Created `$ANDROID_ADAPTIVE_XML_FILE_NAME`', + level: CliLoggerLevel.two, ); } -/// Overrides the existing launcher round icons in the project -/// Note: Do not change interpolation unless you end up with better results (see issue for result when using cubic -/// interpolation) -void overwriteExistingRoundIcons( - AndroidIconTemplate template, - Icon image, - String filename, - String? flavor, -) { - image.saveResizedPng( - template.size, - constants.androidResFolder(flavor) + - template.directoryName + - '/' + - filename, +/// Create ic luncher xml file +void _createIcLauncherMipMapXmlFile() { + final icLauncherXml = File( + '${_flavorHelper.androidResFolder}$ANDROID_ADAPTIVE_XML_DIR/$ANDROID_ADAPTIVE_XML_FILE_NAME'); + icLauncherXml.createSync(recursive: true); + icLauncherXml.writeAsStringSync(IC_LAUNCHER_MIP_MAP_XML); + CliLogger.success( + 'Created `$ANDROID_ADAPTIVE_XML_FILE_NAME`', + level: CliLoggerLevel.two, ); } -/// Saves new launcher icons to the project, keeping the old launcher icons. -/// Note: Do not change interpolation unless you end up with better results -void saveNewImages(AndroidIconTemplate template, Icon image, - String iconFilePath, String? flavor) { - image.saveResizedPng( - template.size, - constants.androidResFolder(flavor) + - template.directoryName + - '/' + - iconFilePath, +// void _createIcLauncherRoundColorXmlFile() { +// final icLauncherXml = File( +// '${_flavorHelper.androidResFolder}$ANDROID_ADAPTIVE_XML_DIR/$ANDROID_ADAPTIVE_ROUND_XML_FILE_NAME'); +// icLauncherXml.createSync(recursive: true); +// icLauncherXml.writeAsStringSync(IC_LAUNCHER_ROUND_BACKGROUND_COLOR_XML); +// CliLogger.success( +// 'Created `$ANDROID_ADAPTIVE_ROUND_XML_FILE_NAME`', +// level: CliLoggerLevel.two, +// ); +// } + +/// Create ic_launcher_round.xml file +void _createIcLauncherRoundMipMapXmlFile() { + final icLauncherXml = File( + '${_flavorHelper.androidResFolder}$ANDROID_ADAPTIVE_XML_DIR/$ANDROID_ADAPTIVE_ROUND_XML_FILE_NAME'); + icLauncherXml.createSync(recursive: true); + icLauncherXml.writeAsStringSync(IC_LAUNCHER_ROUND_MIP_MAP_XML); + CliLogger.success( + 'Created `$ANDROID_ADAPTIVE_ROUND_XML_FILE_NAME`', + level: CliLoggerLevel.two, ); } -/// Updates the line which specifies the launcher icon within the AndroidManifest.xml -/// with the new icon name (only if it has changed) -/// -/// Note: default iconName = "ic_launcher" -Future overwriteAndroidManifestWithNewIconLauncher( - String iconName, File androidManifestFile) async { - // we do not use `file.readAsLinesSync()` here because that always gets rid of the last empty newline - final List oldManifestLines = - (await androidManifestFile.readAsString()).split('\n'); - final List transformedLineIcon = - transformAndroidManifestWithNewIconLauncher(oldManifestLines, iconName); - await androidManifestFile.writeAsString(transformedLineIcon.join('\n')); -} - -/// Updates only the line containing android:icon with the specified iconName -List transformAndroidManifestWithNewIconLauncher( - List oldManifestLines, String iconName) { - return oldManifestLines.map((String line) { - if (line.contains('android:icon')) { - // Using RegExp replace the value of android:icon to point to the new icon - // anything but a quote of any length: [^"]* - // an escaped quote: \\" (escape slash, because it exists regex) - // quote, no quote / quote with things behind : \"[^"]* - // repeat as often as wanted with no quote at start: [^"]*(\"[^"]*)* - // escaping the slash to place in string: [^"]*(\\"[^"]*)*" - // result: any string which does only include escaped quotes - return line.replaceAll(RegExp(r'android:icon="[^"]*(\\"[^"]*)*"'), - 'android:icon="@mipmap/$iconName"'); - } else { - return line; - } - }).toList(); -} - -/// Updates the line which specifies the launcher round icon within the AndroidManifest.xml -/// with the new icon name (only if it has changed) -/// -/// Note: default iconName = "ic_launcher_round" -Future overwriteAndroidManifestWithNewRoundIconLauncher( - String iconName, File androidManifestFile) async { - // we do not use `file.readAsLinesSync()` here because that always gets rid of the last empty newline - final List oldManifestLines = - (await androidManifestFile.readAsString()).split('\n'); - final List transformedLineIconRound = - transformAndroidManifestWithNewRoundIconLauncher( - oldManifestLines, iconName); - await androidManifestFile.writeAsString(transformedLineIconRound.join('\n')); -} - -/// Updates only the line containing android:roundIcon with the specified iconName -List transformAndroidManifestWithNewRoundIconLauncher( - List oldManifestLines, String iconName) { - bool isRoundIconExisting = false; - final newManifest = oldManifestLines.map((String line) { - if (line.contains('android:roundIcon')) { - // Using RegExp replace the value of android:roundIcon to point to the new icon - // anything but a quote of any length: [^"]* - // an escaped quote: \\" (escape slash, because it exists regex) - // quote, no quote / quote with things behind : \"[^"]* - // repeat as often as wanted with no quote at start: [^"]*(\"[^"]*)* - // escaping the slash to place in string: [^"]*(\\"[^"]*)*" - // result: any string which does only include escaped quotes - isRoundIconExisting = true; - return line.replaceAll(RegExp(r'android:roundIcon="[^"]*(\\"[^"]*)*"'), - 'android:roundIcon="@mipmap/$iconName"'); - } else { - return line; - } - }).toList(); - - if (isRoundIconExisting) { - return newManifest; +/// Create android manifest icon launcher round +void _createAndroidManifestIconLauncherRound() { + final androidManifestFile = File(ANDROID_MANIFEST_FILE); + final androidManifestString = androidManifestFile.readAsStringSync(); + final manifestLines = androidManifestString.split('\n'); + + final index = + manifestLines.indexWhere((line) => line.contains('android:roundIcon')); + if (index != -1) { + final lineUpdated = manifestLines.elementAt(index).replaceAll( + RegExp(r'android:roundIcon="[^"]*(\\"[^"]*)*"'), + 'android:roundIcon="@mipmap/$ANDROID_ADAPTIVE_ROUND_ICON_NAME"', + ); + manifestLines.replaceRange(index, index + 1, [lineUpdated]); + androidManifestFile.writeAsStringSync(manifestLines.join('\n')); + CliLogger.success( + 'Updated `android:roundIcon` to manifest', + level: CliLoggerLevel.two, + ); } else { - print('Adding android:roundIcon to manifest'); - return oldManifestLines.map((String line) { - if (line.contains('android:icon')) { - final addLines = - '''android:icon="@mipmap/${constants.androidDefaultIconName}" - android:roundIcon="@mipmap/$iconName"'''; - return line.replaceAll( - RegExp(r'android:icon="[^"]*(\\"[^"]*)*"'), addLines); - } else { - return line; - } - }).toList(); - } -} - -/// File reader -List readFileLinesSync(String file) => File(file).readAsLinesSync(); - -/// Retrieves the flutter sdk path -String flutterSdk() { - final lines = readFileLinesSync(constants.androidLocalProperties); - const key = 'flutter.sdk='; - for (String line in lines) { - if (line.contains(key)) { - // Remove the key and return the flutter sdk path - return line.replaceAll(key, '').trim(); + final index = + manifestLines.indexWhere((line) => line.contains('android:icon')); + if (index != -1) { + final lineUpdated = manifestLines + .elementAt(index) + .replaceAll(RegExp(r'android:icon="[^"]*(\\"[^"]*)*"'), ''' +android:icon="@mipmap/$ANDROID_ICON_NAME" +\t\tandroid:roundIcon="@mipmap/$ANDROID_ADAPTIVE_ROUND_ICON_NAME"'''); + + manifestLines.replaceRange(index, index + 1, [lineUpdated]); + androidManifestFile.writeAsStringSync(manifestLines.join('\n')); + CliLogger.success( + 'Created `android:roundIcon` to manifest', + level: CliLoggerLevel.two, + ); } } - return ''; } -/// Retrieves the string number only -String? getLineValueNumber(List lines, String key) { - for (String line in lines) { - if (line.contains(key)) { - final value = line.replaceAll(RegExp(r'[^\d]'), '').trim(); - if (value.isNotEmpty) { - return value; - } - } +/// Remove android manifest icon launcher round +void _removeAndroidManifestIconLauncherRound() { + final androidManifestFile = File(ANDROID_MANIFEST_FILE); + final androidManifestString = androidManifestFile.readAsStringSync(); + final manifestLines = androidManifestString.split('\n'); + + final index = + manifestLines.indexWhere((line) => line.contains('android:roundIcon')); + if (index != -1) { + final lineUpdated = manifestLines + .elementAt(index) + .replaceAll(RegExp(r'android:roundIcon="[^"]*(\\"[^"]*)*"'), ''); + manifestLines.replaceRange(index, index + 1, [lineUpdated]); + androidManifestFile.writeAsStringSync(manifestLines.join('\n')); + CliLogger.success('Removed `android:roundIcon` from manifest', + level: CliLoggerLevel.two); } - return null; } -/// Retrieves the minSdk value from the Android build.gradle file -int minSdk() { +/// Retrieves the minSdk value +int _minSdk() { String? minSdkValue; - final File androidGradleFile = File(constants.androidGradleFile); + final File androidGradleFile = File(ANDROID_GRADLE_FILE); final androidLines = androidGradleFile.readAsLinesSync(); //! First try -> app/build.gradle file const androidLineKey = 'minSdkVersion'; - minSdkValue = getLineValueNumber(androidLines, androidLineKey); + minSdkValue = _getLineValueNumber(androidLines, androidLineKey); //! Second try -> local.properties if (minSdkValue == null) { - final localLines = readFileLinesSync(constants.androidLocalProperties); + final localLines = File(ANDROID_LOCAL_PROPERTIES).readAsLinesSync(); const localKey = 'flutter.minSdkVersion='; - minSdkValue = getLineValueNumber(localLines, localKey); + minSdkValue = _getLineValueNumber(localLines, localKey); } //! Third try -> flutter.gradle file (default flutter sdk) if (minSdkValue == null) { - final gradleFile = '${flutterSdk()}${constants.flutterSdkGradleFile}'; - final List flutterLines = readFileLinesSync(gradleFile); + final gradleFile = '${_flutterSdk()}$FLUTTER_SDK_GRADLE_FILE'; + final List flutterLines = File(gradleFile).readAsLinesSync(); const flutterLineKey = 'minSdkVersion ='; - minSdkValue = getLineValueNumber(flutterLines, flutterLineKey); + minSdkValue = _getLineValueNumber(flutterLines, flutterLineKey); } return int.tryParse(minSdkValue ?? '0') ?? 0; } -/// Method for the retrieval of the Android icon path -/// If image_path_android is found, this will be priorities over the image_path -/// value. -String getAndroidIconPath(Map config) { - return config['image_path_android'] ?? config['image_path']; -} - -/// Returns true if the adaptive icon configuration is a PNG image -bool isAdaptiveIconConfigPngFile(String backgroundFile) { - return backgroundFile.endsWith('.png'); +/// Retrieves the flutter sdk path +String _flutterSdk() { + final lines = File(ANDROID_LOCAL_PROPERTIES).readAsLinesSync(); + const key = 'flutter.sdk='; + for (String line in lines) { + if (line.contains(key)) { + if (line.contains('//') && line.indexOf('//') < line.indexOf(key)) { + // This line is commented + continue; + } + // Remove the key and return the flutter sdk path + return line.replaceAll(key, '').trim(); + } + } + return ''; } -/// (NOTE THIS IS JUST USED FOR UNIT TEST) -/// Ensures the correct path is used for generating adaptive icons -/// "Next you must create alternative drawable resources in your app for use with -/// Android 8.0 (API level 26) in res/mipmap-anydpi/ic_launcher.xml" -/// Source: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive -bool isCorrectMipMapDirectoryForAdaptiveIcon(String path) { - return path == 'android/app/src/main/res/mipmap-anydpi-v26/'; +/// Retrieves the string number only +String? _getLineValueNumber(List lines, String key) { + for (String line in lines) { + if (line.contains(key)) { + if (line.contains('//') && line.indexOf('//') < line.indexOf(key)) { + // This line is commented + continue; + } + final value = line.replaceAll(RegExp(r'[^\d]'), '').trim(); + if (value.isNotEmpty) { + return value; + } + } + } + return null; } diff --git a/lib/src/ios.dart b/lib/src/ios.dart index b48cdc9..f2d2798 100644 --- a/lib/src/ios.dart +++ b/lib/src/ios.dart @@ -1,358 +1,58 @@ -import 'dart:convert'; +part of icons_launcher_cli; -import 'package:icons_launcher/constants.dart'; -import 'package:icons_launcher/utils.dart'; -import 'package:universal_io/io.dart'; +/// Start create ios icons +void _createIosIcons({required String imagePath}) { + CliLogger.info('Creating iOS icons...'); -import '../icon.dart'; - -/// File to handle the creation of icons for iOS platform -class IosIconTemplate { - IosIconTemplate({required this.size, required this.name}); - - final String name; - final int size; -} - -/// List of icons to create -List iosIcons = [ - IosIconTemplate(name: '-20x20@1x', size: 20), - IosIconTemplate(name: '-20x20@2x', size: 40), - IosIconTemplate(name: '-20x20@3x', size: 60), - IosIconTemplate(name: '-29x29@1x', size: 29), - IosIconTemplate(name: '-29x29@2x', size: 58), - IosIconTemplate(name: '-29x29@3x', size: 87), - IosIconTemplate(name: '-40x40@1x', size: 40), - IosIconTemplate(name: '-40x40@2x', size: 80), - IosIconTemplate(name: '-40x40@3x', size: 120), - IosIconTemplate(name: '-50x50@1x', size: 50), - IosIconTemplate(name: '-50x50@2x', size: 100), - IosIconTemplate(name: '-57x57@1x', size: 57), - IosIconTemplate(name: '-57x57@2x', size: 114), - IosIconTemplate(name: '-60x60@2x', size: 120), - IosIconTemplate(name: '-60x60@3x', size: 180), - IosIconTemplate(name: '-72x72@1x', size: 72), - IosIconTemplate(name: '-72x72@2x', size: 144), - IosIconTemplate(name: '-76x76@1x', size: 76), - IosIconTemplate(name: '-76x76@2x', size: 152), - IosIconTemplate(name: '-83.5x83.5@2x', size: 167), - IosIconTemplate(name: '-1024x1024@1x', size: 1024), -]; - -/// Create the icons -void createIcons(Map config, String? flavor) { - final String filePath = config['image_path_ios'] ?? config['image_path']; - // decodeImageFile shows error message if null - // so can return here if image is null - final image = Icon.loadFile(filePath); + final image = Icon.loadFile(imagePath); if (image == null) { - return; - } - if (config['remove_alpha_ios'] is bool && config['remove_alpha_ios']) { - image.removeAlpha(); - } - if (image.hasAlpha) { - print( - '\nWARNING: Icons with alpha channel are not allowed in the Apple App Store.\nSet "remove_alpha_ios: true" to remove it.\n'); - } - String iconName; - final dynamic iosConfig = config['ios']; - if (flavor != null) { - final String catalogName = 'AppIcon-$flavor'; - printStatus('Building iOS launcher icon for $flavor'); - for (IosIconTemplate template in iosIcons) { - saveNewIcons(template, image, catalogName); - } - iconName = iosDefaultIconName; - changeIosIconLauncher(catalogName, flavor); - modifyContentsFile(catalogName); - } else if (iosConfig is String) { - // If the IOS configuration is a string then the user has specified a new icon to be created - // and for the old icon file to be kept - final String newIconName = iosConfig; - printStatus('Adding new iOS launcher icon'); - for (IosIconTemplate template in iosIcons) { - saveNewIcons(template, image, newIconName); - } - iconName = newIconName; - changeIosIconLauncher(iconName, flavor); - modifyContentsFile(iconName); - } - // Otherwise the user wants the new icon to use the default icons name and - // update config file to use it - else { - printStatus('Overwriting default iOS launcher icon with new icon'); - for (IosIconTemplate template in iosIcons) { - overwriteDefaultIcons(template, image); - } - iconName = iosDefaultIconName; - changeIosIconLauncher('AppIcon', flavor); - } -} - -/// Note: Do not change interpolation unless you end up with better results (see issue for result when using cubic -/// interpolation) -void overwriteDefaultIcons(IosIconTemplate template, Icon image) { - image.saveResizedPng( - template.size, - iosDefaultIconFolder + iosDefaultIconName + template.name + '.png', - ); -} - -/// Note: Do not change interpolation unless you end up with better results (see issue for result when using cubic -/// interpolation) -void saveNewIcons(IosIconTemplate template, Icon image, String newIconName) { - final String newIconFolder = iosAssetFolder + newIconName + '.appiconset/'; - image.saveResizedPng( - template.size, - newIconFolder + newIconName + template.name + '.png', - ); -} - -/// Change the launcher icon to use the new icon -Future changeIosIconLauncher(String iconName, String? flavor) async { - final File iOSConfigFile = File(iosConfigFile); - final List lines = await iOSConfigFile.readAsLines(); - - bool onConfigurationSection = false; - String? currentConfig; - - for (int x = 0; x < lines.length; x++) { - final String line = lines[x]; - if (line.contains('/* Begin XCBuildConfiguration section */')) { - onConfigurationSection = true; - } - if (line.contains('/* End XCBuildConfiguration section */')) { - onConfigurationSection = false; - } - if (onConfigurationSection) { - final match = RegExp('.*/\\* (.*)\.xcconfig \\*/;').firstMatch(line); - if (match != null) { - currentConfig = match.group(1); - } - - if (currentConfig != null && - (flavor == null || currentConfig.contains('-$flavor')) && - line.contains('ASSETCATALOG')) { - lines[x] = line.replaceAll(RegExp('\=(.*);'), '= $iconName;'); - } - } + CliLogger.error('The file $imagePath could not be read.', + level: CliLoggerLevel.two); + exit(1); } - final String entireFile = '${lines.join('\n')}\n'; - await iOSConfigFile.writeAsString(entireFile); -} - -/// Create the Contents.json file -void modifyContentsFile(String newIconName) { - final String newIconFolder = - iosAssetFolder + newIconName + '.appiconset/Contents.json'; - File(newIconFolder).create(recursive: true).then((File contentsJsonFile) { - final String contentsFileContent = - generateContentsFileAsString(newIconName); - contentsJsonFile.writeAsString(contentsFileContent); - }); -} - -/// Generate the Contents json file -String generateContentsFileAsString(String newIconName) { - final Map contentJson = { - 'images': createImageList(newIconName), - 'info': ContentsInfoObject(version: 1, author: 'xcode').toJson() - }; - return json.encode(contentJson); -} - -class ContentsImageObject { - ContentsImageObject({ - required this.size, - required this.idiom, - required this.filename, - required this.scale, - }); - - final String size; - final String idiom; - final String filename; - final String scale; + if (image.hasAlpha) { + CliLogger.warning('App icon for iOS/iPadOS not support alpha channel', + level: CliLoggerLevel.two); + image.removeAlpha(); + CliLogger.success('Removed alpha channel from icon', + level: CliLoggerLevel.two); + } + + final iosIcons = [ + IosIconTemplate(name: '-20x20@1x', size: 20), + IosIconTemplate(name: '-20x20@2x', size: 40), + IosIconTemplate(name: '-20x20@3x', size: 60), + IosIconTemplate(name: '-29x29@1x', size: 29), + IosIconTemplate(name: '-29x29@2x', size: 58), + IosIconTemplate(name: '-29x29@3x', size: 87), + IosIconTemplate(name: '-40x40@1x', size: 40), + IosIconTemplate(name: '-40x40@2x', size: 80), + IosIconTemplate(name: '-40x40@3x', size: 120), + IosIconTemplate(name: '-50x50@1x', size: 50), + IosIconTemplate(name: '-50x50@2x', size: 100), + IosIconTemplate(name: '-57x57@1x', size: 57), + IosIconTemplate(name: '-57x57@2x', size: 114), + IosIconTemplate(name: '-60x60@2x', size: 120), + IosIconTemplate(name: '-60x60@3x', size: 180), + IosIconTemplate(name: '-72x72@1x', size: 72), + IosIconTemplate(name: '-72x72@2x', size: 144), + IosIconTemplate(name: '-76x76@1x', size: 76), + IosIconTemplate(name: '-76x76@2x', size: 152), + IosIconTemplate(name: '-83.5x83.5@2x', size: 167), + IosIconTemplate(name: '-1024x1024@1x', size: 1024), + ]; - Map toJson() { - return { - 'size': size, - 'idiom': idiom, - 'filename': filename, - 'scale': scale - }; + for (final template in iosIcons) { + _saveImageIos(template, image); } -} -class ContentsInfoObject { - ContentsInfoObject({required this.version, required this.author}); - - final int version; - final String author; - - Map toJson() { - return { - 'version': version, - 'author': author, - }; - } + CliLogger.success('Generated app icon images', level: CliLoggerLevel.two); } -/// Create the image list -List> createImageList(String fileNamePrefix) { - final List> imageList = >[ - ContentsImageObject( - size: '20x20', - idiom: 'iphone', - filename: '$fileNamePrefix-20x20@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '20x20', - idiom: 'iphone', - filename: '$fileNamePrefix-20x20@3x.png', - scale: '3x') - .toJson(), - ContentsImageObject( - size: '29x29', - idiom: 'iphone', - filename: '$fileNamePrefix-29x29@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '29x29', - idiom: 'iphone', - filename: '$fileNamePrefix-29x29@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '29x29', - idiom: 'iphone', - filename: '$fileNamePrefix-29x29@3x.png', - scale: '3x') - .toJson(), - ContentsImageObject( - size: '40x40', - idiom: 'iphone', - filename: '$fileNamePrefix-40x40@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '40x40', - idiom: 'iphone', - filename: '$fileNamePrefix-40x40@3x.png', - scale: '3x') - .toJson(), - ContentsImageObject( - size: '50x50', - idiom: 'iphone', - filename: '$fileNamePrefix-50x50@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '50x50', - idiom: 'iphone', - filename: '$fileNamePrefix-50x50@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '57x57', - idiom: 'iphone', - filename: '$fileNamePrefix-57x57@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '57x57', - idiom: 'iphone', - filename: '$fileNamePrefix-57x57@3x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '60x60', - idiom: 'iphone', - filename: '$fileNamePrefix-60x60@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '60x60', - idiom: 'iphone', - filename: '$fileNamePrefix-60x60@3x.png', - scale: '3x') - .toJson(), - ContentsImageObject( - size: '20x20', - idiom: 'ipad', - filename: '$fileNamePrefix-20x20@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '20x20', - idiom: 'ipad', - filename: '$fileNamePrefix-20x20@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '29x29', - idiom: 'ipad', - filename: '$fileNamePrefix-29x29@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '29x29', - idiom: 'ipad', - filename: '$fileNamePrefix-29x29@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '40x40', - idiom: 'ipad', - filename: '$fileNamePrefix-40x40@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '40x40', - idiom: 'ipad', - filename: '$fileNamePrefix-40x40@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '72x72', - idiom: 'ipad', - filename: '$fileNamePrefix-72x72@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '72x72', - idiom: 'ipad', - filename: '$fileNamePrefix-72x72@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '76x76', - idiom: 'ipad', - filename: '$fileNamePrefix-76x76@1x.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '76x76', - idiom: 'ipad', - filename: '$fileNamePrefix-76x76@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '83.5x83.5', - idiom: 'ipad', - filename: '$fileNamePrefix-83.5x83.5@2x.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '1024x1024', - idiom: 'ios-marketing', - filename: '$fileNamePrefix-1024x1024@1x.png', - scale: '1x') - .toJson() - ]; - return imageList; +/// Save ios image +void _saveImageIos(IosIconTemplate template, Icon image) { + final filePath = + '${_flavorHelper.iOSAssetsAppIconFolder}$IOS_DEFAULT_ICON_NAME${template.name}.png'; + image.saveResizedPng(template.size, filePath); } diff --git a/lib/src/linux.dart b/lib/src/linux.dart index 0bb44d5..1cca354 100644 --- a/lib/src/linux.dart +++ b/lib/src/linux.dart @@ -1,83 +1,48 @@ -import 'package:icons_launcher/constants.dart'; -import 'package:icons_launcher/utils.dart'; -import 'package:universal_io/io.dart'; +part of icons_launcher_cli; -import '../icon.dart'; +/// Start create linux icons +void _createLinuxIcons({required String imagePath}) { + CliLogger.info('Creating Linux icons...'); -/// File to handle the creation of icons for Linux platform -class LinuxIconTemplate { - LinuxIconTemplate({required this.size, required this.name}); - - final String name; - final int size; -} - -/// List of icons to create -List linuxIcons = [ - LinuxIconTemplate(name: linuxDefaultIconName, size: 256), -]; + final image = Icon.loadFile(imagePath); + if (image == null) { + CliLogger.error('The file $imagePath could not be read.', + level: CliLoggerLevel.two); + exit(1); + } -/// + final template = LinuxIconTemplate(name: LINUX_DEFAULT_ICON_NAME, size: 256); + _saveImageLinux(template, image, LINUX_DEFAULT_ICON_FILE_NAME); -/// Save the icons -void saveNewIcons(LinuxIconTemplate template, Icon image, - {String? newIconName}) { - final iconName = newIconName ?? template.name; - final filePath = linuxDefaultIconFolder + iconName + '.png'; + CliLogger.success('Generated app icon image', level: CliLoggerLevel.two); - image.saveResizedPng(template.size, filePath); + _createLinuxDesktopFile(); + CliLogger.success('Created desktop entry file', level: CliLoggerLevel.two); } -/// Create the icons -void createIcons(Map config, String? flavor) { - final String filePath = config['image_path_linux'] ?? config['image_path']; - // decodeImageFile shows error message if null - // so can return here if image is null - final image = Icon.loadFile(filePath); - if (image == null) { - return; - } - - final dynamic linuxConfig = config['linux']; - if (flavor != null) { - final String catalogName = 'AppIcon-$flavor'; - printStatus('Building Linux launcher icon for $flavor'); - for (LinuxIconTemplate template in linuxIcons) { - saveNewIcons(template, image, newIconName: catalogName); - } - } else if (linuxConfig is String) { - // If the Linux configuration is a string then the user has specified a new icon to be created - // and for the old icon file to be kept - final String newIconName = linuxConfig; - printStatus('Adding new linux launcher icon'); - for (LinuxIconTemplate template in linuxIcons) { - saveNewIcons(template, image, newIconName: newIconName); - } - } else { - printStatus('Adding new linux launcher icon'); - for (LinuxIconTemplate template in linuxIcons) { - saveNewIcons(template, image); - } - } - createDesktopFile(); +/// Save linux image +void _saveImageLinux( + LinuxIconTemplate template, + Icon image, + String fileName, +) { + image.saveResizedPng(template.size, '$LINUX_DEFAULT_ICON_DIR$fileName'); } -/// Create the .desktop extension file -void createDesktopFile() { +/// Create linux desktop file +void _createLinuxDesktopFile() { const String desktopFile = ''' [Desktop Entry] Name=Flutter Linux App Comment=Flutter Linux launcher icon -Exec=$linuxDefaultIconName -Icon=$linuxDefaultIconName.png +Exec=$LINUX_DEFAULT_ICON_NAME +Icon=$LINUX_DEFAULT_ICON_FILE_NAME Terminal=false Type=Application Categories=Entertainment; '''; - File(linuxDefaultIconFolder + linuxDefaultIconName + '.desktop') - .create(recursive: true) - .then((File file) { - file.writeAsStringSync(desktopFile); - }); + final file = File('$LINUX_DEFAULT_ICON_DIR$LINUX_DEFAULT_ICON_NAME.desktop'); + file.createSync(recursive: true); + file.writeAsStringSync(desktopFile); } diff --git a/lib/src/macos.dart b/lib/src/macos.dart index e20c693..3fcfe28 100644 --- a/lib/src/macos.dart +++ b/lib/src/macos.dart @@ -1,254 +1,36 @@ -import 'dart:convert'; +part of icons_launcher_cli; -import 'package:icons_launcher/constants.dart'; -import 'package:icons_launcher/utils.dart'; -import 'package:universal_io/io.dart'; +/// Start create macos icons +void _createMacOSIcons({required String imagePath}) { + CliLogger.info('Creating macOS icons...'); -import '../icon.dart'; - -/// File to handle the creation of icons for MacOS platform -class MacOSIconTemplate { - MacOSIconTemplate({required this.size, required this.name}); - - final String name; - final int size; -} - -/// List of icons to create -List macosIcons = [ - MacOSIconTemplate(name: '_16', size: 16), - MacOSIconTemplate(name: '_32', size: 32), - MacOSIconTemplate(name: '_64', size: 64), - MacOSIconTemplate(name: '_128', size: 128), - MacOSIconTemplate(name: '_256', size: 256), - MacOSIconTemplate(name: '_512', size: 512), - MacOSIconTemplate(name: '_1024', size: 1024), -]; - -/// Create the icons -void createIcons(Map config, String? flavor) { - final String filePath = config['image_path_macos'] ?? config['image_path']; - // decodeImageFile shows error message if null - // so can return here if image is null - final image = Icon.loadFile(filePath); + final image = Icon.loadFile(imagePath); if (image == null) { - return; - } - if (config['remove_alpha_macos'] is bool && config['remove_alpha_macos']) { - image.removeAlpha(); - } - if (image.hasAlpha) { - print( - '\nWARNING: Icons with alpha channel are not allowed in the Apple App Store.\nSet "remove_alpha_macos: true" to remove it.\n'); - } - String iconName; - final dynamic macosConfig = config['macos']; - if (flavor != null) { - final String catalogName = 'AppIcon-$flavor'; - printStatus('Building MacOS launcher icon for $flavor'); - for (MacOSIconTemplate template in macosIcons) { - saveNewIcons(template, image, catalogName); - } - iconName = macosDefaultIconName; - changeMacOSIconLauncher(catalogName, flavor); - modifyContentsFile(catalogName); - } else if (macosConfig is String) { - // If the MacOS configuration is a string then the user has specified a new icon to be created - // and for the old icon file to be kept - final String newIconName = macosConfig; - printStatus('Adding new MacOS launcher icon'); - for (MacOSIconTemplate template in macosIcons) { - saveNewIcons(template, image, newIconName); - } - iconName = newIconName; - changeMacOSIconLauncher(iconName, flavor); - modifyContentsFile(iconName); - } - // Otherwise the user wants the new icon to use the default icons name and - // update config file to use it - else { - printStatus('Overwriting default MacOS launcher icon with new icon'); - for (MacOSIconTemplate template in macosIcons) { - overwriteDefaultIcons(template, image); - } - iconName = macosDefaultIconName; - changeMacOSIconLauncher('AppIcon', flavor); - } -} - -/// Note: Do not change interpolation unless you end up with better results (see issue for result when using cubic -/// interpolation) -void overwriteDefaultIcons(MacOSIconTemplate template, Icon image) { - image.saveResizedPng( - template.size, - macosDefaultIconFolder + macosDefaultIconName + template.name + '.png', - ); -} - -/// Note: Do not change interpolation unless you end up with better results (see issue for result when using cubic -/// interpolation) -void saveNewIcons(MacOSIconTemplate template, Icon image, String newIconName) { - final String newIconFolder = macosAssetFolder + newIconName + '.appiconset/'; - image.saveResizedPng( - template.size, - newIconFolder + newIconName + template.name + '.png', - ); -} - -/// Change the launcher icon -Future changeMacOSIconLauncher(String iconName, String? flavor) async { - final File macOSConfigFile = File(macosConfigFile); - final List lines = await macOSConfigFile.readAsLines(); - - bool onConfigurationSection = false; - String? currentConfig; - - for (int x = 0; x < lines.length; x++) { - final String line = lines[x]; - if (line.contains('/* Begin XCBuildConfiguration section */')) { - onConfigurationSection = true; - } - if (line.contains('/* End XCBuildConfiguration section */')) { - onConfigurationSection = false; - } - if (onConfigurationSection) { - final match = RegExp('.*/\\* (.*)\.xcconfig \\*/;').firstMatch(line); - if (match != null) { - currentConfig = match.group(1); - } - - if (currentConfig != null && - (flavor == null || currentConfig.contains('-$flavor')) && - line.contains('ASSETCATALOG')) { - lines[x] = line.replaceAll(RegExp('\=(.*);'), '= $iconName;'); - } - } - } - - final String entireFile = lines.join('\n'); - await macOSConfigFile.writeAsString(entireFile); -} - -/// Create the Contents.json file -void modifyContentsFile(String newIconName) { - final String newIconFolder = - macosAssetFolder + newIconName + '.appiconset/Contents.json'; - File(newIconFolder).create(recursive: true).then((File contentsJsonFile) { - final String contentsFileContent = - generateContentsFileAsString(newIconName); - contentsJsonFile.writeAsString(contentsFileContent); - }); -} - -/// Generate the Contents.json file -String generateContentsFileAsString(String newIconName) { - final Map contentJson = { - 'images': createImageList(newIconName), - 'info': ContentsInfoObject(version: 1, author: 'xcode').toJson() - }; - return json.encode(contentJson); -} - -class ContentsImageObject { - ContentsImageObject({ - required this.size, - required this.idiom, - required this.filename, - required this.scale, - }); - - final String size; - final String idiom; - final String filename; - final String scale; + CliLogger.error('The file $imagePath could not be read.', + level: CliLoggerLevel.two); + exit(1); + } + + final macosIcons = [ + MacOSIconTemplate(name: '_16', size: 16), + MacOSIconTemplate(name: '_32', size: 32), + MacOSIconTemplate(name: '_64', size: 64), + MacOSIconTemplate(name: '_128', size: 128), + MacOSIconTemplate(name: '_256', size: 256), + MacOSIconTemplate(name: '_512', size: 512), + MacOSIconTemplate(name: '_1024', size: 1024), + ]; - Map toJson() { - return { - 'size': size, - 'idiom': idiom, - 'filename': filename, - 'scale': scale - }; + for (final template in macosIcons) { + _saveImageMacOS(template, image); } -} -class ContentsInfoObject { - ContentsInfoObject({required this.version, required this.author}); - - final int version; - final String author; - - Map toJson() { - return { - 'version': version, - 'author': author, - }; - } + CliLogger.success('Generated app icon images', level: CliLoggerLevel.two); } -/// Create the image list -List> createImageList(String fileNamePrefix) { - final List> imageList = >[ - ContentsImageObject( - size: '16x16', - idiom: 'mac', - filename: '${fileNamePrefix}_16.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '16x16', - idiom: 'mac', - filename: '${fileNamePrefix}_32.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '32x32', - idiom: 'mac', - filename: '${fileNamePrefix}_32.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '32x32', - idiom: 'mac', - filename: '${fileNamePrefix}_64.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '128x128', - idiom: 'mac', - filename: '${fileNamePrefix}_128.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '128x128', - idiom: 'mac', - filename: '${fileNamePrefix}_256.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '256x256', - idiom: 'mac', - filename: '${fileNamePrefix}_256.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '256x256', - idiom: 'mac', - filename: '${fileNamePrefix}_512.png', - scale: '2x') - .toJson(), - ContentsImageObject( - size: '512x512', - idiom: 'mac', - filename: '${fileNamePrefix}_512.png', - scale: '1x') - .toJson(), - ContentsImageObject( - size: '512x512', - idiom: 'mac', - filename: '${fileNamePrefix}_1024.png', - scale: '2x') - .toJson(), - ]; - return imageList; +/// Save macos image +void _saveImageMacOS(MacOSIconTemplate template, Icon image) { + final filePath = + '$MACOS_DEFAULT_APP_ICON_DIR$MACOS_DEFAULT_ICON_NAME${template.name}.png'; + image.saveResizedPng(template.size, filePath); } diff --git a/lib/src/version.dart b/lib/src/version.dart new file mode 100644 index 0000000..0e58df3 --- /dev/null +++ b/lib/src/version.dart @@ -0,0 +1,2 @@ +// Generated code. Do not modify. +const packageVersion = '2.0.0'; diff --git a/lib/src/web.dart b/lib/src/web.dart index e191cf5..2b7318f 100644 --- a/lib/src/web.dart +++ b/lib/src/web.dart @@ -1,96 +1,50 @@ -import 'package:icons_launcher/constants.dart'; -import 'package:icons_launcher/utils.dart'; +part of icons_launcher_cli; -import '../icon.dart'; +/// Start create web icons +void _createWebIcons({required String imagePath}) { + CliLogger.info('Creating Web icons...'); -/// File to handle the creation of icons for Web platform -class WebIconTemplate { - WebIconTemplate({required this.size, required this.name}); - - final String name; - final int size; -} - -List webIcons = [ - WebIconTemplate(name: 'Icon-192', size: 192), - WebIconTemplate(name: 'Icon-512', size: 512), - WebIconTemplate(name: 'Icon-maskable-192', size: 192), - WebIconTemplate(name: 'Icon-maskable-512', size: 512), -]; + final image = Icon.loadFile(imagePath); + if (image == null) { + CliLogger.error('The file $imagePath could not be read.', + level: CliLoggerLevel.two); + exit(1); + } -WebIconTemplate webFavicon = WebIconTemplate(name: 'favicon', size: 16); + final webIcons = [ + WebIconTemplate(name: 'Icon-192.png', size: 192), + WebIconTemplate(name: 'Icon-512.png', size: 512), + WebIconTemplate(name: 'Icon-maskable-192.png', size: 192), + WebIconTemplate(name: 'Icon-maskable-512.png', size: 512), + ]; -/// Overwrites the default favicon -void overwriteDefaultFavicon(WebIconTemplate template, Icon image) { - image.saveResizedPng( - template.size, - webDefaultFaviconFolder + template.name + '.png', - ); + for (final template in webIcons) { + _saveImageWeb(template, image); + } + CliLogger.success('Generated icon images', level: CliLoggerLevel.two); } -/// Overwrites the default icons -void overwriteDefaultIcons(WebIconTemplate template, Icon image) { - try { - image.saveResizedPng( - template.size, - webDefaultIconFolder + template.name + '.png', - ); - } catch (e) { - print(e); +/// Start create web favicon +void _createWebFavicon({required String imagePath}) { + final image = Icon.loadFile(imagePath); + if (image == null) { + CliLogger.error('The file $imagePath could not be read.', + level: CliLoggerLevel.two); + exit(1); } -} -/// Creates new favicon -void saveNewFavicon(WebIconTemplate template, Icon image) { - image.saveResizedPng( - template.size, - webDefaultFaviconFolder + template.name + '.png', - ); + final webFavicon = WebIconTemplate(name: 'favicon.png', size: 16); + _saveFaviconImageWeb(webFavicon, image); + CliLogger.success('Generated favicon image', level: CliLoggerLevel.two); } -/// Creates new icons -void saveNewIcons(WebIconTemplate template, Icon image) { - image.saveResizedPng( - template.size, - webDefaultIconFolder + template.name + '.png', - ); +/// Save web image +void _saveImageWeb(WebIconTemplate template, Icon image) { + image.saveResizedPng(template.size, '$WEB_DEFAULT_ICON_DIR${template.name}'); } -/// Create icons -void createIcons(Map config, String? flavor) { - final String filePath = config['image_path_web'] ?? config['image_path']; - final String faviconPath = config['favicon_path'] ?? filePath; - // decodeImageFile shows error message if null - // so can return here if image is null - final image = Icon.loadFile(filePath); - final favicon = Icon.loadFile(faviconPath); - if (image == null || favicon == null) { - return; - } - - final dynamic webConfig = config['web']; - if (flavor != null) { - printStatus('Building Web launcher icon for $flavor'); - saveNewFavicon(webFavicon, favicon); - for (WebIconTemplate template in webIcons) { - saveNewIcons(template, image); - } - } else if (webConfig is String) { - // If the Web configuration is a string then the user has specified a new icon to be created - // and for the old icon file to be kept - printStatus('Adding new Web launcher icon'); - saveNewFavicon(webFavicon, favicon); - for (WebIconTemplate template in webIcons) { - saveNewIcons(template, image); - } - } - // Otherwise the user wants the new icon to use the default icons name and - // update config file to use it - else { - printStatus('Overwriting default Web launcher icon with new icon'); - overwriteDefaultFavicon(webFavicon, favicon); - for (WebIconTemplate template in webIcons) { - overwriteDefaultIcons(template, image); - } - } +/// Save favicon image +void _saveFaviconImageWeb(WebIconTemplate template, Icon image) { + image.saveResizedPng( + template.size, '$WEB_DEFAULT_FAVICON_DIR${template.name}'); } diff --git a/lib/src/windows.dart b/lib/src/windows.dart index bacb10e..3bfbea0 100644 --- a/lib/src/windows.dart +++ b/lib/src/windows.dart @@ -1,72 +1,47 @@ -import 'package:icons_launcher/constants.dart'; -import 'package:icons_launcher/icon.dart'; -import 'package:icons_launcher/utils.dart'; +part of icons_launcher_cli; -/// File to handle the creation of icons for Windows platform -class WindowsIconTemplate { - WindowsIconTemplate({required this.size, required this.name}); +/// Start create windows icons +void _createWindowsIcons({required String imagePath}) { + CliLogger.info('Creating Windows icons...'); - final String name; - final int size; -} + final image = Icon.loadFile(imagePath); + if (image == null) { + CliLogger.error('The file $imagePath could not be read.', + level: CliLoggerLevel.two); + exit(1); + } -//? https://www.creativefreedom.co.uk/icon-designers-blog/windows-ico/ + //? https://www.creativefreedom.co.uk/icon-designers-blog/windows-ico/ // Give a highest quality icon with a minimum of 256x256 pixels. // debug ico file here (https://redketchup.io/icon-editor) -List windowsIcons = [ - WindowsIconTemplate(name: '', size: 16), - WindowsIconTemplate(name: '', size: 24), - WindowsIconTemplate(name: '', size: 32), - WindowsIconTemplate(name: '', size: 48), - WindowsIconTemplate(name: '', size: 64), - WindowsIconTemplate(name: '', size: 96), - WindowsIconTemplate(name: '', size: 128), - WindowsIconTemplate(name: '', size: 256), -]; + final List windowsIcons = [ + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 16), + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 24), + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 32), + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 48), + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 64), + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 96), + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 128), + WindowsIconTemplate(name: WINDOWS_DEFAULT_ICON_NAME, size: 256), + ]; -/// Overwrites the icon file with the new icon -void overwriteDefaultIcons(List images) { - Icon.saveIco( - images, - windowsDefaultIconFolder + windowsDefaultIconName + '.ico', - ); -} + final images = []; + for (final template in windowsIcons) { + final resizedImage = image.copyResized(template.size); + images.add(resizedImage); + } + _saveImageWindow(images, WINDOWS_DEFAULT_ICON_FILE_NAME); -/// Creates new icons -void saveNewIcons(List images, String newIconName) { - final String newIconFolder = windowsDefaultIconFolder + newIconName; - Icon.saveIco(images, newIconFolder + newIconName + '.ico'); + CliLogger.success( + 'Generated app icon image', + level: CliLoggerLevel.two, + ); } -/// Create icons -void createIcons(Map config, String? flavor) { - final String filePath = config['image_path_windows'] ?? config['image_path']; - // decodeImageFile shows error message if null - // so can return here if image is null - final image = Icon.loadFile(filePath); - if (image == null) { - return; - } - - final dynamic windowsConfig = config['windows']; - if (windowsConfig is String) { - // If the Windows configuration is a string then the user has specified a new icon to be created - // and for the old icon file to be kept - final String newIconName = windowsConfig; - printStatus('Adding new Windows launcher icon'); - final images = []; - for (WindowsIconTemplate template in windowsIcons) { - final resizedImage = image.copyResized(template.size); - images.add(resizedImage); - } - saveNewIcons(images, newIconName); - } else { - printStatus('Overwriting default Windows launcher icon with new icon'); - final images = []; - for (WindowsIconTemplate template in windowsIcons) { - final resizedImage = image.copyResized(template.size); - images.add(resizedImage); - } - overwriteDefaultIcons(images); - } +/// Save windows image +void _saveImageWindow( + List images, + String fileName, +) { + Icon.saveIco(images, '$WINDOWS_DEFAULT_ICON_DIR$fileName'); } diff --git a/lib/utils.dart b/lib/utils.dart deleted file mode 100644 index a7e64b2..0000000 --- a/lib/utils.dart +++ /dev/null @@ -1,10 +0,0 @@ -/// Logging -void printStatus(String message) { - print('🚀 $message'); -} - -/// Generate error -String generateError(Exception e, String? error) { - final errorOutput = error == null ? '' : ' \n$error'; - return '\n✗ ERROR: ${(e).runtimeType.toString()}$errorOutput'; -} diff --git a/lib/utils/cli_logger.dart b/lib/utils/cli_logger.dart new file mode 100644 index 0000000..eba7730 --- /dev/null +++ b/lib/utils/cli_logger.dart @@ -0,0 +1,78 @@ +/// Log levels +enum CliLoggerLevel { + /// Level one + one, + + /// Level two + two, + + /// Level three + three, +} + +// Reset: \x1B[0m +// Black: \x1B[30m +// White: \x1B[37m +// Red: \x1B[31m +// Green: \x1B[32m +// Yellow: \x1B[33m +// Blue: \x1B[34m +// Cyan: \x1B[36m + +/// Cli Logger +class CliLogger { + /// Constructor + CliLogger(); + + /// Log info + static void info( + String message, { + CliLoggerLevel level = CliLoggerLevel.one, + }) { + final String space = _getSpace(level); + print('\x1B[34m$space🌱 $message\x1B[0m'); + } + + /// Logs a error message at the given level. + static void error( + String message, { + CliLoggerLevel level = CliLoggerLevel.one, + }) { + final String space = _getSpace(level); + print('$space❌ $message'); + } + + /// Logs a warning message at the given level. + static void warning( + String message, { + CliLoggerLevel level = CliLoggerLevel.one, + }) { + final String space = _getSpace(level); + print('\x1B[33m$space🚧 $message\x1B[0m'); + } + + /// Logs a success message at the given level. + static void success( + String message, { + CliLoggerLevel level = CliLoggerLevel.one, + }) { + final String space = _getSpace(level); + print('\x1B[32m$space✅ $message\x1B[0m'); + } + + static String _getSpace(CliLoggerLevel level) { + String space = ''; + switch (level) { + case CliLoggerLevel.one: + space = ''; + break; + case CliLoggerLevel.two: + space = ' '; + break; + case CliLoggerLevel.three: + space = ' '; + break; + } + return space; + } +} diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart new file mode 100644 index 0000000..e620d0f --- /dev/null +++ b/lib/utils/constants.dart @@ -0,0 +1,158 @@ +import '../src/version.dart'; + +/// Start message for the CLI +const String START_MESSAGE = '''\n +╔════════════════════════════════════════════════════╗ +║ ✨✨ ICONS LAUNCHER ✨✨ ║ +╠════════════════════════════════════════════════════╣ +║ Version: $packageVersion ║ +╚════════════════════════════════════════════════════╝ +\n'''; + +/// End message for the CLI +const String END_MESSAGE = '''\n +==> GENERATE LAUNCHER ICONS SUCCESSFULLY <== + ❤️ THANK YOU! ❤️ +'''; + +/// Flutter sdk gradle file location +const String FLUTTER_SDK_GRADLE_FILE = + '/packages/flutter_tools/gradle/flutter.gradle'; + +/// Android local properties file location +const String ANDROID_LOCAL_PROPERTIES = 'android/local.properties'; + +/// Android build gradle file location +const String ANDROID_GRADLE_FILE = 'android/app/build.gradle'; + +/// Android colors xml file location +const String ANDROID_COLOR_FILE = 'values/colors.xml'; + +/// Android AndroidManifest file location +const String ANDROID_MANIFEST_FILE = 'android/app/src/main/AndroidManifest.xml'; + +/// Android icon name +const String ANDROID_ICON_NAME = 'ic_launcher'; + +/// Android icon name with extension +const String ANDROID_ICON_FILE_NAME = '$ANDROID_ICON_NAME.png'; + +/// Android playstore icon name +const String ANDROID_PLAYSTORE_ICON_NAME = 'ic_launcher-playstore'; + +/// Android playstore icon name with extension +const String ANDROID_PLAYSTORE_ICON_FILE_NAME = + '$ANDROID_PLAYSTORE_ICON_NAME.png'; + +/// Android adaptive round icon name +const String ANDROID_ADAPTIVE_ROUND_ICON_NAME = 'ic_launcher_round'; + +/// Android adaptive round icon name with extension +const String ANDROID_ADAPTIVE_ROUND_ICON_FILE_NAME = + '$ANDROID_ADAPTIVE_ROUND_ICON_NAME.png'; + +/// Android adaptive foreground icon name +const String ANDROID_ADAPTIVE_FOREGROUND_ICON_NAME = 'ic_launcher_foreground'; + +/// Android adaptive foreground icon name with extension +const String ANDROID_ADAPTIVE_FOREGROUND_ICON_FILE_NAME = + '$ANDROID_ADAPTIVE_FOREGROUND_ICON_NAME.png'; + +/// Android adaptive background icon name +const String ANDROID_ADAPTIVE_BACKGROUND_ICON_NAME = 'ic_launcher_background'; + +/// Android adaptive background icon name with extension +const String ANDROID_ADAPTIVE_BACKGROUND_ICON_FILE_NAME = + '$ANDROID_ADAPTIVE_BACKGROUND_ICON_NAME.png'; + +/// Android adaptive folder name +const String ANDROID_ADAPTIVE_XML_DIR = 'mipmap-anydpi-v26'; + +/// Android adaptive icon file +const String ANDROID_ADAPTIVE_XML_FILE_NAME = '$ANDROID_ICON_NAME.xml'; + +/// Android adaptive round icon file +const String ANDROID_ADAPTIVE_ROUND_XML_FILE_NAME = + '$ANDROID_ADAPTIVE_ROUND_ICON_NAME.xml'; + +/// Android launcher background color xml +const String IC_LAUNCHER_BACKGROUND_COLOR_XML = ''' + + + + + +'''; + +/// Android launcher background image xml +const String IC_LAUNCHER_MIP_MAP_XML = ''' + + + + + +'''; + +/// Android launcher background round color xml +const String IC_LAUNCHER_ROUND_BACKGROUND_COLOR_XML = ''' + + + + + +'''; + +/// Android launcher background round image xml +const String IC_LAUNCHER_ROUND_MIP_MAP_XML = ''' + + + + + +'''; + +/// IOS config file location +const String IOS_CONFIG_FILE = 'ios/Runner.xcodeproj/project.pbxproj'; + +/// IOS default icon name +const String IOS_DEFAULT_ICON_NAME = 'Icon-App'; + +/// Web default favicon folder +const String WEB_DEFAULT_FAVICON_DIR = 'web/'; + +/// Web default icon folder +const String WEB_DEFAULT_ICON_DIR = 'web/icons/'; + +/// MacOS default app icon folder +const String MACOS_DEFAULT_APP_ICON_DIR = + 'macos/Runner/Assets.xcassets/AppIcon.appiconset/'; + +/// MacOS asset folder +const String MACOS_ASSET_DIR = 'macos/Runner/Assets.xcassets/'; + +/// MacOS config file location +const String MACOS_CONFIG_FILE = 'macos/Runner.xcodeproj/project.pbxproj'; + +/// MacOS default icon name +const String MACOS_DEFAULT_ICON_NAME = 'app_icon'; + +/// MacOS default icon file with extension +const String MACOS_DEFAULT_ICON_FILE_NAME = '$MACOS_DEFAULT_ICON_NAME.png'; + +/// Windows default icon folder +const String WINDOWS_DEFAULT_ICON_DIR = 'windows/runner/resources/'; + +/// Windows default icon name +const String WINDOWS_DEFAULT_ICON_NAME = 'app_icon'; + +/// Windows default icon file with extension +const String WINDOWS_DEFAULT_ICON_FILE_NAME = '$WINDOWS_DEFAULT_ICON_NAME.ico'; + +/// Linux default icon folder +const String LINUX_DEFAULT_ICON_DIR = 'snap/gui/'; + +/// Linux default icon name +const String LINUX_DEFAULT_ICON_NAME = 'app_icon'; + +/// Linux default icon file with extension +const String LINUX_DEFAULT_ICON_FILE_NAME = '$LINUX_DEFAULT_ICON_NAME.png'; diff --git a/lib/utils/flavor_helper.dart b/lib/utils/flavor_helper.dart new file mode 100644 index 0000000..f5e69e7 --- /dev/null +++ b/lib/utils/flavor_helper.dart @@ -0,0 +1,171 @@ +part of icons_launcher_cli; + +/// Flavor helper class +class _FlavorHelper { + _FlavorHelper(this._flavor) { + if (_flavor != null) { + _androidResFolder = 'android/app/src/$_flavor/res/'; + _iOSFlavorName = _flavor!.capitalize(); + } else { + _androidResFolder = 'android/app/src/main/res/'; + _iOSFlavorName = ''; + } + } + + // Android related path values + final String? _flavor; + late String _androidResFolder; + + /// Get flavor name + String? get flavor { + return _flavor; + } + + /// Get Android res folder + String get androidResFolder { + return _androidResFolder; + } + + /// Get Android drawable folder + String get androidDrawableFolder { + return '${_androidResFolder}drawable/'; + } + + /// Get Android night drawable folder + String get androidNightDrawableFolder { + return '${_androidResFolder}drawable-night/'; + } + + /// Get Android launcher background color XML file + String get androidLaunchBackgroundFile { + return '${androidDrawableFolder}launch_background.xml'; + } + + /// Get Android launcher dark background color XML file + String get androidLaunchDarkBackgroundFile { + return '${androidNightDrawableFolder}launch_background.xml'; + } + + /// Get Android style XML file + String get androidStylesFile { + return '${_androidResFolder}values/styles.xml'; + } + + /// Get Android night style XML file + String get androidNightStylesFile { + return '${_androidResFolder}values-night/styles.xml'; + } + + /// Get Android v31 style XML file + String get androidV31StylesFile { + return '${_androidResFolder}values-v31/styles.xml'; + } + + /// Get Android v31 night style XML file + String get androidV31StylesNightFile { + return '${_androidResFolder}values-night-v31/styles.xml'; + } + + /// Get Android v21 drawable folder + String get androidV21DrawableFolder { + return '${_androidResFolder}drawable-v21/'; + } + + /// Get Android v21 launcher background XML file + String get androidV21LaunchBackgroundFile { + return '${androidV21DrawableFolder}launch_background.xml'; + } + + /// Get Android v21 night drawable folder + String get androidNightV21DrawableFolder { + return '${_androidResFolder}drawable-night-v21/'; + } + + /// Get Android v21 launcher dark background XML file + String get androidV21LaunchDarkBackgroundFile { + return '${androidNightV21DrawableFolder}launch_background.xml'; + } + + /// Get Android manifest file + String get androidManifestFile { + return 'android/app/src/main/AndroidManifest.xml'; + } + + // iOS related values + late String? _iOSFlavorName; + + /// Get iOS flavor name + String? get iOSFlavorName { + return _iOSFlavorName; + } + + /// Get iOS assets app icon folder + String get iOSAssetsAppIconFolder { + return 'ios/Runner/Assets.xcassets/${_flavor ?? ''}AppIcon.appiconset/'; + } + + /// Get iOS assets launch image folder + String get iOSAssetsLaunchImageFolder { + return 'ios/Runner/Assets.xcassets/LaunchImage$_iOSFlavorName.imageset/'; + } + + /// Get iOS assets branding image folder + String get iOSAssetsBrandingImageFolder { + return 'ios/Runner/Assets.xcassets/BrandingImage$_iOSFlavorName.imageset/'; + } + + /// Get iOS launch storyboard file + String get iOSLaunchScreenStoryboardFile { + return 'ios/Runner/Base.lproj/$iOSLaunchScreenStoryboardName.storyboard'; + } + + /// Get iOS launch storyboard name + String get iOSLaunchScreenStoryboardName { + return 'LaunchScreen$_iOSFlavorName'; + } + + /// Get iOS info.plist file + String get iOSInfoPlistFile { + return 'ios/Runner/Info.plist'; + } + + /// Get iOS assets background folder + String get iOSAssetsLaunchImageBackgroundFolder { + return 'ios/Runner/Assets.xcassets/LaunchBackground$_iOSFlavorName.imageset/'; + } + + /// Get iOS launch image name + String get iOSLaunchImageName { + if (_iOSFlavorName == null) { + return 'LaunchImage'; + } else { + return 'LaunchImage$_iOSFlavorName'; + } + } + + /// Get iOS branding image name + String get iOSBrandingImageName { + if (_iOSFlavorName == null) { + return 'BrandingImage'; + } else { + return 'BrandingImage$_iOSFlavorName'; + } + } + + /// Get iOS launch background name + String get iOSLaunchBackgroundName { + if (_iOSFlavorName == null) { + return 'LaunchBackground'; + } else { + return 'LaunchBackground$_iOSFlavorName'; + } + } +} + +/// String capitalize extension +extension StringExtension on String { + /// Capitalize string + String capitalize() { + return '${this[0].toUpperCase()}${substring(1).toLowerCase()}'; + } +} diff --git a/lib/icon.dart b/lib/utils/icon.dart similarity index 76% rename from lib/icon.dart rename to lib/utils/icon.dart index e007f59..992c085 100644 --- a/lib/icon.dart +++ b/lib/utils/icon.dart @@ -5,14 +5,21 @@ import 'package:universal_io/io.dart'; /// Icon template class IconTemplate { + /// Constructor const IconTemplate({required this.size}); + /// Size final int size; } +/// Icon class Icon { const Icon._(this.image); + /// Image + final Image image; + + /// Load an image from bytes static Icon? _loadBytes(Uint8List bytes) { final image = decodeImage(bytes); if (image == null) { @@ -22,16 +29,18 @@ class Icon { return Icon._(image); } + /// Load an image from file static Icon? loadFile(String filePath) { return Icon._loadBytes(File(filePath).readAsBytesSync()); } - final Image image; - + /// Check image is alpha bool get hasAlpha => image.channels == Channels.rgba; + /// Remove alpha channel from the image void removeAlpha() { image.channels = Channels.rgb; + image.fillBackground(0xFFFFFFFF); } /// Create a resized copy of this Icon @@ -56,18 +65,18 @@ class Icon { } /// Save the resized image to a file - Future saveResizedPng(int iconSize, String filePath) async { + void saveResizedPng(int iconSize, String filePath) { final data = encodePng(copyResized(iconSize).image); final file = File(filePath); - await file.create(recursive: true); - await file.writeAsBytes(data); + file.createSync(recursive: true); + file.writeAsBytesSync(data); } /// Save the resized image to a Windows ico file - static Future saveIco(List icons, String filePath) async { + static void saveIco(List icons, String filePath) { final data = encodeIcoImages(icons.map((e) => e.image).toList()); final file = File(filePath); - await file.create(recursive: true); - await file.writeAsBytes(data); + file.createSync(recursive: true); + file.writeAsBytesSync(data); } } diff --git a/lib/utils/template.dart b/lib/utils/template.dart new file mode 100644 index 0000000..432a4af --- /dev/null +++ b/lib/utils/template.dart @@ -0,0 +1,71 @@ +/// Android template +class AndroidMipMapIconTemplate { + /// Constructor + AndroidMipMapIconTemplate({required this.directoryName, required this.size}); + + /// Directory name + final String directoryName; + + /// Icon size + final int size; +} + +/// iOS template +class IosIconTemplate { + /// Constructor + IosIconTemplate({required this.size, required this.name}); + + /// Icon name + final String name; + + /// Icon size + final int size; +} + +/// Web template +class WebIconTemplate { + /// Constructor + WebIconTemplate({required this.size, required this.name}); + + /// Icon name + final String name; + + /// Icon size + final int size; +} + +/// MacOS template +class MacOSIconTemplate { + /// Constructor + MacOSIconTemplate({required this.size, required this.name}); + + /// Icon name + final String name; + + /// Icon size + final int size; +} + +/// Windows template +class WindowsIconTemplate { + /// Constructor + WindowsIconTemplate({required this.size, required this.name}); + + /// Icon name + final String name; + + /// Icon size + final int size; +} + +/// Linux template +class LinuxIconTemplate { + /// Constructor + LinuxIconTemplate({required this.size, required this.name}); + + /// Icon name + final String name; + + /// Icon size + final int size; +} diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart new file mode 100644 index 0000000..daac021 --- /dev/null +++ b/lib/utils/utils.dart @@ -0,0 +1,121 @@ +/// Checks if the config file contains a `platform` +bool hasPlatformConfig(Map config) { + final bool isHasPlatforms = config.containsKey('platforms'); + final platforms = config['platforms'] as Map; + final bool isHasPlatformSpecific = isNeedingNewAndroidIcon(platforms) || + isNeedingNewIosIcon(platforms) || + isNeedingNewMacOSIcon(platforms) || + isNeedingNewWindowsIcon(platforms) || + isNeedingNewWebIcon(platforms) || + isNeedingNewLinuxIcon(platforms); + return isHasPlatforms && isHasPlatformSpecific; +} + +/// Checks if the config has android. +bool hasAndroidConfig(Map platforms) { + return platforms.containsKey('android'); +} + +/// Checks if the config need android. +bool isNeedingNewAndroidIcon(Map platforms) { + return hasAndroidConfig(platforms) && platforms['android']['enable'] == true; +} + +/// Checks if the config has android adaptive. +bool hasAndroidAdaptiveConfig(Map platforms) { + return isNeedingNewAndroidIcon(platforms) && + (platforms['android'].containsKey('adaptive_background_image') || + platforms['android'].containsKey('adaptive_background_color')) && + platforms['android'].containsKey('adaptive_foreground_image'); +} + +/// Checks if the config has ios. +bool hasIosConfig(Map platforms) { + return platforms.containsKey('ios'); +} + +/// Checks if the config need ios. +bool isNeedingNewIosIcon(Map platforms) { + return hasIosConfig(platforms) && platforms['ios']['enable'] == true; +} + +/// Checks if the config has macos. +bool hasMacOSConfig(Map platforms) { + return platforms.containsKey('macos'); +} + +/// Checks if the config need macos. +bool isNeedingNewMacOSIcon(Map platforms) { + return hasMacOSConfig(platforms) && platforms['macos']['enable'] == true; +} + +/// Checks if the config has windows. +bool hasWindowsConfig(Map platforms) { + return platforms.containsKey('windows'); +} + +/// Checks if the config need windows. +bool isNeedingNewWindowsIcon(Map platforms) { + return hasWindowsConfig(platforms) && platforms['windows']['enable'] == true; +} + +/// Checks if the config has linux. +bool hasLinuxConfig(Map platforms) { + return platforms.containsKey('linux'); +} + +/// Checks if the config need linux. +bool isNeedingNewLinuxIcon(Map platforms) { + return hasLinuxConfig(platforms) && platforms['linux']['enable'] == true; +} + +/// Checks if the config has web. +bool hasWebConfig(Map platforms) { + return platforms.containsKey('web'); +} + +/// Checks if the config need linux. +bool isNeedingNewWebIcon(Map platforms) { + return hasWebConfig(platforms) && platforms['web']['enable'] == true; +} + +/// Checking color code +bool isValidHexaCode(String hexaCode) { + if (hexaCode[0] != '#') { + return false; + } + + if (!(hexaCode.length == 4 || hexaCode.length == 7)) { + return false; + } + + for (var i = 1; i < hexaCode.length; i++) { + if (!((hexaCode[i].codeUnitAt(0) <= '0'.codeUnitAt(0) && + hexaCode[i].codeUnitAt(0) <= 9) || + (hexaCode[i].codeUnitAt(0) >= 'a'.codeUnitAt(0) && + hexaCode[i].codeUnitAt(0) <= 'f'.codeUnitAt(0)) || + (hexaCode[i].codeUnitAt(0) >= 'A'.codeUnitAt(0) || + hexaCode[i].codeUnitAt(0) <= 'F'.codeUnitAt(0)))) { + return false; + } + } + + return true; +} + +/// Checking valid image file +bool isImageFile(String fileName) { + return fileName.endsWith('.png') || + fileName.endsWith('.jpg') || + fileName.endsWith('.jpeg'); +} + +/// Get color xml content +String getColorXmlContent(String color) { + return ''' + + + ${color.toUpperCase()} + +'''; +} diff --git a/lib/xml_templates.dart b/lib/xml_templates.dart deleted file mode 100644 index 1e55a3b..0000000 --- a/lib/xml_templates.dart +++ /dev/null @@ -1,38 +0,0 @@ -const String icLauncherXml = ''' - - - - - -'''; - -const String icLauncherRoundXml = ''' - - - - - -'''; - -const String icLauncherMipMapXml = ''' - - - - - -'''; - -const String icLauncherRoundMipMapXml = ''' - - - - - -'''; - -const String colorsXml = ''' - - - #FF000000 - -'''; diff --git a/pubspec.yaml b/pubspec.yaml index 78752a9..455758d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A command-line tool that simplifies the task of updating your Flutt maintainer: Mrr Hak homepage: https://mrrhak.com repository: https://github.com/mrrhak/icons_launcher -version: 1.2.1 +version: 2.0.0 dependencies: args: ^2.3.1 @@ -13,7 +13,9 @@ dependencies: yaml: ^3.1.1 environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=2.17.1 <3.0.0" dev_dependencies: - test: ^1.21.1 + build_runner: ^2.2.0 + build_version: ^2.1.1 # dart run build_runner build --delete-conflicting-outputs + test: ^1.21.4 diff --git a/test/config/icons_launcher_test_pubspec.yaml b/test/config/icons_launcher_test_pubspec.yaml index f93bd6b..e295871 100644 --- a/test/config/icons_launcher_test_pubspec.yaml +++ b/test/config/icons_launcher_test_pubspec.yaml @@ -7,9 +7,7 @@ flutter_icons: image_path: 'assets/images/icon-1024x1024.png' android: true ios: true - remove_alpha_ios: true macos: true - remove_alpha_macos: true windows: true linux: true web: true diff --git a/test/main_test.dart b/test/main_test.dart index b904319..01f4f44 100644 --- a/test/main_test.dart +++ b/test/main_test.dart @@ -1,7 +1,4 @@ -import 'package:icons_launcher/constants.dart'; -import 'package:icons_launcher/main.dart' as main_dart; -import 'package:icons_launcher/src/android.dart' as android; -import 'package:icons_launcher/src/ios.dart' as ios; +import 'package:icons_launcher/src/version.dart'; import 'package:test/test.dart'; import 'package:universal_io/io.dart'; import 'package:yaml/yaml.dart'; @@ -9,14 +6,13 @@ import 'package:yaml/yaml.dart'; // Unit tests for main.dart void main() { test('Version checker', () { + //! dart run build_runner build // Read yaml config file final File file = File('pubspec.yaml'); final String content = file.readAsStringSync(); final Map yaml = loadYaml(content); - // Read message constant - final message = introMessage(); - expect(message, contains(yaml['version']), + expect(packageVersion, yaml['version'].toString(), reason: 'Version is not correct'); }); @@ -32,99 +28,4 @@ void main() { expect(length, lessThan(180), reason: 'Description should be less than 180 characters'); }); - - test('Android icon list is correct size', () { - expect(android.androidIcons.length, 5); - }); - - test('Adaptive foreground icons icon list is correct size', () { - expect(android.adaptiveForegroundIcons.length, 5); - }); - - test('iOS icon list is correct size', () { - expect(ios.iosIcons.length, 21); - }); - - test( - 'iOS image list used to generate Contents.json for icon directory is correct size', - () { - expect(ios.createImageList('blah').length, 25); - }); - - test('image_path is in config', () { - final Map flutterIconsConfig = { - 'image_path': 'assets/ic_logo_border.png', - 'android': true, - 'ios': true - }; - expect(main_dart.isImagePathInConfig(flutterIconsConfig), true); - final Map flutterIconsConfigAndroid = { - 'image_path_android': 'assets/images/icon-710x599.png', - 'android': true, - 'ios': true - }; - expect(main_dart.isImagePathInConfig(flutterIconsConfigAndroid), false); - final Map flutterIconsConfigBoth = { - 'image_path_android': 'assets/ic_logo_border.png', - 'image_path_ios': 'assets/ic_logo_rectangle.png', - 'image_path_macos': 'assets/ic_logo_border.png', - 'image_path_windows': 'assets/ic_logo_border.png', - 'image_path_linux': 'assets/ic_logo_border.png', - 'image_path_web': 'assets/ic_logo_border.png', - 'adaptive_icon_background': 'assets/ic_background.png', - 'adaptive_icon_foreground': 'assets/ic_foreground.png', - 'adaptive_icon_round': 'assets/ic_logo_round.png', - 'remove_alpha_ios': false, - 'remove_alpha_macos': false, - 'ios': true, - 'android': true, - 'macos': false, - 'windows': false, - 'linux': false, - 'web': false - }; - expect(main_dart.isImagePathInConfig(flutterIconsConfigBoth), true); - }); - - test('At least one platform is in config file', () { - final Map flutterIconsConfig = { - 'image_path': 'assets/ic_logo_border.png', - 'android': true, - 'ios': true - }; - expect(main_dart.hasPlatformConfig(flutterIconsConfig), true); - }); - - test('No platform specified in config', () { - final Map flutterIconsConfig = { - 'image_path': 'assets/ic_logo_border.png' - }; - expect(main_dart.hasPlatformConfig(flutterIconsConfig), false); - }); - - test('No new Android icon needed - android: false', () { - final Map flutterIconsConfig = { - 'image_path': 'assets/ic_logo_border.png', - 'android': false, - 'ios': true - }; - expect(main_dart.isNeedingNewAndroidIcon(flutterIconsConfig), false); - }); - - test('No new Android icon needed - no Android config', () { - final Map flutterIconsConfig = { - 'image_path': 'assets/ic_logo_border.png', - 'ios': true - }; - expect(main_dart.isNeedingNewAndroidIcon(flutterIconsConfig), false); - }); - - test('No new iOS icon needed - ios: false', () { - final Map flutterIconsConfig = { - 'image_path': 'assets/ic_logo_border.png', - 'android': true, - 'ios': false - }; - expect(main_dart.isNeedingNewIOSIcon(flutterIconsConfig), false); - }); }