From cbd3a9f8486fb16c92f0bd474bd88526c64cdfbf Mon Sep 17 00:00:00 2001 From: r-yanyo Date: Mon, 17 Feb 2025 15:19:46 +0900 Subject: [PATCH 1/4] replace deprecated method --- core/src/utils/platform.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/utils/platform.ts b/core/src/utils/platform.ts index 622b81cac15..dc1336a156f 100644 --- a/core/src/utils/platform.ts +++ b/core/src/utils/platform.ts @@ -99,7 +99,7 @@ const isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || const isCapacitorNative = (win: any): boolean => { const capacitor = win['Capacitor']; - return !!capacitor?.isNative; + return !!capacitor?.isNativePlatform(); }; const isElectron = (win: Window): boolean => testUserAgent(win, /electron/i); From e05865c6941352870b277bd31dcd2edaeb7c7c00 Mon Sep 17 00:00:00 2001 From: ShaneK Date: Fri, 28 Feb 2025 10:56:56 -0800 Subject: [PATCH 2/4] fix(test): fixing mock for native platform check to support new capacitor way of checking --- core/src/utils/test/platform.utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/utils/test/platform.utils.ts b/core/src/utils/test/platform.utils.ts index 0cc7bce9b2e..a9235d80247 100644 --- a/core/src/utils/test/platform.utils.ts +++ b/core/src/utils/test/platform.utils.ts @@ -29,7 +29,7 @@ export const PlatformConfiguration = { }, Capacitor: { Capacitor: { - isNative: true, + isNativePlatform: () => true, }, }, PWA: { From a9c20af0b7e9701e9d8539fd19e6cf126a2f197e Mon Sep 17 00:00:00 2001 From: ShaneK Date: Fri, 28 Feb 2025 11:26:48 -0800 Subject: [PATCH 3/4] fix(capacitor): fixing capacitor 2 support --- core/src/utils/platform.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/utils/platform.ts b/core/src/utils/platform.ts index dc1336a156f..e1aadc1380c 100644 --- a/core/src/utils/platform.ts +++ b/core/src/utils/platform.ts @@ -99,7 +99,8 @@ const isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || const isCapacitorNative = (win: any): boolean => { const capacitor = win['Capacitor']; - return !!capacitor?.isNativePlatform(); + // TODO: Remove when we no longer support Capacitor 2, which does not have isNativePlatform + return !!capacitor?.isNative || (capacitor?.isNativePlatform && !!capacitor.isNativePlatform()); }; const isElectron = (win: Window): boolean => testUserAgent(win, /electron/i); From 8899f9b4a79f5483a83fd3bf9ef0d1b3ccb270b7 Mon Sep 17 00:00:00 2001 From: ShaneK Date: Fri, 28 Feb 2025 11:38:36 -0800 Subject: [PATCH 4/4] fix(capacitor): reference todo ticket, fix boolean conversion --- core/src/utils/platform.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/utils/platform.ts b/core/src/utils/platform.ts index e1aadc1380c..438bab0a42e 100644 --- a/core/src/utils/platform.ts +++ b/core/src/utils/platform.ts @@ -99,8 +99,8 @@ const isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || const isCapacitorNative = (win: any): boolean => { const capacitor = win['Capacitor']; - // TODO: Remove when we no longer support Capacitor 2, which does not have isNativePlatform - return !!capacitor?.isNative || (capacitor?.isNativePlatform && !!capacitor.isNativePlatform()); + // TODO(ROU-11693): Remove when we no longer support Capacitor 2, which does not have isNativePlatform + return !!(capacitor?.isNative || (capacitor?.isNativePlatform && !!capacitor.isNativePlatform())); }; const isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);