Skip to content

Upgrade File Access to DocumentFile for Scoped Storage Compatibility#274

Open
permission-error wants to merge 2 commits intoodk-x:developmentfrom
permission-error:docfile
Open

Upgrade File Access to DocumentFile for Scoped Storage Compatibility#274
permission-error wants to merge 2 commits intoodk-x:developmentfrom
permission-error:docfile

Conversation

@permission-error
Copy link

No description provided.

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?

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