Implement wss preference url in html; Update to work with the tip of vnext branch; allow viewing the android ui from the webpack server (#918)

* Merge branch 'vnext' of https://github.com/mozilla/send into android-preferences

Fix conflicts

* Implement wss preference url in html; Update to work with the tip of vnext branch; allow viewing the android ui from the webpack server

* Use a try/catch in case localStorage isn't available, which it isn't in a ServiceWorker
This commit is contained in:
Donovan Preston 2018-09-06 18:56:04 -04:00 committed by GitHub
parent 690a705be9
commit 71ea4e74f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 6 deletions

View file

@ -1,6 +1,15 @@
const html = require('choo/html');
export default function mainPage(state, emit) {
if (window.location.pathname === '/android/app/src/main/assets/') {
// Hack: For debugging the android app in a web browser from
// http://0.0.0.0:8080/android/app/src/main/assets/ after running webpack
state.prefix = '/android/app/src/main/assets';
}
function clickPreferences(event) {
event.preventDefault();
emit('pushState', '/preferences');
}
function uploadFile(event) {
event.preventDefault();
const target = event.target;
@ -16,6 +25,9 @@ export default function mainPage(state, emit) {
return html`<body>
<div id="white">
<div id="centering">
<a href="#" onclick=${clickPreferences}>
preferenes
</a>
<img src=${state.getAsset('encrypted-envelope.png')} />
<h4>Private, Encrypted File Sharing</h4>
<div>

View file

@ -0,0 +1,36 @@
const html = require('choo/html');
import { setFileProtocolWssUrl, getFileProtocolWssUrl } from '../../app/api';
export default function preferences(state, emit) {
const wssURL = getFileProtocolWssUrl();
function updateWssUrl(event) {
state.wssURL = event.target.value;
setFileProtocolWssUrl(state.wssURL);
emit('render');
}
function clickDone(event) {
event.preventDefault();
emit('pushState', '/');
}
return html`<body>
<div id="white">
<div id="preferences">
<a onclick=${clickDone} href="#">
done
</a>
<dl>
<dt>
wss url:
</dt>
<dd>
<input type="text" onchange=${updateWssUrl} value=${wssURL} />
</dd>
</dl>
</div>
</div>
</body>`;
}