-
Notifications
You must be signed in to change notification settings - Fork 26
Proof Mode to work only with Private Cloud Camera uploads #671
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
Conversation
@@ -830,7 +822,8 @@ | |||
|
|||
mSnackBar?.show() | |||
lifecycleScope.launch(Dispatchers.IO) { | |||
val media = Picker.import(this@MainActivity, getSelectedProject(), uri) | |||
//When we are sharing a file to be uploaded to Save app we don't generate proof. |
Check warning
Code scanning / detekt
Checks if comments have the right spacing Warning
@@ -59,7 +55,8 @@ | |||
val snackbar = showProgressSnackBar(activity, root, activity.getString(R.string.importing_media)) | |||
|
|||
activity.lifecycleScope.launch(Dispatchers.IO) { | |||
val media = import(activity, project(), result.map { it.uri }) | |||
// We don't generate proof for media picker files. | |||
val media = import(activity, project(), result.map { it.uri },false) |
Check warning
Code scanning / detekt
Reports spaces around commas Warning
val media = import(activity, project(), listOf(uri)) | ||
// We generate proof for in app capture Just because we toggle it true, it doesn't generate proof. | ||
// It should be on in the settings too. We check that inside import | ||
val media = import(activity, project(), listOf(uri),true) |
Check warning
Code scanning / detekt
Reports spaces around commas Warning
val result = ArrayList<Media>() | ||
|
||
for (uri in uris) { | ||
try { | ||
val media = import(context, project, uri) | ||
//Simply pass the generate proof boolean for single file import which is looped here |
Check warning
Code scanning / detekt
Checks if comments have the right spacing Warning
@@ -154,7 +155,7 @@ | |||
return result | |||
} | |||
|
|||
fun import(context: Context, project: Project?, uri: Uri): Media? { | |||
fun import(context: Context, project: Project?, uri: Uri, generateProof: Boolean): Media? { |
Check warning
Code scanning / detekt
Restrict the number of return statements in methods. Warning
//If Proof mode is on we need this to be on always | ||
Prefs.proofModeLocation = true | ||
Prefs.proofModeNetwork = true | ||
//Generate proof for camera photos and also always track location |
Check warning
Code scanning / detekt
Checks if comments have the right spacing Warning
hash = ProofMode.generateProof(mContext, mMedia.fileUri, proofHash) | ||
} | ||
return ProofMode.getProofDir(mContext, mMedia.mediaHashString).listFiles() ?: emptyArray() | ||
// Here we are simply fetching the files. Don't generate proof here. This is only called during upload. |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
} | ||
return ProofMode.getProofDir(mContext, mMedia.mediaHashString).listFiles() ?: emptyArray() | ||
// Here we are simply fetching the files. Don't generate proof here. This is only called during upload. | ||
// Generating Proof here won't make sense because the file can be created well before it could be uploaded. |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
return ProofMode.getProofDir(mContext, mMedia.mediaHashString).listFiles() ?: emptyArray() | ||
// Here we are simply fetching the files. Don't generate proof here. This is only called during upload. | ||
// Generating Proof here won't make sense because the file can be created well before it could be uploaded. | ||
var files = ProofMode.getProofDir(mContext, mMedia.mediaHashString).listFiles() ?: emptyArray() |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
// Here we are simply fetching the files. Don't generate proof here. This is only called during upload. | ||
// Generating Proof here won't make sense because the file can be created well before it could be uploaded. | ||
var files = ProofMode.getProofDir(mContext, mMedia.mediaHashString).listFiles() ?: emptyArray() | ||
return files |
Check warning
Code scanning / detekt
Reports mis-indented code Warning
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.
LGTM
No description provided.