Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

App closed before assets installed to local storage, app fails on next launch #31

Closed
nikolasleblanc opened this issue Oct 26, 2015 · 9 comments
Labels
Milestone

Comments

@nikolasleblanc
Copy link

Is this expected behaviour? Anyway around it?

@nikDemyankov
Copy link
Member

Does it fail with exception? Any stack trace?
On what platform: iOS, Android?
What type of project: Cordova, Ionic?

@nikolasleblanc
Copy link
Author

Sorry, my mac was about to reboot itself so was trying to get the issue done as quickly as possible. So...

This is an ionic project, on android, and basically if I load the app for the first time and close it immediately, what I assume is happening is it tries to download as many assets (in this case js files) as it can before I close the app. When I close it quickly, I'm assuming that it's not getting them all. Next time I load the app up, I get stack trace errors in chrome://inspect basically about how it could not load angular because it doesn't have those script files (they don't appear in the sources tab either).

So my guess is I just haven't given it time to get all the files. When I leave the app open, about 30 seconds to a minute later it hits a breakpoint I set up in the function block where it gets events from the native side, saying it's downloaded all the files. Then it works fine on each new reload.

Does this sound like what you'd expect to happen? I figure if it knows when it has downloaded all the files, it should also know when it hasn't, and it shouldn't look for them in local storage until it knows they exist there?

Granted, I'm closing the app a lot quicker than a regular user would because I'm just testing out hot code push, which otherwise works great.

@nikolasleblanc
Copy link
Author

Today I'll be bundling and minifying the js files, which I'm expecting to help things. Will let you know.

@nikDemyankov
Copy link
Member

Thanks for the more detailed explanation, now I understand where is the problem.

Yes, when you launch application for the first time - it creates directory on the external storage and copies in it all data from the assets/www folder (in the case of the android). On the next launch it checks if that folder exists, and if it does - it loads index page from it, and not from the assets folder. Usually copying from assets to external storage happens very fast, but if there is a lot of files, and user quickly closes the app - then yes, that is a problem. Will have to extend that launch checking.

@nikolasleblanc
Copy link
Author

Could it use the manifest file to compare the files it has with the files it doesn't?

@nikDemyankov
Copy link
Member

No, it can't. assets/www contain's more then just files from the manifest. When copying is done - appropriate event is dispatched. I just need to save in preferences, that copying is finished and we can load content from the external storage. If not - use version from the assets.

@nikolasleblanc
Copy link
Author

Ok cool. Thanks Nik. Cool name by the way. ;)

@nikDemyankov nikDemyankov added this to the v1.0.5 milestone Oct 26, 2015
@nikDemyankov
Copy link
Member

Thanks)

@nikDemyankov
Copy link
Member

Fixed in v1.0.5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants