MOBILE-2253 core: Remove PWA files since they aren't used
parent
ca1e510b8f
commit
0bdc85a4a7
|
@ -25,6 +25,8 @@ import { CoreLoginHelperProvider } from '../core/login/providers/helper';
|
||||||
})
|
})
|
||||||
export class MyApp implements AfterViewInit {
|
export class MyApp implements AfterViewInit {
|
||||||
@ViewChild(Nav) navCtrl;
|
@ViewChild(Nav) navCtrl;
|
||||||
|
// Use the page name (string) because the page is lazy loaded (Ionic feature). That way we can load pages without
|
||||||
|
// having to import them. The downside is that each page needs to implement a ngModule.
|
||||||
rootPage:any = 'CoreLoginInitPage';
|
rootPage:any = 'CoreLoginInitPage';
|
||||||
protected logger;
|
protected logger;
|
||||||
protected lastUrls = {};
|
protected lastUrls = {};
|
||||||
|
|
|
@ -46,7 +46,7 @@ export class SQLiteDBMock extends SQLiteDB {
|
||||||
*/
|
*/
|
||||||
emptyDatabase() : Promise<any> {
|
emptyDatabase() : Promise<any> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.db.transaction(tx => {
|
this.db.transaction((tx) => {
|
||||||
// Query all tables from sqlite_master that we have created and can modify.
|
// Query all tables from sqlite_master that we have created and can modify.
|
||||||
let args = [],
|
let args = [],
|
||||||
query = `SELECT * FROM sqlite_master
|
query = `SELECT * FROM sqlite_master
|
||||||
|
|
|
@ -63,11 +63,16 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Copy a file or directory.
|
||||||
|
*
|
||||||
|
* @param {Entry} srce The Entry to copy.
|
||||||
|
* @param {DirectoryEntry} destDir The directory where to put the copy.
|
||||||
|
* @param {string} newName New name of the file/dir.
|
||||||
|
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||||
*/
|
*/
|
||||||
private copyMock(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
|
private copyMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||||
return new Promise<Entry>((resolve, reject) => {
|
return new Promise<Entry>((resolve, reject) => {
|
||||||
srce.copyTo(destdir, newName, (deste) => {
|
srce.copyTo(destDir, newName, (deste) => {
|
||||||
resolve(deste);
|
resolve(deste);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
this.fillErrorMessageMock(err);
|
this.fillErrorMessageMock(err);
|
||||||
|
@ -165,7 +170,10 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Create a file writer for a certain file.
|
||||||
|
*
|
||||||
|
* @param {FileEntry} fe File entry object.
|
||||||
|
* @returns {Promise<FileWriter>} Promise resolved with the FileWriter.
|
||||||
*/
|
*/
|
||||||
private createWriterMock(fe: FileEntry): Promise<FileWriter> {
|
private createWriterMock(fe: FileEntry): Promise<FileWriter> {
|
||||||
return new Promise<FileWriter>((resolve, reject) => {
|
return new Promise<FileWriter>((resolve, reject) => {
|
||||||
|
@ -179,7 +187,9 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Fill the message for an error.
|
||||||
|
*
|
||||||
|
* @param {any} err Error.
|
||||||
*/
|
*/
|
||||||
private fillErrorMessageMock(err: any): void {
|
private fillErrorMessageMock(err: any): void {
|
||||||
try {
|
try {
|
||||||
|
@ -350,11 +360,16 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Move a file or directory.
|
||||||
|
*
|
||||||
|
* @param {Entry} srce The Entry to copy.
|
||||||
|
* @param {DirectoryEntry} destDir The directory where to move the file/dir.
|
||||||
|
* @param {string} newName New name of the file/dir.
|
||||||
|
* @returns {Promise<Entry>} Returns a Promise that resolves to the new Entry object or rejects with an error.
|
||||||
*/
|
*/
|
||||||
private moveMock(srce: Entry, destdir: DirectoryEntry, newName: string): Promise<Entry> {
|
private moveMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||||
return new Promise<Entry>((resolve, reject) => {
|
return new Promise<Entry>((resolve, reject) => {
|
||||||
srce.moveTo(destdir, newName, (deste) => {
|
srce.moveTo(destDir, newName, (deste) => {
|
||||||
resolve(deste);
|
resolve(deste);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
this.fillErrorMessageMock(err);
|
this.fillErrorMessageMock(err);
|
||||||
|
@ -448,7 +463,10 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Read all the files and directories inside a directory.
|
||||||
|
*
|
||||||
|
* @param {DirectoryReader} dr The directory reader.
|
||||||
|
* @return {Promise<Entry[]>} Promise resolved with the list of files/dirs.
|
||||||
*/
|
*/
|
||||||
private readEntriesMock(dr: DirectoryReader): Promise<Entry[]> {
|
private readEntriesMock(dr: DirectoryReader): Promise<Entry[]> {
|
||||||
return new Promise<Entry[]>((resolve, reject) => {
|
return new Promise<Entry[]>((resolve, reject) => {
|
||||||
|
@ -485,7 +503,7 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
fileEntry.file(file => {
|
fileEntry.file((file) => {
|
||||||
reader[`readAs${readAs}`].call(reader, file);
|
reader[`readAs${readAs}`].call(reader, file);
|
||||||
}, error => {
|
}, error => {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
@ -495,7 +513,10 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Delete a file.
|
||||||
|
*
|
||||||
|
* @param {Entry} fe The file to remove.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
private removeMock(fe: Entry): Promise<any> {
|
private removeMock(fe: Entry): Promise<any> {
|
||||||
return new Promise<any>((resolve, reject) => {
|
return new Promise<any>((resolve, reject) => {
|
||||||
|
@ -592,7 +613,10 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Remove a directory and all its contents.
|
||||||
|
*
|
||||||
|
* @param {DirectoryEntry} de Directory to remove.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
private rimrafMock(de: DirectoryEntry): Promise<any> {
|
private rimrafMock(de: DirectoryEntry): Promise<any> {
|
||||||
return new Promise<any>((resolve, reject) => {
|
return new Promise<any>((resolve, reject) => {
|
||||||
|
@ -606,11 +630,15 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Write some data in a file.
|
||||||
|
*
|
||||||
|
* @param {FileWriter} writer File writer.
|
||||||
|
* @param {any} data The data to write.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
private writeMock(writer: FileWriter, gu: any): Promise<any> {
|
private writeMock(writer: FileWriter, data: any): Promise<any> {
|
||||||
if (gu instanceof Blob) {
|
if (data instanceof Blob) {
|
||||||
return this.writeFileInChunksMock(writer, gu);
|
return this.writeFileInChunksMock(writer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise<any>((resolve, reject) => {
|
return new Promise<any>((resolve, reject) => {
|
||||||
|
@ -621,7 +649,7 @@ export class FileMock extends File {
|
||||||
resolve(evt);
|
resolve(evt);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
writer.write(gu);
|
writer.write(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +689,6 @@ export class FileMock extends File {
|
||||||
/**
|
/**
|
||||||
* Write content to FileEntry.
|
* Write content to FileEntry.
|
||||||
*
|
*
|
||||||
* @hidden
|
|
||||||
* @param {FileEntry} fe File entry object.
|
* @param {FileEntry} fe File entry object.
|
||||||
* @param {string | Blob} text Content or blob to write.
|
* @param {string | Blob} text Content or blob to write.
|
||||||
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
|
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
|
||||||
|
@ -682,15 +709,19 @@ export class FileMock extends File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* Write a file in chunks.
|
||||||
*/
|
*
|
||||||
private writeFileInChunksMock(writer: FileWriter, file: Blob) {
|
* @param {FileWriter} writer File writer.
|
||||||
|
* @param {Blob} data Data to write.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
|
*/
|
||||||
|
private writeFileInChunksMock(writer: FileWriter, data: Blob) : Promise<any> {
|
||||||
const BLOCK_SIZE = 1024 * 1024;
|
const BLOCK_SIZE = 1024 * 1024;
|
||||||
let writtenSize = 0;
|
let writtenSize = 0;
|
||||||
|
|
||||||
function writeNextChunk() {
|
function writeNextChunk() {
|
||||||
const size = Math.min(BLOCK_SIZE, file.size - writtenSize);
|
const size = Math.min(BLOCK_SIZE, data.size - writtenSize);
|
||||||
const chunk = file.slice(writtenSize, writtenSize + size);
|
const chunk = data.slice(writtenSize, writtenSize + size);
|
||||||
|
|
||||||
writtenSize += size;
|
writtenSize += size;
|
||||||
writer.write(chunk);
|
writer.write(chunk);
|
||||||
|
@ -699,7 +730,7 @@ export class FileMock extends File {
|
||||||
return new Promise<any>((resolve, reject) => {
|
return new Promise<any>((resolve, reject) => {
|
||||||
writer.onerror = reject;
|
writer.onerror = reject;
|
||||||
writer.onwrite = () => {
|
writer.onwrite = () => {
|
||||||
if (writtenSize < file.size) {
|
if (writtenSize < data.size) {
|
||||||
writeNextChunk();
|
writeNextChunk();
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
|
|
|
@ -39,7 +39,7 @@ export interface CoreLoginSSOData {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates the Cordova Zip plugin in desktop apps and in browser.
|
* Helper provider that provides some common features regarding authentication.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CoreLoginHelperProvider {
|
export class CoreLoginHelperProvider {
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Moodle Mobile",
|
|
||||||
"short_name": "Moodle Mobile",
|
|
||||||
"start_url": "index.html",
|
|
||||||
"display": "standalone",
|
|
||||||
"icons": [{
|
|
||||||
"src": "assets/imgs/logo.png",
|
|
||||||
"sizes": "512x512",
|
|
||||||
"type": "image/png"
|
|
||||||
}],
|
|
||||||
"background_color": "#4e8ef7",
|
|
||||||
"theme_color": "#4e8ef7"
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/**
|
|
||||||
* Check out https://googlechromelabs.github.io/sw-toolbox/ for
|
|
||||||
* more info on how to use sw-toolbox to custom configure your service worker.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
importScripts('./build/sw-toolbox.js');
|
|
||||||
|
|
||||||
self.toolbox.options.cache = {
|
|
||||||
name: 'ionic-cache'
|
|
||||||
};
|
|
||||||
|
|
||||||
// pre-cache our key assets
|
|
||||||
self.toolbox.precache(
|
|
||||||
[
|
|
||||||
'./build/main.js',
|
|
||||||
'./build/vendor.js',
|
|
||||||
'./build/main.css',
|
|
||||||
'./build/polyfills.js',
|
|
||||||
'index.html',
|
|
||||||
'manifest.json'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
// dynamically cache any other local assets
|
|
||||||
self.toolbox.router.any('/*', self.toolbox.fastest);
|
|
||||||
|
|
||||||
// for any other requests go to the network, cache,
|
|
||||||
// and then only use that cached resource if your user goes offline
|
|
||||||
self.toolbox.router.default = self.toolbox.networkFirst;
|
|
Loading…
Reference in New Issue