2018-08-16 18:07:12 +02:00
|
|
|
/* eslint-disable no-console */
|
|
|
|
|
2018-11-08 22:35:19 +01:00
|
|
|
import User from '../user';
|
2018-09-07 00:56:04 +02:00
|
|
|
import storage from '../../app/storage';
|
|
|
|
|
2018-08-16 18:07:12 +02:00
|
|
|
export default function initialState(state, emitter) {
|
|
|
|
const files = [];
|
|
|
|
|
|
|
|
Object.assign(state, {
|
2018-09-07 00:56:04 +02:00
|
|
|
prefix: '/android_asset',
|
2018-09-14 17:00:33 +02:00
|
|
|
user: new User(storage),
|
2018-08-16 18:07:12 +02:00
|
|
|
getAsset(name) {
|
2018-09-07 00:56:04 +02:00
|
|
|
return `${state.prefix}/${name}`;
|
2018-08-16 18:07:12 +02:00
|
|
|
},
|
2019-08-09 20:06:21 +02:00
|
|
|
sentry: {
|
2018-08-16 18:07:12 +02:00
|
|
|
captureException: e => {
|
|
|
|
console.error('ERROR ' + e + ' ' + e.stack);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
storage: {
|
|
|
|
files,
|
|
|
|
remove: function(fileId) {
|
|
|
|
console.log('REMOVE FILEID', fileId);
|
|
|
|
},
|
|
|
|
writeFile: function(file) {
|
|
|
|
console.log('WRITEFILE', file);
|
|
|
|
},
|
|
|
|
addFile: function(file) {
|
|
|
|
console.log('addfile' + JSON.stringify(file));
|
|
|
|
files.push(file);
|
|
|
|
emitter.emit('pushState', `/share/${file.id}`);
|
|
|
|
},
|
|
|
|
totalUploads: 0
|
|
|
|
},
|
|
|
|
transfer: null,
|
|
|
|
uploading: false,
|
|
|
|
settingPassword: false,
|
|
|
|
passwordSetError: null,
|
|
|
|
route: '/'
|
|
|
|
});
|
|
|
|
}
|