Merge pull request #10968 from nextcloud/e2eDocumentNotSetup

Check if e2e is available in DocumentsStorageProvider
This commit is contained in:
Álvaro Brey 2022-11-21 17:20:21 +01:00 committed by GitHub
commit 5fe237033f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,6 +70,7 @@ import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.operations.RemoveFileOperation; import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.RenameFileOperation; import com.owncloud.android.operations.RenameFileOperation;
import com.owncloud.android.ui.activity.SettingsActivity; import com.owncloud.android.ui.activity.SettingsActivity;
import com.owncloud.android.ui.helpers.FileOperationsHelper;
import com.owncloud.android.utils.FileStorageUtils; import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.FileUtil; import com.owncloud.android.utils.FileUtil;
import com.owncloud.android.utils.MimeTypeUtil; import com.owncloud.android.utils.MimeTypeUtil;
@ -165,9 +166,17 @@ public class DocumentsStorageProvider extends DocumentsProvider {
Context context = getNonNullContext(); Context context = getNonNullContext();
Document parentFolder = toDocument(parentDocumentId); Document parentFolder = toDocument(parentDocumentId);
FileDataStorageManager storageManager = parentFolder.getStorageManager();
final FileCursor resultCursor = new FileCursor(projection); final FileCursor resultCursor = new FileCursor(projection);
if (parentFolder.getFile().isEncrypted() &&
!FileOperationsHelper.isEndToEndEncryptionSetup(context, parentFolder.getUser())) {
Toast.makeText(context, R.string.e2e_not_yet_setup, Toast.LENGTH_LONG).show();
return resultCursor;
}
FileDataStorageManager storageManager = parentFolder.getStorageManager();
for (OCFile file : storageManager.getFolderContent(parentFolder.getFile(), false)) { for (OCFile file : storageManager.getFolderContent(parentFolder.getFile(), false)) {
resultCursor.addFile(new Document(storageManager, file)); resultCursor.addFile(new Document(storageManager, file));
} }