Skip to content

Commit

Permalink
Merge pull request #222 from ionic-team/fixes-for-icons
Browse files Browse the repository at this point in the history
feat: add asset support for capacitor
  • Loading branch information
markemer authored Sep 25, 2024
2 parents 4d0a38f + 4cb9609 commit 0f1b30d
Show file tree
Hide file tree
Showing 17 changed files with 1,648 additions and 189 deletions.
641 changes: 635 additions & 6 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"test": "turbo run test",
"shipit": "npm run build-jar -w packages/gradle-parse && npm run build -- --force && npm run test && npx changeset publish && git push --tags"
},
"volta": {
"node": "16.18.1",
"npm": "9.1.2"
},
"packageManager": "npm@9.1.l"
"dependencies": {
"@types/sharp": "^0.31.1"
}
}
1 change: 1 addition & 0 deletions packages/project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"prettier": "^2.7.1",
"prompts": "^2.4.2",
"replace": "^1.1.0",
"sharp": "^0.33.5",
"tempy": "^1.0.1",
"tmp": "^0.2.1",
"ts-node": "^10.2.1",
Expand Down
116 changes: 116 additions & 0 deletions packages/project/src/assets/android/assets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import type {
AndroidOutputAssetTemplate,
AndroidOutputAssetTemplateAdaptiveIcon
} from '../asset-types';
import { AssetKind, AndroidDensity, Format, Platform } from '../asset-types';

export const ANDROID_LDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 36,
height: 36,
density: AndroidDensity.Ldpi,
};

export const ANDROID_MDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 48,
height: 48,
density: AndroidDensity.Mdpi,
};

export const ANDROID_HDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 72,
height: 72,
density: AndroidDensity.Hdpi,
};

export const ANDROID_XHDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 96,
height: 96,
density: AndroidDensity.Xhdpi,
};

export const ANDROID_XXHDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 144,
height: 144,
density: AndroidDensity.Xxhdpi,
};

export const ANDROID_XXXHDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 192,
height: 192,
density: AndroidDensity.Xxxhdpi,
};

/**
* Adaptive icons
*/
export const ANDROID_LDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 81,
height: 81,
density: AndroidDensity.Ldpi,
};

export const ANDROID_MDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 108,
height: 108,
density: AndroidDensity.Mdpi,
};

export const ANDROID_HDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 162,
height: 162,
density: AndroidDensity.Hdpi,
};

export const ANDROID_XHDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 216,
height: 216,
density: AndroidDensity.Xhdpi,
};

export const ANDROID_XXHDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 324,
height: 324,
density: AndroidDensity.Xxhdpi,
};

export const ANDROID_XXXHDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 432,
height: 432,
density: AndroidDensity.Xxxhdpi,
};
Loading

0 comments on commit 0f1b30d

Please sign in to comment.