Check if e2e is available in DocumentsStorageProvider

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2022-11-01 10:44:28 +01:00 committed by Álvaro Brey
parent ee78494df5
commit 64ca4b1858

View file

@ -70,6 +70,7 @@ import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.RenameFileOperation;
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.FileUtil;
import com.owncloud.android.utils.MimeTypeUtil;
@ -165,9 +166,17 @@ public class DocumentsStorageProvider extends DocumentsProvider {
Context context = getNonNullContext();
Document parentFolder = toDocument(parentDocumentId);
FileDataStorageManager storageManager = parentFolder.getStorageManager();
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)) {
resultCursor.addFile(new Document(storageManager, file));
}