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

Support multiple instance by adding instance id #58

Merged
merged 5 commits into from
Apr 3, 2020

Conversation

jia-guo
Copy link
Contributor

@jia-guo jia-guo commented Mar 29, 2020

  • add instanceId as the identifier of the instance
  • encode instanceId in the state params of the authUrl
  • check instanceId when messageHandler is executed

@jia-guo jia-guo requested a review from sankethkatta March 29, 2020 22:22
@codecov
Copy link

codecov bot commented Mar 29, 2020

Codecov Report

Merging #58 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #58   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           15        15           
  Branches         2         2           
=========================================
  Hits            15        15           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0325e2...c7a4a9b. Read the comment docs.

Copy link
Contributor

@sankethkatta sankethkatta left a comment

Choose a reason for hiding this comment

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

Still reviewing the tests, but some starting comments!

@@ -1010,6 +1010,14 @@
"url": "0.10.3",
"uuid": "3.1.0",
"xml2js": "0.4.19"
},
"dependencies": {
"uuid": {
Copy link
Contributor

Choose a reason for hiding this comment

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

we can revert this file now!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just realized that this uuid is a dependency of a dependency 😂. I've removed package-lock and node_modules and re-run npm install, the current one should be alright.

@@ -140,7 +144,7 @@ describe('sdk', () => {
isSmartcarHosted: false,
code: 'super-secret-code',
error: undefined,
state: 'some-state',
state: window.btoa(`{"instanceId":"${smartcar.instanceId}","originalState":"some-state"}`),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the getEncodedState() function for these? If we need to customize the state we can make the helper have a default value:

const getEncodedState = (instanceId, originalState = originalState) => ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Much cleaner.

@sankethkatta
Copy link
Contributor

The rest of the tests look good to me! Just the couple comments above. And we also need to put the right commit message to push up the new version.

@jia-guo
Copy link
Contributor Author

jia-guo commented Apr 1, 2020

The rest of the tests look good to me! Just the couple comments above. And we also need to put the right commit message to push up the new version.

Got it! Thanks so much for reviewing the PR!

@jia-guo jia-guo requested a review from sankethkatta April 1, 2020 16:55
@jia-guo
Copy link
Contributor Author

jia-guo commented Apr 1, 2020

@sankethkatta I tried out in mock ui & found it works as intended.

image

@jia-guo jia-guo merged commit 18c7c8b into master Apr 3, 2020
@jia-guo jia-guo deleted the support-multiple-instance branch April 3, 2020 00:15
@smartcar-ci
Copy link

🎉 This PR is included in version 2.7.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants