Add addCreateFolderOfflineOperation

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-08-12 15:34:30 +02:00
parent 8fb67102c5
commit bc12270740
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
3 changed files with 17 additions and 7 deletions

View file

@ -19,15 +19,12 @@ data class OfflineOperationEntity(
@ColumnInfo(name = ProviderTableMeta._ID)
val id: Int? = null,
@ColumnInfo(name = ProviderTableMeta.OFFLINE_OPERATION_PARENT_ID)
val parentId: Int? = null,
@ColumnInfo(name = ProviderTableMeta.OFFLINE_OPERATION_PARENT_OC_FILE_ID)
val parentOCFileId: Long? = null,
var parentOCFileId: Long? = null,
@ColumnInfo(name = ProviderTableMeta.OFFLINE_OPERATION_TYPE)
val type: OfflineOperationType? = null,
var type: OfflineOperationType? = null,
@ColumnInfo(name = ProviderTableMeta.OFFLINE_OPERATION_CREATED_AT)
val createdAt: Long? = null,
var createdAt: Long? = null,
)

View file

@ -36,6 +36,8 @@ import com.nextcloud.client.database.NextcloudDatabase;
import com.nextcloud.client.database.dao.FileDao;
import com.nextcloud.client.database.dao.OfflineOperationDao;
import com.nextcloud.client.database.entity.FileEntity;
import com.nextcloud.client.database.entity.OfflineOperationEntity;
import com.nextcloud.model.OfflineOperationType;
import com.owncloud.android.MainApp;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.lib.common.network.WebdavEntry;
@ -128,6 +130,18 @@ public class FileDataStorageManager {
return getFileByPath(ProviderTableMeta.FILE_PATH_DECRYPTED, path);
}
public void addCreateFolderOfflineOperation(String path, long parentId) {
OfflineOperationType type = new OfflineOperationType.CreateFolder(path);
OfflineOperationEntity entity = new OfflineOperationEntity();
entity.setParentOCFileId(parentId);
entity.setCreatedAt(System.currentTimeMillis() / 1000L);
entity.setType(type);
offlineOperationDao.insert(entity);
}
private @Nullable
OCFile getFileByPath(String type, String path) {
final boolean shouldUseEncryptedPath = ProviderTableMeta.FILE_PATH.equals(type);

View file

@ -295,7 +295,6 @@ public class ProviderMeta {
public static final String OFFLINE_OPERATION_CREATED_AT = "offline_operations_created_at";
public static final String OFFLINE_OPERATION_FILE_NAME = "offline_operations_file_name";
// Columns of synced folder table
public static final String SYNCED_FOLDER_LOCAL_PATH = "local_path";
public static final String SYNCED_FOLDER_REMOTE_PATH = "remote_path";