diff --git a/packages/amazon/android/build.gradle b/packages/amazon/android/build.gradle index 835ed6e3..d07d528d 100644 --- a/packages/amazon/android/build.gradle +++ b/packages/amazon/android/build.gradle @@ -5,11 +5,10 @@ buildscript { repositories { google() mavenCentral() - jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.7.3' // noinspection DifferentKotlinGradleVersion classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } @@ -27,13 +26,13 @@ def getExtOrIntegerDefault(name) { } android { + namespace = "com.reactnativepurchaselyamazon" compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') defaultConfig { minSdkVersion 21 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') versionCode 1 versionName "1.0" - } buildTypes { @@ -45,80 +44,14 @@ android { disable 'GradleCompatible' } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } } repositories { - mavenCentral() - jcenter() google() - - def found = false - def defaultDir = null - def androidSourcesName = 'React Native sources' - - if (rootProject.ext.has('reactNativeAndroidRoot')) { - defaultDir = rootProject.ext.get('reactNativeAndroidRoot') - } else { - defaultDir = new File( - projectDir, - '/../../../node_modules/react-native/android' - ) - } - - if (defaultDir.exists()) { - maven { - url defaultDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") - found = true - } else { - def parentDir = rootProject.projectDir - - 1.upto(5, { - if (found) return true - parentDir = parentDir.parentFile - - def androidSourcesDir = new File( - parentDir, - 'node_modules/react-native' - ) - - def androidPrebuiltBinaryDir = new File( - parentDir, - 'node_modules/react-native/android' - ) - - if (androidPrebuiltBinaryDir.exists()) { - maven { - url androidPrebuiltBinaryDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") - found = true - } else if (androidSourcesDir.exists()) { - maven { - url androidSourcesDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") - found = true - } - }) - } - - if (!found) { - throw new GradleException( - "${project.name}: unable to locate React Native android sources. " + - "Ensure you have you installed React Native as a dependency in your project and try again." - ) - } + mavenCentral() } def kotlin_version = getExtOrDefault('kotlinVersion') diff --git a/packages/amazon/src/index.ts b/packages/amazon/src/index.ts index defee017..90b78069 100644 --- a/packages/amazon/src/index.ts +++ b/packages/amazon/src/index.ts @@ -1,22 +1,3 @@ -import { NativeModules, Platform } from 'react-native'; - -const LINKING_ERROR = - `The package 'react-native-purchasely-amazon' doesn't seem to be linked. Make sure: \n\n` + - Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + - '- You rebuilt the app after installing the package\n' + - '- You are not using Expo managed workflow\n'; - -const PurchaselyAmazon = NativeModules.PurchaselyAmazon - ? NativeModules.PurchaselyAmazon - : new Proxy( - {}, - { - get() { - throw new Error(LINKING_ERROR); - }, - } - ); - -export function multiply(a: number, b: number): Promise { - return PurchaselyAmazon.multiply(a, b); -} +// This package provides the Purchasely Amazon Appstore SDK as a native dependency. +// No JavaScript API is exposed by this package. +export {} diff --git a/packages/android-player/android/build.gradle b/packages/android-player/android/build.gradle index c8522bf9..daa86b6c 100644 --- a/packages/android-player/android/build.gradle +++ b/packages/android-player/android/build.gradle @@ -4,29 +4,20 @@ buildscript { repositories { google() - mavenCentral() - jcenter() mavenLocal() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.7.3' // noinspection DifferentKotlinGradleVersion classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } -def isNewArchitectureEnabled() { - return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" -} - apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -if (isNewArchitectureEnabled()) { - apply plugin: 'com.facebook.react' -} - def getExtOrDefault(name) { return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['PurchaselyAndroidPlayer_' + name] } @@ -36,13 +27,13 @@ def getExtOrIntegerDefault(name) { } android { + namespace = "com.reactnativepurchaselyandroidplayer" compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') defaultConfig { minSdkVersion 21 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') versionCode 1 versionName "1.0" - buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() } buildTypes { @@ -54,81 +45,14 @@ android { disable 'GradleCompatible' } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } } repositories { - mavenCentral() - jcenter() google() - mavenLocal() - - def found = false - def defaultDir = null - def androidSourcesName = 'React Native sources' - - if (rootProject.ext.has('reactNativeAndroidRoot')) { - defaultDir = rootProject.ext.get('reactNativeAndroidRoot') - } else { - defaultDir = new File( - projectDir, - '/../../../node_modules/react-native/android' - ) - } - - if (defaultDir.exists()) { - maven { - url defaultDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") - found = true - } else { - def parentDir = rootProject.projectDir - - 1.upto(5, { - if (found) return true - parentDir = parentDir.parentFile - - def androidSourcesDir = new File( - parentDir, - 'node_modules/react-native' - ) - - def androidPrebuiltBinaryDir = new File( - parentDir, - 'node_modules/react-native/android' - ) - - if (androidPrebuiltBinaryDir.exists()) { - maven { - url androidPrebuiltBinaryDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") - found = true - } else if (androidSourcesDir.exists()) { - maven { - url androidSourcesDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") - found = true - } - }) - } - - if (!found) { - throw new GradleException( - "${project.name}: unable to locate React Native android sources. " + - "Ensure you have you installed React Native as a dependency in your project and try again." - ) - } + mavenCentral() } def kotlin_version = getExtOrDefault('kotlinVersion') @@ -140,12 +64,3 @@ dependencies { implementation 'io.purchasely:player:5.7.0' } - - -if (isNewArchitectureEnabled()) { - react { - jsRootDir = file("../src/") - libraryName = "PurchaselyAndroidPlayer" - codegenJavaPackageName = "com.reactnativepurchaselyandroidplayer" - } -} diff --git a/packages/android-player/android/gradle.properties b/packages/android-player/android/gradle.properties index 3672553a..1d56d66e 100644 --- a/packages/android-player/android/gradle.properties +++ b/packages/android-player/android/gradle.properties @@ -1,6 +1,6 @@ -PurchaselyGoogle_kotlinVersion=2.1.21 -PurchaselyGoogle_compileSdkVersion=35 -PurchaselyGoogle_targetSdkVersion=35 +PurchaselyAndroidPlayer_kotlinVersion=2.1.21 +PurchaselyAndroidPlayer_compileSdkVersion=35 +PurchaselyAndroidPlayer_targetSdkVersion=35 android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX diff --git a/packages/android-player/package.json b/packages/android-player/package.json index d50ef9be..25a18677 100644 --- a/packages/android-player/package.json +++ b/packages/android-player/package.json @@ -2,7 +2,7 @@ "name": "@purchasely/react-native-purchasely-android-player", "version": "5.7.0", "description": "Player Android", - "source": "./src/index.tsx", + "source": "./src/index.ts", "main": "./lib/commonjs/index.js", "module": "./lib/module/index.js", "types": "./lib/typescript/packages/android-player/src/index.d.ts", @@ -33,14 +33,14 @@ ], "repository": { "type": "git", - "url": "https://github.com/Purchasely/Purchasely-ReactNative/packages/google" + "url": "https://github.com/Purchasely/Purchasely-ReactNative/packages/android-player" }, "author": "Purchasely (https://github.com/Purchasely/Purchasely-ReactNative)", "license": "MIT", "bugs": { "url": "https://github.com/Purchasely/Purchasely-ReactNative/issues" }, - "homepage": "https://github.com/Purchasely/Purchasely-ReactNative/packages/google#readme", + "homepage": "https://github.com/Purchasely/Purchasely-ReactNative/packages/android-player#readme", "publishConfig": { "registry": "https://registry.npmjs.org/" }, diff --git a/packages/android-player/src/index.ts b/packages/android-player/src/index.ts index 47225ba1..dba4bbad 100644 --- a/packages/android-player/src/index.ts +++ b/packages/android-player/src/index.ts @@ -1,20 +1,3 @@ -import { NativeModules, Platform } from 'react-native'; - -const LINKING_ERROR = - `The package 'react-native-purchasely-android-player' doesn't seem to be linked. Make sure: \n\n` + - Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + - '- You rebuilt the app after installing the package\n' + - '- You are not using Expo managed workflow\n'; - -const PurchaselyAndroidPlayer = NativeModules.PurchaselyAndroidPlayer ? NativeModules.PurchaselyAndroidPlayer : new Proxy( - {}, - { - get() { - throw new Error(LINKING_ERROR); - }, - } -); - -export function multiply(a: number, b: number): Promise { - return PurchaselyAndroidPlayer.multiply(a, b); -} +// This package provides the Purchasely Android Player SDK as a native dependency. +// No JavaScript API is exposed by this package. +export {} diff --git a/packages/android-player/turbo.json b/packages/android-player/turbo.json index 405897ee..162fba0c 100644 --- a/packages/android-player/turbo.json +++ b/packages/android-player/turbo.json @@ -2,7 +2,6 @@ "$schema": "https://turbo.build/schema.json", "pipeline": { "build:android": { - "env": ["ORG_GRADLE_PROJECT_newArchEnabled"], "inputs": [ "package.json", "android", @@ -16,21 +15,6 @@ "!example/android/app/build" ], "outputs": [] - }, - "build:ios": { - "env": ["RCT_NEW_ARCH_ENABLED"], - "inputs": [ - "package.json", - "*.podspec", - "ios", - "src/*.ts", - "src/*.tsx", - "example/package.json", - "example/ios", - "!example/ios/build", - "!example/ios/Pods" - ], - "outputs": [] } } } diff --git a/packages/google/android/build.gradle b/packages/google/android/build.gradle index 098a7c7e..76737de2 100644 --- a/packages/google/android/build.gradle +++ b/packages/google/android/build.gradle @@ -4,13 +4,12 @@ buildscript { repositories { google() - mavenCentral() - jcenter() mavenLocal() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.7.3' // noinspection DifferentKotlinGradleVersion classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } @@ -28,13 +27,13 @@ def getExtOrIntegerDefault(name) { } android { + namespace = "com.reactnativepurchaselygoogle" compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') defaultConfig { minSdkVersion 21 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') versionCode 1 versionName "1.0" - } buildTypes { @@ -46,81 +45,14 @@ android { disable 'GradleCompatible' } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } } repositories { - mavenCentral() - jcenter() google() - mavenLocal() - - def found = false - def defaultDir = null - def androidSourcesName = 'React Native sources' - - if (rootProject.ext.has('reactNativeAndroidRoot')) { - defaultDir = rootProject.ext.get('reactNativeAndroidRoot') - } else { - defaultDir = new File( - projectDir, - '/../../../node_modules/react-native/android' - ) - } - - if (defaultDir.exists()) { - maven { - url defaultDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") - found = true - } else { - def parentDir = rootProject.projectDir - - 1.upto(5, { - if (found) return true - parentDir = parentDir.parentFile - - def androidSourcesDir = new File( - parentDir, - 'node_modules/react-native' - ) - - def androidPrebuiltBinaryDir = new File( - parentDir, - 'node_modules/react-native/android' - ) - - if (androidPrebuiltBinaryDir.exists()) { - maven { - url androidPrebuiltBinaryDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") - found = true - } else if (androidSourcesDir.exists()) { - maven { - url androidSourcesDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") - found = true - } - }) - } - - if (!found) { - throw new GradleException( - "${project.name}: unable to locate React Native android sources. " + - "Ensure you have you installed React Native as a dependency in your project and try again." - ) - } + mavenCentral() } def kotlin_version = getExtOrDefault('kotlinVersion') diff --git a/packages/google/src/index.ts b/packages/google/src/index.ts index 116d2d2e..49f00b64 100644 --- a/packages/google/src/index.ts +++ b/packages/google/src/index.ts @@ -1,21 +1,3 @@ -import { NativeModules } from 'react-native'; - -const LINKING_ERROR = - `The package 'react-native-purchasely-google' doesn't seem to be linked. Make sure: \n\n` + - '- You rebuilt the app after installing the package\n' + - '- You are not using Expo managed workflow\n'; - -const PurchaselyGoogle = NativeModules.PurchaselyGoogle - ? NativeModules.PurchaselyGoogle - : new Proxy( - {}, - { - get() { - throw new Error(LINKING_ERROR); - }, - } - ); - -export function multiply(a: number, b: number): Promise { - return PurchaselyGoogle.multiply(a, b); -} +// This package provides the Purchasely Google Play Billing SDK as a native dependency. +// No JavaScript API is exposed by this package. +export {} diff --git a/packages/huawei/android/build.gradle b/packages/huawei/android/build.gradle index 294b33c0..1f7ffb1e 100644 --- a/packages/huawei/android/build.gradle +++ b/packages/huawei/android/build.gradle @@ -5,12 +5,11 @@ buildscript { repositories { google() mavenCentral() - jcenter() maven { url 'https://developer.huawei.com/repo/' } } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.7.3' // noinspection DifferentKotlinGradleVersion classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.huawei.agconnect:agcp:1.6.0.300' @@ -30,13 +29,13 @@ def getExtOrIntegerDefault(name) { } android { + namespace = "com.reactnativepurchaselyhuawei" compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') defaultConfig { minSdkVersion 21 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') versionCode 1 versionName "1.0" - } buildTypes { @@ -48,81 +47,15 @@ android { disable 'GradleCompatible' } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } } repositories { - mavenCentral() - jcenter() google() + mavenCentral() maven { url 'https://developer.huawei.com/repo/' } - - def found = false - def defaultDir = null - def androidSourcesName = 'React Native sources' - - if (rootProject.ext.has('reactNativeAndroidRoot')) { - defaultDir = rootProject.ext.get('reactNativeAndroidRoot') - } else { - defaultDir = new File( - projectDir, - '/../../../node_modules/react-native/android' - ) - } - - if (defaultDir.exists()) { - maven { - url defaultDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") - found = true - } else { - def parentDir = rootProject.projectDir - - 1.upto(5, { - if (found) return true - parentDir = parentDir.parentFile - - def androidSourcesDir = new File( - parentDir, - 'node_modules/react-native' - ) - - def androidPrebuiltBinaryDir = new File( - parentDir, - 'node_modules/react-native/android' - ) - - if (androidPrebuiltBinaryDir.exists()) { - maven { - url androidPrebuiltBinaryDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") - found = true - } else if (androidSourcesDir.exists()) { - maven { - url androidSourcesDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") - found = true - } - }) - } - - if (!found) { - throw new GradleException( - "${project.name}: unable to locate React Native android sources. " + - "Ensure you have you installed React Native as a dependency in your project and try again." - ) - } } def kotlin_version = getExtOrDefault('kotlinVersion') diff --git a/packages/huawei/src/index.ts b/packages/huawei/src/index.ts index 116d2d2e..64d70579 100644 --- a/packages/huawei/src/index.ts +++ b/packages/huawei/src/index.ts @@ -1,21 +1,3 @@ -import { NativeModules } from 'react-native'; - -const LINKING_ERROR = - `The package 'react-native-purchasely-google' doesn't seem to be linked. Make sure: \n\n` + - '- You rebuilt the app after installing the package\n' + - '- You are not using Expo managed workflow\n'; - -const PurchaselyGoogle = NativeModules.PurchaselyGoogle - ? NativeModules.PurchaselyGoogle - : new Proxy( - {}, - { - get() { - throw new Error(LINKING_ERROR); - }, - } - ); - -export function multiply(a: number, b: number): Promise { - return PurchaselyGoogle.multiply(a, b); -} +// This package provides the Purchasely Huawei Mobile Services SDK as a native dependency. +// No JavaScript API is exposed by this package. +export {}