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

fix: incorrect module naming #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/AdsConsent.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { NativeModules } from 'react-native';
import AdsConsentDebugGeography from './AdsConsentDebugGeography';
import AdsConsentStatus from './AdsConsentStatus';

const native = NativeModules.GoogleAdsConsentModule;
const native = NativeModules.RNGoogleAdsConsentModule;

export default {
/**
Expand Down
14 changes: 7 additions & 7 deletions lib/internal/GoogleAdsNativeEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@

import { NativeEventEmitter, NativeModules } from 'react-native';

const { GoogleAdsModule } = NativeModules;
const { RNGoogleAdsModule } = NativeModules;

class GoogleAdsNativeEventEmitter extends NativeEventEmitter {
constructor() {
super(GoogleAdsModule);
super(RNGoogleAdsModule);
this.ready = false;
}

addListener(eventType, listener, context) {
if (!this.ready) {
GoogleAdsModule.eventsNotifyReady(true);
RNGoogleAdsModule.eventsNotifyReady(true);
this.ready = true;
}
GoogleAdsModule.eventsAddListener(eventType);
RNGoogleAdsModule.eventsAddListener(eventType);

let subscription = super.addListener(`google_ads_${eventType}`, listener, context);

Expand All @@ -45,7 +45,7 @@ class GoogleAdsNativeEventEmitter extends NativeEventEmitter {
// we will modify it to do our native unsubscription then call the original
let originalRemove = subscription.remove;
let newRemove = () => {
GoogleAdsModule.eventsRemoveListener(eventType, false);
RNGoogleAdsModule.eventsRemoveListener(eventType, false);
if (super.removeSubscription != null) {
// This is for RN <= 0.64 - 65 and greater no longer have removeSubscription
super.removeSubscription(subscription);
Expand All @@ -59,13 +59,13 @@ class GoogleAdsNativeEventEmitter extends NativeEventEmitter {
}

removeAllListeners(eventType) {
GoogleAdsModule.eventsRemoveListener(eventType, true);
RNGoogleAdsModule.eventsRemoveListener(eventType, true);
super.removeAllListeners(`google_ads_${eventType}`);
}

// This is likely no longer ever called, but it is here for backwards compatibility with RN <= 0.64
removeSubscription(subscription) {
GoogleAdsModule.eventsRemoveListener(subscription.eventType.replace('google_ads_'), false);
RNGoogleAdsModule.eventsRemoveListener(subscription.eventType.replace('google_ads_'), false);
if (super.removeSubscription) {
super.removeSubscription(subscription);
}
Expand Down