Fix #890 Fix delete by initializing the metrics on android; delete was trying to use metrics and causing an exception because it hadn't been initialized

This commit is contained in:
Donovan Preston 2018-12-17 16:40:17 -05:00
parent 793dfb4f42
commit c71ef9ae84
2 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import html from 'choo/html';
import Raven from 'raven-js';
import { setApiUrlPrefix } from '../app/api';
import metrics from '../app/metrics';
import assets from '../common/assets';
import Header from '../app/ui/header';
import storage from '../app/storage';
@ -43,6 +44,7 @@ if (navigator.userAgent === 'Send Android') {
const app = choo();
//app.use(state);
app.use(metrics);
app.use(controller);
app.use(intents);

View File

@ -74,6 +74,7 @@ export default function(state, emitter) {
});
emitter.on('delete', async ({ file, location }) => {
console.log('ondelete');
try {
metrics.deletedUpload({
size: file.size,
@ -86,6 +87,7 @@ export default function(state, emitter) {
state.storage.remove(file.id);
await file.del();
} catch (e) {
console.log(e.stack);
state.raven.captureException(e);
}
render();