feat(modal): remove capacitor 2 support for status bar styles (#29028)

Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Ionic Framework has fallback detection for Capacitor 2 applications to
avoid applying status bar style changes to the card modal.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Ionic Framework's detection for applying status bar styles will be
based on the APIs available in Capacitor 3+.
- Ionic Framework will no longer support the legacy Capacitor 2
configurations.

## Does this introduce a breaking change?

- [x] Yes
- [ ] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->

Developer should upgrade to the latest major release of Capacitor. 

## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
This commit is contained in:
Sean Perkins
2024-02-13 20:29:14 -05:00
committed by GitHub
parent 58d7315802
commit 1fb8ff7861
3 changed files with 7 additions and 19 deletions

View File

@ -21,6 +21,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
- [Content](#version-8x-content) - [Content](#version-8x-content)
- [Datetime](#version-8x-datetime) - [Datetime](#version-8x-datetime)
- [Input](#version-8x-input) - [Input](#version-8x-input)
- [Modal](#version-8x-modal)
- [Nav](#version-8x-nav) - [Nav](#version-8x-nav)
- [Picker](#version-8x-picker) - [Picker](#version-8x-picker)
- [Progress bar](#version-8x-progress-bar) - [Progress bar](#version-8x-progress-bar)
@ -159,6 +160,10 @@ For more information on the dynamic font, refer to the [Dynamic Font Scaling doc
- `accept` has been removed from the `ion-input` component. This was previously used in conjunction with the `type="file"`. However, the `file` value for `type` is not a valid value in Ionic Framework. - `accept` has been removed from the `ion-input` component. This was previously used in conjunction with the `type="file"`. However, the `file` value for `type` is not a valid value in Ionic Framework.
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-input` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy input syntax, refer to the [Input documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax). - The `legacy` property and support for the legacy syntax, which involved placing an `ion-input` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy input syntax, refer to the [Input documentation](https://ionicframework.com/docs/api/input#migrating-from-legacy-input-syntax).
<h4 id="version-8x-modal">Modal</h4>
- Detection for Capacitor <= 2 with applying status bar styles has been removed. Developers should ensure they are using Capacitor 3 or later when using the card modal presentation.
<h4 id="version-8x-nav">Nav</h4> <h4 id="version-8x-nav">Nav</h4>
- `getLength` returns `Promise<number>` instead of `<number>`. This method was not previously available in Nav's TypeScript interface, but developers could still access it by casting Nav as `any`. Developers should ensure they `await` their `getLength` call before accessing the returned value. - `getLength` returns `Promise<number>` instead of `<number>`. This method was not previously available in Nav's TypeScript interface, but developers could still access it by casting Nav as `any`. Developers should ensure they `await` their `getLength` call before accessing the returned value.

View File

@ -68,14 +68,9 @@ export const getBackdropValueForSheet = (x: number, backdropBreakpoint: number)
* is not transformed, so we do not need to * is not transformed, so we do not need to
* adjust the status bar color. * adjust the status bar color.
* *
* Note: We check supportsDefaultStatusBarStyle so that
* Capacitor <= 2 users do not get their status bar
* stuck in an inconsistent state due to a lack of
* support for Style.Default.
*/ */
export const setCardStatusBarDark = () => { export const setCardStatusBarDark = () => {
// TODO FW-4696 Remove supportDefaultStatusBarStyle in Ionic v8 if (!win || win.innerWidth >= 768) {
if (!win || win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
return; return;
} }
@ -83,8 +78,7 @@ export const setCardStatusBarDark = () => {
}; };
export const setCardStatusBarDefault = (defaultStyle = Style.Default) => { export const setCardStatusBarDefault = (defaultStyle = Style.Default) => {
// TODO FW-4696 Remove supportDefaultStatusBarStyle in Ionic v8 if (!win || win.innerWidth >= 768) {
if (!win || win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
return; return;
} }

View File

@ -21,17 +21,6 @@ export const StatusBar = {
} }
return undefined; return undefined;
}, },
// TODO FW-4696 Remove supportDefaultStatusBarStyle in Ionic v8
supportsDefaultStatusBarStyle() {
const capacitor = getCapacitor() as any;
/**
* The 'DEFAULT' status bar style was added
* to the @capacitor/status-bar plugin in Capacitor 3.
* PluginHeaders is only supported in Capacitor 3+,
* so we can use this to detect Capacitor 3.
*/
return !!capacitor?.PluginHeaders;
},
setStyle(options: StyleOptions) { setStyle(options: StyleOptions) {
const engine = this.getEngine(); const engine = this.getEngine();
if (!engine) { if (!engine) {