From b89c4602edf986262a1b2be97ecf7a73f7e4eaec Mon Sep 17 00:00:00 2001 From: Andres Aguilar Date: Mon, 26 Sep 2022 14:48:26 -0700 Subject: [PATCH] don't warn android users about sk2 not available (#2001) Co-authored-by: Andres Aguilar --- docs/docs/migrate_to_10.0.0.md | 2 +- src/internal/platform.ts | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/docs/migrate_to_10.0.0.md b/docs/docs/migrate_to_10.0.0.md index cee2f5a1b..50b6822e8 100644 --- a/docs/docs/migrate_to_10.0.0.md +++ b/docs/docs/migrate_to_10.0.0.md @@ -1,4 +1,4 @@ -# Migrating to 10.x.x +# Migrating to 10.0.0 Starting with 10.0.0, the parameters to some of the methods are now objects instead of positional parameters. diff --git a/src/internal/platform.ts b/src/internal/platform.ts index e54fe8ba1..7846b037f 100644 --- a/src/internal/platform.ts +++ b/src/internal/platform.ts @@ -47,10 +47,13 @@ export const getNativeModule = (): let iosNativeModule: typeof RNIapIos | typeof RNIapIosSk2 = RNIapIos; export const isStorekit2Avaiable = (): boolean => - RNIapIosSk2?.isAvailable() === 1; + isIos && RNIapIosSk2?.isAvailable() === 1; export const isIosStorekit2 = () => - !!iosNativeModule && iosNativeModule === RNIapIosSk2 && isStorekit2Avaiable(); + isIos && + !!iosNativeModule && + iosNativeModule === RNIapIosSk2 && + isStorekit2Avaiable(); export const setIosNativeModule = ( nativeModule: typeof RNIapIos | typeof RNIapIosSk2, @@ -64,9 +67,11 @@ export const storekit2Mode = () => { RNIapIos.disable(); return true; } - console.warn('Storekit 2 is not available on this device'); - - return false; + if (isIos) { + console.warn('Storekit 2 is not available on this device'); + return false; + } + return true; }; export const storekit1Mode = () => {