Hey, I am making an app that is downloading a zipped file and then unzips in a folder (its a folder with an html file as well as some mobile js and CSS helper files). But I cannot seem to open the index.html file with the inAppBrowser. I have built a provider function that sends the file link back to page:
public openInApp(inApp){
return Observable.create(observer => {
this.storage.get('user').then((user) => {
var inAppFolder = cordova.file.dataDirectory + 'files/' + user.user + '/' + inApp.id;
var indexFile = '/' + inApp.syncFrom + '/' + inApp.indexFile;
var fileToOpen = inAppFolder + indexFile;
console.log("File to open: " + fileToOpen);
File.resolveLocalFilesystemUrl(fileToOpen).then((res)=>{
console.log("resolveLocalFilesystemUrl");
console.log(res);
observer.next(res.toURL());
observer.complete();
},(err)=>{
});
});
});
and then I try to open the html file like this:
openInApp(inApp, key) {
this.inapp.openInApp(inApp).subscribe(response=>{
console.log("openInApp response: " + response);
let browser = new InAppBrowser(response, '_system');
}, error =>{
this.presentToast("Error when opening inApp: " + error);
});
};
But I get that file is not found although it gets found in the provider. What am i missing? Is there another way to do this? Im trying to update a very old app that I have access to code and previously it was using iFrames. Is that better you think?