Skip to content

Commit

Permalink
[firebase-analytics] Add DebugView support on Expo client (#7796)
Browse files Browse the repository at this point in the history
* [firebase-analytics] Add FirebaseAnalyticsJS export

* [firebase-analytics] Add sessionId required for DebugView

* [firebase-analytics] Add DebugView support for JS analytics

* [firebase-analytics] update build files

* [firebase-analytics] Add debug-mode for Expo client

* [docs] Add firebase-analytics `setDebugModeEnabled` option

* [fireabse-analytics] Add debug-mode test

* [firebase-analytics] Update JS build files

* [firebase-analytics] Better error message when setDebugModeEnabled is not supported

* [fireabse-analytics] Update js build files

* [firebase-analytics] Fix failing test on setDebugModeEnabled

* [firebase-analytics] Fix not all events visible in cloud

Fixes the timestamps (deltas) in the send events

* [firebase-analytics] Update JS build files

* [fireabse-analytics] Update headers to closer match JS SDK

* [firebase-analytics] Add initial sending of session start

* [firebase-analytics] Add session-number support

* [firebase-analytics] Log to console when debug-mode is enabled

* [firebase-analytics] Fix typing

* [firebase-analytics] Update js build files

* [firebase-analytics] Fix test-suite

* [firebase-analytics] Update changelog
  • Loading branch information
IjzerenHein committed Apr 15, 2020
1 parent f7c5030 commit b9fac3f
Show file tree
Hide file tree
Showing 23 changed files with 291 additions and 37 deletions.
22 changes: 22 additions & 0 deletions apps/test-suite/tests/FirebaseAnalytics.js
Expand Up @@ -6,6 +6,8 @@ export const name = 'FirebaseAnalytics';

export async function test({ describe, beforeAll, afterAll, it, xit, expect }) {
const isConfigured = !!FirebaseCore.DEFAULT_APP_OPTIONS;
const isWebConfigured = !!FirebaseCore.DEFAULT_WEB_APP_OPTIONS;
const isExpoClient = FirebaseCore.DEFAULT_APP_NAME !== '[DEFAULT]';
const itWhenConfigured = isConfigured ? it : xit;
const itWhenNotConfigured = isConfigured ? xit : it;

Expand Down Expand Up @@ -163,5 +165,25 @@ export async function test({ describe, beforeAll, afterAll, it, xit, expect }) {
expect(error).toBeNull();
});
});
describe('setDebugModeEnabled()', async () => {
it(
isExpoClient && isConfigured && isWebConfigured
? `runs on client with web-config`
: `fails when not on client or without web-config`,
async () => {
let error = null;
try {
await Analytics.setDebugModeEnabled(true);
} catch (e) {
error = e;
}
if (isExpoClient && isConfigured && isWebConfigured) {
expect(error).toBeNull();
} else {
expect(error).not.toBeNull();
}
}
);
});
});
}
10 changes: 10 additions & 0 deletions docs/pages/versions/unversioned/sdk/firebase-analytics.md
Expand Up @@ -300,6 +300,16 @@ on the Expo client.
Analytics.setUnavailabilityLogging(false);
```

### setDebugModeEnabled

```tsx
setDebugModeEnabled(isEnabled: boolean): Promise<void>
```

Enables debug mode *(Expo client only)* so events can be tracked using the [DebugView in the Analytics dashboard](https://firebase.google.com/docs/analytics/debugview#reporting).

This option is **only available on the standard Expo client**. When using a standalone build, the bare workflow or web, use the [natively available options](https://firebase.google.com/docs/analytics/debugview).

# Examples

## How do people use my app?
Expand Down
10 changes: 10 additions & 0 deletions docs/pages/versions/v37.0.0/sdk/firebase-analytics.md
Expand Up @@ -300,6 +300,16 @@ on the Expo client.
Analytics.setUnavailabilityLogging(false);
```

### setDebugModeEnabled

```tsx
setDebugModeEnabled(isEnabled: boolean): Promise<void>
```

Enables debug mode *(Expo client only)* so events can be tracked using the [DebugView in the Analytics dashboard](https://firebase.google.com/docs/analytics/debugview#reporting).

This option is **only available on the standard Expo client**. When using a standalone build, the bare workflow or web, use the [natively available options](https://firebase.google.com/docs/analytics/debugview).

# Examples

## How do people use my app?
Expand Down
5 changes: 4 additions & 1 deletion packages/expo-firebase-analytics/CHANGELOG.md
Expand Up @@ -6,7 +6,10 @@

### 🎉 New features

- Add `setDebugModeEnabled` for enabling DebugView on the Expo client. ([#7796](https://github.com/expo/expo/pull/7796) by [@IjzerenHein](https://github.com/IjzerenHein))

### 🐛 Bug fixes

- Fix `expo-firebase-analytics` not recording events on the Expo client running on certain Android devices. ([#7192](https://github.com/expo/expo/pull/7679) by [@IjzerenHein](https://github.com/IjzerenHein))
- Fix no events recorded on the Expo client when running on certain Android devices. ([#7679](https://github.com/expo/expo/pull/7679) by [@IjzerenHein](https://github.com/IjzerenHein))
- Fix `setAnalyticsCollectionEnabled` throwing an error.
- Fixes & improvements to the pure JS analytics client. ([#7796](https://github.com/expo/expo/pull/7796) by [@IjzerenHein](https://github.com/IjzerenHein))
14 changes: 13 additions & 1 deletion packages/expo-firebase-analytics/build/Analytics.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion packages/expo-firebase-analytics/build/Analytics.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-firebase-analytics/build/Analytics.js.map

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions packages/expo-firebase-analytics/build/ExpoFirebaseAnalytics.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b9fac3f

Please sign in to comment.