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

feat: update setLibrary api make it ignore the null value of name or version #449

Merged
merged 12 commits into from
Nov 18, 2021

Conversation

yuhao900914
Copy link
Contributor

@yuhao900914 yuhao900914 commented Nov 17, 2021

Summary

  1. update setLibrary
  2. add outOfsession parameter in identify api
  3. add groupIdentify and identify out of session test

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

@yuhao900914 yuhao900914 requested a review from jooohhn November 17, 2021 19:27
@yuhao900914 yuhao900914 changed the title patch: update setLibrary api make it ignore the null value of name or version feat: update setLibrary api make it ignore the null value of name or version Nov 17, 2021
) {
this.options.library = { name: name, version: version };
AmplitudeClient.prototype.setLibrary = function setLibrary(name, version) {
if (name) this.options.library.name = name;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe wrap other than put them in the same line

Copy link
Contributor

@jooohhn jooohhn left a comment

Choose a reason for hiding this comment

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

LGTM, but 2 changes I believe would be good to address

this.options.library = { name: name, version: version };
AmplitudeClient.prototype.setLibrary = function setLibrary(name, version) {
if (name) this.options.library.name = name;
if (version) this.options.library.version = version;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should do an explicit check for null or undefined. Edge case conditions for falsey values may lead to unexpected outcomes (ike 0 or '' )

@@ -1114,7 +1114,7 @@ var _convertProxyObjectToRealObject = function _convertProxyObjectToRealObject(i
* var identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');
* amplitude.identify(identify);
*/
AmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_error_callback) {
AmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_error_callback, outOfSession) {
Copy link
Contributor

Choose a reason for hiding this comment

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

May be good to add unit test for out of session funcitonality

@yuhao900914 yuhao900914 requested a review from jooohhn November 17, 2021 22:26
@yuhao900914 yuhao900914 merged commit 8e0971e into main Nov 18, 2021
@yuhao900914 yuhao900914 deleted the flutter-web-support branch November 18, 2021 23:33
github-actions bot pushed a commit that referenced this pull request Nov 18, 2021
# [8.12.0](v8.11.1...v8.12.0) (2021-11-18)

### Features

* add more interface for flutter web support ([#444](#444)) ([69c18f7](69c18f7))
* update setLibrary api make it ignore the null value of name or version  ([#449](#449)) ([8e0971e](8e0971e))
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.

3 participants