From c1cb2d429780bd2f30024fa58453d6b83149e30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Wu=CC=88ger?= Date: Wed, 19 Jul 2023 14:31:06 +0200 Subject: [PATCH 1/5] feat(app): Add 'getAppLanguageCode' and 'getAppLanguageTag' --- .../capacitorjs/plugins/app/AppPlugin.java | 16 ++++++++++ app/ios/Plugin/AppPlugin.m | 2 ++ app/ios/Plugin/AppPlugin.swift | 23 +++++++++++++ app/src/definitions.ts | 32 +++++++++++++++++++ app/src/web.ts | 14 +++++++- 5 files changed, 86 insertions(+), 1 deletion(-) diff --git a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java index 916ad391a..4f5f05cb0 100644 --- a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java +++ b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java @@ -14,6 +14,8 @@ import com.getcapacitor.annotation.CapacitorPlugin; import com.getcapacitor.util.InternalUtils; +import java.util.Locale; + @CapacitorPlugin(name = "App") public class AppPlugin extends Plugin { @@ -115,6 +117,20 @@ public void minimizeApp(PluginCall call) { call.resolve(); } + @PluginMethod + public void getAppLanguageCode(PluginCall call) { + JSObject ret = new JSObject(); + ret.put("value", Locale.getDefault().getLanguage()); + call.resolve(ret); + } + + @PluginMethod + public void getAppLanguageTag(PluginCall call) { + JSObject ret = new JSObject(); + ret.put("value", Locale.getDefault().toLanguageTag()); + call.resolve(ret); + } + /** * Handle ACTION_VIEW intents to store a URL that was used to open the app * @param intent diff --git a/app/ios/Plugin/AppPlugin.m b/app/ios/Plugin/AppPlugin.m index e18f8ee39..f94f6320b 100644 --- a/app/ios/Plugin/AppPlugin.m +++ b/app/ios/Plugin/AppPlugin.m @@ -10,4 +10,6 @@ CAP_PLUGIN_METHOD(getState, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(minimizeApp, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(getAppLanguageCode, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(getAppLanguageTag, CAPPluginReturnPromise); ) diff --git a/app/ios/Plugin/AppPlugin.swift b/app/ios/Plugin/AppPlugin.swift index e97412711..0ffc02e87 100644 --- a/app/ios/Plugin/AppPlugin.swift +++ b/app/ios/Plugin/AppPlugin.swift @@ -104,4 +104,27 @@ public class AppPlugin: CAPPlugin { @objc func minimizeApp(_ call: CAPPluginCall) { call.unimplemented() } + + @objc func getAppLanguageCode(_ call: CAPPluginCall) { + + // According to https://developer.apple.com/news/?id=u2cfuj88, the current + // app language is returned by 'Bundle.main.preferredLocalizations.first'. + // Fallback to device language if app language is not defined. + + let appLanguageWithFallbackToDeviceLanguage = + Bundle.main.preferredLocalizations.first ?? Locale.preferredLanguages[0] + let code = String(appLanguageWithFallbackToDeviceLanguage.prefix(2)) + + call.resolve([ + "value": code + ]) + } + + @objc func getAppLanguageTag(_ call: CAPPluginCall) { + let tag = Bundle.main.preferredLocalizations.first ?? Locale.preferredLanguages[0] + + call.resolve([ + "value": tag + ]) + } } diff --git a/app/src/definitions.ts b/app/src/definitions.ts index 33f7583ab..e804bfb31 100644 --- a/app/src/definitions.ts +++ b/app/src/definitions.ts @@ -130,6 +130,24 @@ export type URLOpenListener = (event: URLOpenListenerEvent) => void; export type RestoredListener = (event: RestoredListenerEvent) => void; export type BackButtonListener = (event: BackButtonListenerEvent) => void; +export interface GetLanguageCodeResult { + /** + * Two character language code. + * + * @since 5.1.0 + */ + value: string; +} + +export interface LanguageTag { + /** + * Returns a well-formed IETF BCP 47 language tag. + * + * @since 5.1.0 + */ + value: string; +} + export interface AppPlugin { /** * Force exit the app. This should only be used in conjunction with the `backButton` handler for Android to @@ -171,6 +189,20 @@ export interface AppPlugin { */ minimizeApp(): Promise; + /** + * Get the app specific language locale code. + * + * @since 5.1.0 + */ + getAppLanguageCode(): Promise; + + /** + * Get the app specific language locale tag. + * + * @since 5.1.0 + */ + getAppLanguageTag(): Promise; + /** * Listen for changes in the app or the activity states. * diff --git a/app/src/web.ts b/app/src/web.ts index 1db1ff356..790aecfa9 100644 --- a/app/src/web.ts +++ b/app/src/web.ts @@ -1,6 +1,6 @@ import { WebPlugin } from '@capacitor/core'; -import type { AppInfo, AppPlugin, AppLaunchUrl, AppState } from './definitions'; +import type { AppInfo, AppPlugin, AppLaunchUrl, AppState, GetLanguageCodeResult, LanguageTag } from './definitions'; export class AppWeb extends WebPlugin implements AppPlugin { constructor() { @@ -44,4 +44,16 @@ export class AppWeb extends WebPlugin implements AppPlugin { this.notifyListeners('resume', null); } }; + + async getAppLanguageCode(): Promise { + return { + value: navigator.language.split('-')[0].toLowerCase(), + }; + } + + async getAppLanguageTag(): Promise { + return { + value: navigator.language, + }; + } } From 597ae770a578e7dba3d5ba7db48e008f4d90a485 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 23 Aug 2023 19:45:14 +0200 Subject: [PATCH 2/5] address changes and lint problems --- app/README.md | 46 +++++++++++++++++++ .../capacitorjs/plugins/app/AppPlugin.java | 1 - app/ios/Plugin/AppPlugin.swift | 6 +-- app/src/definitions.ts | 8 ++-- app/src/web.ts | 13 ++++-- 5 files changed, 63 insertions(+), 11 deletions(-) diff --git a/app/README.md b/app/README.md index 5c0ec03ea..4c69d2bd8 100644 --- a/app/README.md +++ b/app/README.md @@ -76,6 +76,8 @@ const checkAppLaunchUrl = async () => { * [`getState()`](#getstate) * [`getLaunchUrl()`](#getlaunchurl) * [`minimizeApp()`](#minimizeapp) +* [`getAppLanguageCode()`](#getapplanguagecode) +* [`getAppLanguageTag()`](#getapplanguagetag) * [`addListener('appStateChange', ...)`](#addlistenerappstatechange) * [`addListener('pause', ...)`](#addlistenerpause) * [`addListener('resume', ...)`](#addlistenerresume) @@ -167,6 +169,36 @@ Only available for Android. -------------------- +### getAppLanguageCode() + +```typescript +getAppLanguageCode() => Promise +``` + +Get the app specific language locale code. + +**Returns:** Promise<AppLanguageCode> + +**Since:** 5.1.0 + +-------------------- + + +### getAppLanguageTag() + +```typescript +getAppLanguageTag() => Promise +``` + +Get the app specific language locale tag. + +**Returns:** Promise<AppLanguageTag> + +**Since:** 5.1.0 + +-------------------- + + ### addListener('appStateChange', ...) ```typescript @@ -364,6 +396,20 @@ Remove all native listeners for this plugin | **`url`** | string | The url used to open the app. | 1.0.0 | +#### AppLanguageCode + +| Prop | Type | Description | Since | +| ----------- | ------------------- | ---------------------------- | ----- | +| **`value`** | string | Two character language code. | 5.1.0 | + + +#### AppLanguageTag + +| Prop | Type | Description | Since | +| ----------- | ------------------- | ----------------------------------------------- | ----- | +| **`value`** | string | Returns a well-formed IETF BCP 47 language tag. | 5.1.0 | + + #### PluginListenerHandle | Prop | Type | diff --git a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java index 4f5f05cb0..8e48cc292 100644 --- a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java +++ b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java @@ -13,7 +13,6 @@ import com.getcapacitor.PluginMethod; import com.getcapacitor.annotation.CapacitorPlugin; import com.getcapacitor.util.InternalUtils; - import java.util.Locale; @CapacitorPlugin(name = "App") diff --git a/app/ios/Plugin/AppPlugin.swift b/app/ios/Plugin/AppPlugin.swift index 0ffc02e87..90b859fdf 100644 --- a/app/ios/Plugin/AppPlugin.swift +++ b/app/ios/Plugin/AppPlugin.swift @@ -104,13 +104,13 @@ public class AppPlugin: CAPPlugin { @objc func minimizeApp(_ call: CAPPluginCall) { call.unimplemented() } - + @objc func getAppLanguageCode(_ call: CAPPluginCall) { - + // According to https://developer.apple.com/news/?id=u2cfuj88, the current // app language is returned by 'Bundle.main.preferredLocalizations.first'. // Fallback to device language if app language is not defined. - + let appLanguageWithFallbackToDeviceLanguage = Bundle.main.preferredLocalizations.first ?? Locale.preferredLanguages[0] let code = String(appLanguageWithFallbackToDeviceLanguage.prefix(2)) diff --git a/app/src/definitions.ts b/app/src/definitions.ts index e804bfb31..59d8fdddd 100644 --- a/app/src/definitions.ts +++ b/app/src/definitions.ts @@ -130,7 +130,7 @@ export type URLOpenListener = (event: URLOpenListenerEvent) => void; export type RestoredListener = (event: RestoredListenerEvent) => void; export type BackButtonListener = (event: BackButtonListenerEvent) => void; -export interface GetLanguageCodeResult { +export interface AppLanguageCode { /** * Two character language code. * @@ -139,7 +139,7 @@ export interface GetLanguageCodeResult { value: string; } -export interface LanguageTag { +export interface AppLanguageTag { /** * Returns a well-formed IETF BCP 47 language tag. * @@ -194,14 +194,14 @@ export interface AppPlugin { * * @since 5.1.0 */ - getAppLanguageCode(): Promise; + getAppLanguageCode(): Promise; /** * Get the app specific language locale tag. * * @since 5.1.0 */ - getAppLanguageTag(): Promise; + getAppLanguageTag(): Promise; /** * Listen for changes in the app or the activity states. diff --git a/app/src/web.ts b/app/src/web.ts index 790aecfa9..1b94947ec 100644 --- a/app/src/web.ts +++ b/app/src/web.ts @@ -1,6 +1,13 @@ import { WebPlugin } from '@capacitor/core'; -import type { AppInfo, AppPlugin, AppLaunchUrl, AppState, GetLanguageCodeResult, LanguageTag } from './definitions'; +import type { + AppInfo, + AppPlugin, + AppLaunchUrl, + AppState, + AppLanguageCode, + AppLanguageTag, +} from './definitions'; export class AppWeb extends WebPlugin implements AppPlugin { constructor() { @@ -45,13 +52,13 @@ export class AppWeb extends WebPlugin implements AppPlugin { } }; - async getAppLanguageCode(): Promise { + async getAppLanguageCode(): Promise { return { value: navigator.language.split('-')[0].toLowerCase(), }; } - async getAppLanguageTag(): Promise { + async getAppLanguageTag(): Promise { return { value: navigator.language, }; From f1daaf74bbffe5b18d648cc9c063dd2b6ff71595 Mon Sep 17 00:00:00 2001 From: IT-MikeS <20338451+IT-MikeS@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:31:47 -0500 Subject: [PATCH 3/5] chore: swap to just getAppLanguage --- .../capacitorjs/plugins/app/AppPlugin.java | 9 +------- app/ios/Plugin/AppPlugin.m | 3 +-- app/ios/Plugin/AppPlugin.swift | 21 ++----------------- app/src/definitions.ts | 20 ++---------------- app/src/web.ts | 9 +------- 5 files changed, 7 insertions(+), 55 deletions(-) diff --git a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java index 8e48cc292..8cabd2e85 100644 --- a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java +++ b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java @@ -117,19 +117,12 @@ public void minimizeApp(PluginCall call) { } @PluginMethod - public void getAppLanguageCode(PluginCall call) { + public void getAppLanguage(PluginCall call) { JSObject ret = new JSObject(); ret.put("value", Locale.getDefault().getLanguage()); call.resolve(ret); } - @PluginMethod - public void getAppLanguageTag(PluginCall call) { - JSObject ret = new JSObject(); - ret.put("value", Locale.getDefault().toLanguageTag()); - call.resolve(ret); - } - /** * Handle ACTION_VIEW intents to store a URL that was used to open the app * @param intent diff --git a/app/ios/Plugin/AppPlugin.m b/app/ios/Plugin/AppPlugin.m index f94f6320b..bbda64302 100644 --- a/app/ios/Plugin/AppPlugin.m +++ b/app/ios/Plugin/AppPlugin.m @@ -10,6 +10,5 @@ CAP_PLUGIN_METHOD(getState, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(minimizeApp, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(getAppLanguageCode, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(getAppLanguageTag, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(getAppLanguage, CAPPluginReturnPromise); ) diff --git a/app/ios/Plugin/AppPlugin.swift b/app/ios/Plugin/AppPlugin.swift index 90b859fdf..06b34e6ac 100644 --- a/app/ios/Plugin/AppPlugin.swift +++ b/app/ios/Plugin/AppPlugin.swift @@ -105,26 +105,9 @@ public class AppPlugin: CAPPlugin { call.unimplemented() } - @objc func getAppLanguageCode(_ call: CAPPluginCall) { - - // According to https://developer.apple.com/news/?id=u2cfuj88, the current - // app language is returned by 'Bundle.main.preferredLocalizations.first'. - // Fallback to device language if app language is not defined. - - let appLanguageWithFallbackToDeviceLanguage = - Bundle.main.preferredLocalizations.first ?? Locale.preferredLanguages[0] - let code = String(appLanguageWithFallbackToDeviceLanguage.prefix(2)) - - call.resolve([ - "value": code - ]) - } - - @objc func getAppLanguageTag(_ call: CAPPluginCall) { - let tag = Bundle.main.preferredLocalizations.first ?? Locale.preferredLanguages[0] - + @objc func getAppLanguage(_ call: CAPPluginCall) { call.resolve([ - "value": tag + "value": Bundle.main.preferredLocalizations.first ]) } } diff --git a/app/src/definitions.ts b/app/src/definitions.ts index 59d8fdddd..5908223eb 100644 --- a/app/src/definitions.ts +++ b/app/src/definitions.ts @@ -132,16 +132,7 @@ export type BackButtonListener = (event: BackButtonListenerEvent) => void; export interface AppLanguageCode { /** - * Two character language code. - * - * @since 5.1.0 - */ - value: string; -} - -export interface AppLanguageTag { - /** - * Returns a well-formed IETF BCP 47 language tag. + * Two or Three character language code. * * @since 5.1.0 */ @@ -194,14 +185,7 @@ export interface AppPlugin { * * @since 5.1.0 */ - getAppLanguageCode(): Promise; - - /** - * Get the app specific language locale tag. - * - * @since 5.1.0 - */ - getAppLanguageTag(): Promise; + getAppLanguage(): Promise; /** * Listen for changes in the app or the activity states. diff --git a/app/src/web.ts b/app/src/web.ts index 1b94947ec..fe0aee860 100644 --- a/app/src/web.ts +++ b/app/src/web.ts @@ -6,7 +6,6 @@ import type { AppLaunchUrl, AppState, AppLanguageCode, - AppLanguageTag, } from './definitions'; export class AppWeb extends WebPlugin implements AppPlugin { @@ -52,15 +51,9 @@ export class AppWeb extends WebPlugin implements AppPlugin { } }; - async getAppLanguageCode(): Promise { + async getAppLanguage(): Promise { return { value: navigator.language.split('-')[0].toLowerCase(), }; } - - async getAppLanguageTag(): Promise { - return { - value: navigator.language, - }; - } } From ee81d28fd2a58e67b7de12c07b5687062746e5dc Mon Sep 17 00:00:00 2001 From: IT-MikeS <20338451+IT-MikeS@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:35:32 -0500 Subject: [PATCH 4/5] chore: fix ts --- app/README.md | 59 +++++++++++++----------------------------- app/src/definitions.ts | 12 ++++----- 2 files changed, 24 insertions(+), 47 deletions(-) diff --git a/app/README.md b/app/README.md index 4c69d2bd8..b3868a5d7 100644 --- a/app/README.md +++ b/app/README.md @@ -76,8 +76,7 @@ const checkAppLaunchUrl = async () => { * [`getState()`](#getstate) * [`getLaunchUrl()`](#getlaunchurl) * [`minimizeApp()`](#minimizeapp) -* [`getAppLanguageCode()`](#getapplanguagecode) -* [`getAppLanguageTag()`](#getapplanguagetag) +* [`getAppLanguage()`](#getapplanguage) * [`addListener('appStateChange', ...)`](#addlistenerappstatechange) * [`addListener('pause', ...)`](#addlistenerpause) * [`addListener('resume', ...)`](#addlistenerresume) @@ -169,10 +168,10 @@ Only available for Android. -------------------- -### getAppLanguageCode() +### getAppLanguage() ```typescript -getAppLanguageCode() => Promise +getAppLanguage() => Promise ``` Get the app specific language locale code. @@ -184,25 +183,10 @@ Get the app specific language locale code. -------------------- -### getAppLanguageTag() - -```typescript -getAppLanguageTag() => Promise -``` - -Get the app specific language locale tag. - -**Returns:** Promise<AppLanguageTag> - -**Since:** 5.1.0 - --------------------- - - ### addListener('appStateChange', ...) ```typescript -addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener) => Promise & PluginListenerHandle +addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener) => Promise ``` Listen for changes in the app or the activity states. @@ -217,7 +201,7 @@ On Web it's fired when the document's visibilitychange gets fired. | **`eventName`** | 'appStateChange' | | **`listenerFunc`** | StateChangeListener | -**Returns:** Promise<PluginListenerHandle> & PluginListenerHandle +**Returns:** Promise<PluginListenerHandle> **Since:** 1.0.0 @@ -227,7 +211,7 @@ On Web it's fired when the document's visibilitychange gets fired. ### addListener('pause', ...) ```typescript -addListener(eventName: 'pause', listenerFunc: () => void) => Promise & PluginListenerHandle +addListener(eventName: 'pause', listenerFunc: () => void) => Promise ``` Listen for when the app or the activity are paused. @@ -241,7 +225,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h | **`eventName`** | 'pause' | | **`listenerFunc`** | () => void | -**Returns:** Promise<PluginListenerHandle> & PluginListenerHandle +**Returns:** Promise<PluginListenerHandle> **Since:** 4.1.0 @@ -251,7 +235,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h ### addListener('resume', ...) ```typescript -addListener(eventName: 'resume', listenerFunc: () => void) => Promise & PluginListenerHandle +addListener(eventName: 'resume', listenerFunc: () => void) => Promise ``` Listen for when the app or activity are resumed. @@ -266,7 +250,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h | **`eventName`** | 'resume' | | **`listenerFunc`** | () => void | -**Returns:** Promise<PluginListenerHandle> & PluginListenerHandle +**Returns:** Promise<PluginListenerHandle> **Since:** 4.1.0 @@ -276,7 +260,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h ### addListener('appUrlOpen', ...) ```typescript -addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener) => Promise & PluginListenerHandle +addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener) => Promise ``` Listen for url open events for the app. This handles both custom URL scheme links as well @@ -287,7 +271,7 @@ as URLs your app handles (Universal Links on iOS and App Links on Android) | **`eventName`** | 'appUrlOpen' | | **`listenerFunc`** | URLOpenListener | -**Returns:** Promise<PluginListenerHandle> & PluginListenerHandle +**Returns:** Promise<PluginListenerHandle> **Since:** 1.0.0 @@ -297,7 +281,7 @@ as URLs your app handles (Universal Links on iOS and App Links on Android) ### addListener('appRestoredResult', ...) ```typescript -addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener) => Promise & PluginListenerHandle +addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener) => Promise ``` If the app was launched with previously persisted plugin call data, such as on Android @@ -327,7 +311,7 @@ Activities (for example, Camera) to have this event and process handled. | **`eventName`** | 'appRestoredResult' | | **`listenerFunc`** | RestoredListener | -**Returns:** Promise<PluginListenerHandle> & PluginListenerHandle +**Returns:** Promise<PluginListenerHandle> **Since:** 1.0.0 @@ -337,7 +321,7 @@ Activities (for example, Camera) to have this event and process handled. ### addListener('backButton', ...) ```typescript -addListener(eventName: 'backButton', listenerFunc: BackButtonListener) => Promise & PluginListenerHandle +addListener(eventName: 'backButton', listenerFunc: BackButtonListener) => Promise ``` Listen for the hardware back button event (Android only). Listening for this event will disable the @@ -349,7 +333,7 @@ If you want to close the app, call `App.exitApp()`. | **`eventName`** | 'backButton' | | **`listenerFunc`** | BackButtonListener | -**Returns:** Promise<PluginListenerHandle> & PluginListenerHandle +**Returns:** Promise<PluginListenerHandle> **Since:** 1.0.0 @@ -398,16 +382,9 @@ Remove all native listeners for this plugin #### AppLanguageCode -| Prop | Type | Description | Since | -| ----------- | ------------------- | ---------------------------- | ----- | -| **`value`** | string | Two character language code. | 5.1.0 | - - -#### AppLanguageTag - -| Prop | Type | Description | Since | -| ----------- | ------------------- | ----------------------------------------------- | ----- | -| **`value`** | string | Returns a well-formed IETF BCP 47 language tag. | 5.1.0 | +| Prop | Type | Description | Since | +| ----------- | ------------------- | ------------------------------------- | ----- | +| **`value`** | string | Two or Three character language code. | 5.1.0 | #### PluginListenerHandle diff --git a/app/src/definitions.ts b/app/src/definitions.ts index 5908223eb..4f61c5bd0 100644 --- a/app/src/definitions.ts +++ b/app/src/definitions.ts @@ -200,7 +200,7 @@ export interface AppPlugin { addListener( eventName: 'appStateChange', listenerFunc: StateChangeListener, - ): Promise & PluginListenerHandle; + ): Promise; /** * Listen for when the app or the activity are paused. @@ -214,7 +214,7 @@ export interface AppPlugin { addListener( eventName: 'pause', listenerFunc: () => void, - ): Promise & PluginListenerHandle; + ): Promise; /** * Listen for when the app or activity are resumed. @@ -229,7 +229,7 @@ export interface AppPlugin { addListener( eventName: 'resume', listenerFunc: () => void, - ): Promise & PluginListenerHandle; + ): Promise; /** * Listen for url open events for the app. This handles both custom URL scheme links as well @@ -240,7 +240,7 @@ export interface AppPlugin { addListener( eventName: 'appUrlOpen', listenerFunc: URLOpenListener, - ): Promise & PluginListenerHandle; + ): Promise; /** * If the app was launched with previously persisted plugin call data, such as on Android @@ -270,7 +270,7 @@ export interface AppPlugin { addListener( eventName: 'appRestoredResult', listenerFunc: RestoredListener, - ): Promise & PluginListenerHandle; + ): Promise; /** * Listen for the hardware back button event (Android only). Listening for this event will disable the @@ -282,7 +282,7 @@ export interface AppPlugin { addListener( eventName: 'backButton', listenerFunc: BackButtonListener, - ): Promise & PluginListenerHandle; + ): Promise; /** * Remove all native listeners for this plugin From 3d00a29927404107cdadb6c66e32f0a7c8a7f9aa Mon Sep 17 00:00:00 2001 From: IT-MikeS <20338451+IT-MikeS@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:40:56 -0500 Subject: [PATCH 5/5] chore: docs --- app/README.md | 2 +- app/src/definitions.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/README.md b/app/README.md index b3868a5d7..da8642faf 100644 --- a/app/README.md +++ b/app/README.md @@ -178,7 +178,7 @@ Get the app specific language locale code. **Returns:** Promise<AppLanguageCode> -**Since:** 5.1.0 +**Since:** 6.0.0 -------------------- diff --git a/app/src/definitions.ts b/app/src/definitions.ts index 4f61c5bd0..7eef8bdf2 100644 --- a/app/src/definitions.ts +++ b/app/src/definitions.ts @@ -183,7 +183,7 @@ export interface AppPlugin { /** * Get the app specific language locale code. * - * @since 5.1.0 + * @since 6.0.0 */ getAppLanguage(): Promise;