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
Binary file added .yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
30 changes: 3 additions & 27 deletions RNAmazonPublisherServices.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require "json"

new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED']

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
Expand All @@ -12,34 +10,12 @@ Pod::Spec.new do |s|
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => "13.0" }
s.source = { :git => "https://github.com/wjaykim/react-native-aps.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift}"

if new_arch_enabled
s.platforms = { :ios => "11.0" }

# folly_version must match the version used in React Native
# See folly_version in react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec
folly_config = get_folly_config()
folly_version = folly_config[:version]
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

s.compiler_flags = folly_compiler_flags

s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\""
}

s.dependency "React-Codegen"
s.dependency "RCT-Folly", folly_version
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
else
s.platforms = { :ios => "10.0" }
end
install_modules_dependencies(s)

s.dependency "React-Core"
s.dependency "AmazonPublisherServicesSDK"
s.dependency "AmazonPublisherServicesSDK", "5.3.1"
end
34 changes: 13 additions & 21 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
ext.safeExtGet = {prop, fallback ->
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
apply plugin: 'com.android.library'

android {
compileSdkVersion safeExtGet('compileSdkVersion', 31)
compileSdkVersion safeExtGet('compileSdkVersion', 35)

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 31)
minSdkVersion safeExtGet('minSdkVersion', 24)
targetSdkVersion safeExtGet('targetSdkVersion', 34)
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

}


buildTypes {
release {
minifyEnabled false
consumerProguardFiles 'proguard-rules.pro'
}
}

buildFeatures {
buildConfig true
}
}

repositories {
Expand All @@ -39,7 +45,7 @@ dependencies {
} else {
implementation 'com.facebook.react:react-native:+'
}
implementation ("com.amazon.android:aps-sdk:9.4.2")
implementation("com.amazon.android:aps-sdk:11.1.1")
}

if (isNewArchitectureEnabled()) {
Expand All @@ -48,19 +54,5 @@ if (isNewArchitectureEnabled()) {
codegenJavaPackageName = "com.adversport.rnaps"
root = rootProject.file("..")
jsRootDir = file("../src/turbomodules")
reactNativeDir = rootProject.file("../node_modules/react-native/")
codegenDir = rootProject.file("../node_modules/react-native-codegen/")
}
}

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def isNewArchitectureEnabled() {
// To opt-in for the New Architecture, you can either:
// - Set `newArchEnabled` to true inside the `gradle.properties` file
// - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ public void onSuccess(DTBAdResponse response) {
public void loadAd(int loaderId, String adType, ReadableMap options, Promise promise) {
stopAutoRefresh(loaderId);

DTBAdRequest adLoader = new DTBAdRequest();
DTBAdNetworkInfo adNetworkInfo = RNAPSAdsModule.getCachedAdNetworkInfo();
if (adNetworkInfo == null) {
adNetworkInfo = new DTBAdNetworkInfo(DTBAdNetwork.OTHER);
}
DTBAdRequest adLoader = new DTBAdRequest(adNetworkInfo);

String slotUUID = options.getString("slotUUID");
if (slotUUID == null) {
Expand Down
17 changes: 15 additions & 2 deletions android/src/main/java/com/adversport/rnaps/RNAPSAdsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public class RNAPSAdsModule extends ReactContextBaseJavaModule {

public static final String MODULE_NAME = "RNAPSAdsModule";

private static DTBAdNetworkInfo cachedAdNetworkInfo = null;

public static DTBAdNetworkInfo getCachedAdNetworkInfo() {
return cachedAdNetworkInfo;
}

public RNAPSAdsModule(ReactApplicationContext reactContext) {
super(reactContext);
}
Expand Down Expand Up @@ -62,7 +68,14 @@ public void setAdNetworkInfo(ReadableMap adNetworkInfoMap) {
adNetwork = DTBAdNetwork.AD_GENERATION;
break;
case "IRON_SOURCE":
adNetwork = DTBAdNetwork.IRON_SOURCE;
case "UNITY_LEVELPLAY":
adNetwork = DTBAdNetwork.UNITY_LEVELPLAY;
break;
case "UNKNOWN":
adNetwork = DTBAdNetwork.UNKNOWN;
break;
case "CUSTOM_MEDIATION":
adNetwork = DTBAdNetwork.CUSTOM_MEDIATION;
break;
case "MAX":
adNetwork = DTBAdNetwork.MAX;
Expand Down Expand Up @@ -91,7 +104,7 @@ public void setAdNetworkInfo(ReadableMap adNetworkInfoMap) {
}
}

AdRegistration.setAdNetworkInfo(adNetworkInfo);
cachedAdNetworkInfo = adNetworkInfo;
}

@ReactMethod
Expand Down
Binary file added example/.yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions example/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
Loading
Loading