Commit 81050901 by Matteo

Condivisione direttamente con url

parent a1f8bfde
......@@ -179,6 +179,8 @@ export class UtilService {
}
fileScaricati: Array<string>;
datiScaricati: Array<Blob>;
files: Array<Pair>;
count: number;
total: number;
......@@ -186,6 +188,8 @@ export class UtilService {
{
this.count = 0;
this.fileScaricati = new Array();
this.datiScaricati = new Array();
this.files = fileSel;
this.showLoading();
/*var i = 0;
while(i < fileSel.length)
......@@ -221,25 +225,31 @@ export class UtilService {
}, 1000);
else{
this.closeLoading();
this.socialSharing.share(null, null, this.fileScaricati, null).then(() => {
console.log("File condiviso con successo!");
}).catch((e) => {
this.presentAlert("Avviso", "", 'Errore durante la condivisione dei file', ["OK"]);
console.log('Errore durante la condivisione dei file:' + e);
});
this.socialSharing.share(null, null, this.fileScaricati, null).then(() => {
console.log("File condiviso con successo!");
}).catch((e) => {
this.presentAlert("Avviso", "", 'Errore durante la condivisione dei file', ["OK"]);
console.log('Errore durante la condivisione dei file:' + e);
});
}
}
async saveFile(fileInfo: Pair, index)
{
var path = "";
if(this.platform.is("ios")) path = this.file.tempDirectory;
if(this.platform.is("ios")) path = this.file.dataDirectory;
else path = this.file.externalDataDirectory;
var nomeFile : string = fileInfo.key;
nomeFile = nomeFile.replace(/\//g, "-");
await this.download(fileInfo.value)
.subscribe(
(data) => { // Success
if(this.platform.is("ios"))
{
this.fileScaricati.push(fileInfo.value);
this.count++;
}
else
this.file.writeFile(path, nomeFile, data, { replace: true }).then((fileEntry: FileEntry) => {
this.fileScaricati.push(fileEntry.toURL());
this.count++;
......@@ -256,7 +266,7 @@ export class UtilService {
shareDocumento(fileUrl: string, nomeFile: string)
{
var path = "";
if(this.platform.is("ios")) path = this.file.tempDirectory;
if(this.platform.is("ios")) path = this.file.dataDirectory;
else path = this.file.externalDataDirectory;
nomeFile = nomeFile.replace(/\//g, "-");
this.showLoading();
......@@ -283,7 +293,7 @@ export class UtilService {
downloadDocumento(fileUrl: string, nomeFile: string)
{
var path = "";
if(this.platform.is("ios")) path = this.file.tempDirectory;
if(this.platform.is("ios")) path = this.file.dataDirectory;
else path = this.file.externalDataDirectory;
nomeFile = nomeFile.replace(/\//g, "-");
this.showLoading();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment