@capacitor-community/app-icon
Advanced tools
Comparing version 4.0.0 to 4.1.0-beta.0
@@ -19,3 +19,3 @@ { | ||
], | ||
"docs": "Checks if changing the app icon is supported", | ||
"docs": "Checks if changing the app icon is supported. (iOS only)", | ||
"complexTypes": [], | ||
@@ -104,5 +104,17 @@ "slug": "issupported" | ||
{ | ||
"name": "disable", | ||
"tags": [ | ||
{ | ||
"text": "3.1.0", | ||
"name": "since" | ||
} | ||
], | ||
"docs": "Name of icons to disable. This is not used for iOS, but required for Android.", | ||
"complexTypes": [], | ||
"type": "string[] | undefined" | ||
}, | ||
{ | ||
"name": "suppressNotification", | ||
"tags": [], | ||
"docs": "Flag controlling the in app notification which shows after icon is changed.", | ||
"docs": "Flag controlling the in app notification which shows after icon is changed. (iOS)", | ||
"complexTypes": [], | ||
@@ -123,5 +135,17 @@ "type": "boolean" | ||
"tags": [], | ||
"docs": "Flag controlling the in app notification which shows after icon is changed.", | ||
"docs": "Flag controlling the in app notification which shows after icon is changed (iOS).", | ||
"complexTypes": [], | ||
"type": "boolean" | ||
}, | ||
{ | ||
"name": "disable", | ||
"tags": [ | ||
{ | ||
"text": "3.1.1", | ||
"name": "since" | ||
} | ||
], | ||
"docs": "Name of icons to disable. This is not used for iOS, but required for Android.", | ||
"complexTypes": [], | ||
"type": "string[] | undefined" | ||
} | ||
@@ -128,0 +152,0 @@ ] |
@@ -1,2 +0,2 @@ | ||
interface IconOptions { | ||
export interface IconOptions { | ||
/** | ||
@@ -7,15 +7,25 @@ * Name of alternate icon to set | ||
/** | ||
* Flag controlling the in app notification which shows after icon is changed. | ||
* Name of icons to disable. This is not used for iOS, but required for Android. | ||
* @since 3.1.0 | ||
*/ | ||
disable?: string[]; | ||
/** | ||
* Flag controlling the in app notification which shows after icon is changed. (iOS) | ||
*/ | ||
suppressNotification: boolean; | ||
} | ||
interface ResetOptions { | ||
export interface ResetOptions { | ||
/** | ||
* Flag controlling the in app notification which shows after icon is changed. | ||
* Flag controlling the in app notification which shows after icon is changed (iOS). | ||
*/ | ||
suppressNotification: boolean; | ||
/** | ||
* Name of icons to disable. This is not used for iOS, but required for Android. | ||
* @since 3.1.1 | ||
*/ | ||
disable?: string[]; | ||
} | ||
export interface AppIconPlugin { | ||
/** | ||
* Checks if changing the app icon is supported | ||
* Checks if changing the app icon is supported. (iOS only) | ||
* @since 1.0.0 | ||
@@ -44,2 +54,1 @@ */ | ||
} | ||
export {}; |
import { WebPlugin } from '@capacitor/core'; | ||
import type { AppIconPlugin } from './definitions'; | ||
import { AppIconPlugin } from './definitions'; | ||
export declare class AppIconWeb extends WebPlugin implements AppIconPlugin { | ||
@@ -4,0 +4,0 @@ isSupported(): Promise<{ |
@@ -34,3 +34,3 @@ var capacitorAppIcon = (function (exports, core) { | ||
})({}, capacitorExports); | ||
}({}, capacitorExports)); | ||
//# sourceMappingURL=plugin.js.map |
{ | ||
"name": "@capacitor-community/app-icon", | ||
"version": "4.0.0", | ||
"version": "4.1.0-beta.0", | ||
"description": "Capacitor community plugin for changing an iOS app icon.", | ||
@@ -10,2 +10,4 @@ "main": "dist/plugin.cjs.js", | ||
"files": [ | ||
"android/src/main/", | ||
"android/build.gradle", | ||
"dist/", | ||
@@ -34,2 +36,3 @@ "ios/Plugin/", | ||
"devDependencies": { | ||
"@capacitor/android": "^5.0.0", | ||
"@capacitor/core": "^5.0.0", | ||
@@ -56,3 +59,4 @@ "@capacitor/docgen": "^0.0.18", | ||
"native", | ||
"icon" | ||
"icon", | ||
"appicon" | ||
], | ||
@@ -65,2 +69,5 @@ "eslintConfig": { | ||
"src": "ios" | ||
}, | ||
"android": { | ||
"src": "android" | ||
} | ||
@@ -67,0 +74,0 @@ }, |
150
README.md
@@ -27,5 +27,5 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
> This plugin only changes the main app icon on the device homescreen. The icon in springboard and in other areas of iOS will not change and continue to show the original. | ||
> This plugin only changes the main app icon on the device homescreen. The icon in springboard and in other areas will not change and continue to show the original. (iOS) | ||
> Changing the app icon is only allowed when the app is in the foreground. | ||
> Changing the app icon is only allowed when the app is in the foreground (iOS). | ||
@@ -43,6 +43,54 @@ > Android support is currently in beta. See the [android-support](https://github.com/capacitor-community/app-icon/tree/android-support) branch for more info. | ||
The alternate icons need to be included within the app bundle and referenced in the project prior to using this plugin. It is not possible to switch to any icon on the fly without adding it to the project first. Below are the configurations steps for each platform. | ||
## Android Configuration | ||
### Add Alternate Icons | ||
The alternate icons need to be included within the app bundle and referenced in the iOS project `Info.plist` prior to using this plugin. It is not possible to switch to any icon on the fly without adding it to the iOS project first. | ||
Add the alternate icons directly to your android project in `app/src/main/res`. | ||
### Setup ApplicationManifest.xml | ||
Each alternate icon is represented by an [`<activity-alias>`](https://developer.android.com/guide/topics/manifest/activity-alias-element). Add all the alternative icons to the `ApplicationManifest.xml` as child elements under `<application>`. The `name` attribute on `<activity-alias>` must be prefixed with dot `.` See [ApplicationManifest.xml](https://github.com/capacitor-community/app-icon/blob/android-support/example/android/app/src/main/AndroidManifest.xml) for full example. | ||
```xml | ||
<application> | ||
<!-- ... --> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:launchMode="singleTask" | ||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" | ||
android:label="@string/title_activity_main" | ||
android:theme="@style/AppTheme.NoActionBarLaunch"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<!-- <category android:name="android.intent.category.LAUNCHER" /> --> | ||
</intent-filter> | ||
</activity> | ||
<activity-alias | ||
android:label="Stencil" | ||
android:icon="@drawable/stencil" | ||
android:roundIcon="@drawable/stencil" | ||
android:name=".stencil" | ||
android:enabled="true" | ||
android:exported="true" | ||
android:targetActivity=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity-alias> | ||
<!-- additional <activity-alias> --> | ||
<application> | ||
``` | ||
## iOS Configuration | ||
### Add Alternate Icons | ||
Add the alternate icons directly to your iOS project or in a subdirectory. | ||
@@ -99,6 +147,14 @@ | ||
const changeIcon = async (iconName) => { | ||
await AppIcon.change({name: iconName, suppressNotification: true}); | ||
} | ||
const getName = async () => { | ||
const { value } = await AppIcon.getName(); | ||
console.log(value); | ||
} | ||
const resetIcon = async () => { | ||
const disable: string[] = ['stencil']; // all added aliaces names | ||
await AppIcon.reset({ suppressNotification: true, disable }); | ||
} | ||
``` | ||
@@ -108,16 +164,34 @@ | ||
<docgen-index> | ||
* [`isSupported()`](#issupported) | ||
* [`getName()`](#getname) | ||
* [`change(...)`](#change) | ||
* [`reset(...)`](#reset) | ||
* [Interfaces](#interfaces) | ||
</docgen-index> | ||
<docgen-api> | ||
<!--Update the source file JSDoc comments and rerun docgen to update the docs below--> | ||
### isSupported() | ||
```typescript | ||
isSupported() => Promise<{value: boolean}> | ||
isSupported() => Promise<{ value: boolean; }> | ||
``` | ||
Checks to see if using alternate icons is supported on your device. | ||
Checks if changing the app icon is supported. (iOS only) | ||
--- | ||
**Returns:** <code>Promise<{ value: boolean; }></code> | ||
**Since:** 1.0.0 | ||
-------------------- | ||
### getName() | ||
```typescript | ||
getName(): Promise<{value: string | null}>; | ||
getName() => Promise<{ value: string | null; }> | ||
``` | ||
@@ -127,8 +201,13 @@ | ||
--- | ||
**Returns:** <code>Promise<{ value: string | null; }></code> | ||
**Since:** 1.0.0 | ||
-------------------- | ||
### change(...) | ||
```typescript | ||
change(options: IconOptions): Promise<void>; | ||
change(options: IconOptions) => Promise<void> | ||
``` | ||
@@ -140,20 +219,26 @@ | ||
| ------------- | --------------------------------------------------- | | ||
| **`options`** | <code><a href="#IconOptions">IconOptions</a></code> | | ||
| **`options`** | <code><a href="#iconoptions">IconOptions</a></code> | | ||
--- | ||
**Since:** 1.0.0 | ||
-------------------- | ||
### reset(...) | ||
```typescript | ||
reset(options: ResetOptions): Promise<void>; | ||
reset(options: ResetOptions) => Promise<void> | ||
``` | ||
Changes app icon to specified alternate. | ||
Reverts app icon to original. | ||
| Param | Type | | ||
| ------------- | --------------------------------------------------- | | ||
| **`options`** | <code><a href="#IconOptions">ResetOptions</a></code> | | ||
| Param | Type | | ||
| ------------- | ----------------------------------------------------- | | ||
| **`options`** | <code><a href="#resetoptions">ResetOptions</a></code> | | ||
--- | ||
**Since:** 1.0.0 | ||
-------------------- | ||
### Interfaces | ||
@@ -164,16 +249,17 @@ | ||
Represents the options passed to `change`. | ||
| Prop | Type | Description | Since | | ||
| -------------------------- | --------------------- | --------------------------------------------------------------------------------- | ----- | | ||
| **`name`** | <code>string</code> | Name of alternate icon to set | | | ||
| **`disable`** | <code>string[]</code> | Name of icons to disable. This is not used for iOS, but required for Android. | 3.1.0 | | ||
| **`suppressNotification`** | <code>boolean</code> | Flag controlling the in app notification which shows after icon is changed. (iOS) | | | ||
| Prop | Type | Description | Since | | ||
| ----------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----- | | ||
| **`name`** | <code>string</code> | Name of alternate icon to set. | 1.0.0 | | ||
| **`suppressNotification`** | <code>boolean</code> | Flag controlling the in app notification which shows after icon is changed. | 1.0.0 | | ||
#### ResetOptions | ||
Represents the options passed to `reset`. | ||
| Prop | Type | Description | Since | | ||
| -------------------------- | --------------------- | --------------------------------------------------------------------------------- | ----- | | ||
| **`suppressNotification`** | <code>boolean</code> | Flag controlling the in app notification which shows after icon is changed (iOS). | | | ||
| **`disable`** | <code>string[]</code> | Name of icons to disable. This is not used for iOS, but required for Android. | 3.1.1 | | ||
| Prop | Type | Description | Since | | ||
| ----------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----- | | ||
| **`suppressNotification`** | <code>boolean</code> | Flag controlling the in app notification which shows after icon is changed. | 1.0.0 | | ||
</docgen-api> | ||
@@ -190,8 +276,10 @@ ## Contributors ✨ | ||
<tr> | ||
<td align="center" valign="top" width="14.28%"><a href="http://johnborg.es"><img src="https://avatars.githubusercontent.com/u/1888122?v=4?s=100" width="100px;" alt="John Borges"/><br /><sub><b>John Borges</b></sub></a><br /><a href="https://github.com/capacitor-community/app-icon/commits?author=johnborges" title="Code">💻</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="http://www.devdactic.com"><img src="https://avatars.githubusercontent.com/u/2514208?v=4?s=100" width="100px;" alt="Simon Grimm"/><br /><sub><b>Simon Grimm</b></sub></a><br /><a href="https://github.com/capacitor-community/app-icon/commits?author=saimon24" title="Code">💻</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/chvonrohr"><img src="https://avatars.githubusercontent.com/u/1733057?v=4?s=100" width="100px;" alt="Christian von Rohr"/><br /><sub><b>Christian von Rohr</b></sub></a><br /><a href="https://github.com/capacitor-community/app-icon/commits?author=chvonrohr" title="Code">💻</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://qliq.dev"><img src="https://avatars.githubusercontent.com/u/5783161?v=4?s=100" width="100px;" alt="QliQ.dev"/><br /><sub><b>QliQ.dev</b></sub></a><br /><a href="https://github.com/capacitor-community/app-icon/commits?author=qliqdev" title="Code">💻</a></td> | ||
<td align="center"><a href="http://johnborg.es"><img src="https://avatars.githubusercontent.com/u/1888122?v=4?s=100" width="100px;" alt="John Borges"/><br /><sub><b>John Borges</b></sub></a><br /><a href="https://github.com/capacitor-community/app-icon/commits?author=johnborges" title="Code">💻</a></td> | ||
<td align="center"><a href="http://www.devdactic.com"><img src="https://avatars.githubusercontent.com/u/2514208?v=4?s=100" width="100px;" alt="Simon Grimm"/><br /><sub><b>Simon Grimm</b></sub></a><br /><a href="https://github.com/capacitor-community/app-icon/commits?author=saimon24" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/chvonrohr"><img src="https://avatars.githubusercontent.com/u/1733057?v=4?s=100" width="100px;" alt="Christian von Rohr"/><br /><sub><b>Christian von Rohr</b></sub></a><br /><a href="https://github.com/capacitor-community/app-icon/commits?author=chvonrohr" title="Code">💻</a></td> | ||
</tr> | ||
</tbody> | ||
<tfoot> | ||
</tfoot> | ||
</table> | ||
@@ -198,0 +286,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
41132
27
430
285
14
2