capacitor-community / capacitor-community/firebase-analytics

Method signature incorrect for setScreenName()

Open
#130 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
178
Forks
70
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
The typing for `setScreenName()` is incorrect. It shows the `nameOverride` property as optional, but it is not:

```ts
setScreenName(options: {
screenName: string;
nameOverride?: string;
}): Promise;
```

If it is omitted, Xcode logs errors for every `setScreenName()` call, and Analytics DebugView will not show that it received any screen_view events. Errors look like this:

```
2022-10-14 17:07:43.621470-0600 App[6719:1746615] 8.15.0 - [Firebase/Analytics][I-ACS013000] Screen parameter value must be of type NSString: (nil)
2022-10-14 17:07:43.621767-0600 App[6719:1746615] 8.15.0 - [Firebase/Analytics][I-ACS031028] Received invalid class for screen: (nil)
```
Those 2 logs appear for each call to `setScreenName()` that does not include the `nameOverride` property.

**To Reproduce**
In your app, call the method without the `nameOverride` property:

```ts
setScreenName(screenName: string): void {
FirebaseAnalytics.setScreenName({ screenName });
}
```

**Expected behavior**
The method signature should require the `nameOverride` property.

**Desktop (please complete the following information):**
- OS: 12.6
- Browser: Chrome
- Version: 106

**Smartphone (please complete the following information):**
- Device: iOS simulator - iPhone 12 Pro Max
- OS: 14
- Browser: Safari

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.