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

TIMOB-14746-added support for appCache #4661

Merged
merged 1 commit into from
Oct 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ public TiUIWebView(TiViewProxy proxy)
settings.setDatabaseEnabled(true);
}

File cacheDir = TiApplication.getInstance().getCacheDir();
Copy link
Contributor

Choose a reason for hiding this comment

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

Base on the Android doc http://developer.android.com/reference/android/content/ContextWrapper.html#getCacheDir(), shouldn't we specify a reasonable maximum to the cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cache size is managed through the property setAppCacheMaxSize on WebSettings and it is recommended to use the default value.

if (cacheDir != null) {
settings.setAppCacheEnabled(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this addresses the issue mentioned. The ticket specifically ask for caching using a custom manifest, i.e: only cache the files declared in the manifest. Essentially we would need to implement our own custom cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The manifest file is deployed in the server describing which files can be cached and is referred in the html file using 'manifest' attribute in the html tag. The client webview will only cache those files, I don't think we need to do anything else. I tested with 'http://www.w3schools.com/html/tryhtml5_html_manifest.htm' and seems working.

settings.setAppCachePath(cacheDir.getAbsolutePath());
}

// enable zoom controls by default
boolean enableZoom = true;
Expand Down