Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: v3.4 #273

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@nativescript/firebase-performance": "file:../../packages/firebase-performance",
"@nativescript/firebase-remote-config": "file:../../packages/firebase-remote-config",
"@nativescript/firebase-storage": "file:../../packages/firebase-storage",
"@nativescript/google-signin": "^1.0.0-alpha.9",
"@nativescript/google-signin": "~2.1.0",
"@nativescript/firebase-app-check-debug": "file:../../packages/firebase-app-check-debug",
"@nativescript/firebase-messaging-core": "file:../../packages/firebase-messaging-core",
"@nativescript/firebase-ui": "file:../../packages/firebase-ui"
Expand Down
10 changes: 2 additions & 8 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@
"inputs": ["production", "^production"],
"cache": true
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
},
"build.all": {
"cache": true
},
"test": {
"cache": true
},
"e2e": {
"@nx/eslint:lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plugins",
"version": "3.3.2",
"version": "3.4.0-alpha.1",
"license": "MIT",
"scripts": {
"postinstall": "husky && npx ts-patch install",
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase-admob/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,12 @@ export class Admob implements IAdmob {

if (typeof requestConfiguration?.tagForChildDirectedTreatment === 'boolean') {
this._requestConfiguration.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;
GADMobileAds.sharedInstance().requestConfiguration.tagForChildDirectedTreatment(requestConfiguration.tagForChildDirectedTreatment);
GADMobileAds.sharedInstance().requestConfiguration.tagForChildDirectedTreatment = Number(requestConfiguration.tagForChildDirectedTreatment);
}

if (typeof requestConfiguration?.tagForUnderAgeOfConsent === 'boolean') {
this._requestConfiguration.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;
GADMobileAds.sharedInstance().requestConfiguration.tagForUnderAgeOfConsent(requestConfiguration.tagForUnderAgeOfConsent);
GADMobileAds.sharedInstance().requestConfiguration.tagForUnderAgeOfConsent = Number(requestConfiguration.tagForUnderAgeOfConsent);
}

if (Array.isArray(requestConfiguration?.testDevices)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase-admob/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nativescript/firebase-admob",
"version": "3.3.2",
"version": "3.4.0-alpha.1",
"description": "NativeScript Firebase - Admob",
"main": "index",
"typings": "index.d.ts",
Expand Down
Binary file modified packages/firebase-admob/platforms/android/firebase_admob.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/firebase-admob/platforms/android/include.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
implementation 'com.google.android.gms:play-services-ads:21.5.0'
implementation 'com.google.android.gms:play-services-ads:23.5.0'
implementation 'com.google.android.ump:user-messaging-platform:2.0.0'
implementation 'androidx.core:core-ktx:1.6.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ package org.nativescript.firebase.admob
import android.app.Activity
import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.location.Location
import android.os.Bundle
import android.os.Handler
import android.os.Looper
Expand All @@ -16,7 +13,6 @@ import com.google.ads.mediation.admob.AdMobAdapter
import com.google.android.gms.ads.*
import com.google.android.gms.ads.admanager.AdManagerAdRequest
import com.google.android.gms.ads.formats.AdManagerAdViewOptions
import com.google.android.gms.ads.formats.ShouldDelayBannerRenderingListener
import com.google.android.gms.ads.initialization.AdapterStatus
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback
import com.google.android.gms.ads.nativead.NativeAdOptions
Expand Down Expand Up @@ -446,14 +442,14 @@ class FirebaseAdmob {
)
}

if (it.has(AD_MANAGER_AD_VIEW_OPTIONS_SHOULD_DELAY_BANNER_RENDERING_KEY)) {
options.setShouldDelayBannerRenderingListener(object :
ShouldDelayBannerRenderingListener {
override fun shouldDelayBannerRendering(p0: Runnable): Boolean {
return it.getBoolean(AD_MANAGER_AD_VIEW_OPTIONS_SHOULD_DELAY_BANNER_RENDERING_KEY)
}
})
}
// if (it.has(AD_MANAGER_AD_VIEW_OPTIONS_SHOULD_DELAY_BANNER_RENDERING_KEY)) {
// options.setShouldDelayBannerRenderingListener(object :
// ShouldDelayBannerRenderingListener {
// override fun shouldDelayBannerRendering(p0: Runnable): Boolean {
// return it.getBoolean(AD_MANAGER_AD_VIEW_OPTIONS_SHOULD_DELAY_BANNER_RENDERING_KEY)
// }
// })
// }
adLoader.withAdManagerAdViewOptions(options.build())

}
Expand Down Expand Up @@ -825,10 +821,50 @@ class FirebaseAdmob {
}
}

private fun buildManagerRequest(adRequest: AdManagerAdRequest.Builder, request: String) {
try {
val json = JSONObject(request)
if (json.has(CONTENT_URL_KEY)) {
adRequest.setContentUrl(
json.getString(CONTENT_URL_KEY)
)
}

json.optJSONArray(KEYWORDS_KEY)?.let {
for (i in 0 until it.length()) {
adRequest.addKeyword(it.getString(i))
}
}

val extras = Bundle()


if (json.has(REQUEST_NON_PERSONALIZED_ADS_ONLY_KEY)) {
extras.putString("npa", "1")
}

json.optJSONObject(NETWORK_EXTRAS_KEY)?.let {
for (key in it.keys()) {
extras.putString(
key, it.getString(key)
)
}
}

adRequest.addNetworkExtrasBundle(AdMobAdapter::class.java, extras)

if (json.has(REQUEST_AGENT_KEY)) {
adRequest.setRequestAgent(json.getString(REQUEST_AGENT_KEY))
}

} catch (e: Exception) {
}
}

private fun buildAdManagerRequest(request: String): AdManagerAdRequest {
val adRequest = AdManagerAdRequest.Builder()

buildRequest(adRequest, request)
buildManagerRequest(adRequest, request)
try {
val json = JSONObject(request)

Expand Down
3 changes: 2 additions & 1 deletion packages/firebase-admob/platforms/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
use_frameworks!
pod 'Google-Mobile-Ads-SDK', '~> 10.2.0'
platform :ios, '12.0'
pod 'Google-Mobile-Ads-SDK', '~> 11.12.0'
Loading