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

Add getters and watchers for oneSignalId and externalId #690

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

jinliu9508
Copy link
Contributor

@jinliu9508 jinliu9508 commented Jan 24, 2024

Description

One Line Summary

Add getters and observer for onesignalId and externalId.

Details

Motivation

Exposing the onesignal ID and external ID with getters.
Also grant developers the ability to add observers that can be called when there is a change in user state.

Scope

UserState contains onesignalId and externalId (both can be empty strings if not available or not set).

Testing

Unit testing

No unit testing at this time

Manual testing

I have added two testing buttons in the test scene for getting onesignalId and externalId. I have also add observer to test the callback when the ids are changed.

Unity version: 2022.3.10f1
For Android: Emulator Pixel 3a api34
For ios: iPhone15 Simulator

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

@jinliu9508 jinliu9508 changed the base branch from main to user-model/main January 24, 2024 22:32
@jinliu9508 jinliu9508 force-pushed the AddOneSignalIdAndExternalId branch from 8a38e60 to 9fb0d58 Compare January 25, 2024 18:11
@jinliu9508 jinliu9508 force-pushed the AddOneSignalIdAndExternalId branch 7 times, most recently from d36f8db to d57c900 Compare February 12, 2024 20:04
@jinliu9508 jinliu9508 changed the title WIP: Add getters and watchers for oneSignalId and externalId Add getters and watchers for oneSignalId and externalId Feb 12, 2024
Copy link
Contributor

@shepherd-l shepherd-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had some nits, looks good!

Could you also update the Manual testing section in your PR to include what devices and version of Unity you tested on? I think it would be helpful to have it documented

WIP: I will test the PR on devices later

MIGRATION_GUIDE_v3_to_v5.md Outdated Show resolved Hide resolved
MIGRATION_GUIDE_v3_to_v5.md Show resolved Hide resolved
OneSignalExample/Assets/OneSignal/CHANGELOG.md Outdated Show resolved Hide resolved
com.onesignal.unity.android/Runtime/AndroidUserManager.cs Outdated Show resolved Hide resolved
com.onesignal.unity.core/Runtime/User/IUserManager.cs Outdated Show resolved Hide resolved
com.onesignal.unity.core/Runtime/User/IUserManager.cs Outdated Show resolved Hide resolved
com.onesignal.unity.core/Runtime/User/IUserState.cs Outdated Show resolved Hide resolved
com.onesignal.unity.core/Runtime/User/UserChangedState.cs Outdated Show resolved Hide resolved
OneSignalExample/Assets/OneSignal/CHANGELOG.md Outdated Show resolved Hide resolved
OneSignalExample/Assets/OneSignal/CHANGELOG.md Outdated Show resolved Hide resolved
@jinliu9508
Copy link
Contributor Author

Just had some nits, looks good!

Could you also update the Manual testing section in your PR to include what devices and version of Unity you tested on? I think it would be helpful to have it documented

WIP: I will test the PR on devices later

@shepherd-l Thanks for the review! I have made changes addressing all the concerns. Please have a look again.

Copy link
Contributor

@shepherd-l shepherd-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Tested new install, login, and logout on an emulated Pixel 4 with Android 12 and physical iPhone 12 with iOS 15.5 built with Unity 2022.3.10f1 with the OneSignal example app

@jinliu9508 jinliu9508 force-pushed the AddOneSignalIdAndExternalId branch 2 times, most recently from a1e313e to b14828f Compare February 13, 2024 20:54
Copy link
Contributor

@shepherd-l shepherd-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more nits

MIGRATION_GUIDE_v3_to_v5.md Show resolved Hide resolved
com.onesignal.unity.core/Runtime/User/Models/IUserState.cs Outdated Show resolved Hide resolved
com.onesignal.unity.core/Runtime/User/Models/IUserState.cs Outdated Show resolved Hide resolved
@jinliu9508 jinliu9508 force-pushed the AddOneSignalIdAndExternalId branch from b14828f to 2435b2a Compare February 13, 2024 21:27
Copy link
Contributor

@shepherd-l shepherd-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jinliu9508 jinliu9508 force-pushed the AddOneSignalIdAndExternalId branch from 2435b2a to 6656aaf Compare February 13, 2024 22:01
@jinliu9508 jinliu9508 merged commit a59eb24 into user-model/main Feb 13, 2024
1 of 2 checks passed
@jinliu9508 jinliu9508 deleted the AddOneSignalIdAndExternalId branch February 13, 2024 22:02
jinliu9508 added a commit that referenced this pull request Feb 23, 2024
Add getters and watchers for oneSignalId and externalId
jinliu9508 added a commit that referenced this pull request Feb 27, 2024
Add getters and watchers for oneSignalId and externalId
jinliu9508 added a commit that referenced this pull request Feb 27, 2024
Add getters and watchers for oneSignalId and externalId
jinliu9508 added a commit that referenced this pull request Feb 27, 2024
Add getters and watchers for oneSignalId and externalId
jinliu9508 added a commit that referenced this pull request Feb 27, 2024
Add getters and watchers for oneSignalId and externalId
jinliu9508 added a commit that referenced this pull request Mar 1, 2024
Add getters and watchers for oneSignalId and externalId
jinliu9508 added a commit that referenced this pull request Mar 4, 2024
Add getters and watchers for oneSignalId and externalId
jinliu9508 added a commit that referenced this pull request Mar 4, 2024
Add getters and watchers for oneSignalId and externalId
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