aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-07-04 04:48:18 +0800
committerDan Finlay <dan@danfinlay.com>2017-07-04 04:48:18 +0800
commit91cd849e76d81ebbb984a007979b0566e13a86c2 (patch)
tree9e474ffadc6ecba9af68bb6ed09c9e951caffd0f
parentfa533469cb6ddc5b5142afed2b4950565494d5a0 (diff)
downloadtangerine-wallet-browser-91cd849e76d81ebbb984a007979b0566e13a86c2.tar
tangerine-wallet-browser-91cd849e76d81ebbb984a007979b0566e13a86c2.tar.gz
tangerine-wallet-browser-91cd849e76d81ebbb984a007979b0566e13a86c2.tar.bz2
tangerine-wallet-browser-91cd849e76d81ebbb984a007979b0566e13a86c2.tar.lz
tangerine-wallet-browser-91cd849e76d81ebbb984a007979b0566e13a86c2.tar.xz
tangerine-wallet-browser-91cd849e76d81ebbb984a007979b0566e13a86c2.tar.zst
tangerine-wallet-browser-91cd849e76d81ebbb984a007979b0566e13a86c2.zip
Began creating new UI template
-rw-r--r--app/scripts/background.js3
-rw-r--r--app/scripts/send-token.js33
-rw-r--r--app/send-token.html11
3 files changed, 46 insertions, 1 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index e8987394f..7e8f9172f 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -90,7 +90,8 @@ function setupController (initState) {
extension.runtime.onConnect.addListener(connectRemote)
function connectRemote (remotePort) {
- var isMetaMaskInternalProcess = remotePort.name === 'popup' || remotePort.name === 'notification'
+ const name = remotePort.name
+ var isMetaMaskInternalProcess = name === 'popup' || name === 'notification' || name === 'ui'
var portStream = new PortStream(remotePort)
if (isMetaMaskInternalProcess) {
// communication with popup
diff --git a/app/scripts/send-token.js b/app/scripts/send-token.js
new file mode 100644
index 000000000..9e6868884
--- /dev/null
+++ b/app/scripts/send-token.js
@@ -0,0 +1,33 @@
+const startPopup = require('./popup-core')
+const PortStream = require('./lib/port-stream.js')
+const ExtensionPlatform = require('./platforms/extension')
+const extension = require('extensionizer')
+const NotificationManager = require('./lib/notification-manager')
+const notificationManager = new NotificationManager()
+
+// create platform global
+global.platform = new ExtensionPlatform()
+
+// inject css
+const css = MetaMaskUiCss()
+injectCss(css)
+
+// setup stream to background
+const extensionPort = extension.runtime.connect({ name: 'ui' })
+const connectionStream = new PortStream(extensionPort)
+
+// start ui
+const container = document.getElementById('app-content')
+startPopup({ container, connectionStream }, (err, store) => {
+ if (err) return displayCriticalError(err)
+ store.subscribe(() => {
+ const state = store.getState()
+ })
+})
+
+function displayCriticalError (err) {
+ container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
+ container.style.height = '80px'
+ log.error(err.stack)
+ throw err
+}
diff --git a/app/send-token.html b/app/send-token.html
new file mode 100644
index 000000000..5f98e1072
--- /dev/null
+++ b/app/send-token.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>MetaMask Plugin</title>
+ </head>
+ <body>
+ <div id="app-content"></div>
+ <script src="./scripts/send-token.js" type="text/javascript" charset="utf-8"></script>
+ </body>
+</html>