From a79b5043b482faf618e1d65dee3b818bb9ea2e9c Mon Sep 17 00:00:00 2001 From: "damian.ionic" Date: Tue, 21 Nov 2023 10:00:19 -0800 Subject: [PATCH 1/3] fix(screen-orientation) Add ScreenOrientationLockType to handle removal of OrientationLockType --- screen-orientation/README.md | 15 ++++++++++++--- screen-orientation/src/definitions.ts | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/screen-orientation/README.md b/screen-orientation/README.md index 056b05d40..5c2756ccd 100644 --- a/screen-orientation/README.md +++ b/screen-orientation/README.md @@ -39,6 +39,7 @@ By default, an iPad allows Multitasking and its orientation cannot be locked. If * [`addListener('screenOrientationChange', ...)`](#addlistenerscreenorientationchange) * [`removeAllListeners()`](#removealllisteners) * [Interfaces](#interfaces) +* [Type Aliases](#type-aliases) @@ -135,9 +136,9 @@ Removes all listeners. #### OrientationLockOptions -| Prop | Type | -| ----------------- | -------------------------------- | -| **`orientation`** | OrientationLockType | +| Prop | Type | Description | +| ----------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| **`orientation`** | any | OrientationLockType was removed from lib.dom. Use the preferred ScreenOrientationLockType | #### PluginListenerHandle @@ -146,4 +147,12 @@ Removes all listeners. | ------------ | ----------------------------------------- | | **`remove`** | () => Promise<void> | + +### Type Aliases + + +#### ScreenOrientationLockType + +'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary' + diff --git a/screen-orientation/src/definitions.ts b/screen-orientation/src/definitions.ts index af3ac5cc1..61a605c43 100644 --- a/screen-orientation/src/definitions.ts +++ b/screen-orientation/src/definitions.ts @@ -1,9 +1,22 @@ import type { PluginListenerHandle } from '@capacitor/core'; export interface OrientationLockOptions { - orientation: OrientationLockType; + /** + * OrientationLockType was removed from lib.dom. Use the preferred ScreenOrientationLockType + */ + orientation: OrientationLockType | ScreenOrientationLockType; } +export type ScreenOrientationLockType = + | 'any' + | 'natural' + | 'landscape' + | 'portrait' + | 'portrait-primary' + | 'portrait-secondary' + | 'landscape-primary' + | 'landscape-secondary'; + export interface ScreenOrientationResult { type: OrientationType; } From 08ba942134cd583507866b391410c867b9412b8f Mon Sep 17 00:00:00 2001 From: "damian.ionic" Date: Tue, 21 Nov 2023 11:08:19 -0800 Subject: [PATCH 2/3] fix (screen-orientation) update to add OrientationLockType --- screen-orientation/README.md | 8 ++++---- screen-orientation/src/definitions.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/screen-orientation/README.md b/screen-orientation/README.md index 5c2756ccd..f936c73ea 100644 --- a/screen-orientation/README.md +++ b/screen-orientation/README.md @@ -136,9 +136,9 @@ Removes all listeners. #### OrientationLockOptions -| Prop | Type | Description | -| ----------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| **`orientation`** | any | OrientationLockType was removed from lib.dom. Use the preferred ScreenOrientationLockType | +| Prop | Type | Description | +| ----------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| **`orientation`** | OrientationLockType | Note: OrientationLockType was removed from typescript >= 5.2. | #### PluginListenerHandle @@ -151,7 +151,7 @@ Removes all listeners. ### Type Aliases -#### ScreenOrientationLockType +#### OrientationLockType 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary' diff --git a/screen-orientation/src/definitions.ts b/screen-orientation/src/definitions.ts index 61a605c43..6d60449ed 100644 --- a/screen-orientation/src/definitions.ts +++ b/screen-orientation/src/definitions.ts @@ -2,12 +2,12 @@ import type { PluginListenerHandle } from '@capacitor/core'; export interface OrientationLockOptions { /** - * OrientationLockType was removed from lib.dom. Use the preferred ScreenOrientationLockType + * Note: OrientationLockType was removed from typescript >= 5.2. */ - orientation: OrientationLockType | ScreenOrientationLockType; + orientation: OrientationLockType; } -export type ScreenOrientationLockType = +export type OrientationLockType = | 'any' | 'natural' | 'landscape' From ef8c20cad375f6c9a6bc5689811e16ebbc9edd36 Mon Sep 17 00:00:00 2001 From: "damian.ionic" Date: Wed, 13 Dec 2023 11:54:19 -0800 Subject: [PATCH 3/3] fix: address code review comments --- screen-orientation/README.md | 6 +++--- screen-orientation/src/definitions.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/screen-orientation/README.md b/screen-orientation/README.md index f936c73ea..d9cb3e8fd 100644 --- a/screen-orientation/README.md +++ b/screen-orientation/README.md @@ -136,9 +136,9 @@ Removes all listeners. #### OrientationLockOptions -| Prop | Type | Description | -| ----------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| **`orientation`** | OrientationLockType | Note: OrientationLockType was removed from typescript >= 5.2. | +| Prop | Type | Description | +| ----------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| **`orientation`** | OrientationLockType | Note: Typescript v5.2+ users should import OrientationLockType from @capacitor/screen-orientation. | #### PluginListenerHandle diff --git a/screen-orientation/src/definitions.ts b/screen-orientation/src/definitions.ts index 6d60449ed..da041e040 100644 --- a/screen-orientation/src/definitions.ts +++ b/screen-orientation/src/definitions.ts @@ -2,7 +2,7 @@ import type { PluginListenerHandle } from '@capacitor/core'; export interface OrientationLockOptions { /** - * Note: OrientationLockType was removed from typescript >= 5.2. + * Note: Typescript v5.2+ users should import OrientationLockType from @capacitor/screen-orientation. */ orientation: OrientationLockType; }