Skip to content

Commit

Permalink
don't warn android users about sk2 not available (#2001)
Browse files Browse the repository at this point in the history
Co-authored-by: Andres Aguilar <andres.aguilar@nfl.com>
  • Loading branch information
andresesfm and Andres Aguilar authored Sep 26, 2022
1 parent 0581815 commit b89c460
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/docs/migrate_to_10.0.0.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
15 changes: 10 additions & 5 deletions src/internal/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = () => {
Expand Down

0 comments on commit b89c460

Please sign in to comment.