Skip to content

Commit

Permalink
feat: upgrade dependencies
Browse files Browse the repository at this point in the history
closes: #131
closes: #130
closes: #129
closes: #127
closes: #123
closes: #51
  • Loading branch information
triniwiz committed Sep 21, 2022
1 parent 8b4f102 commit 6b44588
Show file tree
Hide file tree
Showing 62 changed files with 2,226 additions and 2,171 deletions.
38 changes: 19 additions & 19 deletions packages/firebase-admob/adsconsent/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ import { AdsConsentBase, AdsConsentDebugGeography, AdsConsentStatus } from './co
export { AdsConsentStatus, AdsConsentDebugGeography };

export class AdsConsent extends AdsConsentBase {
static #geography: AdsConsentDebugGeography;
static #deviceIds: string[];
static #tagForUnderAgeOfConsent: boolean;
static #consentForm: com.google.android.ump.ConsentForm;
static #consentInfo: com.google.android.ump.ConsentInformation;
static _geography: AdsConsentDebugGeography;
static _deviceIds: string[];
static _tagForUnderAgeOfConsent: boolean;
static _consentForm: com.google.android.ump.ConsentForm;
static _consentInfo: com.google.android.ump.ConsentInformation;
static reset() {
org.nativescript.firebase.admob.FirebaseAdmob.AdConsent.reset(Utils.android.getApplicationContext());
}
static addTestDevices(deviceIds: string[]) {
this.#deviceIds = deviceIds;
this._deviceIds = deviceIds;
}
static getStatus(): AdsConsentStatus {
return org.nativescript.firebase.admob.FirebaseAdmob.AdConsent.getStatus(Utils.android.getApplicationContext()) as any;
}
static requestInfoUpdate(): Promise<void> {
return new Promise((resolve, reject) => {
const info = {};
if (this.#geography) {
info['geography'] = this.#geography;
if (this._geography) {
info['geography'] = this._geography;
}

if (this.#deviceIds) {
info['deviceIds'] = this.#deviceIds;
if (this._deviceIds) {
info['deviceIds'] = this._deviceIds;
}

if (typeof this.#tagForUnderAgeOfConsent === 'boolean') {
info['tagForUnderAgeOfConsent'] = this.#tagForUnderAgeOfConsent;
if (typeof this._tagForUnderAgeOfConsent === 'boolean') {
info['tagForUnderAgeOfConsent'] = this._tagForUnderAgeOfConsent;
}

org.nativescript.firebase.admob.FirebaseAdmob.AdConsent.requestInfoUpdate(
Expand All @@ -49,24 +49,24 @@ export class AdsConsent extends AdsConsentBase {
});
}
static setDebugGeography(geography: AdsConsentDebugGeography) {
this.#geography = geography;
this._geography = geography;
}
static setTagForUnderAgeOfConsent(tag: boolean) {
this.#tagForUnderAgeOfConsent = tag;
this._tagForUnderAgeOfConsent = tag;
}

static isConsentFormAvailable() {
if (!this.#consentInfo) {
this.#consentInfo = com.google.android.ump.UserMessagingPlatform.getConsentInformation(Utils.android.getApplicationContext());
if (!this._consentInfo) {
this._consentInfo = com.google.android.ump.UserMessagingPlatform.getConsentInformation(Utils.android.getApplicationContext());
}
return this.#consentInfo.isConsentFormAvailable();
return this._consentInfo.isConsentFormAvailable();
}

static showForm(): Promise<void> {
return new Promise((resolve, reject) => {
org.nativescript.firebase.admob.FirebaseAdmob.AdConsent.show(
Application.android.foregroundActivity || Application.android.startActivity,
this.#consentForm,
this._consentForm,
new org.nativescript.firebase.admob.FirebaseAdmob.Callback<java.lang.Void>({
onSuccess(val) {
resolve();
Expand All @@ -85,7 +85,7 @@ export class AdsConsent extends AdsConsentBase {
Utils.android.getApplicationContext(),
new org.nativescript.firebase.admob.FirebaseAdmob.Callback<com.google.android.ump.ConsentForm>({
onSuccess(form) {
AdsConsent.#consentForm = form;
AdsConsent._consentForm = form;
resolve();
},
onError(error) {
Expand Down
30 changes: 15 additions & 15 deletions packages/firebase-admob/adsconsent/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { AdsConsentBase, AdsConsentDebugGeography, AdsConsentStatus } from './co
export { AdsConsentStatus, AdsConsentDebugGeography };

export class AdsConsent extends AdsConsentBase {
static #geography: AdsConsentDebugGeography;
static #deviceIds: string[];
static #tagForUnderAgeOfConsent: boolean;
static #consentForm: UMPConsentForm;
static _geography: AdsConsentDebugGeography;
static _deviceIds: string[];
static _tagForUnderAgeOfConsent: boolean;
static _consentForm: UMPConsentForm;
static reset() {
UMPConsentInformation.sharedInstance.reset();
}
static addTestDevices(deviceIds: string[]) {
this.#deviceIds = deviceIds;
this._deviceIds = deviceIds;
}
static getStatus(): AdsConsentStatus {
switch (UMPConsentInformation.sharedInstance.consentStatus) {
Expand All @@ -30,7 +30,7 @@ export class AdsConsent extends AdsConsentBase {
static requestInfoUpdate(): Promise<void> {
return new Promise((resolve, reject) => {
const request = UMPRequestParameters.new();
switch (this.#geography) {
switch (this._geography) {
case AdsConsentDebugGeography.DISABLED:
request.debugSettings.geography = UMPDebugGeography.Disabled;
break;
Expand All @@ -42,10 +42,10 @@ export class AdsConsent extends AdsConsentBase {
break;
}

if (Array.isArray(this.#deviceIds)) {
request.debugSettings.testDeviceIdentifiers = this.#deviceIds.map((item) => {
if (Array.isArray(this._deviceIds)) {
request.debugSettings.testDeviceIdentifiers = this._deviceIds.map((item) => {
if (item === 'EMULATOR') {
if(typeof GADSimulatorID){
if (typeof GADSimulatorID) {
return GADSimulatorID;
}
return '';
Expand All @@ -54,8 +54,8 @@ export class AdsConsent extends AdsConsentBase {
}) as any;
}

if (typeof this.#tagForUnderAgeOfConsent === 'boolean') {
request.tagForUnderAgeOfConsent = this.#tagForUnderAgeOfConsent;
if (typeof this._tagForUnderAgeOfConsent === 'boolean') {
request.tagForUnderAgeOfConsent = this._tagForUnderAgeOfConsent;
}

UMPConsentInformation.sharedInstance.requestConsentInfoUpdateWithParametersCompletionHandler(request, (error) => {
Expand All @@ -68,10 +68,10 @@ export class AdsConsent extends AdsConsentBase {
});
}
static setDebugGeography(geography: AdsConsentDebugGeography) {
this.#geography = geography;
this._geography = geography;
}
static setTagForUnderAgeOfConsent(tag: boolean) {
this.#tagForUnderAgeOfConsent = tag;
this._tagForUnderAgeOfConsent = tag;
}

static isConsentFormAvailable() {
Expand All @@ -85,7 +85,7 @@ export class AdsConsent extends AdsConsentBase {

static showForm(): Promise<void> {
return new Promise((resolve, reject) => {
this.#consentForm.presentFromViewControllerCompletionHandler(topViewController(), (error) => {
this._consentForm.presentFromViewControllerCompletionHandler(topViewController(), (error) => {
if (error) {
reject(FirebaseError.fromNative(error));
} else {
Expand All @@ -100,7 +100,7 @@ export class AdsConsent extends AdsConsentBase {
if (error) {
reject(FirebaseError.fromNative(error));
} else {
AdsConsent.#consentForm = form;
AdsConsent._consentForm = form;
resolve();
}
});
Expand Down

0 comments on commit 6b44588

Please sign in to comment.