mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 09:23:21 +01:00
Adding CreatePasswordScreen
This commit is contained in:
parent
20cb6a76dd
commit
0264ecaad7
2
.babelrc
2
.babelrc
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"presets": ["es2015", "stage-0"],
|
"presets": ["es2015", "stage-0", "react"],
|
||||||
"plugins": ["transform-runtime", "transform-async-to-generator"]
|
"plugins": ["transform-runtime", "transform-async-to-generator"]
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ function createBundle (entryPoint) {
|
|||||||
cache: {},
|
cache: {},
|
||||||
packageCache: {},
|
packageCache: {},
|
||||||
plugin: [watchify],
|
plugin: [watchify],
|
||||||
})
|
}).transform('babelify')
|
||||||
|
|
||||||
bundler.on('update', bundle)
|
bundler.on('update', bundle)
|
||||||
bundle()
|
bundle()
|
||||||
|
13
mascara/src/app/first-time/create-password-screen.js
Normal file
13
mascara/src/app/first-time/create-password-screen.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import React, {Component, PropTypes} from 'react'
|
||||||
|
|
||||||
|
export default class CreatePasswordScreen extends Component {
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
54
mascara/src/app/first-time/index.js
Normal file
54
mascara/src/app/first-time/index.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import React, {Component, PropTypes} from 'react'
|
||||||
|
import CreatePasswordScreen from './create-password-screen'
|
||||||
|
|
||||||
|
export default class FirstTimeFlow extends Component {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
screenType: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
screenType: FirstTimeFlow.CREATE_PASSWORD
|
||||||
|
};
|
||||||
|
|
||||||
|
static SCREEN_TYPE = {
|
||||||
|
CREATE_PASSWORD: 'create_password',
|
||||||
|
UNIQUE_IMAGE: 'unique_image',
|
||||||
|
TERM_OF_USE: 'term_of_use',
|
||||||
|
BACK_UP_PHRASE: 'back_up_phrase',
|
||||||
|
CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase',
|
||||||
|
BUY_ETHER: 'buy_ether'
|
||||||
|
};
|
||||||
|
|
||||||
|
static getScreenType = ({isInitialized, noActiveNotices, seedWords}) => {
|
||||||
|
const {SCREEN_TYPE} = FirstTimeFlow
|
||||||
|
|
||||||
|
if (!isInitialized) {
|
||||||
|
return SCREEN_TYPE.CREATE_PASSWORD
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!noActiveNotices) {
|
||||||
|
return SCREEN_TYPE.TERM_OF_USE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seedWords) {
|
||||||
|
return SCREEN_TYPE.BACK_UP_PHRASE
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
renderScreen() {
|
||||||
|
const {SCREEN_TYPE} = FirstTimeFlow
|
||||||
|
|
||||||
|
switch (this.props.screenType) {
|
||||||
|
case SCREEN_TYPE.CREATE_PASSWORD:
|
||||||
|
return <CreatePasswordScreen />
|
||||||
|
default:
|
||||||
|
return <noscript />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return <div>{this.renderScreen()}</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,8 @@ const Component = require('react').Component
|
|||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
const actions = require('./actions')
|
const actions = require('./actions')
|
||||||
|
// mascara
|
||||||
|
const MascaraFirstTime = require('../../mascara/src/app/first-time').default
|
||||||
// init
|
// init
|
||||||
const InitializeMenuScreen = require('./first-time/init-menu')
|
const InitializeMenuScreen = require('./first-time/init-menu')
|
||||||
const NewKeyChainScreen = require('./new-keychain')
|
const NewKeyChainScreen = require('./new-keychain')
|
||||||
@ -43,6 +45,10 @@ function mapStateToProps (state) {
|
|||||||
accounts,
|
accounts,
|
||||||
address,
|
address,
|
||||||
keyrings,
|
keyrings,
|
||||||
|
isMascara,
|
||||||
|
isInitialized,
|
||||||
|
noActiveNotices,
|
||||||
|
seedWords
|
||||||
} = state.metamask
|
} = state.metamask
|
||||||
const selected = address || Object.keys(accounts)[0]
|
const selected = address || Object.keys(accounts)[0]
|
||||||
|
|
||||||
@ -56,6 +62,8 @@ function mapStateToProps (state) {
|
|||||||
currentView: state.appState.currentView,
|
currentView: state.appState.currentView,
|
||||||
activeAddress: state.appState.activeAddress,
|
activeAddress: state.appState.activeAddress,
|
||||||
transForward: state.appState.transForward,
|
transForward: state.appState.transForward,
|
||||||
|
isMascara: state.metamask.isMascara,
|
||||||
|
isOnboarding: Boolean(!noActiveNotices || seedWords || !isInitialized),
|
||||||
seedWords: state.metamask.seedWords,
|
seedWords: state.metamask.seedWords,
|
||||||
unapprovedTxs: state.metamask.unapprovedTxs,
|
unapprovedTxs: state.metamask.unapprovedTxs,
|
||||||
unapprovedMsgs: state.metamask.unapprovedMsgs,
|
unapprovedMsgs: state.metamask.unapprovedMsgs,
|
||||||
@ -123,6 +131,11 @@ App.prototype.renderAppBar = function () {
|
|||||||
const props = this.props
|
const props = this.props
|
||||||
const state = this.state || {}
|
const state = this.state || {}
|
||||||
const isNetworkMenuOpen = state.isNetworkMenuOpen || false
|
const isNetworkMenuOpen = state.isNetworkMenuOpen || false
|
||||||
|
const {isMascara, isOnboarding} = props
|
||||||
|
|
||||||
|
if (isMascara && isOnboarding) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
@ -407,9 +420,20 @@ App.prototype.renderBackButton = function (style, justArrow = false) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App.prototype.renderMascaraFirstTime = function () {
|
||||||
|
return 'hi'
|
||||||
|
}
|
||||||
|
|
||||||
App.prototype.renderPrimary = function () {
|
App.prototype.renderPrimary = function () {
|
||||||
log.debug('rendering primary')
|
log.debug('rendering primary')
|
||||||
var props = this.props
|
var props = this.props
|
||||||
|
const {isMascara, isOnboarding} = props
|
||||||
|
|
||||||
|
if (isMascara && isOnboarding) {
|
||||||
|
return h(MascaraFirstTime, {
|
||||||
|
screenType: MascaraFirstTime.getScreenType(props)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// notices
|
// notices
|
||||||
if (!props.noActiveNotices) {
|
if (!props.noActiveNotices) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const extend = require('xtend')
|
const extend = require('xtend')
|
||||||
const actions = require('../actions')
|
const actions = require('../actions')
|
||||||
|
const MetamascaraPlatform = require('../../../app/scripts/platforms/window')
|
||||||
|
|
||||||
module.exports = reduceMetamask
|
module.exports = reduceMetamask
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ function reduceMetamask (state, action) {
|
|||||||
var metamaskState = extend({
|
var metamaskState = extend({
|
||||||
isInitialized: false,
|
isInitialized: false,
|
||||||
isUnlocked: false,
|
isUnlocked: false,
|
||||||
|
isMascara: window.platform instanceof MetamascaraPlatform,
|
||||||
rpcTarget: 'https://rawtestrpc.metamask.io/',
|
rpcTarget: 'https://rawtestrpc.metamask.io/',
|
||||||
identities: {},
|
identities: {},
|
||||||
unapprovedTxs: {},
|
unapprovedTxs: {},
|
||||||
|
Loading…
Reference in New Issue
Block a user