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

Feature/blockstack #30

Merged
merged 2 commits into from
Apr 22, 2018
Merged

Feature/blockstack #30

merged 2 commits into from
Apr 22, 2018

Conversation

billxinli
Copy link
Contributor

@billxinli billxinli commented Apr 19, 2018

Summary

This PR added the following features

  • Blockstack Login
  • Test Coverage

This PR modified the following features

  • Ejected the create-react-app magic, and we have control over all the config files, this is because blockstack needs cors enabled to fetch the manifest file for auth flow.

Screenshot

login

terminal

How to test it

yarn test to see the test failing because of coverage

Click the login button to see your information being pulled from blockstack

Other Information

I will split PRs into seperate things in the future.

@coveralls
Copy link

coveralls commented Apr 19, 2018

Pull Request Test Coverage Report for Build 68

  • 25 of 27 (92.59%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+13.0%) to 79.116%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/common/AuthenticationButton/index.jsx 12 14 85.71%
Totals Coverage Status
Change from base Build 59: 13.0%
Covered Lines: 158
Relevant Lines: 178

💛 - Coveralls

@JackNeto
Copy link
Collaborator

@billxinli do you want me to review it now or should I wait until you're done?

@billxinli billxinli force-pushed the feature/blockstack branch 3 times, most recently from a3b9f38 to b5005bf Compare April 20, 2018 05:01
- Ejected create-react-app
- Added jest coverage
- Cleaned up code
@billxinli
Copy link
Contributor Author

@JackNeto Could you please review the above? Thanks!

@@ -0,0 +1,5 @@
const blockstack = require('blockstack')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file seem unnecessary

import React from 'react'
import Button from 'material-ui/Button'
import { withStyles } from 'material-ui/styles'
import BlockstackService from './../../lib/BlockstackService'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of having a BlockstackService it seems simpler to just import the methods from blockstack js

import {
  redirectToSignIn, 
  handlePendingSignIn, 
  signUserOut, 
  isUserSignedIn, 
  loadUserData, 
  Person
} from 'blockstack';

@billxinli
Copy link
Contributor Author

billxinli commented Apr 22, 2018

This is a weird issue, I am not sure what is causing it, I will have to take a look to see how ES6 imports and module.exports works together.

If I do:
import BlockstackService from 'blockstack'; I see the following:

screen shot 2018-04-22 at 2 12 40 pm

However, it works if I do import {isUserSignedIn,...} from 'blockstack'; But this means I have to use isUserSignedIn() directly, rather than BlockstackService.isUserSignedIn()

Where as if I do:

const blockstack = require('blockstack')

And I inspect the blockstack variable, I can see all the functions that the module blockstack defines, and I can use blockstack.isUserSignedIn() rather than importing them individually.

https://nodejs.org/api/esm.html#esm_interop_with_existing_modules

I am not sure if there is something wonky going on with Webpack + Babel

Copy link
Collaborator

@JackNeto JackNeto left a comment

Choose a reason for hiding this comment

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

It works well for me. I was seeing the problem you mentioned. Make sure you run yarn install and then restart the server.

@billxinli billxinli merged commit f17d293 into master Apr 22, 2018
@billxinli billxinli deleted the feature/blockstack branch April 22, 2018 20:56
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.

None yet

3 participants