diff --git a/README.md b/README.md index 73ca84d6..3b8929b9 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ When using The New Architecture, some legacy code will still be used though. See | iOS | Full Screen Ads (Turbo Native Module) | ✅ Complete | | iOS | User Messaging Platform (Turbo Native Module) | ⏳ To-Do | | iOS | EventEmitter (Turbo Native Module) | ⏳ To-Do | -| iOS | Revenue Precision Constants (Turbo Native Module) | ⏳ To-Do | +| iOS | Revenue Precision Constants (Turbo Native Module) | ✅ Complete | | Android | Mobile Ads SDK Methods (Turbo Native Module) | ⏳ To-Do | | Android | Banners (Fabric Native Component) | ⏳ To-Do | | Android | Full Screen Ads (Turbo Native Module) | ⏳ To-Do | diff --git a/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java b/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java index 89cf6f6f..5c1e0163 100644 --- a/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +++ b/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java @@ -21,7 +21,6 @@ import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReadableMap; -import com.google.android.gms.ads.AdValue; import io.invertase.googlemobileads.common.RCTConvert; import io.invertase.googlemobileads.common.ReactNativeEvent; import io.invertase.googlemobileads.common.ReactNativeEventEmitter; @@ -150,29 +149,4 @@ public void preferencesClearAll(Promise promise) { ReactNativePreferences.getSharedInstance().clearAll(); promise.resolve(null); } - - @Override - public Map getConstants() { - Map constants = new HashMap<>(); - // List> appsList = new ArrayList<>(); - // List reactNativeApps = ReactNativeApp.getApps(getReactApplicationContext()); - - // for (ReactNativeApp app : reactNativeApps) { - // appsList.add(RCTConvertFirebase.reactNativeAppToMap(app)); - // } - - // constants.put("NATIVE_FIREBASE_APPS", appsList); - - // constants.put("FIREBASE_RAW_JSON", ReactNativeJSON.getSharedInstance().getRawJSON()); - - // Precision types in ad revenue events. - // See: - // https://developers.google.com/android/reference/com/google/android/gms/ads/AdValue.PrecisionType - constants.put("REVENUE_PRECISION_UNKNOWN", AdValue.PrecisionType.UNKNOWN); - constants.put("REVENUE_PRECISION_ESTIMATED", AdValue.PrecisionType.ESTIMATED); - constants.put("REVENUE_PRECISION_PUBLISHER_PROVIDED", AdValue.PrecisionType.PUBLISHER_PROVIDED); - constants.put("REVENUE_PRECISION_PRECISE", AdValue.PrecisionType.PRECISE); - - return constants; - } } diff --git a/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt b/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt index 29c57164..aedc2daa 100644 --- a/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +++ b/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt @@ -23,6 +23,7 @@ import com.google.android.gms.ads.initialization.OnInitializationCompleteListene import com.google.android.gms.ads.RequestConfiguration import com.google.android.gms.ads.AdInspectorError import com.google.android.gms.ads.AdRequest +import com.google.android.gms.ads.AdValue; import com.google.android.gms.ads.OnAdInspectorClosedListener private const val SERVICE = "RNGoogleMobileAdsModule"; @@ -33,6 +34,18 @@ class ReactNativeGoogleMobileAdsModule( override fun getName() = SERVICE + override fun getConstants(): Map { + return mapOf( + // Precision types in ad revenue events. + // See: + // https://developers.google.com/android/reference/com/google/android/gms/ads/AdValue.PrecisionType + "REVENUE_PRECISION_UNKNOWN" to AdValue.PrecisionType.UNKNOWN, + "REVENUE_PRECISION_ESTIMATED" to AdValue.PrecisionType.ESTIMATED, + "REVENUE_PRECISION_PUBLISHER_PROVIDED" to AdValue.PrecisionType.PUBLISHER_PROVIDED, + "REVENUE_PRECISION_PRECISE" to AdValue.PrecisionType.PRECISE + ) + } + private fun buildRequestConfiguration( requestConfiguration: ReadableMap ): RequestConfiguration { diff --git a/src/common/constants.ts b/src/common/constants.ts index 7a004025..b0020581 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -7,12 +7,6 @@ const { REVENUE_PRECISION_UNKNOWN, } = RNGoogleMobileAdsModule.getConstants?.() ?? {}; -console.log('hiiii'); -console.log('REVENUE_PRECISION_ESTIMATED', REVENUE_PRECISION_ESTIMATED); -console.log('REVENUE_PRECISION_PRECISE', REVENUE_PRECISION_PRECISE); -console.log('REVENUE_PRECISION_PUBLISHER_PROVIDED', REVENUE_PRECISION_PUBLISHER_PROVIDED); -console.log('REVENUE_PRECISION_UNKNOWN', REVENUE_PRECISION_UNKNOWN); - export enum RevenuePrecisions { ESTIMATED = REVENUE_PRECISION_ESTIMATED, PRECISE = REVENUE_PRECISION_PRECISE,