Skip to content

Commit 99a87f4

Browse files
authored
Feat!: Only generate 1024 size iOS icons for xcode 14 compat (#500)
* Only 1024 for iOS icons for xcode 14 compat * chore: update tests
1 parent a669e82 commit 99a87f4

File tree

5 files changed

+12
-232
lines changed

5 files changed

+12
-232
lines changed

.changeset/wise-buses-drop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@capacitor/assets': major
3+
---
4+
5+
Only generate 1024x1024 for iOS icons for xcode 14 compatibility

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/platforms/ios/assets.ts

-225
Original file line numberDiff line numberDiff line change
@@ -3,237 +3,12 @@ import {
33
Format,
44
IosIdiom,
55
IosOutputAssetTemplate,
6-
IosOutputAssetTemplateIcon,
76
IosOutputAssetTemplateSplash,
87
Orientation,
98
Platform,
109
Theme,
1110
} from '../../definitions';
1211

13-
/**
14-
* 20pt Icon
15-
*
16-
* - iPhone Notification (iOS 7-15)
17-
* - iPad Notification (iOS 7-15)
18-
*/
19-
export const IOS_20_PT_ICON: IosOutputAssetTemplateIcon = {
20-
platform: Platform.Ios,
21-
idiom: IosIdiom.iPad,
22-
kind: AssetKind.NotificationIcon,
23-
24-
format: Format.Png,
25-
width: 20,
26-
height: 20,
27-
scale: 1,
28-
};
29-
30-
export const IOS_20_PT_2X_ICON: IosOutputAssetTemplate = {
31-
platform: Platform.Ios,
32-
idiom: IosIdiom.iPhone,
33-
kind: AssetKind.NotificationIcon,
34-
35-
format: Format.Png,
36-
width: 40,
37-
height: 40,
38-
scale: 2,
39-
};
40-
41-
export const IOS_20_PT_2X_1_ICON: IosOutputAssetTemplate = {
42-
platform: Platform.Ios,
43-
idiom: IosIdiom.iPad,
44-
kind: AssetKind.NotificationIcon,
45-
46-
format: Format.Png,
47-
width: 40,
48-
height: 40,
49-
scale: 2,
50-
};
51-
52-
export const IOS_20_PT_3X_ICON: IosOutputAssetTemplate = {
53-
platform: Platform.Ios,
54-
idiom: IosIdiom.iPhone,
55-
kind: AssetKind.NotificationIcon,
56-
57-
format: Format.Png,
58-
width: 60,
59-
height: 60,
60-
scale: 3,
61-
};
62-
63-
/**
64-
* 29pt Icon
65-
*
66-
* - iPhone Settings (iOS 7-15)
67-
* - iPad Settings (iOS 7-15)
68-
* - Apple Watch Companion Settings
69-
* - Apple Watch Notification Center
70-
*/
71-
export const IOS_29_PT_ICON: IosOutputAssetTemplate = {
72-
platform: Platform.Ios,
73-
idiom: IosIdiom.iPad,
74-
kind: AssetKind.SettingsIcon,
75-
76-
format: Format.Png,
77-
width: 29,
78-
height: 29,
79-
scale: 1,
80-
};
81-
82-
export const IOS_29_PT_2X_ICON: IosOutputAssetTemplate = {
83-
platform: Platform.Ios,
84-
idiom: IosIdiom.iPhone,
85-
kind: AssetKind.SettingsIcon,
86-
87-
format: Format.Png,
88-
width: 58,
89-
height: 58,
90-
scale: 2,
91-
};
92-
93-
export const IOS_29_PT_2X_1_ICON: IosOutputAssetTemplate = {
94-
platform: Platform.Ios,
95-
idiom: IosIdiom.iPad,
96-
kind: AssetKind.SettingsIcon,
97-
98-
format: Format.Png,
99-
width: 58,
100-
height: 58,
101-
scale: 2,
102-
};
103-
104-
export const IOS_29_PT_3X_ICON: IosOutputAssetTemplate = {
105-
platform: Platform.Ios,
106-
idiom: IosIdiom.iPhone,
107-
kind: AssetKind.SettingsIcon,
108-
109-
format: Format.Png,
110-
width: 87,
111-
height: 87,
112-
scale: 3,
113-
};
114-
115-
/**
116-
* 40pt Icon
117-
*
118-
* - iPhone Spotlight (iOS 7-15)
119-
* - iPad Spotlight (iOS 7-15)
120-
* - Apple Watch Home Screen
121-
*/
122-
export const IOS_40_PT_ICON: IosOutputAssetTemplate = {
123-
platform: Platform.Ios,
124-
idiom: IosIdiom.iPad,
125-
kind: AssetKind.SpotlightIcon,
126-
127-
format: Format.Png,
128-
width: 40,
129-
height: 40,
130-
scale: 1,
131-
};
132-
133-
export const IOS_40_PT_2X_ICON: IosOutputAssetTemplate = {
134-
platform: Platform.Ios,
135-
idiom: IosIdiom.iPhone,
136-
kind: AssetKind.SpotlightIcon,
137-
138-
format: Format.Png,
139-
width: 80,
140-
height: 80,
141-
scale: 2,
142-
};
143-
144-
export const IOS_40_PT_2X_1_ICON: IosOutputAssetTemplate = {
145-
platform: Platform.Ios,
146-
idiom: IosIdiom.iPad,
147-
kind: AssetKind.SpotlightIcon,
148-
149-
format: Format.Png,
150-
width: 80,
151-
height: 80,
152-
scale: 2,
153-
};
154-
155-
export const IOS_40_PT_3X_ICON: IosOutputAssetTemplate = {
156-
platform: Platform.Ios,
157-
idiom: IosIdiom.iPhone,
158-
kind: AssetKind.SpotlightIcon,
159-
160-
format: Format.Png,
161-
width: 120,
162-
height: 120,
163-
scale: 3,
164-
};
165-
166-
/**
167-
* 60pt Icon
168-
*
169-
* - iPhone App (iOS 7-15)
170-
*/
171-
172-
export const IOS_60_PT_2X_ICON: IosOutputAssetTemplate = {
173-
platform: Platform.Ios,
174-
idiom: IosIdiom.iPhone,
175-
kind: AssetKind.Icon,
176-
177-
format: Format.Png,
178-
width: 120,
179-
height: 120,
180-
scale: 2,
181-
};
182-
183-
export const IOS_60_PT_3X_ICON: IosOutputAssetTemplate = {
184-
platform: Platform.Ios,
185-
idiom: IosIdiom.iPhone,
186-
kind: AssetKind.Icon,
187-
188-
format: Format.Png,
189-
width: 180,
190-
height: 180,
191-
scale: 3,
192-
};
193-
194-
/**
195-
* 76pt Icon
196-
*
197-
* - iPad App (iOS 7+)
198-
*/
199-
export const IOS_76_PT_1X_ICON: IosOutputAssetTemplate = {
200-
platform: Platform.Ios,
201-
idiom: IosIdiom.iPad,
202-
kind: AssetKind.Icon,
203-
204-
format: Format.Png,
205-
width: 76,
206-
height: 76,
207-
scale: 1,
208-
};
209-
210-
export const IOS_76_PT_2X_ICON: IosOutputAssetTemplate = {
211-
platform: Platform.Ios,
212-
idiom: IosIdiom.iPad,
213-
kind: AssetKind.Icon,
214-
215-
format: Format.Png,
216-
width: 152,
217-
height: 152,
218-
scale: 2,
219-
};
220-
221-
/**
222-
* 83.5pt Icon
223-
*
224-
* iPad Pro (12.9-inch)
225-
*/
226-
export const IOS_83_5_PT_2X_ICON: IosOutputAssetTemplate = {
227-
platform: Platform.Ios,
228-
idiom: IosIdiom.iPad,
229-
kind: AssetKind.Icon,
230-
231-
format: Format.Png,
232-
width: 167,
233-
height: 167,
234-
scale: 2,
235-
};
236-
23712
/**
23813
* 1024px Icon
23914
*

test/platforms/ios.asset.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('iOS Asset Test', () => {
9595
const strategy = new IosAssetGenerator();
9696
let generatedAssets = ((await assets.iosNotificationIcon?.generate(strategy, ctx.project)) ??
9797
[]) as OutputAsset<IosOutputAssetTemplate>[];
98-
expect(generatedAssets.length).toBeGreaterThan(0);
98+
expect(generatedAssets.length).toBeGreaterThanOrEqual(0);
9999
expect(generatedAssets.length).toBe(exportedIcons.length);
100100

101101
await verifyExists(generatedAssets);
@@ -108,7 +108,7 @@ describe('iOS Asset Test', () => {
108108
const strategy = new IosAssetGenerator();
109109
let generatedAssets = ((await assets.iosSettingsIcon?.generate(strategy, ctx.project)) ??
110110
[]) as OutputAsset<IosOutputAssetTemplate>[];
111-
expect(generatedAssets.length).toBeGreaterThan(0);
111+
expect(generatedAssets.length).toBeGreaterThanOrEqual(0);
112112
expect(generatedAssets.length).toBe(exportedIcons.length);
113113

114114
await verifyExists(generatedAssets);
@@ -121,7 +121,7 @@ describe('iOS Asset Test', () => {
121121
const strategy = new IosAssetGenerator();
122122
let generatedAssets = ((await assets.iosSpotlightIcon?.generate(strategy, ctx.project)) ??
123123
[]) as OutputAsset<IosOutputAssetTemplate>[];
124-
expect(generatedAssets.length).toBeGreaterThan(0);
124+
expect(generatedAssets.length).toBeGreaterThanOrEqual(0);
125125
expect(generatedAssets.length).toBe(exportedIcons.length);
126126

127127
await verifyExists(generatedAssets);

test/task.generate.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Task: Generate test', () => {
4646
// log('public', generated);
4747

4848
// TODO: Make this more specific instead of "it generated a lot of assets"
49-
expect(generated.length).toBeGreaterThanOrEqual(97);
49+
expect(generated.length).toBeGreaterThanOrEqual(77);
5050
});
5151

5252
it('Should support custom pwa manifest dir', async () => {
@@ -62,6 +62,6 @@ describe('Task: Generate test', () => {
6262
expect(manifest['background_color']).toBe('#abcdef');
6363

6464
// TODO: Make this more specific instead of "it generated a lot of assets"
65-
expect(generated.length).toBeGreaterThanOrEqual(97);
65+
expect(generated.length).toBeGreaterThanOrEqual(77);
6666
});
6767
});

0 commit comments

Comments
 (0)