implemented amplitude metrics (#1141)

This commit is contained in:
Danny Coates 2019-02-12 11:50:06 -08:00 committed by GitHub
parent 1a483cad55
commit 9b37e92a81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 774 additions and 528 deletions

View file

@ -1,4 +1,4 @@
import { isFile } from './utils';
import { arrayToB64, isFile } from './utils';
import OwnedFile from './ownedFile';
class Mem {
@ -58,6 +58,15 @@ class Storage {
return fs;
}
get id() {
let id = this.engine.getItem('device_id');
if (!id) {
id = arrayToB64(crypto.getRandomValues(new Uint8Array(16)));
this.engine.setItem('device_id', id);
}
return id;
}
get totalDownloads() {
return Number(this.engine.getItem('totalDownloads'));
}