wip on using shared ui in android

This commit is contained in:
Danny Coates 2018-11-02 15:51:27 -07:00
parent 77a5a377e3
commit eb79ce1835
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
16 changed files with 105 additions and 181 deletions

View file

@ -20,12 +20,42 @@ window.DEFAULTS = {
};
const choo = require('choo');
const html = require('choo/html');
const assets = require('../common/assets');
const header = require('../app/ui/header');
const locale = require('../common/locales');
const home = require('../app/ui/home');
const app = choo();
function body(main) {
return function(state, emit) {
return html`<body class="flex flex-col items-center font-sans bg-blue-lightest md:h-screen md:bg-grey-lightest">
${header(state, emit)}
<a id="hamburger" class="absolute pin-t pin-r z-50" href="#" onclick=${clickPreferences}>
<img src=${assets.get('preferences.png')} />
</a>
${main(state, emit)}
</body>`;
function clickPreferences(event) {
event.preventDefault();
emit('pushState', '/preferences');
}
};
}
app.use((state, emitter) => {
state.translate = locale.getTranslator();
state.capabilities = {}; //TODO
// for debugging
window.appState = state;
window.appEmit = emitter.emit.bind(emitter);
});
app.use(require('./stores/state').default);
app.use(require('../app/fileManager').default);
app.use(require('./stores/intents').default);
app.route('/', require('./pages/home').default);
app.route('/', body(home));
app.route('/options', require('./pages/options').default);
app.route('/upload', require('./pages/upload').default);
app.route('/share/:id', require('./pages/share').default);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,124 +0,0 @@
html {
height: 100vh;
}
body {
box-sizing: border-box;
margin: 0;
min-height: 100vh;
background-image: repeating-linear-gradient(
45deg,
white,
white 5px,
#ea000e 5px,
#ea000e 25px,
white 25px,
white 30px,
#0083ff 30px,
#0083ff 50px
);
}
#white {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: white;
margin: 0 10px;
padding: 10px;
text-align: center;
}
#centering {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
height: 100%;
width: 100%;
}
#label {
position: fixed;
right: 2em;
bottom: 1em;
}
#label img {
height: 60px;
width: 60px;
}
#input {
display: none;
}
#url {
display: none;
}
#copy-link {
text-align: right;
}
#copy-image {
position: relative;
top: 6px;
height: 30px;
width: 30px;
}
.spacer {
height: 12em;
}
#send-another {
margin-bottom: 1em;
height: 60px;
width: 60px;
position: fixed;
right: 2em;
bottom: 1em;
}
.card {
margin: 6px;
padding: 6px;
border: 1px solid white;
border-radius: 5px;
box-shadow: 5px 5px 5px 5px #d5d5d5;
text-align: left;
}
.progress {
display: inline-block;
height: 4px;
border-radius: 2px;
background-color: #1b96ef;
color: white;
}
.cancel {
text-align: right;
}
#preferences {
text-align: left;
}
#hamburger {
position: fixed;
right: 2em;
top: 1em;
}
#top-banner {
position: fixed;
top: 1em;
left: 2em;
}
#options {
text-align: left;
}

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Firefox Send</title>
<link href="index.css" rel="stylesheet">
</head>
<body>
<script src="vendor.js"></script>
<script src="android.js"></script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View file

@ -1,21 +1,10 @@
const child_process = require('child_process');
const fs = require('fs');
const path = require('path');
child_process.execSync('npm run build');
const prefix = path.join('..', '..', 'dist');
const json_string = fs.readFileSync(path.join(prefix, 'manifest.json'));
const manifest = JSON.parse(json_string);
const android_filename = manifest['android.js'];
fs.writeFileSync(
'src/main/assets/android.js',
fs.readFileSync(`${prefix}${android_filename}`)
);
const vendor_filename = manifest['vendor.js'];
fs.writeFileSync(
'src/main/assets/vendor.js',
fs.readFileSync(`${prefix}${vendor_filename}`)
child_process.execSync(
`cp -R ${path.resolve(__dirname, '../dist')} ${path.resolve(
__dirname,
'app/src/main/assets'
)}`
);

View file

@ -12,9 +12,6 @@ export default function initialState(state, emitter) {
getAsset(name) {
return `${state.prefix}/${name}`;
},
translate: (...toTranslate) => {
return toTranslate.map(o => JSON.stringify(o)).toString();
},
raven: {
captureException: e => {
console.error('ERROR ' + e + ' ' + e.stack);