Skip to content

Commit

Permalink
BREAKING: remove deprecated analytics methods
Browse files Browse the repository at this point in the history
BREAKING CHANGE: switch to setScreenView, logPurchase, logViewPromotion, logRefund as needed
  • Loading branch information
mikehardy committed Nov 16, 2020
1 parent e3ff7bd commit 18f5b0f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
20 changes: 0 additions & 20 deletions packages/analytics/__tests__/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,6 @@ describe('Analytics', () => {
);
});

it('call methods, getters & setters that fire a console.warn() & have no return value', () => {
const analytics = firebase.analytics();
// @ts-ignore test
const logEcommercePurchaseSpy = jest.spyOn(analytics, 'logEcommercePurchase');
// @ts-ignore test
const logPresentOfferSpy = jest.spyOn(analytics, 'logPresentOffer');
// @ts-ignore test
const logPurchaseRefundSpy = jest.spyOn(analytics, 'logPurchaseRefund');
// @ts-ignore test
analytics.logEcommercePurchase();
// @ts-ignore test
analytics.logPresentOffer();
// @ts-ignore test
analytics.logPurchaseRefund();

expect(logEcommercePurchaseSpy).toBeCalled();
expect(logPresentOfferSpy).toBeCalled();
expect(logPurchaseRefundSpy).toBeCalled();
});

describe('logEvent()', () => {
it('errors if name is not a string', () => {
// @ts-ignore test
Expand Down
43 changes: 0 additions & 43 deletions packages/analytics/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,6 @@ class FirebaseAnalyticsModule extends FirebaseModule {
return this.native.setAnalyticsCollectionEnabled(enabled);
}

setCurrentScreen(screenName, screenClassOverride) {
// eslint-disable-next-line no-console
console.warn(
'firebase.analytics().setCurrentScreen(), is now deprecated. Please use firebase.analytics().logScreenView() instead',
);
return this.logScreenView({
screen_name: screenName,
screen_class: screenClassOverride,
});
}

setSessionTimeoutDuration(milliseconds = 1800000) {
if (!isNumber(milliseconds)) {
throw new Error(
Expand Down Expand Up @@ -319,16 +308,6 @@ class FirebaseAnalyticsModule extends FirebaseModule {
),
);
}
/**
* logEcommercePurchase purchase is now deprecated, use logPurchase instead:
* https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event#public-static-final-string-ecommerce_purchase
*/
logEcommercePurchase() {
// eslint-disable-next-line no-console
console.warn(
'firebase.analytics().logEcommercePurchase(), "ECOMMERCE_PURCHASE" event is now deprecated. Please use firebase.analytics().logPurchase() instead',
);
}

logGenerateLead(object = {}) {
if (!isObject(object)) {
Expand Down Expand Up @@ -423,28 +402,6 @@ class FirebaseAnalyticsModule extends FirebaseModule {
);
}

/**
* Deprecated, use logRefundEvent instead:
* https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event#public-static-final-string-present_offer
*/
logPresentOffer() {
// eslint-disable-next-line no-console
console.warn(
'firebase.analytics().logPresentOffer(), "PRESENT_OFFER" event is now deprecated. Please use firebase.analytics().logViewPromotion() instead',
);
}

/**
* Deprecated, use logRefundEvent instead:
* https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event#public-static-final-string-purchase_refund
*/
logPurchaseRefund() {
// eslint-disable-next-line no-console
console.warn(
'firebase.analytics().logPurchaseRefund(), "PURCHASE_REFUND" event is now deprecated. Please use firebase.analytics().logRefund() instead',
);
}

logSelectContent(object) {
if (!isObject(object)) {
throw new Error(
Expand Down

0 comments on commit 18f5b0f

Please sign in to comment.