-
Notifications
You must be signed in to change notification settings - Fork 116
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
base: development
Are you sure you want to change the base?
Conversation
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"); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this?
No description provided.