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-20439] Android: Delete temp camera data on exit #9362

Merged
merged 4 commits into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
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 @@ -627,7 +627,7 @@ private static File createExternalStorageFile(String extension, String type, boo
File file;
String ext = extension == null ? ".jpg" : extension;
try {
file = TiFileHelper.getInstance().getTempFile(appDir, ext, false);
file = TiFileHelper.getInstance().getTempFile(appDir, ext, !isPublic);
} catch (IOException e) {
Log.e(TAG, "Failed to create file: " + e.getMessage());
return null;
Expand Down Expand Up @@ -809,7 +809,7 @@ public void onResult(Activity activity, int requestCode, int resultCode, Intent
copyFile(imageFile, dataFile);
imageFile.delete();
imageFile = dataFile;

TiFileHelper.getInstance().destroyOnExit(imageFile);
} catch(Throwable t) {
if (errorCallback != null) {
KrollDict response = new KrollDict();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,11 @@ public File getTempFileFromInputStream(InputStream is, String suffix, boolean de
return null;
}

public void destroyOnExit(File file)
{
tempFiles.add(file);
}

// Destroys all temporary files that have been created.
// This is called when the application is exited/destroyed.
public void destroyTempFiles()
Expand Down