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

Upgrade File Access to DocumentFile for Scoped Storage Compatibility #274

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

permission-error
Copy link

No description provided.

if (!instanceFolder.exists() && !instanceFolder.mkdirs()) {
throw new Exception("Should have been able to create " + instanceFolder.getPath());
}
assertTrue(instanceFolder.exists());
FileOutputStream f = new FileOutputStream(new File(instanceFolder.getPath() + "/temp"));
f.write(new byte[] { 97, 98, 99 });
File tempFile = new File(instanceFolder, "temp");
Copy link
Contributor

Choose a reason for hiding this comment

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

@wbrunette what do you think, please. Although he converted the File object to a DocumentFile in line 1580

Copy link
Member

Choose a reason for hiding this comment

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

You are correct,

There are other ways to create a DocumentFile such as fromSingleUri

OutputStream outputStream = context.getContentResolver().openOutputStream(newFile.getUri());
if (outputStream != null) {
outputStream.write(content.getBytes());
outputStream.close();
}

FileManifestDocument tableManifestEntries =
synchronizer.getAppLevelFileManifest(null, null, true);
synchronizer.getAppLevelFileManifest(String.valueOf(nullFiles), null, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you use this String.valueOf(nullFiles), please?

"sample.jpg");
DocumentFile configFile = DocumentFile.fromFile(
new File(ODKFileUtils.getAssetsCsvInstanceFolder(getAppName(), tableId, rowIdFullCommon),
"sample.jpg"));
cvValues.put("col6", ODKFileUtils.asConfigRelativePath(getAppName(), configFile)); // configpath
File rowFile = new File(ODKFileUtils.getInstanceFolder(getAppName(), tableId, rowIdFullCommon), "sample.jpg");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you skipped this

@@ -529,7 +531,7 @@ public void syncTableLevelFiles(String tableId, String serverReportedTableLevelE

for (OdkTablesFileManifestEntry entry : manifestDocument.entries) {
File localFile = ODKFileUtils.asConfigFile(sc.getAppName(), entry.filename);
Copy link
Contributor

Choose a reason for hiding this comment

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

this?

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.

3 participants