Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asset extraction #771

Merged
merged 1 commit into from
May 31, 2017
Merged

Fix asset extraction #771

merged 1 commit into from
May 31, 2017

Conversation

petekanev
Copy link
Contributor

Add additional logic to asset extraction so that whenever a new version of the application is pushed to the device, at startup the old assets will be wiped out and replaced with those of the new application package.

This will also prevent Android's Auto Backup feature (Android devices level 23 and up) from messing up the application with previously cached scripts, as the changes restored will be removed by the asset extraction mechanism in the runtime.

Also write the assetsThumb, used to check whether assets should be extracted, to a directory that is not backed up, to prevent the thumb from being cached.

Note: scripts and files stored in context.getFilesDir()/app, those downloaded either from a push plugin, http service, or just stored there, will naturally be removed when the extraction mechanism runs.

Addresses issue NativeScript/NativeScript#4137

…n is updated

keep the assetsThumb that will not be backed up by the android Auto Backup feature
@petekanev petekanev self-assigned this May 30, 2017
@ns-bot
Copy link

ns-bot commented May 30, 2017

💚

Copy link

@vakrilov vakrilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

return;
}

for (File childFile : files) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there an API to nuke the whole folder at once?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in Java. Java is special! There is a more concise API to work with files, but it isn't available on devices up to Level 23

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh well ...

@petekanev petekanev merged commit f7a8222 into master May 31, 2017
@petekanev petekanev deleted the pete/clear-assets-on-update branch May 31, 2017 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants