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

[PLAT-8726] Use device.id as fallback user.id for events & sessions #1442

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Jul 20, 2022

Goal

Makes behaviour of user.id consistent with other platform, crash errors, and our online documentation.

After calling Bugsnag.setUser(nil, withEmail: nil, andName: nil), events and sessions should have their user.id set to the default Bugsnag-generated device ID.

Changeset

Adds -[BugsnagUser withUserId] to get a user object with the fallback id if required.

Updates BugsnagSessionTracker and BugsnagClient to use this method to populate sessions and events with a user.id.

Renames -[BugsnagUser initWithUserId:name:emailAddress:] to -[BugsnagUser initWithId:name:emailAddress:].

Removes unused method +[BugsnagUser userWithUserId:name:emailAddress:].

Simplifies -[BugsnagConfiguration getPersistedUserData].

Testing

Amends existing and adds a new scenario to verify that fallback user.id is sent when expected, while retaining ability to nullify it via callbacks.

@github-actions
Copy link

github-actions bot commented Jul 20, 2022

Bugsnag.framework binary size decreased by 168 bytes from 805,032 to 804,864 🎉

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +216  +0.1%    +216    __TEXT,__text
  [ = ]       0  +1.2%    +168    [__LINKEDIT]
  +0.1%      +8  +0.1%      +8    __DATA,__objc_selrefs
  +0.1%      +4  +0.1%      +4    __TEXT,__unwind_info
  -0.0%      -8  -0.0%      -8    __DATA,__objc_const
  -0.1%     -31  -0.1%     -31    __TEXT,__objc_methname
  -0.0%     -32  -0.0%     -32    Symbol Table
  -0.1%    -136  -0.1%    -136    String Table
  -0.7%    -189  -0.7%    -189    [__TEXT]
  -0.0%    -168  [ = ]       0    TOTAL

Generated by 🚫 Danger

@nickdowell nickdowell changed the base branch from master to next July 20, 2022 14:58
@nickdowell nickdowell changed the title [PLAT-8726] Use device.id for event & session user.id if nil [PLAT-8726] Use device.id as fallback user.id for events & sessions Jul 20, 2022
@nickdowell nickdowell merged commit 9083917 into next Jul 21, 2022
@nickdowell nickdowell deleted the nickdowell/user-id-nil-handling branch July 21, 2022 07:33
@nickdowell nickdowell mentioned this pull request Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants