Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 5 additions & 72 deletions packages/amazon/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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 {
Expand All @@ -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')
Expand Down
25 changes: 3 additions & 22 deletions packages/amazon/src/index.ts
Original file line number Diff line number Diff line change
@@ -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<number> {
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 {}
97 changes: 6 additions & 91 deletions packages/android-player/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand All @@ -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 {
Expand All @@ -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')
Expand All @@ -140,12 +64,3 @@ dependencies {

implementation 'io.purchasely:player:5.7.0'
}


if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "PurchaselyAndroidPlayer"
codegenJavaPackageName = "com.reactnativepurchaselyandroidplayer"
}
}
6 changes: 3 additions & 3 deletions packages/android-player/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions packages/android-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 <kevin@purchasely.com> (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/"
},
Expand Down
23 changes: 3 additions & 20 deletions packages/android-player/src/index.ts
Original file line number Diff line number Diff line change
@@ -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<number> {
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 {}
16 changes: 0 additions & 16 deletions packages/android-player/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build:android": {
"env": ["ORG_GRADLE_PROJECT_newArchEnabled"],
"inputs": [
"package.json",
"android",
Expand All @@ -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": []
}
}
}
Loading