├── .gitattributes ├── .gitignore ├── .npmignore ├── README.md ├── RNAppodeal.podspec ├── android ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── appodeal │ │ └── rnappodeal │ │ ├── RCTAppodealBannerView.java │ │ ├── RCTAppodealMrecView.java │ │ ├── RNAppodealBannerManager.java │ │ ├── RNAppodealDispatchGroup.java │ │ ├── RNAppodealModule.java │ │ ├── RNAppodealMrecManager.java │ │ ├── RNAppodealPackage.java │ │ └── RNAppodealUtils.java │ └── res │ └── xml │ └── network_security_config.xml ├── example ├── .buckconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .node-version ├── .prettierrc.js ├── .ruby-version ├── .watchmanconfig ├── __tests__ │ └── App-test.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── google-services.json │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── appodeal │ │ │ │ └── rnappodeal │ │ │ │ └── example │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.ts ├── ios │ ├── Dummy.swift │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Example-tvOS.xcscheme │ │ │ └── Example.xcscheme │ ├── Example.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Example │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ ├── ExampleTests │ │ ├── ExampleTests.m │ │ └── Info.plist │ ├── GoogleService-Info.plist │ └── Podfile ├── jest.config.js ├── metro.config.js ├── package.json ├── src │ ├── App.tsx │ ├── advertising │ │ ├── BannerView.tsx │ │ ├── constants.ts │ │ └── index.ts │ ├── components │ │ ├── Spacer.tsx │ │ ├── controls │ │ │ ├── AutocacheControl.tsx │ │ │ └── BannerSegmentedControl.tsx │ │ ├── index.tsx │ │ └── sections │ │ │ ├── InitialisationSection.tsx │ │ │ └── ShowSection.tsx │ ├── screens │ │ ├── AdvancedFeaturesScreen.tsx │ │ └── HomeScreen.tsx │ └── styles │ │ └── index.ts └── tsconfig.json ├── ios ├── RNADefines.h ├── RNADefines.m ├── RNAppodeal.h ├── RNAppodeal.m ├── RNAppodeal.xcodeproj │ └── project.pbxproj ├── RNAppodealBannerView.h ├── RNAppodealBannerView.m ├── RNAppodealBannerViewManager.h ├── RNAppodealBannerViewManager.m ├── RNAppodealMrecViewManager.h └── RNAppodealMrecViewManager.m ├── package.json ├── src ├── RNAppodeal.ts ├── RNAppodealBanner.tsx ├── RNAppodealMrec.tsx ├── RNAppodealTypes.ts ├── events │ ├── appodeal.ts │ ├── banner.ts │ ├── interstiital.ts │ └── rewarded.ts └── index.ts └── tsconfig.json /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Typescript generated files 2 | dist/ 3 | 4 | # OSX 5 | # 6 | .DS_Store 7 | 8 | # node.js 9 | # 10 | node_modules/ 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | 15 | # Xcode 16 | # 17 | Pods/ 18 | build/ 19 | *.pbxuser 20 | !default.pbxuser 21 | *.mode1v3 22 | !default.mode1v3 23 | *.mode2v3 24 | !default.mode2v3 25 | *.perspectivev3 26 | !default.perspectivev3 27 | xcuserdata 28 | *.xccheckout 29 | *.moved-aside 30 | DerivedData 31 | *.hmap 32 | *.ipa 33 | *.xcuserstate 34 | project.xcworkspace 35 | 36 | 37 | # Android/IntelliJ 38 | # 39 | build/ 40 | captures/ 41 | .settings 42 | .idea 43 | .gradle 44 | local.properties 45 | *.iml 46 | *.hprof 47 | 48 | # BUCK 49 | buck-out/ 50 | \.buckd/ 51 | *.keystore 52 | 53 | package-lock.json 54 | yarn.lock 55 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example 2 | .gitignore 3 | -------------------------------------------------------------------------------- /RNAppodeal.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 3 | 4 | s.name = "RNAppodeal" 5 | s.version = package['version'] 6 | s.summary = "React Native plugin for Appodeal SDK" 7 | s.description = <<-DESC 8 | React Native plugin for Appodeal SDK. It supports interstitial, rewarded video and banner ads 9 | DESC 10 | s.homepage = "https://appodeal.com" 11 | s.license = "MIT" 12 | s.author = { "author" => "appodeal.com" } 13 | s.platform = :ios, "13.0" 14 | s.source = { :git => package['repository']['url'], :tag => "master" } 15 | s.source_files = "ios/**/*.{h,m}" 16 | 17 | s.requires_arc = true 18 | s.static_framework = true 19 | 20 | s.dependency "React" 21 | s.dependency "Appodeal", "3.5.0" 22 | s.dependency "APDIABAdapter", "3.5.0.0" 23 | end 24 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | key.properties 11 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | def safeExtGet(prop, fallback) { 2 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 3 | } 4 | 5 | buildscript { 6 | repositories { 7 | mavenCentral() 8 | maven { 9 | url 'https://maven.google.com/' 10 | name 'Google' 11 | } 12 | } 13 | 14 | dependencies { 15 | classpath 'com.android.tools.build:gradle:7.4.2' 16 | } 17 | } 18 | 19 | apply plugin: 'com.android.library' 20 | 21 | android { 22 | // Conditional for compatibility with AGP <4.2. 23 | if (project.android.hasProperty("namespace")) { 24 | namespace 'com.appodeal.rnappodeal' 25 | } 26 | 27 | compileSdkVersion safeExtGet('compileSdkVersion', 34) 28 | 29 | defaultConfig { 30 | minSdkVersion safeExtGet('minSdkVersion', 21) 31 | targetSdkVersion safeExtGet('targetSdkVersion', 34) 32 | versionCode 1 33 | versionName "1.0" 34 | ndk { 35 | abiFilters "armeabi-v7a", "x86" 36 | 00 37 | } 38 | } 39 | lintOptions { 40 | warning 'InvalidPackage' 41 | } 42 | testOptions { 43 | unitTests.includeAndroidResources = true 44 | unitTests.returnDefaultValues = true 45 | } 46 | compileOptions { 47 | sourceCompatibility JavaVersion.VERSION_1_8 48 | targetCompatibility JavaVersion.VERSION_1_8 49 | } 50 | } 51 | 52 | repositories { 53 | mavenCentral() 54 | maven { url "https://maven.google.com" } 55 | maven { url "https://artifactory.appodeal.com/appodeal" } 56 | } 57 | 58 | 59 | dependencies { 60 | implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" 61 | implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.1')}" 62 | 63 | // Appodeal 3.5.0 64 | implementation 'com.appodeal.ads.sdk:core:3.5.0' 65 | implementation 'com.appodeal.ads.sdk.networks:iab:3.5.0.0' 66 | } -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 11 | -------------------------------------------------------------------------------- /android/src/main/java/com/appodeal/rnappodeal/RCTAppodealBannerView.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.res.Resources; 6 | import android.os.Handler; 7 | import android.os.Looper; 8 | import android.util.DisplayMetrics; 9 | import android.util.TypedValue; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | 13 | import androidx.annotation.NonNull; 14 | import androidx.annotation.Nullable; 15 | 16 | import com.appodeal.ads.Appodeal; 17 | import com.appodeal.ads.BannerCallbacks; 18 | import com.appodeal.ads.BannerView; 19 | import com.facebook.react.bridge.Arguments; 20 | import com.facebook.react.bridge.ReactContext; 21 | import com.facebook.react.bridge.WritableMap; 22 | import com.facebook.react.uimanager.events.RCTEventEmitter; 23 | import com.facebook.react.views.view.ReactViewGroup; 24 | 25 | public class RCTAppodealBannerView extends ReactViewGroup implements BannerCallbacks { 26 | 27 | enum BannerSize {PHONE, TABLET} 28 | 29 | private static final String defaultPlacement = "default"; 30 | private static final Handler handler = new Handler(Looper.getMainLooper()); 31 | 32 | private BannerSize size = BannerSize.PHONE; 33 | private String placement = defaultPlacement; 34 | 35 | @Nullable 36 | private Runnable showRunnable = null; 37 | 38 | private final Runnable measureAndLayout = () -> { 39 | for (int i = 0; i < getChildCount(); i++) { 40 | View child = getChildAt(i); 41 | child.measure( 42 | MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY), 43 | MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY) 44 | ); 45 | child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight()); 46 | } 47 | }; 48 | 49 | public RCTAppodealBannerView(Context context) { 50 | super(context); 51 | } 52 | 53 | @Override 54 | public void requestLayout() { 55 | super.requestLayout(); 56 | post(measureAndLayout); 57 | } 58 | 59 | public void setAdSize(String adSize) { 60 | if (adSize.equals("tablet")) { 61 | this.size = BannerSize.TABLET; 62 | } else { 63 | this.size = BannerSize.PHONE; 64 | } 65 | cacheAdIfNeeded(); 66 | } 67 | 68 | public BannerSize getSize() { 69 | return this.size; 70 | } 71 | 72 | public void setPlacement(String placement) { 73 | this.placement = placement; 74 | } 75 | 76 | public String getPlacement() { 77 | return placement; 78 | } 79 | 80 | public void showBannerView(@NonNull BannerView bannerView) { 81 | showRunnable = () -> { 82 | Activity activity = getReactContext().getCurrentActivity(); 83 | if (activity == null) return; 84 | 85 | Appodeal.set728x90Banners(size == RCTAppodealBannerView.BannerSize.TABLET); 86 | 87 | int height = getEstimatedHeight(); 88 | Resources resources = getReactContext().getResources(); 89 | DisplayMetrics dm = resources.getDisplayMetrics(); 90 | int widthPixels = resources.getDisplayMetrics().widthPixels; 91 | int heightPixels = dp2px(height, dm); 92 | 93 | LayoutParams bannerLayoutParams = new BannerView.LayoutParams(widthPixels, heightPixels); 94 | bannerView.setLayoutParams(bannerLayoutParams); 95 | bannerView.setVisibility(VISIBLE); 96 | bannerView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); 97 | 98 | removeAllViews(); 99 | setVisibility(VISIBLE); 100 | addView(bannerView); 101 | 102 | bannerView.bringToFront(); 103 | 104 | String showPlacement = placement == null ? defaultPlacement : placement; 105 | Appodeal.show(activity, Appodeal.BANNER_VIEW, showPlacement); 106 | }; 107 | handler.postDelayed(showRunnable, 250L); 108 | } 109 | 110 | public void hideBannerView(@NonNull BannerView bannerView) { 111 | removeAllViews(); 112 | ViewGroup parent = (ViewGroup) bannerView.getParent(); 113 | if (parent != null) { 114 | parent.removeView(bannerView); 115 | } 116 | handler.removeCallbacks(showRunnable); 117 | } 118 | 119 | private void cacheAdIfNeeded() { 120 | if (!Appodeal.isAutoCacheEnabled(Appodeal.BANNER_VIEW)) { 121 | Activity activity = getReactContext().getCurrentActivity(); 122 | if (activity != null) { 123 | Appodeal.cache(activity, Appodeal.BANNER_VIEW); 124 | } 125 | } 126 | } 127 | 128 | private int getEstimatedHeight() { 129 | if (size == BannerSize.TABLET) { 130 | return 90; 131 | } 132 | return 50; 133 | } 134 | 135 | private ReactContext getReactContext() { 136 | return (ReactContext) getContext(); 137 | } 138 | 139 | private RCTEventEmitter getEmitter() { 140 | return getReactContext().getJSModule(RCTEventEmitter.class); 141 | } 142 | 143 | private int dp2px(int dp, DisplayMetrics dm) { 144 | return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, dm)); 145 | } 146 | 147 | @Override 148 | public void onBannerLoaded(int height, boolean isPrecache) { 149 | WritableMap params = Arguments.createMap(); 150 | params.putInt("height", height); 151 | params.putBoolean("isPrecache", isPrecache); 152 | getEmitter().receiveEvent(getId(), "onBannerLoaded", params); 153 | } 154 | 155 | @Override 156 | public void onBannerFailedToLoad() { 157 | getEmitter().receiveEvent(getId(), "onBannerFailedToLoad", null); 158 | } 159 | 160 | @Override 161 | public void onBannerClicked() { 162 | getEmitter().receiveEvent(getId(), "onBannerClicked", null); 163 | } 164 | 165 | @Override 166 | public void onBannerExpired() { 167 | getEmitter().receiveEvent(getId(), "onBannerExpired", null); 168 | } 169 | 170 | @Override 171 | public void onBannerShowFailed() { 172 | } 173 | 174 | @Override 175 | public void onBannerShown() { 176 | } 177 | } -------------------------------------------------------------------------------- /android/src/main/java/com/appodeal/rnappodeal/RCTAppodealMrecView.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal; 2 | 3 | import android.app.Activity; 4 | import android.content.res.Resources; 5 | import android.os.Handler; 6 | import android.os.Looper; 7 | import android.util.DisplayMetrics; 8 | import android.util.TypedValue; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.FrameLayout; 12 | 13 | import androidx.annotation.NonNull; 14 | import androidx.annotation.Nullable; 15 | 16 | import com.appodeal.ads.Appodeal; 17 | import com.appodeal.ads.BannerView; 18 | import com.appodeal.ads.MrecCallbacks; 19 | import com.appodeal.ads.MrecView; 20 | import com.facebook.react.bridge.Arguments; 21 | import com.facebook.react.bridge.ReactContext; 22 | import com.facebook.react.bridge.WritableMap; 23 | import com.facebook.react.uimanager.ThemedReactContext; 24 | import com.facebook.react.uimanager.events.RCTEventEmitter; 25 | import com.facebook.react.views.view.ReactViewGroup; 26 | 27 | 28 | public class RCTAppodealMrecView extends ReactViewGroup implements MrecCallbacks { 29 | private static final String defaultPlacement = "default"; 30 | private static final Handler handler = new Handler(Looper.getMainLooper()); 31 | 32 | private String placement = defaultPlacement; 33 | 34 | @Nullable 35 | private Runnable showRunnable = null; 36 | 37 | private final Runnable measureAndLayout = () -> { 38 | for (int i = 0; i < getChildCount(); i++) { 39 | View child = getChildAt(i); 40 | child.measure( 41 | MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY), 42 | MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY) 43 | ); 44 | child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight()); 45 | } 46 | }; 47 | 48 | public RCTAppodealMrecView(ThemedReactContext context) { 49 | super(context); 50 | cacheAdIfNeeded(); 51 | } 52 | 53 | @Override 54 | public void requestLayout() { 55 | super.requestLayout(); 56 | post(measureAndLayout); 57 | } 58 | 59 | public void setPlacement(String placement) { 60 | this.placement = placement; 61 | } 62 | 63 | public String getPlacement() { 64 | return placement; 65 | } 66 | 67 | public void showBannerView(@NonNull MrecView bannerView) { 68 | showRunnable = () -> { 69 | Activity activity = getReactContext().getCurrentActivity(); 70 | if (activity == null) return; 71 | 72 | Resources resources = getReactContext().getResources(); 73 | DisplayMetrics dm = resources.getDisplayMetrics(); 74 | int widthPixels = resources.getDisplayMetrics().widthPixels; 75 | int heightPixels = dp2px(250, dm); 76 | 77 | LayoutParams bannerLayoutParams = new BannerView.LayoutParams(widthPixels, heightPixels); 78 | bannerView.setLayoutParams(bannerLayoutParams); 79 | bannerView.setVisibility(VISIBLE); 80 | bannerView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); 81 | 82 | removeAllViews(); 83 | setVisibility(VISIBLE); 84 | addView(bannerView); 85 | 86 | bannerView.bringToFront(); 87 | 88 | String showPlacement = placement == null ? defaultPlacement : placement; 89 | Appodeal.show(activity, Appodeal.MREC, showPlacement); 90 | }; 91 | handler.postDelayed(showRunnable, 250L); 92 | } 93 | 94 | public void hideBannerView(@NonNull MrecView bannerView) { 95 | removeAllViews(); 96 | ViewGroup parent = (ViewGroup) bannerView.getParent(); 97 | if (parent != null) { 98 | parent.removeView(bannerView); 99 | } 100 | handler.removeCallbacks(showRunnable); 101 | } 102 | 103 | private void cacheAdIfNeeded() { 104 | if (!Appodeal.isAutoCacheEnabled(Appodeal.MREC)) { 105 | Activity activity = getReactContext().getCurrentActivity(); 106 | if (activity != null) { 107 | Appodeal.cache(activity, Appodeal.MREC); 108 | } 109 | } 110 | } 111 | 112 | private ReactContext getReactContext() { 113 | return (ReactContext) getContext(); 114 | } 115 | 116 | private RCTEventEmitter getEmitter() { 117 | return getReactContext().getJSModule(RCTEventEmitter.class); 118 | } 119 | 120 | private int dp2px(int dp, DisplayMetrics dm) { 121 | return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, dm)); 122 | } 123 | 124 | @Override 125 | public void onMrecLoaded(boolean isPrecache) { 126 | WritableMap params = Arguments.createMap(); 127 | params.putInt("height", 250); 128 | params.putBoolean("isPrecache", isPrecache); 129 | getEmitter().receiveEvent(getId(), "onMrecLoaded", params); 130 | } 131 | 132 | @Override 133 | public void onMrecFailedToLoad() { 134 | getEmitter().receiveEvent(getId(), "onMrecFailedToLoad", null); 135 | } 136 | 137 | @Override 138 | public void onMrecClicked() { 139 | getEmitter().receiveEvent(getId(), "onMrecClicked", null); 140 | } 141 | 142 | @Override 143 | public void onMrecExpired() { 144 | getEmitter().receiveEvent(getId(), "onMrecExpired", null); 145 | } 146 | 147 | @Override 148 | public void onMrecShowFailed() { } 149 | 150 | @Override 151 | public void onMrecShown() { } 152 | } -------------------------------------------------------------------------------- /android/src/main/java/com/appodeal/rnappodeal/RNAppodealBannerManager.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.annotation.NonNull; 6 | import androidx.annotation.Nullable; 7 | 8 | import com.appodeal.ads.Appodeal; 9 | import com.appodeal.ads.BannerView; 10 | import com.facebook.react.common.MapBuilder; 11 | import com.facebook.react.uimanager.SimpleViewManager; 12 | import com.facebook.react.uimanager.ThemedReactContext; 13 | import com.facebook.react.uimanager.annotations.ReactProp; 14 | 15 | import java.lang.ref.WeakReference; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | import java.util.ListIterator; 19 | import java.util.Map; 20 | 21 | public class RNAppodealBannerManager extends SimpleViewManager { 22 | 23 | @NonNull 24 | private final List> instances = new ArrayList<>(); 25 | @NonNull 26 | private WeakReference apdBannerView = new WeakReference<>(null); 27 | 28 | @ReactProp(name = "adSize") 29 | public void setSize(RCTAppodealBannerView view, String size) { 30 | view.setAdSize(size); 31 | } 32 | 33 | @ReactProp(name = "placement") 34 | public void setPlacement(RCTAppodealBannerView view, String placement) { 35 | view.setPlacement(placement); 36 | } 37 | 38 | @NonNull 39 | @Override 40 | public RCTAppodealBannerView createViewInstance(@NonNull ThemedReactContext context) { 41 | RCTAppodealBannerView banner = new RCTAppodealBannerView(context); 42 | // Setup callbacks 43 | Appodeal.setBannerCallbacks(banner); 44 | // Hide previously created banners 45 | // Iterate through instances in forward direction 46 | BannerView apdBannerView = getApdBannerView(context); 47 | for (WeakReference reference : instances) { 48 | RCTAppodealBannerView previousBanner = reference.get(); 49 | if (previousBanner != null) { 50 | previousBanner.hideBannerView(apdBannerView); 51 | } 52 | } 53 | // Save instance 54 | banner.showBannerView(apdBannerView); 55 | instances.add(new WeakReference<>(banner)); 56 | return banner; 57 | } 58 | 59 | @Override 60 | public void onDropViewInstance(@NonNull RCTAppodealBannerView view) { 61 | super.onDropViewInstance(view); 62 | BannerView apdBannerView = getApdBannerView(view.getContext()); 63 | view.hideBannerView(apdBannerView); 64 | 65 | // Trying to show a previous banner 66 | // Iterate through instances in reverse direction 67 | ListIterator> iterator = instances.listIterator(instances.size()); 68 | while (iterator.hasPrevious()) { 69 | WeakReference reference = iterator.previous(); 70 | RCTAppodealBannerView previousBanner = reference.get(); 71 | if (previousBanner == null) { 72 | continue; 73 | } 74 | if (previousBanner == view) { 75 | iterator.remove(); 76 | } else if (previousBanner.getSize() == view.getSize()) { 77 | previousBanner.showBannerView(apdBannerView); 78 | break; 79 | } 80 | } 81 | } 82 | 83 | @NonNull 84 | public BannerView getApdBannerView(@NonNull Context context) { 85 | BannerView bannerView = apdBannerView.get(); 86 | if (bannerView == null) { 87 | bannerView = Appodeal.getBannerView(context.getApplicationContext()); 88 | apdBannerView = new WeakReference<>(bannerView); 89 | } 90 | return bannerView; 91 | } 92 | 93 | @Nullable 94 | @Override 95 | public Map getExportedCustomDirectEventTypeConstants() { 96 | return MapBuilder.of( 97 | "onBannerLoaded", 98 | MapBuilder.of("registrationName", "onAdLoaded"), 99 | "onBannerFailedToLoad", 100 | MapBuilder.of("registrationName", "onAdFailedToLoad"), 101 | "onBannerClicked", 102 | MapBuilder.of("registrationName", "onAdClicked"), 103 | "onBannerExpired", 104 | MapBuilder.of("registrationName", "onAdExpired") 105 | ); 106 | } 107 | 108 | @NonNull 109 | @Override 110 | public String getName() { 111 | return "RNAppodealBannerView"; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /android/src/main/java/com/appodeal/rnappodeal/RNAppodealDispatchGroup.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal; 2 | 3 | public class RNAppodealDispatchGroup { 4 | private int count = 0; 5 | private Runnable runnable; 6 | 7 | public RNAppodealDispatchGroup() { 8 | super(); 9 | count = 0; 10 | } 11 | 12 | public synchronized void enter() { 13 | count++; 14 | } 15 | 16 | public synchronized void leave() { 17 | count--; 18 | notifyGroup(); 19 | } 20 | 21 | public void notify(Runnable r) { 22 | runnable = r; 23 | } 24 | 25 | private void notifyGroup() { 26 | if (count <= 0 && runnable != null) { 27 | runnable.run(); 28 | runnable = null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /android/src/main/java/com/appodeal/rnappodeal/RNAppodealMrecManager.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal; 2 | 3 | import android.content.Context; 4 | 5 | import com.appodeal.ads.Appodeal; 6 | import com.appodeal.ads.BannerView; 7 | import com.appodeal.ads.MrecView; 8 | import com.facebook.react.common.MapBuilder; 9 | import com.facebook.react.uimanager.SimpleViewManager; 10 | import com.facebook.react.uimanager.ThemedReactContext; 11 | import com.facebook.react.uimanager.annotations.ReactProp; 12 | 13 | import java.lang.ref.WeakReference; 14 | import java.util.ArrayList; 15 | import java.util.Iterator; 16 | import java.util.List; 17 | import java.util.ListIterator; 18 | import java.util.Map; 19 | 20 | import androidx.annotation.NonNull; 21 | import androidx.annotation.Nullable; 22 | 23 | 24 | public class RNAppodealMrecManager extends SimpleViewManager { 25 | @NonNull 26 | private final List> instances = new ArrayList<>(); 27 | 28 | @NonNull 29 | private WeakReference apdMrecView = new WeakReference<>(null); 30 | 31 | @ReactProp(name = "placement") 32 | public void setPlacement(RCTAppodealMrecView view, String placement) { view.setPlacement(placement); } 33 | 34 | @NonNull 35 | @Override 36 | public RCTAppodealMrecView createViewInstance(@NonNull ThemedReactContext context) { 37 | RCTAppodealMrecView banner = new RCTAppodealMrecView(context); 38 | // Setup callbacks 39 | Appodeal.setMrecCallbacks(banner); 40 | // Hide previously created banners 41 | // Iterate through instances in forward direction 42 | MrecView apdMrecView = getApdMrecView(context); 43 | for (WeakReference reference : instances) { 44 | RCTAppodealMrecView previousBanner = reference.get(); 45 | if (previousBanner != null) { 46 | previousBanner.hideBannerView(apdMrecView); 47 | } 48 | } 49 | // Save instance 50 | banner.showBannerView(apdMrecView); 51 | instances.add(new WeakReference<>(banner)); 52 | return banner; 53 | } 54 | 55 | @Override 56 | public void onDropViewInstance(@NonNull RCTAppodealMrecView view) { 57 | super.onDropViewInstance(view); 58 | MrecView apdMrecView = getApdMrecView(view.getContext()); 59 | view.hideBannerView(apdMrecView); 60 | 61 | // Trying to show a previous banner 62 | // Iterate through instances in reverse direction 63 | ListIterator> iterator = instances.listIterator(instances.size()); 64 | while (iterator.hasPrevious()) { 65 | WeakReference reference = iterator.previous(); 66 | RCTAppodealMrecView previousBanner = reference.get(); 67 | if (previousBanner == null) { 68 | continue; 69 | } 70 | if (previousBanner == view) { 71 | iterator.remove(); 72 | } else { 73 | previousBanner.showBannerView(apdMrecView); 74 | break; 75 | } 76 | } 77 | } 78 | 79 | @NonNull 80 | public MrecView getApdMrecView(@NonNull Context context) { 81 | MrecView mrecView = apdMrecView.get(); 82 | if (mrecView == null) { 83 | mrecView = Appodeal.getMrecView(context.getApplicationContext()); 84 | apdMrecView = new WeakReference<>(mrecView); 85 | } 86 | return mrecView; 87 | } 88 | 89 | @Nullable 90 | @Override 91 | public Map getExportedCustomDirectEventTypeConstants() { 92 | return MapBuilder.of( 93 | "onMrecLoaded", 94 | MapBuilder.of("registrationName", "onAdLoaded"), 95 | "onMrecFailedToLoad", 96 | MapBuilder.of("registrationName", "onAdFailedToLoad"), 97 | "onMrecClicked", 98 | MapBuilder.of("registrationName", "onAdClicked"), 99 | "onMrecExpired", 100 | MapBuilder.of("registrationName", "onAdExpired") 101 | ); 102 | } 103 | 104 | @Override 105 | public String getName() { 106 | return "RNAppodealMrecView"; 107 | } 108 | } -------------------------------------------------------------------------------- /android/src/main/java/com/appodeal/rnappodeal/RNAppodealPackage.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.facebook.react.ReactPackage; 6 | import com.facebook.react.bridge.JavaScriptModule; 7 | import com.facebook.react.bridge.NativeModule; 8 | import com.facebook.react.bridge.ReactApplicationContext; 9 | import com.facebook.react.uimanager.ViewManager; 10 | 11 | import java.util.Arrays; 12 | import java.util.Collections; 13 | import java.util.List; 14 | 15 | 16 | public class RNAppodealPackage implements ReactPackage { 17 | @NonNull 18 | @Override 19 | public List createNativeModules(@NonNull ReactApplicationContext reactContext) { 20 | return Collections.singletonList(new RNAppodealModule(reactContext)); 21 | } 22 | 23 | // Deprecated from RN 0.47 24 | public List> createJSModules() { 25 | return Collections.emptyList(); 26 | } 27 | 28 | @NonNull 29 | @Override 30 | public List createViewManagers(@NonNull ReactApplicationContext reactContext) { 31 | return Arrays.asList(new RNAppodealBannerManager(), new RNAppodealMrecManager()); 32 | } 33 | } -------------------------------------------------------------------------------- /android/src/main/java/com/appodeal/rnappodeal/RNAppodealUtils.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal; 2 | 3 | import com.appodeal.ads.Appodeal; 4 | import com.appodeal.ads.inapp.InAppPurchase; 5 | import com.appodeal.ads.utils.Log; 6 | import com.appodeal.consent.ConsentStatus; 7 | import com.facebook.react.bridge.ReadableMap; 8 | 9 | import java.util.HashMap; 10 | import java.util.Iterator; 11 | import java.util.Map; 12 | 13 | class RNAppodealUtils { 14 | static Log.LogLevel getLogLevelFromString(String logLevel) { 15 | Log.LogLevel result = Log.LogLevel.none; 16 | if (logLevel.equals("debug")) { 17 | result = Log.LogLevel.debug; 18 | } else if (logLevel.equals("verbose")) { 19 | result = Log.LogLevel.verbose; 20 | } 21 | return result; 22 | } 23 | 24 | static int getAdTypesFormRNTypes(int types) { 25 | int result = 0; 26 | if ((types & (1 << 0)) > 0) { 27 | result |= Appodeal.INTERSTITIAL; 28 | } 29 | if ((types & (1 << 2)) > 0) { 30 | result |= Appodeal.BANNER; 31 | } 32 | if ((types & (1 << 3)) > 0) { 33 | result |= Appodeal.BANNER_BOTTOM; 34 | } 35 | if ((types & (1 << 4)) > 0) { 36 | result |= Appodeal.BANNER_TOP; 37 | } 38 | if ((types & (1 << 5)) > 0) { 39 | result |= Appodeal.REWARDED_VIDEO; 40 | } 41 | if ((types & (1 << 8)) > 0) { 42 | result |= Appodeal.MREC; 43 | } 44 | return result; 45 | } 46 | 47 | static int getRNTypesFromAdType(int types) { 48 | int result = 0; 49 | if ((types & Appodeal.INTERSTITIAL) > 0) { 50 | result |= 1; 51 | } 52 | if ((types & Appodeal.BANNER) > 0) { 53 | result |= (1 << 2); 54 | } 55 | if ((types & Appodeal.BANNER_BOTTOM) > 0) { 56 | result |= (1 << 3); 57 | } 58 | if ((types & Appodeal.BANNER_TOP) > 0) { 59 | result |= (1 << 4); 60 | } 61 | if ((types & Appodeal.REWARDED_VIDEO) > 0) { 62 | result |= (1 << 5); 63 | } 64 | if ((types & Appodeal.MREC) > 0) { 65 | result |= (1 << 8); 66 | } 67 | return result; 68 | } 69 | 70 | static int getRNAppodealConsentStatusFromStatus(ConsentStatus status) { 71 | switch (status) { 72 | case Required: 73 | return 1; 74 | case NotRequired: 75 | return 2; 76 | case Obtained: 77 | return 3; 78 | default: 79 | return 0; 80 | } 81 | } 82 | 83 | static InAppPurchase.Type getPurchaseTypeFromRNPurchaseType(int type) { 84 | if (type == 0) { 85 | return InAppPurchase.Type.InApp; 86 | } else { 87 | return InAppPurchase.Type.Subs; 88 | } 89 | } 90 | 91 | static int getRNPurchaseTypeFromType(InAppPurchase.Type type) { 92 | if (type == InAppPurchase.Type.InApp) { 93 | return 0; 94 | } 95 | return 1; 96 | } 97 | 98 | static Map getMapFromReadableMap(ReadableMap map) { 99 | Map result = new HashMap<>(); 100 | Iterator> iterator = map.getEntryIterator(); 101 | while (iterator.hasNext()) { 102 | Map.Entry entry = iterator.next(); 103 | Object value = entry.getValue(); 104 | result.put(entry.getKey(), entry.getValue().toString()); 105 | } 106 | return result; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /android/src/main/res/xml/network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /example/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore polyfills 9 | node_modules/react-native/Libraries/polyfills/.* 10 | 11 | ; These should not be required directly 12 | ; require from fbjs/lib instead: require('fbjs/lib/warning') 13 | node_modules/warning/.* 14 | 15 | ; Flow doesn't support platforms 16 | .*/Libraries/Utilities/LoadingView.js 17 | 18 | [untyped] 19 | .*/node_modules/@react-native-community/cli/.*/.* 20 | 21 | [include] 22 | 23 | [libs] 24 | node_modules/react-native/interface.js 25 | node_modules/react-native/flow/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | exact_by_default=true 31 | format.bracket_spacing=false 32 | 33 | module.file_ext=.js 34 | module.file_ext=.json 35 | module.file_ext=.ios.js 36 | 37 | munge_underscores=true 38 | 39 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 40 | module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' 41 | 42 | suppress_type=$FlowIssue 43 | suppress_type=$FlowFixMe 44 | suppress_type=$FlowFixMeProps 45 | suppress_type=$FlowFixMeState 46 | 47 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 50 | 51 | [lints] 52 | sketchy-null-number=warn 53 | sketchy-null-mixed=warn 54 | sketchy-number=warn 55 | untyped-type-import=warn 56 | nonstrict-import=warn 57 | deprecated-type=warn 58 | unsafe-getters-setters=warn 59 | inexact-spread=warn 60 | unnecessary-invariant=warn 61 | deprecated-utility=error 62 | 63 | [strict] 64 | deprecated-type 65 | nonstrict-import 66 | sketchy-null 67 | unclear-type 68 | unsafe-getters-setters 69 | untyped-import 70 | untyped-type-import 71 | 72 | [version] 73 | ^0.182.0 74 | -------------------------------------------------------------------------------- /example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | ios/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | .cxx/ 33 | 34 | # node.js 35 | # 36 | node_modules/ 37 | npm-debug.log 38 | yarn-error.log 39 | /yarn.lock 40 | 41 | # BUCK 42 | buck-out/ 43 | \.buckd/ 44 | *.keystore 45 | !debug.keystore 46 | 47 | # fastlane 48 | # 49 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 50 | # screenshots whenever they are needed. 51 | # For more information about the recommended setup visit: 52 | # https://docs.fastlane.tools/best-practices/source-control/ 53 | 54 | **/fastlane/report.xml 55 | **/fastlane/Preview.html 56 | **/fastlane/screenshots 57 | **/fastlane/test_output 58 | 59 | # Bundle artifact 60 | *.jsbundle 61 | 62 | # CocoaPods 63 | /ios/Pods/ 64 | /ios/Podfile.lock 65 | -------------------------------------------------------------------------------- /example/.node-version: -------------------------------------------------------------------------------- 1 | 16 -------------------------------------------------------------------------------- /example/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /example/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.5 -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.example", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.example", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.google.gms.google-services' 3 | 4 | import com.android.build.OutputFile 5 | 6 | /** 7 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 8 | * and bundleReleaseJsAndAssets). 9 | * These basically call `react-native bundle` with the correct arguments during the Android build 10 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 11 | * bundle directly from the development server. Below you can see all the possible configurations 12 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 13 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 14 | * 15 | * project.ext.react = [ 16 | * // the name of the generated asset file containing your JS bundle 17 | * bundleAssetName: "index.android.bundle", 18 | * 19 | * // the entry file for bundle generation. If none specified and 20 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 21 | * // default. Can be overridden with ENTRY_FILE environment variable. 22 | * entryFile: "index.android.js", 23 | * 24 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 25 | * bundleCommand: "ram-bundle", 26 | * 27 | * // whether to bundle JS and assets in debug mode 28 | * bundleInDebug: false, 29 | * 30 | * // whether to bundle JS and assets in release mode 31 | * bundleInRelease: true, 32 | * 33 | * // whether to bundle JS and assets in another build variant (if configured). 34 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 35 | * // The configuration property can be in the following formats 36 | * // 'bundleIn${productFlavor}${buildType}' 37 | * // 'bundleIn${buildType}' 38 | * // bundleInFreeDebug: true, 39 | * // bundleInPaidRelease: true, 40 | * // bundleInBeta: true, 41 | * 42 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 43 | * // for example: to disable dev mode in the staging build type (if configured) 44 | * devDisabledInStaging: true, 45 | * // The configuration property can be in the following formats 46 | * // 'devDisabledIn${productFlavor}${buildType}' 47 | * // 'devDisabledIn${buildType}' 48 | * 49 | * // the root of your project, i.e. where "package.json" lives 50 | * root: "../../", 51 | * 52 | * // where to put the JS bundle asset in debug mode 53 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 54 | * 55 | * // where to put the JS bundle asset in release mode 56 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 57 | * 58 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 59 | * // require('./image.png')), in debug mode 60 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 61 | * 62 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 63 | * // require('./image.png')), in release mode 64 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 65 | * 66 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 67 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 68 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 69 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 70 | * // for example, you might want to remove it from here. 71 | * inputExcludes: ["android/**", "ios/**"], 72 | * 73 | * // override which node gets called and with what additional arguments 74 | * nodeExecutableAndArgs: ["node"], 75 | * 76 | * // supply additional arguments to the packager 77 | * extraPackagerArgs: [] 78 | * ] 79 | */ 80 | 81 | project.ext.react = [ 82 | enableHermes: false, // clean and rebuild if changing 83 | ] 84 | 85 | apply from: "../../node_modules/react-native/react.gradle" 86 | 87 | /** 88 | * Set this to true to create two separate APKs instead of one: 89 | * - An APK that only works on ARM devices 90 | * - An APK that only works on x86 devices 91 | * The advantage is the size of the APK is reduced by about 4MB. 92 | * Upload all the APKs to the Play Store and people will download 93 | * the correct one based on the CPU architecture of their device. 94 | */ 95 | def enableSeparateBuildPerCPUArchitecture = false 96 | 97 | /** 98 | * Run Proguard to shrink the Java bytecode in release builds. 99 | */ 100 | def enableProguardInReleaseBuilds = false 101 | 102 | /** 103 | * The preferred build flavor of JavaScriptCore. 104 | * 105 | * For example, to use the international variant, you can use: 106 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 107 | * 108 | * The international variant includes ICU i18n library and necessary data 109 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 110 | * give correct results when using with locales other than en-US. Note that 111 | * this variant is about 6MiB larger per architecture than default. 112 | */ 113 | def jscFlavor = 'org.webkit:android-jsc:+' 114 | 115 | /** 116 | * Whether to enable the Hermes VM. 117 | * 118 | * This should be set on project.ext.react and mirrored here. If it is not set 119 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 120 | * and the benefits of using Hermes will therefore be sharply reduced. 121 | */ 122 | def enableHermes = project.ext.react.get("enableHermes", false); 123 | 124 | android { 125 | ndkVersion rootProject.ext.ndkVersion 126 | compileSdkVersion rootProject.ext.compileSdkVersion 127 | 128 | namespace 'com.appodeal.rnappodeal.example' 129 | defaultConfig { 130 | applicationId "com.appodealstack.demo" 131 | minSdkVersion rootProject.ext.minSdkVersion 132 | targetSdkVersion rootProject.ext.targetSdkVersion 133 | versionCode 1 134 | versionName "1.0" 135 | } 136 | 137 | compileOptions { 138 | sourceCompatibility JavaVersion.VERSION_1_8 139 | targetCompatibility JavaVersion.VERSION_1_8 140 | } 141 | 142 | splits { 143 | abi { 144 | reset() 145 | enable enableSeparateBuildPerCPUArchitecture 146 | universalApk false // If true, also generate a universal APK 147 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 148 | } 149 | } 150 | signingConfigs { 151 | debug { 152 | storeFile file('debug.keystore') 153 | storePassword 'android' 154 | keyAlias 'androiddebugkey' 155 | keyPassword 'android' 156 | } 157 | } 158 | buildTypes { 159 | debug { 160 | signingConfig signingConfigs.debug 161 | } 162 | release { 163 | // Caution! In production, you need to generate your own keystore file. 164 | // see https://reactnative.dev/docs/signed-apk-android. 165 | signingConfig signingConfigs.debug 166 | minifyEnabled enableProguardInReleaseBuilds 167 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 168 | } 169 | } 170 | 171 | // applicationVariants are e.g. debug, release 172 | applicationVariants.configureEach { variant -> 173 | variant.outputs.each { output -> 174 | // For each separate APK per architecture, set a unique version code as described here: 175 | // https://developer.android.com/studio/build/configure-apk-splits.html 176 | // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. 177 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 178 | def abi = output.getFilter(OutputFile.ABI) 179 | if (abi != null) { // null for the universal-debug, universal-release variants 180 | output.versionCodeOverride = 181 | defaultConfig.versionCode * 1000 + versionCodes.get(abi) 182 | } 183 | } 184 | } 185 | } 186 | 187 | dependencies { 188 | // Appodeal 3.5.0 189 | implementation 'com.appodeal.ads:sdk:3.5.0.0' 190 | 191 | //noinspection GradleDynamicVersion 192 | implementation "com.facebook.react:react-native:+" // From node_modules 193 | 194 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 195 | exclude group: 'com.facebook.fbjni' 196 | } 197 | 198 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 199 | exclude group: 'com.facebook.flipper' 200 | exclude group: 'com.squareup.okhttp3', module: 'okhttp' 201 | } 202 | 203 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 204 | exclude group: 'com.facebook.flipper' 205 | } 206 | 207 | if (enableHermes) { 208 | //noinspection GradleDynamicVersion 209 | implementation("com.facebook.react:hermes-engine:+") { // From node_modules 210 | exclude group: 'com.facebook.fbjni' 211 | } 212 | } else { 213 | implementation jscFlavor 214 | } 215 | } 216 | 217 | // Run this once to be able to run the application with BUCK 218 | // puts all compile dependencies into folder libs for BUCK to use 219 | tasks.register('copyDownloadableDepsToLibs', Copy) { 220 | from configurations.implementation 221 | into 'libs' 222 | } 223 | 224 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 225 | apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") -------------------------------------------------------------------------------- /example/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/debug.keystore -------------------------------------------------------------------------------- /example/android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "785362040133", 4 | "firebase_url": "https://appodeal-sandbox.firebaseio.com", 5 | "project_id": "appodeal-sandbox", 6 | "storage_bucket": "appodeal-sandbox.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:785362040133:android:77aa069cb9b77f91c57a2c", 12 | "android_client_info": { 13 | "package_name": "com.appodealstack.demo" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "785362040133-9odke8a112ah3a9d2dbl9gd2lrpm809c.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyBwlWE5mcH3RTbABRPp7_bSio1vzsQmjqY" 25 | } 26 | ], 27 | "services": { 28 | "appinvite_service": { 29 | "other_platform_oauth_client": [ 30 | { 31 | "client_id": "785362040133-9odke8a112ah3a9d2dbl9gd2lrpm809c.apps.googleusercontent.com", 32 | "client_type": 3 33 | } 34 | ] 35 | } 36 | } 37 | } 38 | ], 39 | "configuration_version": "1" 40 | } -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /example/android/app/src/debug/java/com/example/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.example; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | 32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 33 | client.addPlugin(new ReactFlipperPlugin()); 34 | client.addPlugin(new DatabasesFlipperPlugin(context)); 35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 36 | client.addPlugin(CrashReporterPlugin.getInstance()); 37 | 38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 39 | NetworkingModule.setCustomClientBuilder( 40 | new NetworkingModule.CustomClientBuilder() { 41 | @Override 42 | public void apply(OkHttpClient.Builder builder) { 43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 44 | } 45 | }); 46 | client.addPlugin(networkFlipperPlugin); 47 | client.start(); 48 | 49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 50 | // Hence we run if after all native modules have been initialized 51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 52 | if (reactContext == null) { 53 | reactInstanceManager.addReactInstanceEventListener( 54 | new ReactInstanceManager.ReactInstanceEventListener() { 55 | @Override 56 | public void onReactContextInitialized(ReactContext reactContext) { 57 | reactInstanceManager.removeReactInstanceEventListener(this); 58 | reactContext.runOnNativeModulesQueueThread( 59 | new Runnable() { 60 | @Override 61 | public void run() { 62 | client.addPlugin(new FrescoFlipperPlugin()); 63 | } 64 | }); 65 | } 66 | }); 67 | } else { 68 | client.addPlugin(new FrescoFlipperPlugin()); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 12 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/appodeal/rnappodeal/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal.example; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "Example"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/appodeal/rnappodeal/example/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.appodeal.rnappodeal.example; 2 | 3 | import android.app.Application; 4 | import android.content.BroadcastReceiver; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.content.IntentFilter; 8 | import android.os.Build; 9 | 10 | import androidx.annotation.Nullable; 11 | 12 | import com.facebook.react.PackageList; 13 | import com.facebook.react.ReactApplication; 14 | import com.facebook.react.ReactInstanceManager; 15 | import com.facebook.react.ReactNativeHost; 16 | import com.facebook.react.ReactPackage; 17 | import com.facebook.soloader.SoLoader; 18 | 19 | import java.lang.reflect.InvocationTargetException; 20 | import java.util.List; 21 | 22 | public class MainApplication extends Application implements ReactApplication { 23 | 24 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 25 | @Override 26 | public boolean getUseDeveloperSupport() { 27 | return BuildConfig.DEBUG; 28 | } 29 | 30 | @Override 31 | protected List getPackages() { 32 | @SuppressWarnings("UnnecessaryLocalVariable") 33 | List packages = new PackageList(this).getPackages(); 34 | // Packages that cannot be autolinked yet can be added manually here, for example: 35 | // packages.add(new MyReactNativePackage()); 36 | return packages; 37 | } 38 | 39 | @Override 40 | protected String getJSMainModuleName() { 41 | return "index"; 42 | } 43 | }; 44 | 45 | @Override 46 | public ReactNativeHost getReactNativeHost() { 47 | return mReactNativeHost; 48 | } 49 | 50 | @Override 51 | public void onCreate() { 52 | super.onCreate(); 53 | SoLoader.init(this, /* native exopackage */ false); 54 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 55 | } 56 | 57 | @Override 58 | public Intent registerReceiver(@Nullable BroadcastReceiver receiver, IntentFilter filter) { 59 | if (Build.VERSION.SDK_INT >= 34 && getApplicationInfo().targetSdkVersion >= 34) { 60 | return super.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED); 61 | } else { 62 | return super.registerReceiver(receiver, filter); 63 | } 64 | } 65 | 66 | /** 67 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 68 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 69 | * 70 | * @param context 71 | * @param reactInstanceManager 72 | */ 73 | private static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 74 | if (BuildConfig.DEBUG) { 75 | /* 76 | We use reflection here to pick up the class that initializes Flipper, 77 | since Flipper library is not available in release mode 78 | */ 79 | try { 80 | Class aClass = Class.forName("com.example.ReactNativeFlipper"); 81 | aClass.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 82 | .invoke(null, context, reactInstanceManager); 83 | } catch (ClassNotFoundException e) { 84 | e.printStackTrace(); 85 | } catch (NoSuchMethodException e) { 86 | e.printStackTrace(); 87 | } catch (IllegalAccessException e) { 88 | e.printStackTrace(); 89 | } catch (InvocationTargetException e) { 90 | e.printStackTrace(); 91 | } 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Example 3 | your_facebook_app_id 4 | your_facebook_login_protocol_scheme 5 | your_facebook_client_token 6 | 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | def REACT_NATIVE_VERSION = new File(['node', '--print', "JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) 4 | 5 | buildscript { 6 | ext { 7 | minSdkVersion = 21 8 | compileSdkVersion = 34 9 | targetSdkVersion = 34 10 | ndkVersion = "21.4.7075529" 11 | } 12 | repositories { 13 | google() 14 | mavenCentral() 15 | } 16 | dependencies { 17 | classpath('com.google.gms:google-services:4.4.2') 18 | classpath('com.android.tools.build:gradle:7.4.2') 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | google() 25 | mavenCentral() 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | maven { url("$rootDir/../node_modules/react-native/android") } 28 | // Android JSC is installed from npm 29 | maven { url("$rootDir/../node_modules/jsc-android/dist") } 30 | maven { url 'https://www.jitpack.io' } 31 | // Appodeal SDK 32 | maven { url "https://artifactory.appodeal.com/appodeal" } 33 | } 34 | 35 | configurations.configureEach { 36 | resolutionStrategy { 37 | // Remove this override in 0.65+, as a proper fix is included in react-native itself. 38 | force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=false 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.125.0 29 | 30 | org.gradle.jvmargs=-Xmx4096m 31 | android.defaults.buildfeatures.buildconfig=true 32 | android.nonTransitiveRClass=false 33 | android.nonFinalResIds=false 34 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appodeal/react-native-appodeal/dfb9f79d8c75d205e042e453865dea47a8ae7c78/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip 6 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Example' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") 3 | applyNativeModulesSettingsGradle(settings) 4 | include ':app' -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "displayName": "Example" 4 | } -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /example/index.ts: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import { App } from './src/App'; 3 | import { name as appName } from './app.json'; 4 | 5 | 6 | AppRegistry.registerComponent(appName, () => App); 7 | -------------------------------------------------------------------------------- /example/ios/Dummy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Dummy.swift 3 | // Example 4 | // 5 | // Created by Stas Kochkin on 12.11.2020. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /example/ios/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /example/ios/Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #if DEBUG && __has_include() 8 | #define FLIPPER 1 9 | #endif 10 | 11 | #if FLIPPER 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | 19 | static void InitializeFlipper(UIApplication *application) { 20 | FlipperClient *client = [FlipperClient sharedClient]; 21 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 22 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 23 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 24 | [client addPlugin:[FlipperKitReactPlugin new]]; 25 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 26 | [client start]; 27 | } 28 | #endif 29 | 30 | @implementation AppDelegate 31 | 32 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 33 | { 34 | #if FLIPPER 35 | InitializeFlipper(application); 36 | #endif 37 | 38 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 39 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 40 | moduleName:@"Example" 41 | initialProperties:nil]; 42 | 43 | 44 | if (@available(iOS 13.0, *)) { 45 | rootView.backgroundColor = [UIColor systemBackgroundColor]; 46 | } else { 47 | rootView.backgroundColor = [UIColor whiteColor]; 48 | } 49 | 50 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 51 | UIViewController *rootViewController = [UIViewController new]; 52 | rootViewController.view = rootView; 53 | self.window.rootViewController = rootViewController; 54 | [self.window makeKeyAndVisible]; 55 | return YES; 56 | } 57 | 58 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 59 | { 60 | #if DEBUG 61 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 62 | #else 63 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 64 | #endif 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /example/ios/Example/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/ios/Example/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Example/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/ios/ExampleTests/ExampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface ExampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation ExampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 38 | if (level >= RCTLogLevelError) { 39 | redboxError = message; 40 | } 41 | }); 42 | #endif 43 | 44 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 45 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 46 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | 48 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 49 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 50 | return YES; 51 | } 52 | return NO; 53 | }]; 54 | } 55 | 56 | #ifdef DEBUG 57 | RCTSetLogFunction(RCTDefaultLogFunction); 58 | #endif 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /example/ios/ExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CLIENT_ID 6 | 785362040133-g1habjruddvsvjde8es9elli7dauhe86.apps.googleusercontent.com 7 | REVERSED_CLIENT_ID 8 | com.googleusercontent.apps.785362040133-g1habjruddvsvjde8es9elli7dauhe86 9 | API_KEY 10 | AIzaSyCsx-RMQOpt6VwzEe7dYBmJy_IGB2j6EwA 11 | GCM_SENDER_ID 12 | 785362040133 13 | PLIST_VERSION 14 | 1 15 | BUNDLE_ID 16 | com.appodeal.sandbox 17 | PROJECT_ID 18 | appodeal-sandbox 19 | STORAGE_BUCKET 20 | appodeal-sandbox.appspot.com 21 | IS_ADS_ENABLED 22 | 23 | IS_ANALYTICS_ENABLED 24 | 25 | IS_APPINVITE_ENABLED 26 | 27 | IS_GCM_ENABLED 28 | 29 | IS_SIGNIN_ENABLED 30 | 31 | GOOGLE_APP_ID 32 | 1:785362040133:ios:ce09daf0828746cf 33 | DATABASE_URL 34 | https://appodeal-sandbox.firebaseio.com 35 | 36 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '13.0' 5 | install! 'cocoapods', :deterministic_uuids => false 6 | 7 | source 'https://cdn.cocoapods.org' 8 | source 'https://github.com/appodeal/CocoaPods.git' 9 | source 'https://github.com/bidon-io/CocoaPods_Specs.git' 10 | 11 | def appodeal 12 | pod 'Appodeal', '3.5.0' 13 | pod 'APDAdjustAdapter', '3.5.0.0' 14 | pod 'APDAmazonAdapter', '3.5.0.0' 15 | pod 'APDAppLovinAdapter', '3.5.0.0' 16 | pod 'APDAppLovinMAXAdapter', '3.5.0.0' 17 | pod 'APDAppsFlyerAdapter', '3.5.0.0' 18 | pod 'APDBidMachineAdapter', '3.5.0.0' 19 | pod 'APDBidonAdapter', '3.5.0.0' 20 | pod 'APDBigoAdsAdapter', '3.5.0.0' 21 | pod 'APDDTExchangeAdapter', '3.5.0.0' 22 | pod 'APDFacebookAdapter', '3.5.0.0' 23 | pod 'APDFirebaseAdapter', '3.5.0.0' 24 | pod 'APDGoogleAdMobAdapter', '3.5.0.0' 25 | pod 'APDIABAdapter', '3.5.0.0' 26 | pod 'APDInMobiAdapter', '3.5.0.0' 27 | pod 'APDIronSourceAdapter', '3.5.0.0' 28 | pod 'APDLevelPlayAdapter', '3.5.0.0' 29 | pod 'APDMetaAudienceNetworkAdapter', '3.5.0.0' 30 | pod 'APDMintegralAdapter', '3.5.0.0' 31 | pod 'APDMyTargetAdapter', '3.5.0.0' 32 | pod 'APDPangleAdapter', '3.5.0.0' 33 | pod 'APDSentryAdapter', '3.5.0.0' 34 | pod 'APDSmaatoAdapter', '3.5.0.0' 35 | pod 'APDUnityAdapter', '3.5.0.0' 36 | pod 'APDVungleAdapter', '3.5.0.0' 37 | pod 'APDYandexAdapter', '3.5.0.0' 38 | pod 'AppLovinMediationAmazonAdMarketplaceAdapter', '5.0.1.0' 39 | pod 'AppLovinMediationBidMachineAdapter', '3.2.0.0.0' 40 | pod 'AppLovinMediationBigoAdsAdapter', '4.6.0.0' 41 | pod 'AppLovinMediationByteDanceAdapter', '6.4.1.2.0' 42 | pod 'AppLovinMediationChartboostAdapter', '9.8.0.0' 43 | pod 'AppLovinMediationFacebookAdapter', '6.16.0.0' 44 | pod 'AppLovinMediationFyberAdapter', '8.3.5.0' 45 | pod 'AppLovinMediationGoogleAdManagerAdapter', '11.13.0.0' 46 | pod 'AppLovinMediationGoogleAdapter', '11.13.0.0' 47 | pod 'AppLovinMediationInMobiAdapter', '10.8.0.0' 48 | pod 'AppLovinMediationIronSourceAdapter', '8.7.0.0.0' 49 | pod 'AppLovinMediationMintegralAdapter', '7.7.6.0.0' 50 | pod 'AppLovinMediationMobileFuseAdapter', '1.8.2.0' 51 | pod 'AppLovinMediationMolocoAdapter', '3.6.0.0' 52 | pod 'AppLovinMediationMyTargetAdapter', '5.25.1.0' 53 | pod 'AppLovinMediationOguryPresageAdapter', '5.0.2.0' 54 | pod 'AppLovinMediationSmaatoAdapter', '22.9.2.0' 55 | pod 'AppLovinMediationUnityAdsAdapter', '4.13.1.0' 56 | pod 'AppLovinMediationVerveAdapter', '3.1.4.0' 57 | pod 'AppLovinMediationVungleAdapter', '7.4.4.0' 58 | pod 'AppLovinMediationYandexAdapter', '5.2.1.0' 59 | pod 'BidMachineAmazonAdapter', '3.2.0.0' 60 | pod 'BidMachineMetaAudienceAdapter', '3.2.0.0' 61 | pod 'BidMachineMintegralAdapter', '3.2.0.0' 62 | pod 'BidMachineMyTargetAdapter', '3.2.0.0' 63 | pod 'BidMachinePangleAdapter', '3.2.0.0' 64 | pod 'BidMachineVungleAdapter', '3.2.0.0' 65 | pod 'BidonAdapterAmazon', '0.7.12.0' 66 | pod 'BidonAdapterAppLovin', '0.7.12.0' 67 | pod 'BidonAdapterBidMachine', '0.7.12.0' 68 | pod 'BidonAdapterBigoAds', '0.7.12.0' 69 | pod 'BidonAdapterChartboost', '0.7.12.0' 70 | pod 'BidonAdapterDTExchange', '0.7.12.0' 71 | pod 'BidonAdapterInMobi', '0.7.12.0' 72 | pod 'BidonAdapterIronSource', '0.7.12.0' 73 | pod 'BidonAdapterMetaAudienceNetwork', '0.7.12.0' 74 | pod 'BidonAdapterMintegral', '0.7.12.0' 75 | pod 'BidonAdapterMobileFuse', '0.7.12.0' 76 | pod 'BidonAdapterMyTarget', '0.7.12.0' 77 | pod 'BidonAdapterUnityAds', '0.7.12.0' 78 | pod 'BidonAdapterVungle', '0.7.12.0' 79 | pod 'BidonAdapterYandex', '0.7.12.0' 80 | pod 'IronSourceAPSAdapter', '4.3.18.0' 81 | pod 'IronSourceAdMobAdapter', '4.3.60.0' 82 | pod 'IronSourceAppLovinAdapter', '4.3.52.0' 83 | pod 'IronSourceBidMachineAdapter', '4.3.14.0' 84 | pod 'IronSourceBigoAdapter', '4.3.4.0' 85 | pod 'IronSourceFacebookAdapter', '4.3.47.0' 86 | pod 'IronSourceFyberAdapter', '4.3.41.0' 87 | pod 'IronSourceInMobiAdapter', '4.3.26.0' 88 | pod 'IronSourceMintegralAdapter', '4.3.32.0' 89 | pod 'IronSourceMobileFuseAdapter', '4.3.5.0' 90 | pod 'IronSourceMolocoAdapter', '4.3.10.0' 91 | pod 'IronSourceMyTargetAdapter', '4.1.27.0' 92 | pod 'IronSourceOguryAdapter', '4.3.3.0' 93 | pod 'IronSourcePangleAdapter', '4.3.39.0' 94 | pod 'IronSourceSmaatoAdapter', '4.3.16.0' 95 | pod 'IronSourceUnityAdsAdapter', '4.3.47.0' 96 | pod 'IronSourceVerveAdapter', '4.3.4.0' 97 | pod 'IronSourceVungleAdapter', '4.3.42.0' 98 | end 99 | 100 | target "Example" do 101 | config = use_native_modules! 102 | 103 | use_react_native!( 104 | :path => config[:reactNativePath], 105 | :hermes_enabled => false, 106 | :fabric_enabled => false, 107 | :app_path => "#{Pod::Config.instance.installation_root}/..", 108 | ) 109 | 110 | appodeal 111 | 112 | target "ExampleTests" do 113 | inherit! :complete 114 | end 115 | 116 | use_frameworks! :linkage => :static 117 | end 118 | 119 | def __apply_Xcode_15_post_install_workaround(installer) 120 | xcode_version_output = `xcodebuild -version` 121 | xcode_version_match = xcode_version_output.match(/Xcode (\d+(\.\d+)?)/) 122 | 123 | if xcode_version_match 124 | xcode_version = Gem::Version.new(xcode_version_match[1]) 125 | if xcode_version >= Gem::Version.new('15.0') 126 | installer.pods_project.targets.each do |target| 127 | target.build_configurations.each do |config| 128 | config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION'] 129 | 130 | # Xcode 15 patch 131 | xcconfig_path = config.base_configuration_reference.real_path 132 | xcconfig = File.read(xcconfig_path) 133 | xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR") 134 | end 135 | end 136 | end 137 | end 138 | end 139 | 140 | post_install do |installer| 141 | # Apply react-native patches 142 | react_native_post_install( 143 | installer, 144 | :mac_catalyst_enabled => false, 145 | ) 146 | # Switch deployment targets to 13.0 147 | installer.pods_project.targets.each do |target| 148 | target.build_configurations.each do |config| 149 | config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "13.0" 150 | end 151 | end 152 | # Apply XCode 12.5 M1 patch 153 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 154 | # Apply Xcode 15 patch 155 | __apply_Xcode_15_post_install_workaround(installer) 156 | end 157 | -------------------------------------------------------------------------------- /example/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 4 | }; -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest", 10 | "lint": "eslint . --ext .js,.jsx,.ts,.tsx" 11 | }, 12 | "dependencies": { 13 | "@react-native-segmented-control/segmented-control": "^2.5.4", 14 | "@react-navigation/native": "^6.1.18", 15 | "@react-navigation/native-stack": "^6.11.0", 16 | "react": "18.1.0", 17 | "react-native": "0.70.10", 18 | "react-native-appodeal": "../", 19 | "react-native-safe-area-context": "^4.11.0", 20 | "react-native-screens": "3.25.0", 21 | "react-native-vector-icons": "^10.2.0" 22 | }, 23 | "devDependencies": { 24 | "@babel/core": "^7.12.9", 25 | "@babel/runtime": "^7.12.5", 26 | "@react-native-community/eslint-config": "^2.0.0", 27 | "@tsconfig/react-native": "^2.0.2", 28 | "@types/jest": "^26.0.23", 29 | "@types/react": "^18.0.21", 30 | "@types/react-native": "^0.70.6", 31 | "@types/react-test-renderer": "^18.0.0", 32 | "@typescript-eslint/eslint-plugin": "^5.37.0", 33 | "@typescript-eslint/parser": "^5.37.0", 34 | "babel-jest": "^26.6.3", 35 | "eslint": "^7.32.0", 36 | "jest": "^26.6.3", 37 | "metro-react-native-babel-preset": "0.72.3", 38 | "react-test-renderer": "18.1.0", 39 | "typescript": "^5.5.4" 40 | }, 41 | "jest": { 42 | "preset": "react-native", 43 | "moduleFileExtensions": [ 44 | "ts", 45 | "tsx", 46 | "js", 47 | "jsx", 48 | "json", 49 | "node" 50 | ] 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-bitwise */ 2 | import React from 'react'; 3 | import {NavigationContainer} from '@react-navigation/native'; 4 | import {createNativeStackNavigator} from '@react-navigation/native-stack'; 5 | import {StatusBar} from 'react-native'; 6 | import {HomeScreen} from './screens/HomeScreen'; 7 | import {AdvancedFeaturesScreen} from './screens/AdvancedFeaturesScreen'; 8 | import {Appodeal} from 'react-native-appodeal'; 9 | 10 | const Stack = createNativeStackNavigator(); 11 | 12 | export const App = () => { 13 | return ( 14 | 15 | 16 | 17 | 22 | 27 | 28 | 29 | ); 30 | }; 31 | -------------------------------------------------------------------------------- /example/src/advertising/BannerView.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {BannerShowStyle, isViewBannerStyle} from '.'; 3 | import {AppodealBanner, AppodealMrec} from 'react-native-appodeal'; 4 | import {styles} from '../styles'; 5 | 6 | interface BannerViewProps { 7 | visible: boolean; 8 | showStyle: BannerShowStyle; 9 | } 10 | 11 | interface MrecViewProps { 12 | visible: boolean; 13 | } 14 | 15 | export const BannerView = (props: BannerViewProps) => { 16 | return isViewBannerStyle(props.showStyle) && props.visible ? ( 17 | console.log('Banner view did load')} 21 | onAdExpired={() => console.log('Banner view expired')} 22 | onAdClicked={() => console.log('Banner view is clicked')} 23 | onAdFailedToLoad={() => console.log('Banner view is failed to load')} 24 | usesSmartSizing 25 | /> 26 | ) : null; 27 | }; 28 | 29 | export const MrecView = (props: MrecViewProps) => { 30 | return props.visible ? ( 31 | console.log('MREC view did load')} 34 | onAdExpired={() => console.log('MREC view expired')} 35 | onAdClicked={() => console.log('MREC view is clicked')} 36 | onAdFailedToLoad={() => console.log('MREC view is failed to load')} 37 | /> 38 | ) : null; 39 | }; 40 | -------------------------------------------------------------------------------- /example/src/advertising/constants.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-bitwise */ 2 | import {Platform} from 'react-native'; 3 | import { 4 | AppodealAdType, 5 | AppodealGender, 6 | AppodealLogLevel, 7 | } from 'react-native-appodeal'; 8 | 9 | interface User { 10 | age: number; 11 | gender: AppodealGender; 12 | id: string; 13 | } 14 | 15 | interface Constants { 16 | appKey: string; 17 | adTypes: number; 18 | logLevel: AppodealLogLevel; 19 | user: User; 20 | } 21 | 22 | export const constants: Constants = { 23 | appKey: 24 | Platform.OS === 'ios' 25 | ? 'dee74c5129f53fc629a44a690a02296694e3eef99f2d3a5f' 26 | : 'd908f77a97ae0993514bc8edba7e776a36593c77e5f44994', 27 | adTypes: 28 | AppodealAdType.INTERSTITIAL | 29 | AppodealAdType.REWARDED_VIDEO | 30 | AppodealAdType.BANNER | 31 | AppodealAdType.MREC, 32 | logLevel: __DEV__ ? AppodealLogLevel.VERBOSE : AppodealLogLevel.NONE, 33 | user: { 34 | age: 23, 35 | gender: AppodealGender.MALE, 36 | id: 'some attribution id', 37 | }, 38 | }; 39 | -------------------------------------------------------------------------------- /example/src/advertising/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-bitwise */ 2 | import { 3 | Appodeal, 4 | AppodealAdType, 5 | AppodealInterstitialEvent, 6 | AppodealRewardedEvent, 7 | AppodealBannerEvent, 8 | AppodealSdkEvent, 9 | AppodealAdRevenue, 10 | } from 'react-native-appodeal'; 11 | import {constants} from './constants'; 12 | 13 | export enum SDKState { 14 | PENDING = 0, 15 | INITIALIZING = 1, 16 | INITIALIZED = 2, 17 | } 18 | 19 | export const initialize = (testing: boolean) => { 20 | Appodeal.setLogLevel(constants.logLevel); 21 | // Setup callbacks 22 | registerListeners(); 23 | 24 | // Set user settings 25 | Appodeal.setUserId(constants.user.id); 26 | Appodeal.setCustomStateValue(constants.user.age, 'appodeal_user_age'); 27 | Appodeal.setCustomStateValue(constants.user.gender, 'appodeal_user_gender'); 28 | 29 | // Set extras 30 | Appodeal.setExtrasValue('app_specific_value', 'app_specific_key'); 31 | 32 | // Global settings 33 | // Appodeal.setSharedAdsInstanceAcrossActivities(true); 34 | Appodeal.setTriggerPrecacheCallbacks(constants.adTypes, false); 35 | Appodeal.setLogLevel(constants.logLevel); 36 | Appodeal.setTesting(testing); 37 | Appodeal.setTabletBanners(false); 38 | 39 | // Disable network 40 | Appodeal.disableNetwork( 41 | 'some_network_id', 42 | AppodealAdType.BANNER | AppodealAdType.INTERSTITIAL, 43 | ); 44 | 45 | // Initialize 46 | Appodeal.initialize(constants.appKey, constants.adTypes); 47 | }; 48 | 49 | export const isInitialized = () => { 50 | return Appodeal.isInitialized(constants.adTypes); 51 | }; 52 | 53 | export enum BannerShowStyle { 54 | BOTTOM = 'Bottom', 55 | TOP = 'Top', 56 | VIEW = 'View', 57 | } 58 | 59 | export const isViewBannerStyle = (style: BannerShowStyle) => 60 | style === BannerShowStyle.VIEW; 61 | 62 | export const bannerAdType = (style: BannerShowStyle) => { 63 | switch (style) { 64 | case BannerShowStyle.BOTTOM: 65 | return AppodealAdType.BANNER_BOTTOM; 66 | case BannerShowStyle.TOP: 67 | return AppodealAdType.BANNER_TOP; 68 | default: 69 | return AppodealAdType.BANNER; 70 | } 71 | }; 72 | 73 | let levelsPlayed = 0; 74 | 75 | const registerListeners = () => { 76 | // SDK callbacks 77 | Appodeal.addEventListener(AppodealSdkEvent.INITIALIZED, () => 78 | console.log('Appodeal SDK initialized'), 79 | ); 80 | Appodeal.addEventListener( 81 | AppodealSdkEvent.AD_REVENUE, 82 | (revenue: AppodealAdRevenue) => { 83 | console.log('Appodeal SDK did receive ad revenue: ', revenue); 84 | }, 85 | ); 86 | // Interstitial callbacks 87 | Appodeal.addEventListener(AppodealInterstitialEvent.LOADED, (event: any) => 88 | console.log('Interstitial loaded. Precache: ', event.isPrecache), 89 | ); 90 | Appodeal.addEventListener(AppodealInterstitialEvent.SHOWN, () => { 91 | console.log('Interstitial shown'); 92 | levelsPlayed += 1; 93 | Appodeal.setCustomStateValue(levelsPlayed, 'levels_played'); 94 | Appodeal.setCustomStateValue('gold', 'player_rank'); 95 | }); 96 | Appodeal.addEventListener(AppodealInterstitialEvent.EXPIRED, () => 97 | console.log('Interstitial expired'), 98 | ); 99 | Appodeal.addEventListener(AppodealInterstitialEvent.CLICKED, () => 100 | console.log('Interstitial clicked'), 101 | ); 102 | Appodeal.addEventListener(AppodealInterstitialEvent.CLOSED, () => 103 | console.log('Interstitial closed'), 104 | ); 105 | Appodeal.addEventListener(AppodealInterstitialEvent.FAILED_TO_LOAD, () => 106 | console.log('Interstitial failed to load'), 107 | ); 108 | Appodeal.addEventListener(AppodealInterstitialEvent.FAILED_TO_SHOW, () => 109 | console.log('Interstitial failed to show'), 110 | ); 111 | // Banner callbacks 112 | Appodeal.addEventListener(AppodealBannerEvent.LOADED, (event: any) => 113 | console.log( 114 | 'Banner loaded. Height: ', 115 | event.height + ', precache: ' + event.isPrecache, 116 | ), 117 | ); 118 | Appodeal.addEventListener(AppodealBannerEvent.SHOWN, () => 119 | console.log('Banner shown'), 120 | ); 121 | Appodeal.addEventListener(AppodealBannerEvent.EXPIRED, () => 122 | console.log('Banner expired'), 123 | ); 124 | Appodeal.addEventListener(AppodealBannerEvent.CLICKED, () => 125 | console.log('Banner clicked'), 126 | ); 127 | Appodeal.addEventListener(AppodealBannerEvent.FAILED_TO_LOAD, () => 128 | console.log('Banner failed to load'), 129 | ); 130 | 131 | // Rewarded video callbacks 132 | Appodeal.addEventListener(AppodealRewardedEvent.LOADED, (event: any) => 133 | console.log('Rewarded video loaded. Precache: ', event.isPrecache), 134 | ); 135 | Appodeal.addEventListener(AppodealRewardedEvent.SHOWN, () => 136 | console.log('Rewarded video shown'), 137 | ); 138 | Appodeal.addEventListener(AppodealRewardedEvent.EXPIRED, () => 139 | console.log('Rewarded video expired'), 140 | ); 141 | Appodeal.addEventListener(AppodealRewardedEvent.REWARD, (event: any) => 142 | console.log( 143 | 'Rewarded video finished. Amount: ', 144 | event.amount + ', currency: ' + event.currency, 145 | ), 146 | ); 147 | Appodeal.addEventListener(AppodealRewardedEvent.CLOSED, (event: any) => 148 | console.log('Rewarded video closed, is finished: ', event.isFinished), 149 | ); 150 | Appodeal.addEventListener(AppodealRewardedEvent.FAILED_TO_LOAD, () => 151 | console.log('Rewarded video failed to load'), 152 | ); 153 | Appodeal.addEventListener(AppodealRewardedEvent.FAILED_TO_SHOW, () => 154 | console.log('Rewarded video failed to show'), 155 | ); 156 | }; 157 | -------------------------------------------------------------------------------- /example/src/components/Spacer.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {View} from 'react-native'; 3 | 4 | interface SpacerProps { 5 | horizontal?: boolean; 6 | value?: number; 7 | } 8 | 9 | export const Spacer = (props: SpacerProps) => { 10 | const defaultValue = 'auto'; 11 | 12 | return ( 13 | 19 | ); 20 | }; 21 | -------------------------------------------------------------------------------- /example/src/components/controls/AutocacheControl.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-bitwise */ 2 | import React from 'react'; 3 | import {TouchableOpacity, View, Text, ScrollView} from 'react-native'; 4 | import {styles} from '../../styles'; 5 | import {AppodealAdType} from 'react-native-appodeal'; 6 | 7 | interface AutocacheControlProps { 8 | mask: number; 9 | onUpdate(mask: number): void; 10 | } 11 | 12 | const CustomButton = (props: { 13 | title: string; 14 | selected: boolean; 15 | onPress(): void; 16 | }) => { 17 | return ( 18 | 19 | 20 | {props.title} 21 | 22 | 23 | ); 24 | }; 25 | 26 | export const AutocacheControl = (props: AutocacheControlProps) => { 27 | const update = (adType: number) => { 28 | let newMask = props.mask; 29 | if (newMask & adType) { 30 | newMask &= ~adType; 31 | } else { 32 | newMask |= adType; 33 | } 34 | props.onUpdate(newMask); 35 | }; 36 | 37 | return ( 38 | 39 | Autocache 40 | 41 | 42 | 0} 45 | onPress={() => update(AppodealAdType.BANNER)} 46 | /> 47 | 0} 50 | onPress={() => update(AppodealAdType.MREC)} 51 | /> 52 | 0} 55 | onPress={() => update(AppodealAdType.INTERSTITIAL)} 56 | /> 57 | 0} 60 | onPress={() => update(AppodealAdType.REWARDED_VIDEO)} 61 | /> 62 | 63 | 64 | 65 | ); 66 | }; 67 | -------------------------------------------------------------------------------- /example/src/components/controls/BannerSegmentedControl.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {BannerShowStyle} from '../../advertising'; 3 | import {View, Text} from 'react-native'; 4 | import {styles} from '../../styles'; 5 | import SegmentedControl from '@react-native-segmented-control/segmented-control'; 6 | 7 | interface BannerSegmentedControlProps { 8 | visible: boolean; 9 | showStyle: BannerShowStyle; 10 | onChange(showStyle: BannerShowStyle): void; 11 | } 12 | 13 | export const BannerSegmentedControl = (props: BannerSegmentedControlProps) => { 14 | let showStyles = [ 15 | BannerShowStyle.BOTTOM, 16 | BannerShowStyle.TOP, 17 | BannerShowStyle.VIEW, 18 | ]; 19 | 20 | const index = () => { 21 | return showStyles.indexOf(props.showStyle); 22 | }; 23 | 24 | return props.visible ? ( 25 | 26 | Banner style 27 | 28 | 33 | props.onChange(showStyles[event.nativeEvent.selectedSegmentIndex]) 34 | } 35 | /> 36 | 37 | 38 | ) : null; 39 | }; 40 | -------------------------------------------------------------------------------- /example/src/components/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {styles} from '../styles'; 3 | import {Text, View, TouchableHighlight} from 'react-native'; 4 | import {Link} from '@react-navigation/native'; 5 | import Icon from 'react-native-vector-icons/Ionicons'; 6 | 7 | export const SectionHeader = (props: {value: string}) => { 8 | return {props.value}; 9 | }; 10 | 11 | export const Row = (props: { 12 | title: string; 13 | onClick?(): void; 14 | accessory?(): any; 15 | }) => { 16 | return ( 17 | props.onClick && props.onClick()}> 18 | 19 | 20 | 21 | {props.title} 22 | 23 | 24 | {props.accessory && props.accessory()} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | ); 33 | }; 34 | 35 | export const LinkRow = (props: {title: string; route: string}) => { 36 | return ( 37 | 38 | 39 | 40 | 41 | {props.title} 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | ); 56 | }; 57 | -------------------------------------------------------------------------------- /example/src/components/sections/InitialisationSection.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {View, Switch, ActivityIndicator} from 'react-native'; 3 | import {SectionHeader, Row, LinkRow} from '..'; 4 | import {SDKState} from '../../advertising'; 5 | 6 | interface InitialisationSectionStateProps { 7 | state: SDKState; 8 | } 9 | 10 | interface InitialisationSectionDispatchProps { 11 | onInitialize: () => void; 12 | } 13 | 14 | type InitialisationSectionProps = InitialisationSectionStateProps & 15 | InitialisationSectionDispatchProps; 16 | 17 | export const InitialisationSection = (props: InitialisationSectionProps) => { 18 | const accessory = () => { 19 | switch (props.state) { 20 | case SDKState.PENDING: 21 | return ( 22 | props.onInitialize()} /> 23 | ); 24 | case SDKState.INITIALIZED: 25 | return ; 26 | case SDKState.INITIALIZING: 27 | return ; 28 | } 29 | }; 30 | 31 | return ( 32 | 33 | 34 | 35 | 36 | 37 | ); 38 | }; 39 | -------------------------------------------------------------------------------- /example/src/components/sections/ShowSection.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-bitwise */ 2 | import React from 'react'; 3 | import {AppodealAdType, Appodeal} from 'react-native-appodeal'; 4 | import {View} from 'react-native'; 5 | import {SectionHeader, Row} from '..'; 6 | import { 7 | BannerShowStyle, 8 | bannerAdType, 9 | isViewBannerStyle, 10 | } from '../../advertising'; 11 | import {BannerView, MrecView} from '../../advertising/BannerView'; 12 | import {Spacer} from '../Spacer'; 13 | 14 | interface ShowSectionProps { 15 | visible: boolean; 16 | autocache: number; 17 | bannerShowStyle: BannerShowStyle; 18 | } 19 | 20 | export const ShowSection = (props: ShowSectionProps) => { 21 | const [isBannerPresented, setBannerPresented] = React.useState(false); 22 | const [isMrecPresented, setMrecPresented] = React.useState(false); 23 | 24 | const updateBanner = () => { 25 | if (!isViewBannerStyle(props.bannerShowStyle)) { 26 | if (isBannerPresented) { 27 | Appodeal.hide(bannerAdType(props.bannerShowStyle)); 28 | setBannerPresented(false); 29 | } else if (Appodeal.canShow(bannerAdType(props.bannerShowStyle))) { 30 | Appodeal.show(bannerAdType(props.bannerShowStyle)); 31 | setBannerPresented(true); 32 | } 33 | } else { 34 | setBannerPresented(!isBannerPresented); 35 | } 36 | }; 37 | 38 | return props.visible ? ( 39 | 40 | 41 | {(props.autocache & AppodealAdType.INTERSTITIAL) > 0 ? null : ( 42 | Appodeal.cache(AppodealAdType.INTERSTITIAL)} 45 | /> 46 | )} 47 | Appodeal.show(AppodealAdType.INTERSTITIAL)} 50 | /> 51 | {/* */} 52 | 53 | {(props.autocache & AppodealAdType.REWARDED_VIDEO) > 0 ? null : ( 54 | Appodeal.cache(AppodealAdType.REWARDED_VIDEO)} 57 | /> 58 | )} 59 | Appodeal.show(AppodealAdType.REWARDED_VIDEO)} 62 | /> 63 | {/* */} 64 | 65 | {(props.autocache & AppodealAdType.BANNER) > 0 ? null : ( 66 | Appodeal.cache(AppodealAdType.BANNER)} 69 | /> 70 | )} 71 | 75 | 79 | {/* */} 80 | 81 | setMrecPresented(!isMrecPresented)} 84 | /> 85 | 86 | 87 | 88 | ) : null; 89 | }; 90 | -------------------------------------------------------------------------------- /example/src/screens/AdvancedFeaturesScreen.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-bitwise */ 2 | import React from 'react'; 3 | import {styles} from '../styles'; 4 | import {ScrollView, SafeAreaView, View, Switch, Text} from 'react-native'; 5 | import {Row, SectionHeader} from '../components'; 6 | import SegmentedControl from '@react-native-community/segmented-control'; 7 | import {Appodeal, AppodealConsentStatus} from 'react-native-appodeal'; 8 | import {constants} from '../advertising/constants'; 9 | 10 | let _smartBanners = true; 11 | let _tabletBanners = false; 12 | 13 | export const AdvancedFeaturesScreen = () => { 14 | const [consentStatus, setConsentStatus] = React.useState( 15 | Appodeal.consentStatus(), 16 | ); 17 | const [smartBanners, setSmartBanners] = React.useState(_smartBanners); 18 | const [tabletBanners, setTabletBanners] = React.useState(_tabletBanners); 19 | 20 | const smartBannersSwitch = () => ( 21 | { 24 | Appodeal.setSmartBanners(value); 25 | _smartBanners = value; 26 | setSmartBanners(value); 27 | }} 28 | /> 29 | ); 30 | 31 | const tabletBannersSwitch = () => ( 32 | { 35 | Appodeal.setTabletBanners(value); 36 | _tabletBanners = value; 37 | setTabletBanners(value); 38 | }} 39 | /> 40 | ); 41 | 42 | const subtitleAccessory = (value: any) => ( 43 | {value} 44 | ); 45 | 46 | const extrasSections = () => ( 47 | <> 48 | 49 | {Object.entries(Appodeal.getExtras()).map((entry) => ( 50 | subtitleAccessory(entry[1])} 54 | /> 55 | ))} 56 | 57 | ); 58 | 59 | const customStateSection = () => ( 60 | <> 61 | 62 | {Object.entries(Appodeal.getCustomState()).map((entry) => ( 63 | subtitleAccessory(entry[1])} 67 | /> 68 | ))} 69 | 70 | ); 71 | 72 | const consentStatusString = () => { 73 | switch (consentStatus) { 74 | case AppodealConsentStatus.OBTAINED: 75 | return 'Obtained'; 76 | case AppodealConsentStatus.NOT_REQUIRED: 77 | return 'Not Required'; 78 | case AppodealConsentStatus.REQUIRED: 79 | return 'Required'; 80 | default: 81 | return 'Unknown'; 82 | } 83 | }; 84 | 85 | return ( 86 | <> 87 | 88 | 89 | 90 | 91 | 92 | 93 | subtitleAccessory(consentStatusString())} 96 | /> 97 | 100 | Appodeal.requestConsentInfoUpdate(constants.appKey) 101 | .then((status) => setConsentStatus(status)) 102 | .catch((error) => console.log(error)) 103 | .finally(() => 104 | console.log('Appodeal did update consent information'), 105 | ) 106 | } 107 | /> 108 | subtitleAccessory('Force')} 111 | onClick={() => 112 | Appodeal.showConsentForm() 113 | .then((status) => setConsentStatus(status)) 114 | .catch((error) => console.log(error)) 115 | .finally(() => 116 | console.log('Appodeal did update consent information'), 117 | ) 118 | } 119 | /> 120 | subtitleAccessory('If Needed')} 123 | onClick={() => 124 | Appodeal.showConsentFormIfNeeded() 125 | .then((status) => setConsentStatus(status)) 126 | .catch((error) => console.log(error)) 127 | .finally(() => 128 | console.log('Appodeal did update consent information'), 129 | ) 130 | } 131 | /> 132 | { 135 | Appodeal.revokeConsent(); 136 | setConsentStatus(Appodeal.consentStatus()); 137 | }} 138 | /> 139 | {Object.keys(Appodeal.getExtras()).length > 0 140 | ? extrasSections() 141 | : null} 142 | {Object.keys(Appodeal.getCustomState()).length > 0 143 | ? customStateSection() 144 | : null} 145 | 146 | 147 | 148 | ); 149 | }; 150 | -------------------------------------------------------------------------------- /example/src/screens/HomeScreen.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-bitwise */ 2 | import React, {useEffect} from 'react'; 3 | import {styles} from '../styles'; 4 | import {initialize, isInitialized, SDKState} from '../advertising'; 5 | import {ShowSection} from '../components/sections/ShowSection'; 6 | import {BannerSegmentedControl} from '../components/controls/BannerSegmentedControl'; 7 | import {AutocacheControl} from '../components/controls/AutocacheControl'; 8 | import {InitialisationSection} from '../components/sections/InitialisationSection'; 9 | import {ScrollView, SafeAreaView, Switch} from 'react-native'; 10 | import {Row} from '../components'; 11 | import { 12 | AppodealAdType, 13 | Appodeal, 14 | AppodealSdkEvent, 15 | } from 'react-native-appodeal'; 16 | import {BannerShowStyle} from '../advertising'; 17 | 18 | export const HomeScreen = () => { 19 | const [state, setState] = React.useState( 20 | isInitialized() ? SDKState.INITIALIZED : SDKState.PENDING, 21 | ); 22 | 23 | const [autocache, setAutocache] = React.useState( 24 | AppodealAdType.INTERSTITIAL | AppodealAdType.BANNER, 25 | ); 26 | 27 | const [testMode, setTestMode] = React.useState(true); 28 | 29 | const [bannerShowStyle, setBannerShowStyle] = React.useState( 30 | BannerShowStyle.BOTTOM, 31 | ); 32 | 33 | const initSDK = () => { 34 | if (state === SDKState.INITIALIZING) { 35 | return; 36 | } 37 | 38 | if (state !== SDKState.INITIALIZED) { 39 | setState(SDKState.INITIALIZING); 40 | Appodeal.addEventListener(AppodealSdkEvent.INITIALIZED, () => { 41 | setState(SDKState.INITIALIZED); 42 | }); 43 | } 44 | 45 | initialize(testMode); 46 | }; 47 | 48 | useEffect(() => { 49 | const types = [ 50 | AppodealAdType.INTERSTITIAL, 51 | AppodealAdType.REWARDED_VIDEO, 52 | AppodealAdType.BANNER, 53 | ]; 54 | types.forEach((adType) => 55 | Appodeal.setAutoCache(adType, (autocache & adType) > 0), 56 | ); 57 | }, [autocache]); 58 | 59 | const testModeSwitch = () => ( 60 | 61 | ); 62 | 63 | return ( 64 | <> 65 | 66 | 67 | 68 | 69 | setAutocache(value)} 72 | /> 73 | 78 | 83 | 84 | 85 | 86 | ); 87 | }; 88 | -------------------------------------------------------------------------------- /example/src/styles/index.ts: -------------------------------------------------------------------------------- 1 | import {StyleSheet, Platform} from 'react-native'; 2 | 3 | const statusBarHeight = Platform.OS === 'ios' ? 35 : 0; 4 | 5 | export const styles = StyleSheet.create({ 6 | container: { 7 | flex: 1, 8 | justifyContent: 'center', 9 | alignItems: 'center', 10 | }, 11 | navBar: { 12 | backgroundColor: '#hsl(0, 0%, 97%)', 13 | height: 44 + statusBarHeight, 14 | alignSelf: 'stretch', 15 | paddingTop: statusBarHeight, 16 | justifyContent: 'center', 17 | alignItems: 'center', 18 | }, 19 | navBarTitle: { 20 | color: 'black', 21 | fontSize: 16, 22 | }, 23 | _scrollView: { 24 | flex: 1, 25 | alignSelf: 'stretch', 26 | backgroundColor: 'hsl(0, 0%, 97%)', 27 | }, 28 | get scrollView() { 29 | return this._scrollView; 30 | }, 31 | set scrollView(value) { 32 | this._scrollView = value; 33 | }, 34 | sectionHeader: { 35 | marginLeft: 20, 36 | marginTop: 20, 37 | marginBottom: 8, 38 | textTransform: 'uppercase', 39 | color: '#999', 40 | fontSize: 14, 41 | }, 42 | sectionFooter: { 43 | textAlign: 'center', 44 | marginTop: 8, 45 | marginBottom: 20, 46 | color: '#999', 47 | fontSize: 12, 48 | }, 49 | rowContainer: { 50 | backgroundColor: 'transparent', 51 | height: 44, 52 | alignItems: 'stretch', 53 | }, 54 | borderContainer: { 55 | alignSelf: 'stretch', 56 | height: 1, 57 | paddingLeft: 16, 58 | backgroundColor: 'white', 59 | }, 60 | border: { 61 | flex: 1, 62 | backgroundColor: '#ccc', 63 | }, 64 | link: { 65 | position: 'absolute', 66 | flex: 1, 67 | width: '100%', 68 | height: '100%', 69 | backgroundColor: 'transparent', 70 | alignContent: 'stretch', 71 | }, 72 | contentRowContainer: { 73 | flexDirection: 'row', 74 | paddingLeft: 16, 75 | flex: 1, 76 | alignItems: 'center', 77 | backgroundColor: 'white', 78 | }, 79 | titlesRowContainer: { 80 | flex: 1, 81 | justifyContent: 'space-around', 82 | alignSelf: 'stretch', 83 | }, 84 | accessoryContainer: { 85 | alignContent: 'stretch', 86 | paddingRight: 8, 87 | }, 88 | rowTitle: { 89 | color: 'black', 90 | fontSize: 16, 91 | marginRight: 16, 92 | }, 93 | rowRightDetail: { 94 | color: 'gray', 95 | fontSize: 16, 96 | marginRight: 15, 97 | }, 98 | banner: { 99 | height: 50, 100 | marginVertical: 8, 101 | width: '100%', 102 | backgroundColor: 'hsl(0, 0%, 97%)', 103 | alignContent: 'stretch', 104 | }, 105 | mrec: { 106 | height: 250, 107 | marginVertical: 8, 108 | width: '100%', 109 | backgroundColor: 'hsl(0, 0%, 97%)', 110 | alignContent: 'stretch', 111 | }, 112 | buttonSelected: { 113 | flex: 1, 114 | justifyContent: 'space-around', 115 | alignSelf: 'stretch', 116 | margin: 8, 117 | height: 26, 118 | borderRadius: 8, 119 | fontSize: 16, 120 | backgroundColor: '#53d769', 121 | }, 122 | buttonPlain: { 123 | flex: 1, 124 | justifyContent: 'space-around', 125 | alignSelf: 'stretch', 126 | margin: 8, 127 | borderRadius: 8, 128 | fontSize: 16, 129 | backgroundColor: '#ddd', 130 | }, 131 | buttonText: { 132 | color: 'white', 133 | fontSize: 16, 134 | marginLeft: 8, 135 | marginRight: 8, 136 | }, 137 | segmentedControl: { 138 | margin: 8, 139 | }, 140 | }); 141 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "allowSyntheticDefaultImports": true, 5 | "esModuleInterop": true, 6 | "isolatedModules": true, 7 | "jsx": "react", 8 | "lib": [ 9 | "es6" 10 | ], 11 | "moduleResolution": "node", 12 | "noEmit": true, 13 | "strict": true, 14 | "target": "esnext" 15 | }, 16 | "exclude": [ 17 | "node_modules", 18 | "babel.config.js", 19 | "metro.config.js", 20 | "jest.config.js" 21 | ] 22 | } -------------------------------------------------------------------------------- /ios/RNADefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNADefines.h 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 26/09/2019. 6 | // Copyright © 2019 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | 14 | FOUNDATION_EXPORT NSString *const kEventAppodealInitialized; 15 | FOUNDATION_EXPORT NSString *const kEventAppodealDidReceiveRevenue; 16 | 17 | FOUNDATION_EXPORT NSString *const kEventBannerLoaded; 18 | FOUNDATION_EXPORT NSString *const kEventBannerFailedToLoad; 19 | FOUNDATION_EXPORT NSString *const kEventBannerExpired; 20 | FOUNDATION_EXPORT NSString *const kEventBannerShown; 21 | FOUNDATION_EXPORT NSString *const kEventBannerClicked; 22 | 23 | FOUNDATION_EXPORT NSString *const kEventInterstitialLoaded; 24 | FOUNDATION_EXPORT NSString *const kEventInterstitialFailedToLoad; 25 | FOUNDATION_EXPORT NSString *const kEventInterstitialFailedToPresent; 26 | FOUNDATION_EXPORT NSString *const kEventInterstitialExpired; 27 | FOUNDATION_EXPORT NSString *const kEventInterstitialShown; 28 | FOUNDATION_EXPORT NSString *const kEventInterstitialClosed; 29 | FOUNDATION_EXPORT NSString *const kEventInterstitialClicked; 30 | 31 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoLoaded; 32 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoFailedToLoad; 33 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoFailedToPresent; 34 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoExpired; 35 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoShown; 36 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoClicked; 37 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoClosed; 38 | FOUNDATION_EXPORT NSString *const kEventRewardedVideoFinished; 39 | 40 | NSString *RNAVersion(void); 41 | NSArray *RNASupportedMehtods(void); 42 | 43 | typedef NS_OPTIONS(NSInteger, RNAAdType) { 44 | RNAAdTypeNone = 0, 45 | RNAAdTypeInterstitial = 1 << 0, 46 | RNAAdTypeBanner = 1 << 2, 47 | RNAAdTypeBannerBottom = 1 << 3, 48 | RNAAdTypeBannerTop = 1 << 4, 49 | RNAAdTypeRewardedVideo = 1 << 5, 50 | RNAAdTypeNative = 1 << 7, 51 | RNAAdTypeMREC = 1 << 8 52 | }; 53 | 54 | 55 | AppodealAdType AppodealAdTypeFromRNAAdType(RNAAdType adType); 56 | RNAAdType RNAAdTypeFromaAppodealAdType(AppodealAdType adType); 57 | AppodealShowStyle AppodealShowStyleFromRNAAdType(RNAAdType adType); 58 | APDPurchaseType APDPurchaseTypeFromRNPurchase(NSInteger type); 59 | BOOL isRNAAdTypeBanner(RNAAdType adType); 60 | CGSize RNAppodealBannerViewSizeFromString(NSString *size); 61 | NSString *NSStringFromAppodealBannerViewSize(CGSize size); 62 | NSNumber *RNAppodealConsentStatusFrom(APDConsentStatus status); 63 | -------------------------------------------------------------------------------- /ios/RNADefines.m: -------------------------------------------------------------------------------- 1 | // 2 | // RNADefines.m 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 26/09/2019. 6 | // Copyright © 2019 Facebook. All rights reserved. 7 | // 8 | 9 | #import "RNADefines.h" 10 | #import 11 | #import 12 | 13 | #pragma mark - Constants 14 | 15 | NSString *const kEventAppodealInitialized = @"onAppodealInitialized"; 16 | NSString *const kEventAppodealDidReceiveRevenue = @"onAppodealDidReceiveRevenue"; 17 | 18 | NSString *const kEventBannerLoaded = @"onBannerLoaded"; 19 | NSString *const kEventBannerFailedToLoad = @"onBannerFailedToLoad"; 20 | NSString *const kEventBannerExpired = @"onBannerExpired"; 21 | NSString *const kEventBannerShown = @"onBannerShown"; 22 | NSString *const kEventBannerClicked = @"onBannerClicked"; 23 | 24 | NSString *const kEventInterstitialLoaded = @"onInterstitialLoaded"; 25 | NSString *const kEventInterstitialFailedToLoad = @"onInterstitialFailedToLoad"; 26 | NSString *const kEventInterstitialFailedToPresent = @"onInterstitialFaliedToShow"; 27 | NSString *const kEventInterstitialExpired = @"onInterstitialExpired"; 28 | NSString *const kEventInterstitialShown = @"onInterstitialShown"; 29 | NSString *const kEventInterstitialClosed = @"onInterstitialClosed"; 30 | NSString *const kEventInterstitialClicked = @"onInterstitialClicked"; 31 | 32 | NSString *const kEventRewardedVideoLoaded = @"onRewardedVideoLoaded"; 33 | NSString *const kEventRewardedVideoFailedToLoad = @"onRewardedVideoFailedToLoad"; 34 | NSString *const kEventRewardedVideoFailedToPresent = @"onRewardedVideoFailedToShow"; 35 | NSString *const kEventRewardedVideoExpired = @"onRewardedVideoExpired"; 36 | NSString *const kEventRewardedVideoShown = @"onRewardedVideoShown"; 37 | NSString *const kEventRewardedVideoClosed = @"onRewardedVideoClosed"; 38 | NSString *const kEventRewardedVideoFinished = @"onRewardedVideoFinished"; 39 | NSString *const kEventRewardedVideoClicked = @"onRewardedVideoClicked"; 40 | 41 | #pragma mark - Converter 42 | 43 | @implementation RCTConvert (Appodeal) 44 | 45 | RCT_ENUM_CONVERTER(APDLogLevel, (@{ 46 | @"debug": @(APDLogLevelDebug), 47 | @"verbose": @(APDLogLevelVerbose), 48 | @"off": @(APDLogLevelOff), 49 | }), APDLogLevelInfo, integerValue) 50 | 51 | RCT_ENUM_CONVERTER(AppodealUserGender, (@{ 52 | @"male": @(AppodealUserGenderMale), 53 | @"female": @(AppodealUserGenderFemale), 54 | }), AppodealUserGenderOther, integerValue) 55 | 56 | + (RNAAdType)RNAAdType:(id)json RCT_DYNAMIC { 57 | return RNAAdTypeBannerTop; 58 | } 59 | 60 | @end 61 | 62 | 63 | #pragma mark - Utils 64 | 65 | NSString *RNAVersion(void) { 66 | return @"3.5.0"; 67 | } 68 | 69 | NSArray *RNASupportedMehtods(void) { 70 | return @[ 71 | kEventAppodealInitialized, 72 | kEventAppodealDidReceiveRevenue, 73 | kEventBannerLoaded, 74 | kEventBannerFailedToLoad, 75 | kEventBannerExpired, 76 | kEventBannerShown, 77 | kEventBannerClicked, 78 | kEventInterstitialLoaded, 79 | kEventInterstitialFailedToLoad, 80 | kEventInterstitialShown, 81 | kEventInterstitialFailedToPresent, 82 | kEventInterstitialExpired, 83 | kEventInterstitialClosed, 84 | kEventInterstitialClicked, 85 | kEventRewardedVideoLoaded, 86 | kEventRewardedVideoFailedToLoad, 87 | kEventRewardedVideoFailedToPresent, 88 | kEventRewardedVideoExpired, 89 | kEventRewardedVideoShown, 90 | kEventRewardedVideoClosed, 91 | kEventRewardedVideoFinished, 92 | kEventRewardedVideoClicked 93 | ]; 94 | } 95 | 96 | AppodealAdType AppodealAdTypeFromRNAAdType(RNAAdType adType) { 97 | AppodealAdType result = 0; 98 | if ((adType & RNAAdTypeInterstitial) > 0) { 99 | result |= AppodealAdTypeInterstitial; 100 | } 101 | 102 | if (isRNAAdTypeBanner(adType) > 0) { 103 | result |= AppodealAdTypeBanner; 104 | } 105 | 106 | if ((adType & RNAAdTypeRewardedVideo) > 0) { 107 | result |= AppodealAdTypeRewardedVideo; 108 | } 109 | 110 | if ((adType & RNAAdTypeNative) > 0) { 111 | result |= AppodealAdTypeNativeAd; 112 | } 113 | 114 | if ((adType & RNAAdTypeMREC) > 0) { 115 | result |= AppodealAdTypeMREC; 116 | } 117 | 118 | return result; 119 | } 120 | 121 | RNAAdType RNAAdTypeFromaAppodealAdType(AppodealAdType adType) { 122 | RNAAdType result = 0; 123 | if ((adType & AppodealAdTypeInterstitial) > 0) { 124 | result |= RNAAdTypeInterstitial; 125 | } 126 | 127 | if ((adType & AppodealAdTypeBanner) > 0) { 128 | result |= RNAAdTypeBanner; 129 | } 130 | 131 | if ((adType & AppodealAdTypeRewardedVideo) > 0) { 132 | result |= RNAAdTypeRewardedVideo; 133 | } 134 | 135 | if ((adType & AppodealAdTypeNativeAd) > 0) { 136 | result |= RNAAdTypeNative; 137 | } 138 | 139 | if ((adType & AppodealAdTypeMREC) > 0) { 140 | result |= RNAAdTypeMREC; 141 | } 142 | 143 | return result; 144 | } 145 | 146 | AppodealShowStyle AppodealShowStyleFromRNAAdType(RNAAdType adType) { 147 | if ((adType & RNAAdTypeInterstitial) > 0) { 148 | return AppodealShowStyleInterstitial; 149 | } 150 | 151 | if ((adType & RNAAdTypeBannerBottom) > 0) { 152 | return AppodealShowStyleBannerBottom; 153 | } 154 | 155 | if ((adType & RNAAdTypeBannerTop) > 0) { 156 | return AppodealShowStyleBannerTop; 157 | } 158 | 159 | if ((adType & RNAAdTypeRewardedVideo) > 0) { 160 | return AppodealShowStyleRewardedVideo; 161 | } 162 | 163 | return 0; 164 | } 165 | 166 | APDPurchaseType APDPurchaseTypeFromRNPurchase(NSInteger type) { 167 | return (APDPurchaseType)type; 168 | } 169 | 170 | BOOL isRNAAdTypeBanner(RNAAdType adType) { 171 | return ((adType & RNAAdTypeBanner) > 0 || (adType & RNAAdTypeBannerBottom) > 0 || (adType & RNAAdTypeBannerTop) > 0); 172 | } 173 | 174 | CGSize RNAppodealBannerViewSizeFromString(NSString *size) { 175 | if ([size isEqualToString:@"tablet"]) { 176 | return kAppodealUnitSize_728x90; 177 | } else { 178 | return kAPDAdSize320x50; 179 | } 180 | } 181 | 182 | NSString *NSStringFromAppodealBannerViewSize(CGSize size) { 183 | if (CGSizeEqualToSize(size, kAppodealUnitSize_728x90)) { 184 | return @"tablet"; 185 | } else { 186 | return @"phone"; 187 | } 188 | } 189 | 190 | NSNumber *RNAppodealConsentStatusFrom(APDConsentStatus status) { 191 | return @(status); 192 | } 193 | -------------------------------------------------------------------------------- /ios/RNAppodeal.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | 6 | @interface RNAppodeal : RCTEventEmitter 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /ios/RNAppodeal.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4202C1632A14FEA40075560D /* RNAppodealMrecViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4202C1622A14FEA40075560D /* RNAppodealMrecViewManager.m */; }; 11 | 423911F7233CBDEA00C47FA0 /* RNADefines.m in Sources */ = {isa = PBXBuildFile; fileRef = 423911F6233CBDEA00C47FA0 /* RNADefines.m */; }; 12 | 42E9D361233D3A74003F3784 /* RNAppodealBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 42E9D360233D3A74003F3784 /* RNAppodealBannerView.m */; }; 13 | 42E9D365233D3F7B003F3784 /* RNAppodealBannerViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 42E9D364233D3F7B003F3784 /* RNAppodealBannerViewManager.m */; }; 14 | B3E7B58A1CC2AC0600A0062D /* RNAppodeal.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNAppodeal.m */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXCopyFilesBuildPhase section */ 18 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 19 | isa = PBXCopyFilesBuildPhase; 20 | buildActionMask = 2147483647; 21 | dstPath = "include/$(PRODUCT_NAME)"; 22 | dstSubfolderSpec = 16; 23 | files = ( 24 | ); 25 | runOnlyForDeploymentPostprocessing = 0; 26 | }; 27 | /* End PBXCopyFilesBuildPhase section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 134814201AA4EA6300B7C361 /* libRNAppodeal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNAppodeal.a; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 4202C1612A14FEA40075560D /* RNAppodealMrecViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNAppodealMrecViewManager.h; sourceTree = ""; }; 32 | 4202C1622A14FEA40075560D /* RNAppodealMrecViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNAppodealMrecViewManager.m; sourceTree = ""; }; 33 | 423911F5233CBDEA00C47FA0 /* RNADefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNADefines.h; sourceTree = ""; }; 34 | 423911F6233CBDEA00C47FA0 /* RNADefines.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNADefines.m; sourceTree = ""; }; 35 | 42E9D35F233D3A74003F3784 /* RNAppodealBannerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAppodealBannerView.h; sourceTree = ""; }; 36 | 42E9D360233D3A74003F3784 /* RNAppodealBannerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNAppodealBannerView.m; sourceTree = ""; }; 37 | 42E9D363233D3F7B003F3784 /* RNAppodealBannerViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNAppodealBannerViewManager.h; sourceTree = ""; }; 38 | 42E9D364233D3F7B003F3784 /* RNAppodealBannerViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNAppodealBannerViewManager.m; sourceTree = ""; }; 39 | B3E7B5881CC2AC0600A0062D /* RNAppodeal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNAppodeal.h; sourceTree = ""; }; 40 | B3E7B5891CC2AC0600A0062D /* RNAppodeal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNAppodeal.m; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | 134814211AA4EA7D00B7C361 /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 134814201AA4EA6300B7C361 /* libRNAppodeal.a */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | 42E9D362233D3F62003F3784 /* Banner */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 42E9D35F233D3A74003F3784 /* RNAppodealBannerView.h */, 66 | 42E9D360233D3A74003F3784 /* RNAppodealBannerView.m */, 67 | 42E9D363233D3F7B003F3784 /* RNAppodealBannerViewManager.h */, 68 | 42E9D364233D3F7B003F3784 /* RNAppodealBannerViewManager.m */, 69 | 4202C1612A14FEA40075560D /* RNAppodealMrecViewManager.h */, 70 | 4202C1622A14FEA40075560D /* RNAppodealMrecViewManager.m */, 71 | ); 72 | name = Banner; 73 | sourceTree = ""; 74 | }; 75 | 58B511D21A9E6C8500147676 = { 76 | isa = PBXGroup; 77 | children = ( 78 | 42E9D362233D3F62003F3784 /* Banner */, 79 | B3E7B5881CC2AC0600A0062D /* RNAppodeal.h */, 80 | B3E7B5891CC2AC0600A0062D /* RNAppodeal.m */, 81 | 423911F5233CBDEA00C47FA0 /* RNADefines.h */, 82 | 423911F6233CBDEA00C47FA0 /* RNADefines.m */, 83 | 134814211AA4EA7D00B7C361 /* Products */, 84 | ); 85 | sourceTree = ""; 86 | }; 87 | /* End PBXGroup section */ 88 | 89 | /* Begin PBXNativeTarget section */ 90 | 58B511DA1A9E6C8500147676 /* RNAppodeal */ = { 91 | isa = PBXNativeTarget; 92 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNAppodeal" */; 93 | buildPhases = ( 94 | 58B511D71A9E6C8500147676 /* Sources */, 95 | 58B511D81A9E6C8500147676 /* Frameworks */, 96 | 58B511D91A9E6C8500147676 /* CopyFiles */, 97 | ); 98 | buildRules = ( 99 | ); 100 | dependencies = ( 101 | ); 102 | name = RNAppodeal; 103 | productName = RCTDataManager; 104 | productReference = 134814201AA4EA6300B7C361 /* libRNAppodeal.a */; 105 | productType = "com.apple.product-type.library.static"; 106 | }; 107 | /* End PBXNativeTarget section */ 108 | 109 | /* Begin PBXProject section */ 110 | 58B511D31A9E6C8500147676 /* Project object */ = { 111 | isa = PBXProject; 112 | attributes = { 113 | LastUpgradeCheck = 0830; 114 | ORGANIZATIONNAME = Facebook; 115 | TargetAttributes = { 116 | 58B511DA1A9E6C8500147676 = { 117 | CreatedOnToolsVersion = 6.1.1; 118 | }; 119 | }; 120 | }; 121 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNAppodeal" */; 122 | compatibilityVersion = "Xcode 3.2"; 123 | developmentRegion = English; 124 | hasScannedForEncodings = 0; 125 | knownRegions = ( 126 | English, 127 | en, 128 | ); 129 | mainGroup = 58B511D21A9E6C8500147676; 130 | productRefGroup = 58B511D21A9E6C8500147676; 131 | projectDirPath = ""; 132 | projectRoot = ""; 133 | targets = ( 134 | 58B511DA1A9E6C8500147676 /* RNAppodeal */, 135 | ); 136 | }; 137 | /* End PBXProject section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | 58B511D71A9E6C8500147676 /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | 423911F7233CBDEA00C47FA0 /* RNADefines.m in Sources */, 145 | 42E9D361233D3A74003F3784 /* RNAppodealBannerView.m in Sources */, 146 | 4202C1632A14FEA40075560D /* RNAppodealMrecViewManager.m in Sources */, 147 | 42E9D365233D3F7B003F3784 /* RNAppodealBannerViewManager.m in Sources */, 148 | B3E7B58A1CC2AC0600A0062D /* RNAppodeal.m in Sources */, 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | /* End PBXSourcesBuildPhase section */ 153 | 154 | /* Begin XCBuildConfiguration section */ 155 | 58B511ED1A9E6C8500147676 /* Debug */ = { 156 | isa = XCBuildConfiguration; 157 | buildSettings = { 158 | ALWAYS_SEARCH_USER_PATHS = NO; 159 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 160 | CLANG_CXX_LIBRARY = "libc++"; 161 | CLANG_ENABLE_MODULES = YES; 162 | CLANG_ENABLE_OBJC_ARC = YES; 163 | CLANG_WARN_BOOL_CONVERSION = YES; 164 | CLANG_WARN_CONSTANT_CONVERSION = YES; 165 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 166 | CLANG_WARN_EMPTY_BODY = YES; 167 | CLANG_WARN_ENUM_CONVERSION = YES; 168 | CLANG_WARN_INFINITE_RECURSION = YES; 169 | CLANG_WARN_INT_CONVERSION = YES; 170 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 171 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 172 | CLANG_WARN_UNREACHABLE_CODE = YES; 173 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 174 | COPY_PHASE_STRIP = NO; 175 | ENABLE_STRICT_OBJC_MSGSEND = YES; 176 | ENABLE_TESTABILITY = YES; 177 | GCC_C_LANGUAGE_STANDARD = gnu99; 178 | GCC_DYNAMIC_NO_PIC = NO; 179 | GCC_NO_COMMON_BLOCKS = YES; 180 | GCC_OPTIMIZATION_LEVEL = 0; 181 | GCC_PREPROCESSOR_DEFINITIONS = ( 182 | "DEBUG=1", 183 | "$(inherited)", 184 | ); 185 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 186 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 187 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 188 | GCC_WARN_UNDECLARED_SELECTOR = YES; 189 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 190 | GCC_WARN_UNUSED_FUNCTION = YES; 191 | GCC_WARN_UNUSED_VARIABLE = YES; 192 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 193 | MTL_ENABLE_DEBUG_INFO = YES; 194 | ONLY_ACTIVE_ARCH = YES; 195 | SDKROOT = iphoneos; 196 | }; 197 | name = Debug; 198 | }; 199 | 58B511EE1A9E6C8500147676 /* Release */ = { 200 | isa = XCBuildConfiguration; 201 | buildSettings = { 202 | ALWAYS_SEARCH_USER_PATHS = NO; 203 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 204 | CLANG_CXX_LIBRARY = "libc++"; 205 | CLANG_ENABLE_MODULES = YES; 206 | CLANG_ENABLE_OBJC_ARC = YES; 207 | CLANG_WARN_BOOL_CONVERSION = YES; 208 | CLANG_WARN_CONSTANT_CONVERSION = YES; 209 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 210 | CLANG_WARN_EMPTY_BODY = YES; 211 | CLANG_WARN_ENUM_CONVERSION = YES; 212 | CLANG_WARN_INFINITE_RECURSION = YES; 213 | CLANG_WARN_INT_CONVERSION = YES; 214 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 215 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 216 | CLANG_WARN_UNREACHABLE_CODE = YES; 217 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 218 | COPY_PHASE_STRIP = YES; 219 | ENABLE_NS_ASSERTIONS = NO; 220 | ENABLE_STRICT_OBJC_MSGSEND = YES; 221 | GCC_C_LANGUAGE_STANDARD = gnu99; 222 | GCC_NO_COMMON_BLOCKS = YES; 223 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 224 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 225 | GCC_WARN_UNDECLARED_SELECTOR = YES; 226 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 227 | GCC_WARN_UNUSED_FUNCTION = YES; 228 | GCC_WARN_UNUSED_VARIABLE = YES; 229 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 230 | MTL_ENABLE_DEBUG_INFO = NO; 231 | SDKROOT = iphoneos; 232 | VALIDATE_PRODUCT = YES; 233 | }; 234 | name = Release; 235 | }; 236 | 58B511F01A9E6C8500147676 /* Debug */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | FRAMEWORK_SEARCH_PATHS = ( 240 | "$(inherited)", 241 | "$(SRCROOT)/../example/ios/Pods/Appodeal/**", 242 | ); 243 | HEADER_SEARCH_PATHS = ( 244 | "$(inherited)", 245 | "$(SRCROOT)/../example/ios/Pods/Headers/Public/**", 246 | ); 247 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 248 | OTHER_LDFLAGS = "$(inherited)"; 249 | PRODUCT_NAME = RNAppodeal; 250 | SKIP_INSTALL = YES; 251 | }; 252 | name = Debug; 253 | }; 254 | 58B511F11A9E6C8500147676 /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | FRAMEWORK_SEARCH_PATHS = ( 258 | "$(inherited)", 259 | "$(SRCROOT)/../example/ios/Pods/Appodeal/**", 260 | ); 261 | HEADER_SEARCH_PATHS = ( 262 | "$(inherited)", 263 | "$(SRCROOT)/../example/ios/Pods/Headers/Public/**", 264 | ); 265 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 266 | OTHER_LDFLAGS = "$(inherited)"; 267 | PRODUCT_NAME = RNAppodeal; 268 | SKIP_INSTALL = YES; 269 | }; 270 | name = Release; 271 | }; 272 | /* End XCBuildConfiguration section */ 273 | 274 | /* Begin XCConfigurationList section */ 275 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNAppodeal" */ = { 276 | isa = XCConfigurationList; 277 | buildConfigurations = ( 278 | 58B511ED1A9E6C8500147676 /* Debug */, 279 | 58B511EE1A9E6C8500147676 /* Release */, 280 | ); 281 | defaultConfigurationIsVisible = 0; 282 | defaultConfigurationName = Release; 283 | }; 284 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNAppodeal" */ = { 285 | isa = XCConfigurationList; 286 | buildConfigurations = ( 287 | 58B511F01A9E6C8500147676 /* Debug */, 288 | 58B511F11A9E6C8500147676 /* Release */, 289 | ); 290 | defaultConfigurationIsVisible = 0; 291 | defaultConfigurationName = Release; 292 | }; 293 | /* End XCConfigurationList section */ 294 | }; 295 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 296 | } 297 | -------------------------------------------------------------------------------- /ios/RNAppodealBannerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNAppodealBannerView.h 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 26/09/2019. 6 | // Copyright © 2019 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface RNAppodealBannerView : RCTView 18 | 19 | @property (nonatomic, copy) NSString *adSize; 20 | 21 | @property (nonatomic, copy) RCTBubblingEventBlock onAdLoaded; 22 | @property (nonatomic, copy) RCTBubblingEventBlock onAdFailedToLoad; 23 | @property (nonatomic, copy) RCTBubblingEventBlock onAdClicked; 24 | @property (nonatomic, copy) RCTBubblingEventBlock onAdExpired; 25 | 26 | @property (nonatomic, strong, readonly) APDBannerView *bannerView; 27 | 28 | - (void)setAdSize:(NSString *)adSize; 29 | 30 | @end 31 | 32 | 33 | @interface RNAppodealMrecView : RNAppodealBannerView 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /ios/RNAppodealBannerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RNAppodealBannerView.m 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 26/09/2019. 6 | // Copyright © 2019 Facebook. All rights reserved. 7 | // 8 | 9 | #import "RNAppodealBannerView.h" 10 | #import "RNADefines.h" 11 | 12 | #import 13 | #import 14 | 15 | 16 | @interface RNAppodealBannerView () 17 | 18 | @property (nonatomic, strong) APDBannerView *bannerView; 19 | 20 | @end 21 | 22 | 23 | @implementation RNAppodealBannerView 24 | 25 | - (instancetype)initWithFrame:(CGRect)frame { 26 | if (self = [super initWithFrame:frame]) { 27 | self.backgroundColor = UIColor.clearColor; 28 | } 29 | return self; 30 | } 31 | 32 | - (NSString *)adSize { 33 | return NSStringFromAppodealBannerViewSize(self.bannerView.adSize); 34 | } 35 | 36 | - (void)setAdSize:(NSString *)adSize { 37 | UIViewController *rootViewController = RCTPresentedViewController(); 38 | [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; 39 | 40 | CGSize size = RNAppodealBannerViewSizeFromString(adSize); 41 | NSAssert([Appodeal isInitializedForAdType:AppodealAdTypeBanner], 42 | @"Appodeal should be initialised with AppodealAdTypeBanner before trying to add AppodealBanner in hierachy"); 43 | 44 | // Create banner 45 | self.bannerView = [[APDBannerView alloc] initWithSize:size 46 | rootViewController:rootViewController]; 47 | self.bannerView.delegate = self; 48 | self.bannerView.frame = self.bounds; 49 | 50 | [self.bannerView loadAd]; 51 | } 52 | 53 | - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex { 54 | RCTLogError(@"RNAppodealBannerView cannot have subviews"); 55 | } 56 | 57 | - (void)layoutSubviews { 58 | [super layoutSubviews]; 59 | self.bannerView.frame = self.bounds; 60 | } 61 | 62 | #pragma mark - APDBannerViewDelegate 63 | 64 | - (void)bannerViewDidLoadAd:(APDBannerView *)bannerView isPrecache:(BOOL)precache { 65 | self.onAdLoaded ? self.onAdLoaded(@{@"isPreache": @(precache)}) : nil; 66 | if (self.bannerView.superview != self) { 67 | [self addSubview:self.bannerView]; 68 | } 69 | } 70 | 71 | - (void)bannerView:(APDBannerView *)bannerView didFailToLoadAdWithError:(NSError *)error { 72 | self.onAdFailedToLoad ? self.onAdFailedToLoad(@{@"error": error.localizedDescription}) : nil; 73 | } 74 | 75 | - (void)bannerViewExpired:(APDBannerView *)bannerView { 76 | self.onAdExpired ? self.onAdExpired(@{}) : nil; 77 | } 78 | 79 | - (void)bannerViewDidInteract:(APDBannerView *)bannerView { 80 | self.onAdClicked ? self.onAdClicked(@{}) : nil; 81 | } 82 | 83 | @end 84 | 85 | 86 | @implementation RNAppodealMrecView 87 | 88 | - (instancetype)initWithFrame:(CGRect)frame { 89 | if (self = [super initWithFrame:frame]) { 90 | self.bannerView = [[APDMRECView alloc] init]; 91 | self.bannerView.delegate = self; 92 | self.bannerView.frame = frame; 93 | 94 | [self.bannerView loadAd]; 95 | } 96 | return self; 97 | } 98 | 99 | - (void)setAdSize:(NSString *)adSize { 100 | [NSException raise:@"Unsupported method" 101 | format:@"RNAppodealMrecView doesn't supporting -setAdSize:"]; 102 | } 103 | 104 | @end 105 | 106 | -------------------------------------------------------------------------------- /ios/RNAppodealBannerViewManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNAppodealBannerViewManager.h 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 26/09/2019. 6 | // Copyright © 2019 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface RNAppodealBannerViewManager : RCTViewManager 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /ios/RNAppodealBannerViewManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // RNAppodealBannerViewManager.m 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 26/09/2019. 6 | // Copyright © 2019 Facebook. All rights reserved. 7 | // 8 | 9 | #import "RNAppodealBannerViewManager.h" 10 | #import "RNAppodealBannerView.h" 11 | 12 | #import 13 | #import 14 | #import 15 | 16 | 17 | @implementation RNAppodealBannerViewManager 18 | 19 | @synthesize bridge; 20 | 21 | RCT_EXPORT_MODULE(); 22 | 23 | - (UIView *)view { 24 | return [[RNAppodealBannerView alloc] initWithFrame:CGRectZero]; 25 | } 26 | 27 | RCT_REMAP_VIEW_PROPERTY(placement, _bannerView.placement, NSString) 28 | RCT_REMAP_VIEW_PROPERTY(usesSmartSizing, _bannerView.usesSmartSizing, BOOL) 29 | RCT_REMAP_VIEW_PROPERTY(adSize, adSize, NSString) 30 | 31 | RCT_EXPORT_VIEW_PROPERTY(onAdLoaded, RCTBubblingEventBlock) 32 | RCT_EXPORT_VIEW_PROPERTY(onAdFailedToLoad, RCTBubblingEventBlock) 33 | RCT_EXPORT_VIEW_PROPERTY(onAdClicked, RCTBubblingEventBlock) 34 | RCT_EXPORT_VIEW_PROPERTY(onAdExpired, RCTBubblingEventBlock) 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /ios/RNAppodealMrecViewManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNAppodealMrecViewManager.h 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 17.05.2023. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface RNAppodealMrecViewManager : RCTViewManager 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /ios/RNAppodealMrecViewManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // RNAppodealMrecViewManager.m 3 | // RNAppodeal 4 | // 5 | // Created by Stas Kochkin on 17.05.2023. 6 | // 7 | 8 | #import "RNAppodealMrecViewManager.h" 9 | #import "RNAppodealBannerView.h" 10 | 11 | 12 | @implementation RNAppodealMrecViewManager 13 | 14 | @synthesize bridge; 15 | 16 | RCT_EXPORT_MODULE(); 17 | 18 | - (UIView *)view { 19 | return [[RNAppodealMrecView alloc] initWithFrame:CGRectZero]; 20 | } 21 | 22 | RCT_REMAP_VIEW_PROPERTY(placement, _bannerView.placement, NSString) 23 | 24 | RCT_EXPORT_VIEW_PROPERTY(onAdLoaded, RCTBubblingEventBlock) 25 | RCT_EXPORT_VIEW_PROPERTY(onAdFailedToLoad, RCTBubblingEventBlock) 26 | RCT_EXPORT_VIEW_PROPERTY(onAdClicked, RCTBubblingEventBlock) 27 | RCT_EXPORT_VIEW_PROPERTY(onAdExpired, RCTBubblingEventBlock) 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-appodeal", 3 | "version": "3.5.0", 4 | "description": "React Native Module created to support Appodeal SDK for iOS and Android platforms", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/appodeal/react-native-appodeal.git" 8 | }, 9 | "homepage": "https://appodeal.com", 10 | "main": "src/index.ts", 11 | "directories": { 12 | "example": "example" 13 | }, 14 | "scripts": { 15 | "tsc": "tsc --project .", 16 | "prepare": "npm run tsc" 17 | }, 18 | "author": "Appodeal ", 19 | "license": "MIT", 20 | "peerDependencies": { 21 | "react": "*", 22 | "react-native": "*" 23 | }, 24 | "devDependencies": { 25 | "@types/react": "^18.0.21", 26 | "@types/react-native": "^0.70.6", 27 | "tslib": "^2.7.0", 28 | "typescript": "^5.5.4" 29 | }, 30 | "keywords": [ 31 | "react", 32 | "react-native", 33 | "react-component", 34 | "appodeal", 35 | "monetisation", 36 | "android", 37 | "ios", 38 | "ads" 39 | ], 40 | "files": [ 41 | "android", 42 | "ios", 43 | "src", 44 | "package.json", 45 | "dist", 46 | "RNAppodeal.podspec" 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /src/RNAppodeal.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | import { NativeModules, NativeEventEmitter, Platform } from "react-native"; 4 | import { 5 | AppodealLogLevel, 6 | AppodealConsentStatus, 7 | AppodealIOSPurchase, 8 | AppodealAndroidPurchase, 9 | AppodealReward, 10 | } from "./RNAppodealTypes"; 11 | 12 | const RNAppodeal = NativeModules.RNAppodeal; 13 | 14 | type Map = { [key: string]: any }; 15 | type EventHandler = (params?: any) => void; 16 | type Event = string; 17 | type AdType = number; 18 | 19 | const dummyHandler = () => {}; 20 | const emitter = new NativeEventEmitter(RNAppodeal); 21 | const subscriptions = new Map(); 22 | 23 | const _addEventListener = (event: Event, handler: EventHandler) => { 24 | let listener = emitter.addListener(event, handler); 25 | subscriptions.set(handler, listener); 26 | return { remove: () => _removeEventListener(event, handler) }; 27 | }; 28 | 29 | const _removeEventListener = (event: Event, handler: EventHandler) => { 30 | const listener = subscriptions.get(handler); 31 | listener.remove(); 32 | subscriptions.delete(handler); 33 | }; 34 | 35 | const _removeAllListeners = () => { 36 | subscriptions.forEach((listener, key, map) => { 37 | listener.remove(); 38 | map.delete(key); 39 | }); 40 | }; 41 | 42 | /** 43 | * Appodeal SDK interface 44 | */ 45 | export interface Appodeal { 46 | /** 47 | * Adds event listeners to Appodeal SDK 48 | * @param event Event name 49 | * @param handler Event listener callback handler 50 | */ 51 | addEventListener(event: Event, handler: EventHandler): void; 52 | /** 53 | * Removes listener for specific event 54 | * @param event Event name 55 | * @param handler Event handler 56 | */ 57 | removeEventListener(event: Event, handler: EventHandler): void; 58 | /** 59 | * Removes all event listener 60 | */ 61 | removeAllListeners(): void; 62 | /** 63 | * Initialize Appodeal SDK 64 | * @param appKey Application app key 65 | * @param adTypes Ad types mask 66 | */ 67 | initialize(appKey: string, adTypes: AdType): void; 68 | /** 69 | * Check that Appodeal SDK has been initialized for a given ad type mask 70 | * @param adTypes Ad type mask 71 | */ 72 | isInitialized(adTypes: AdType): boolean; 73 | /** 74 | * Shows an ad if it has been loaded 75 | * @param adTypes Ad type to be shown 76 | * @param placement Optional placement name 77 | */ 78 | show(adTypes: AdType, placement?: string): void; 79 | /** 80 | * Check if an ad is loaded 81 | * @param adTypes Ad types 82 | */ 83 | isLoaded(adTypes: AdType): boolean; 84 | /** 85 | * Check if an ad can be shown for placement 86 | * @param adTypes Ad types 87 | * @param placement Optional placement name 88 | */ 89 | canShow(adTypes: AdType, placement?: string): boolean; 90 | /** 91 | * Hides presented ad 92 | * @param adTypes Ad type mask 93 | */ 94 | hide(adTypes: AdType): void; 95 | /** 96 | * Starting cache of an ad for specific ad type 97 | * @param adTypes Ad types mask 98 | */ 99 | cache(adTypes: AdType): void; 100 | /** 101 | * Enables or disables autocache for specific ad type 102 | * @param adTypes Ad types masl 103 | * @param value Boolean flag indicating whether the autocache should be enabled or not 104 | */ 105 | setAutoCache(adTypes: AdType, value: boolean): void; 106 | /** 107 | * Check that loaded ad is precache or not 108 | * @param adTypes Ad type 109 | */ 110 | isPrecache(adTypes: AdType): boolean; 111 | /** 112 | * Force SDK use 728x90 or 320x50 banner size for top and bottom banner presentation size 113 | * @param value Boolean flag indicating tablet or phone banner size 114 | */ 115 | setTabletBanners(value: boolean): void; 116 | /** 117 | * Enables or disables smart sizing that fills full width for banners 118 | * @param value Boolean flag indicating smart sizing supported 119 | */ 120 | setSmartBanners(value: boolean): void; 121 | /** 122 | * Enables or disables banners refresh animation 123 | * @param value Boolean flag indicating banner refresh animation enabled 124 | */ 125 | setBannerAnimation(value: boolean): void; 126 | /** 127 | * Sets that application is for kids 128 | * @param value Boolean flag indicating child directed treatment 129 | */ 130 | setChildDirectedTreatment(value: boolean): void; 131 | /** 132 | * Returns current user consent status 133 | */ 134 | consentStatus(): AppodealConsentStatus; 135 | /** 136 | * Revokes user consent 137 | */ 138 | revokeConsent(): void; 139 | /** 140 | * Request consent parameters 141 | * @param appKey Appodeal app key 142 | */ 143 | requestConsentInfoUpdate(appKey: string): Promise; 144 | /** 145 | * Shows consent form if consent status is REQUIRED 146 | */ 147 | showConsentFormIfNeeded(): Promise; 148 | /** 149 | * Shows consent form 150 | */ 151 | showConsentForm(): Promise; 152 | /** 153 | * Enables or disables test mode 154 | * @param value Boolean flag indicating test mode 155 | */ 156 | setTesting(value: boolean): void; 157 | /** 158 | * Sets level of logged messages 159 | * @param value Log level 160 | */ 161 | setLogLevel(value: AppodealLogLevel): void; 162 | /** 163 | * Enables or disables firing of callback on load in case precache ad was loaded 164 | * @param adTypes Ad type 165 | * @param value Boolean flag indicating precache callbacks activity 166 | */ 167 | setTriggerPrecacheCallbacks(adTypes: AdType, value: boolean): void; 168 | /** 169 | * Disables ad network for specific ad types 170 | * @param network Network status 171 | * @param adTypes Ad type mask 172 | */ 173 | disableNetwork(network: string, adTypes: AdType): void; 174 | /** 175 | * Get Appodeal SDK version 176 | */ 177 | getVersion(): string; 178 | /** 179 | * Set user identifier 180 | * @param id App specific user id 181 | */ 182 | setUserId(id: string): void; 183 | /** 184 | * Set extras value in Appodeal SDK 185 | * @param value Nullable extras value 186 | * @param key Nonnull extras key 187 | */ 188 | setExtrasValue(value: any | null, key: string): void; 189 | /** 190 | * Get Appodeal SDK extras 191 | */ 192 | getExtras(): Map; 193 | /** 194 | * Set custom state value in Appodeal SDK 195 | * @param value Nullable custom state value 196 | * @param key Nonnull custom state key 197 | */ 198 | setCustomStateValue(value: any | null, key: string): void; 199 | /** 200 | * Get Appodeal SDK custom state 201 | */ 202 | getCustomState(): Map; 203 | /** 204 | * Returns reward parameters for given placement 205 | * @param placement Placement name 206 | */ 207 | getRewardParameters(placement: string): AppodealReward; 208 | /** 209 | * Returns predicted eCPM of loaded ad for ad type 210 | * @param adType Ad type 211 | * @param callback Callback returning predicted eCPM 212 | */ 213 | predictedEcpm(adType: AdType): number; 214 | /** 215 | * Track in app purchase 216 | * @param amount Purchase amount 217 | * @param currency Purchase currency 218 | */ 219 | trackInAppPurchase(amount: number, currency: string): void; 220 | /** 221 | * Validate and track in app purchase 222 | * @param purchase Purchased product info 223 | */ 224 | validateAndTrackInAppPurchase( 225 | purchase: AppodealAndroidPurchase | AppodealIOSPurchase, 226 | callback?: EventHandler 227 | ): void; 228 | /** 229 | * Track in app event 230 | * @param name Event name 231 | * @param parameters Optional additional parameters 232 | */ 233 | trackEvent(name: string, parameters?: Map): void; 234 | 235 | /** 236 | * Set self-hosted Bidon environment endpoint 237 | * @param endpoint Bidon environment endpoint 238 | */ 239 | setBidonEndpoint(endpoint: string): void; 240 | 241 | /** 242 | * Get self-hosted Bidon environment endpoint 243 | * @returns Bidon environment endpoint 244 | */ 245 | getBidonEndpoint(): string | null; 246 | } 247 | 248 | const appodeal: Appodeal = { 249 | addEventListener: (event: Event, handler: EventHandler): void => { 250 | _addEventListener(event, handler); 251 | }, 252 | 253 | removeEventListener: (event: Event, handler: EventHandler): void => { 254 | _removeEventListener(event, handler); 255 | }, 256 | 257 | removeAllListeners: (): void => { 258 | _removeAllListeners(); 259 | }, 260 | 261 | initialize: (appKey: string, adTypes: AdType): void => { 262 | RNAppodeal.initializeWithAppKey(appKey, adTypes); 263 | }, 264 | 265 | isInitialized: (adTypes: AdType): boolean => { 266 | return RNAppodeal.isInitialized(adTypes); 267 | }, 268 | 269 | show: (adTypes: AdType, placement?: string): void => { 270 | RNAppodeal.show(adTypes, placement || null); 271 | }, 272 | 273 | isLoaded: (adTypes: AdType): boolean => { 274 | return RNAppodeal.isLoaded(adTypes); 275 | }, 276 | 277 | canShow: (adTypes: AdType, placement?: string): boolean => { 278 | return RNAppodeal.canShow(adTypes, placement || null); 279 | }, 280 | 281 | hide: (adTypes: AdType): void => { 282 | RNAppodeal.hide(adTypes); 283 | }, 284 | 285 | cache: (adTypes: AdType): void => { 286 | RNAppodeal.cache(adTypes); 287 | }, 288 | 289 | setAutoCache: (adTypes: AdType, value: boolean): void => { 290 | RNAppodeal.setAutoCache(adTypes, value); 291 | }, 292 | 293 | isPrecache: (adTypes: AdType): boolean => { 294 | return RNAppodeal.isPrecache(adTypes); 295 | }, 296 | 297 | setTabletBanners: (value: boolean): void => { 298 | RNAppodeal.setTabletBanners(value); 299 | }, 300 | 301 | setSmartBanners: (value: boolean): void => { 302 | RNAppodeal.setSmartBanners(value); 303 | }, 304 | 305 | setBannerAnimation: (value: boolean): void => { 306 | RNAppodeal.setBannerAnimation(value); 307 | }, 308 | 309 | consentStatus: (): AppodealConsentStatus => { 310 | return RNAppodeal.consentStatus(); 311 | }, 312 | 313 | revokeConsent: (): void => { 314 | RNAppodeal.revokeConsent(); 315 | }, 316 | 317 | requestConsentInfoUpdate: ( 318 | appKey: string 319 | ): Promise => { 320 | return RNAppodeal.requestConsentInfoUpdateWithAppKey(appKey).then( 321 | (parameters) => parameters.status 322 | ); 323 | }, 324 | 325 | showConsentFormIfNeeded: (): Promise => { 326 | return RNAppodeal.showConsentFormIfNeeded().then( 327 | (parameters) => parameters.status 328 | ); 329 | }, 330 | 331 | showConsentForm: () => { 332 | return RNAppodeal.showConsentForm().then( 333 | (parameters) => parameters.status 334 | ); 335 | }, 336 | 337 | setChildDirectedTreatment: (value: boolean): void => { 338 | RNAppodeal.setChildDirectedTreatment(value); 339 | }, 340 | 341 | setTesting: (value: boolean): void => { 342 | RNAppodeal.setTesting(value); 343 | }, 344 | 345 | setLogLevel: (value: AppodealLogLevel): void => { 346 | RNAppodeal.setLogLevel(value); 347 | }, 348 | 349 | setTriggerPrecacheCallbacks: (adTypes: AdType, value: boolean): void => { 350 | RNAppodeal.setTriggerPrecacheCallbacks(adTypes, value); 351 | }, 352 | 353 | disableNetwork: (network: string, adTypes: AdType): void => { 354 | RNAppodeal.disableNetwork(network, adTypes); 355 | }, 356 | 357 | getVersion: (): string => { 358 | return RNAppodeal.getVersion(); 359 | }, 360 | 361 | setUserId: (id: string): void => { 362 | RNAppodeal.setUserId(id); 363 | }, 364 | 365 | setExtrasValue: (value: any | null, key: string): void => { 366 | if (Platform.OS == "ios") { 367 | RNAppodeal.setExtrasValue(value, key); 368 | } else if (typeof value === "string") { 369 | RNAppodeal.setExtrasStringValue(value, key); 370 | } else if (typeof value === "number" && Number.isInteger(value)) { 371 | RNAppodeal.setExtrasIntegerValue(value, key); 372 | } else if (typeof value === "number") { 373 | RNAppodeal.setExtrasDoubleValue(value, key); 374 | } else if (typeof value === "boolean") { 375 | RNAppodeal.setExtrasBooleanValue(value, key); 376 | } else if (typeof value === "object") { 377 | RNAppodeal.setExtrasMapValue(value, key); 378 | } else if (value === null) { 379 | RNAppodeal.removeExtrasValue(key); 380 | } 381 | }, 382 | 383 | getExtras: (): Map => { 384 | return RNAppodeal.getExtras(); 385 | }, 386 | 387 | setCustomStateValue: (value: any | null, key: string): void => { 388 | if (Platform.OS == "ios") { 389 | RNAppodeal.setCustomStateValue(value, key); 390 | } else if (typeof value === "string") { 391 | RNAppodeal.setCustomStateStringValue(value, key); 392 | } else if (typeof value === "number" && Number.isInteger(value)) { 393 | RNAppodeal.setCustomStateIntegerValue(value, key); 394 | } else if (typeof value === "number") { 395 | RNAppodeal.setCustomStateDoubleValue(value, key); 396 | } else if (typeof value === "boolean") { 397 | RNAppodeal.setCustomStateBooleanValue(value, key); 398 | } else if (value === null) { 399 | RNAppodeal.removeCustomStateValue(key); 400 | } 401 | }, 402 | 403 | getCustomState: (): Map => { 404 | return RNAppodeal.getCustomState(); 405 | }, 406 | 407 | getRewardParameters: (placement: string): AppodealReward => { 408 | return RNAppodeal.getRewardParameters(placement); 409 | }, 410 | 411 | predictedEcpm: (adType: AdType): number => { 412 | return RNAppodeal.predictedEcpm(adType); 413 | }, 414 | 415 | trackInAppPurchase: (amount: number, currency: string) => { 416 | RNAppodeal.trackInAppPurchase(amount, currency); 417 | }, 418 | 419 | validateAndTrackInAppPurchase: ( 420 | purchase: AppodealIOSPurchase | AppodealAndroidPurchase, 421 | callback?: EventHandler 422 | ) => { 423 | RNAppodeal.validateAndTrackInAppPurchase( 424 | purchase, 425 | callback || dummyHandler 426 | ); 427 | }, 428 | 429 | trackEvent: (name: string, parameters?: Map) => { 430 | RNAppodeal.trackEvent(name, parameters || null); 431 | }, 432 | 433 | setBidonEndpoint: (endpoint: string): void => { 434 | RNAppodeal.setBidonEndpoint(endpoint); 435 | }, 436 | 437 | getBidonEndpoint: (): string | null => { 438 | return RNAppodeal.getBidonEndpoint(); 439 | }, 440 | }; 441 | 442 | export default appodeal; 443 | -------------------------------------------------------------------------------- /src/RNAppodealBanner.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { requireNativeComponent, StyleProp, ViewStyle } from 'react-native'; 3 | 4 | 5 | interface AppodealBannerProps { 6 | adSize: AdSize, 7 | placement?: string, 8 | usesSmartSizing?: boolean 9 | onAdLoaded?: Function, 10 | onAdFailedToLoad?: Function, 11 | onAdClicked?: Function, 12 | onAdExpired?: Function, 13 | style?: StyleProp 14 | } 15 | 16 | type AdSize = 'phone' | 'tablet'; 17 | 18 | interface NativeAppodealBannerProps { 19 | adSize: AdSize, 20 | placement?: string, 21 | usesSmartSizing?: boolean, 22 | onAdLoaded?: Function, 23 | onAdFailedToLoad?: Function, 24 | onAdClicked?: Function, 25 | onAdExpired?: Function, 26 | style?: StyleProp, 27 | } 28 | 29 | const RNAppodealBannerView = requireNativeComponent('RNAppodealBannerView'); 30 | 31 | const AppodealBanner = (props: AppodealBannerProps) => { 32 | const { 33 | adSize, 34 | placement, 35 | usesSmartSizing, 36 | onAdLoaded, 37 | onAdFailedToLoad, 38 | onAdClicked, 39 | onAdExpired, 40 | style, 41 | ...restProps 42 | } = props 43 | 44 | const height: Record = { 45 | phone: 50, 46 | tablet: 90 47 | }; 48 | 49 | return ( 50 | 61 | ); 62 | } 63 | 64 | export default AppodealBanner; 65 | -------------------------------------------------------------------------------- /src/RNAppodealMrec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { requireNativeComponent, StyleProp, ViewStyle } from 'react-native'; 3 | 4 | 5 | interface AppodealMrecProps { 6 | placement?: string, 7 | onAdLoaded?: Function, 8 | onAdFailedToLoad?: Function, 9 | onAdClicked?: Function, 10 | onAdExpired?: Function, 11 | style?: StyleProp 12 | } 13 | 14 | 15 | interface NativeAppodealMrecProps { 16 | placement?: string, 17 | onAdLoaded?: Function, 18 | onAdFailedToLoad?: Function, 19 | onAdClicked?: Function, 20 | onAdExpired?: Function, 21 | style?: StyleProp, 22 | } 23 | 24 | 25 | const RNAppodealMrecView = requireNativeComponent('RNAppodealMrecView'); 26 | 27 | const AppodealMrec = (props: AppodealMrecProps) => { 28 | const { 29 | placement, 30 | onAdLoaded, 31 | onAdFailedToLoad, 32 | onAdClicked, 33 | onAdExpired, 34 | style, 35 | ...restProps 36 | } = props 37 | 38 | return ( 39 | 48 | ); 49 | } 50 | 51 | export default AppodealMrec; -------------------------------------------------------------------------------- /src/RNAppodealTypes.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | export interface AdTypeType { 4 | readonly NONE: number, 5 | readonly BANNER: number, 6 | readonly INTERSTITIAL: number, 7 | readonly BANNER_BOTTOM: number, 8 | readonly BANNER_TOP: number, 9 | readonly REWARDED_VIDEO: number, 10 | readonly MREC: number 11 | } 12 | 13 | type Map = { [key: string]: any }; 14 | 15 | export const AppodealAdType: AdTypeType = { 16 | NONE: 0, 17 | INTERSTITIAL: 1 << 0, 18 | BANNER: 1 << 2, 19 | BANNER_BOTTOM: 1 << 3, 20 | BANNER_TOP: 1 << 4, 21 | REWARDED_VIDEO: 1 << 5, 22 | MREC: 1 << 8. 23 | } 24 | 25 | export enum AppodealLogLevel { 26 | NONE = 'none', 27 | DEBUG = 'debug', 28 | VERBOSE = 'verbose' 29 | } 30 | 31 | export enum AppodealGender { 32 | OTHER = 0, 33 | FEMALE = 1, 34 | MALE = 2, 35 | } 36 | 37 | export enum AppodealConsentStatus { 38 | UNKNOWN = 0, 39 | REQUIRED = 1, 40 | NOT_REQUIRED = 2, 41 | OBTAINED = 3 42 | } 43 | 44 | export interface AppodealReward { 45 | name: string, 46 | amount: string 47 | } 48 | 49 | export interface AppodealIOSPurchase { 50 | productId: string, 51 | productType: AppodealIOSPurchaseType, 52 | price: number, 53 | currency: string, 54 | transactionId: string, 55 | additionalParameters: Map | null 56 | } 57 | 58 | export enum AppodealIOSPurchaseType { 59 | CONSUMABLE = 0, 60 | NON_CONSUMABLE = 1, 61 | AUTO_RENEWABLE_SUBSCRIPTION = 2, 62 | NON_RENEWING_SUBSCRIPTION = 3 63 | } 64 | 65 | export interface AppodealAndroidPurchase { 66 | publicKey: string, 67 | productType: AppodealAndroidPurchaseType, 68 | signature: string, 69 | purchaseData: string, 70 | purchaseToken: string, 71 | timestamp: number, 72 | developerPayload: string, 73 | price: string, 74 | currency: string, 75 | orderId: string, 76 | sku: string, 77 | additionalParameters: Map | null 78 | } 79 | 80 | export enum AppodealAndroidPurchaseType { 81 | IN_APP = 0, 82 | SUBSCRIPTION = 1 83 | } 84 | 85 | export interface AppodealAdRevenue { 86 | networkName: string, 87 | adUnitName: string, 88 | placement: string, 89 | revenuePrecision: string, 90 | demandSource: string, 91 | currency: string, 92 | revenue: number, 93 | adType: AdTypeType 94 | } -------------------------------------------------------------------------------- /src/events/appodeal.ts: -------------------------------------------------------------------------------- 1 | export const INITIALIZED = "onAppodealInitialized"; 2 | export const AD_REVENUE = "onAppodealDidReceiveRevenue"; -------------------------------------------------------------------------------- /src/events/banner.ts: -------------------------------------------------------------------------------- 1 | export const LOADED = 'onBannerLoaded' 2 | export const FAILED_TO_LOAD = 'onBannerFailedToLoad' 3 | export const EXPIRED = 'onBannerExpired' 4 | export const SHOWN = 'onBannerShown' 5 | export const CLICKED = 'onBannerClicked' -------------------------------------------------------------------------------- /src/events/interstiital.ts: -------------------------------------------------------------------------------- 1 | export const LOADED = 'onInterstitialLoaded' 2 | export const FAILED_TO_LOAD = 'onInterstitialFailedToLoad' 3 | export const EXPIRED = 'onInterstitialExpired' 4 | export const SHOWN = 'onInterstitialShown' 5 | export const FAILED_TO_SHOW = 'onInterstitialFaliedToShow' 6 | export const CLICKED = 'onInterstitialClicked' 7 | export const CLOSED = 'onInterstitialClosed' -------------------------------------------------------------------------------- /src/events/rewarded.ts: -------------------------------------------------------------------------------- 1 | export const LOADED = 'onRewardedVideoLoaded' 2 | export const FAILED_TO_LOAD = 'onRewardedVideoFailedToLoad' 3 | export const EXPIRED = 'onRewardedVideoExpired' 4 | export const SHOWN = 'onRewardedVideoShown' 5 | export const FAILED_TO_SHOW = 'onRewardedVideoFailedToShow' 6 | export const CLOSED = 'onRewardedVideoClosed' 7 | export const REWARD = 'onRewardedVideoFinished' 8 | export const CLICKED = 'onRewardedVideoClicked' 9 | 10 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { default as Appodeal } from './RNAppodeal'; 2 | import { default as AppodealBanner } from './RNAppodealBanner'; 3 | import { default as AppodealMrec } from './RNAppodealMrec'; 4 | 5 | import { 6 | AppodealAdType, 7 | AppodealLogLevel, 8 | AppodealGender, 9 | AppodealConsentStatus, 10 | AppodealAndroidPurchase, 11 | AppodealAndroidPurchaseType, 12 | AppodealIOSPurchase, 13 | AppodealIOSPurchaseType, 14 | AppodealReward, 15 | AppodealAdRevenue 16 | } from './RNAppodealTypes'; 17 | 18 | import * as AppodealInterstitialEvent from './events/interstiital'; 19 | import * as AppodealRewardedEvent from './events/rewarded'; 20 | import * as AppodealBannerEvent from './events/banner'; 21 | import * as AppodealSdkEvent from './events/appodeal'; 22 | 23 | 24 | export { 25 | Appodeal, 26 | AppodealBanner, 27 | AppodealMrec, 28 | AppodealAdType, 29 | AppodealLogLevel, 30 | AppodealGender, 31 | AppodealConsentStatus, 32 | AppodealAndroidPurchase, 33 | AppodealAndroidPurchaseType, 34 | AppodealIOSPurchase, 35 | AppodealIOSPurchaseType, 36 | AppodealReward, 37 | AppodealAdRevenue, 38 | AppodealInterstitialEvent, 39 | AppodealRewardedEvent, 40 | AppodealBannerEvent, 41 | AppodealSdkEvent, 42 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react", 4 | "target": "es2015", 5 | "lib": [ "es2017" ], 6 | "skipLibCheck": true, 7 | "importHelpers": true, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "declaration": true, 13 | "declarationDir": "dist/types", 14 | "outDir": "dist/lib", 15 | "typeRoots": ["node_modules/@types"] 16 | }, 17 | "include": ["src"], 18 | "exclude": [ 19 | "node_modules", 20 | "dist", 21 | "ios", 22 | "android", 23 | "example" 24 | ] 25 | } --------------------------------------------------------------------------------