diff --git a/app/schemas/com.nextcloud.client.database.NextcloudDatabase/67.json b/app/schemas/com.nextcloud.client.database.NextcloudDatabase/67.json new file mode 100644 index 0000000000..15752cfeb4 --- /dev/null +++ b/app/schemas/com.nextcloud.client.database.NextcloudDatabase/67.json @@ -0,0 +1,1130 @@ +{ + "formatVersion": 1, + "database": { + "version": 67, + "identityHash": "be969fd72e75dd6116b4fa746bcf5b6a", + "entities": [ + { + "tableName": "arbitrary_data", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `cloud_id` TEXT, `key` TEXT, `value` TEXT)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "cloudId", + "columnName": "cloud_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "key", + "columnName": "key", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "value", + "columnName": "value", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "capabilities", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` TEXT, `version_mayor` INTEGER, `version_minor` INTEGER, `version_micro` INTEGER, `version_string` TEXT, `version_edition` TEXT, `extended_support` INTEGER, `core_pollinterval` INTEGER, `sharing_api_enabled` INTEGER, `sharing_public_enabled` INTEGER, `sharing_public_password_enforced` INTEGER, `sharing_public_expire_date_enabled` INTEGER, `sharing_public_expire_date_days` INTEGER, `sharing_public_expire_date_enforced` INTEGER, `sharing_public_send_mail` INTEGER, `sharing_public_upload` INTEGER, `sharing_user_send_mail` INTEGER, `sharing_resharing` INTEGER, `sharing_federation_outgoing` INTEGER, `sharing_federation_incoming` INTEGER, `files_bigfilechunking` INTEGER, `files_undelete` INTEGER, `files_versioning` INTEGER, `external_links` INTEGER, `server_name` TEXT, `server_color` TEXT, `server_text_color` TEXT, `server_element_color` TEXT, `server_slogan` TEXT, `server_logo` TEXT, `background_url` TEXT, `end_to_end_encryption` INTEGER, `end_to_end_encryption_keys_exist` INTEGER, `activity` INTEGER, `background_default` INTEGER, `background_plain` INTEGER, `richdocument` INTEGER, `richdocument_mimetype_list` TEXT, `richdocument_direct_editing` INTEGER, `richdocument_direct_templates` INTEGER, `richdocument_optional_mimetype_list` TEXT, `sharing_public_ask_for_optional_password` INTEGER, `richdocument_product_name` TEXT, `direct_editing_etag` TEXT, `user_status` INTEGER, `user_status_supports_emoji` INTEGER, `etag` TEXT, `files_locking_version` TEXT)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "accountName", + "columnName": "account", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "versionMajor", + "columnName": "version_mayor", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "versionMinor", + "columnName": "version_minor", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "versionMicro", + "columnName": "version_micro", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "versionString", + "columnName": "version_string", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "versionEditor", + "columnName": "version_edition", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "extendedSupport", + "columnName": "extended_support", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "corePollinterval", + "columnName": "core_pollinterval", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingApiEnabled", + "columnName": "sharing_api_enabled", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingPublicEnabled", + "columnName": "sharing_public_enabled", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingPublicPasswordEnforced", + "columnName": "sharing_public_password_enforced", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingPublicExpireDateEnabled", + "columnName": "sharing_public_expire_date_enabled", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingPublicExpireDateDays", + "columnName": "sharing_public_expire_date_days", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingPublicExpireDateEnforced", + "columnName": "sharing_public_expire_date_enforced", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingPublicSendMail", + "columnName": "sharing_public_send_mail", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingPublicUpload", + "columnName": "sharing_public_upload", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingUserSendMail", + "columnName": "sharing_user_send_mail", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingResharing", + "columnName": "sharing_resharing", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingFederationOutgoing", + "columnName": "sharing_federation_outgoing", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharingFederationIncoming", + "columnName": "sharing_federation_incoming", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "filesBigfilechunking", + "columnName": "files_bigfilechunking", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "filesUndelete", + "columnName": "files_undelete", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "filesVersioning", + "columnName": "files_versioning", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "externalLinks", + "columnName": "external_links", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "serverName", + "columnName": "server_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serverColor", + "columnName": "server_color", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serverTextColor", + "columnName": "server_text_color", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serverElementColor", + "columnName": "server_element_color", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serverSlogan", + "columnName": "server_slogan", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serverLogo", + "columnName": "server_logo", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serverBackgroundUrl", + "columnName": "background_url", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "endToEndEncryption", + "columnName": "end_to_end_encryption", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "endToEndEncryptionKeysExist", + "columnName": "end_to_end_encryption_keys_exist", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "activity", + "columnName": "activity", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "serverBackgroundDefault", + "columnName": "background_default", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "serverBackgroundPlain", + "columnName": "background_plain", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "richdocument", + "columnName": "richdocument", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "richdocumentMimetypeList", + "columnName": "richdocument_mimetype_list", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "richdocumentDirectEditing", + "columnName": "richdocument_direct_editing", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "richdocumentTemplates", + "columnName": "richdocument_direct_templates", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "richdocumentOptionalMimetypeList", + "columnName": "richdocument_optional_mimetype_list", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "sharingPublicAskForOptionalPassword", + "columnName": "sharing_public_ask_for_optional_password", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "richdocumentProductName", + "columnName": "richdocument_product_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "directEditingEtag", + "columnName": "direct_editing_etag", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "userStatus", + "columnName": "user_status", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "userStatusSupportsEmoji", + "columnName": "user_status_supports_emoji", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "etag", + "columnName": "etag", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "filesLockingVersion", + "columnName": "files_locking_version", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "external_links", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `icon_url` TEXT, `language` TEXT, `type` INTEGER, `name` TEXT, `url` TEXT, `redirect` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "iconUrl", + "columnName": "icon_url", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "language", + "columnName": "language", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "url", + "columnName": "url", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "redirect", + "columnName": "redirect", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "filelist", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `filename` TEXT, `encrypted_filename` TEXT, `path` TEXT, `path_decrypted` TEXT, `parent` INTEGER, `created` INTEGER, `modified` INTEGER, `content_type` TEXT, `content_length` INTEGER, `media_path` TEXT, `file_owner` TEXT, `last_sync_date` INTEGER, `last_sync_date_for_data` INTEGER, `modified_at_last_sync_for_data` INTEGER, `etag` TEXT, `etag_on_server` TEXT, `share_by_link` INTEGER, `permissions` TEXT, `remote_id` TEXT, `local_id` INTEGER, `update_thumbnail` INTEGER, `is_downloading` INTEGER, `favorite` INTEGER, `is_encrypted` INTEGER, `etag_in_conflict` TEXT, `shared_via_users` INTEGER, `mount_type` INTEGER, `has_preview` INTEGER, `unread_comments_count` INTEGER, `owner_id` TEXT, `owner_display_name` TEXT, `note` TEXT, `sharees` TEXT, `rich_workspace` TEXT, `metadata_size` TEXT, `locked` INTEGER, `lock_type` INTEGER, `lock_owner` TEXT, `lock_owner_display_name` TEXT, `lock_owner_editor` TEXT, `lock_timestamp` INTEGER, `lock_timeout` INTEGER, `lock_token` TEXT)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "filename", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "encryptedName", + "columnName": "encrypted_filename", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "path", + "columnName": "path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "pathDecrypted", + "columnName": "path_decrypted", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "parent", + "columnName": "parent", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "creation", + "columnName": "created", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "modified", + "columnName": "modified", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "contentType", + "columnName": "content_type", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "contentLength", + "columnName": "content_length", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "storagePath", + "columnName": "media_path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "accountOwner", + "columnName": "file_owner", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "lastSyncDate", + "columnName": "last_sync_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lastSyncDateForData", + "columnName": "last_sync_date_for_data", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "modifiedAtLastSyncForData", + "columnName": "modified_at_last_sync_for_data", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "etag", + "columnName": "etag", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "etagOnServer", + "columnName": "etag_on_server", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "sharedViaLink", + "columnName": "share_by_link", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "permissions", + "columnName": "permissions", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "remoteId", + "columnName": "remote_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "localId", + "columnName": "local_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "updateThumbnail", + "columnName": "update_thumbnail", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "isDownloading", + "columnName": "is_downloading", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "favorite", + "columnName": "favorite", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "isEncrypted", + "columnName": "is_encrypted", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "etagInConflict", + "columnName": "etag_in_conflict", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "sharedWithSharee", + "columnName": "shared_via_users", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "mountType", + "columnName": "mount_type", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "hasPreview", + "columnName": "has_preview", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "unreadCommentsCount", + "columnName": "unread_comments_count", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "ownerId", + "columnName": "owner_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "ownerDisplayName", + "columnName": "owner_display_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "note", + "columnName": "note", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "sharees", + "columnName": "sharees", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "richWorkspace", + "columnName": "rich_workspace", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "metadataSize", + "columnName": "metadata_size", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "locked", + "columnName": "locked", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lockType", + "columnName": "lock_type", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lockOwner", + "columnName": "lock_owner", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "lockOwnerDisplayName", + "columnName": "lock_owner_display_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "lockOwnerEditor", + "columnName": "lock_owner_editor", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "lockTimestamp", + "columnName": "lock_timestamp", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lockTimeout", + "columnName": "lock_timeout", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lockToken", + "columnName": "lock_token", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "filesystem", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `local_path` TEXT, `is_folder` INTEGER, `found_at` INTEGER, `upload_triggered` INTEGER, `syncedfolder_id` TEXT, `crc32` TEXT, `modified_at` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "localPath", + "columnName": "local_path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "fileIsFolder", + "columnName": "is_folder", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "fileFoundRecently", + "columnName": "found_at", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "fileSentForUpload", + "columnName": "upload_triggered", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "syncedFolderId", + "columnName": "syncedfolder_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "crc32", + "columnName": "crc32", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "fileModified", + "columnName": "modified_at", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "ocshares", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `file_source` INTEGER, `item_source` INTEGER, `share_type` INTEGER, `shate_with` TEXT, `path` TEXT, `permissions` INTEGER, `shared_date` INTEGER, `expiration_date` INTEGER, `token` TEXT, `shared_with_display_name` TEXT, `is_directory` INTEGER, `user_id` INTEGER, `id_remote_shared` INTEGER, `owner_share` TEXT, `is_password_protected` INTEGER, `note` TEXT, `hide_download` INTEGER, `share_link` TEXT, `share_label` TEXT)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "fileSource", + "columnName": "file_source", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "itemSource", + "columnName": "item_source", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "shareType", + "columnName": "share_type", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "shareWith", + "columnName": "shate_with", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "path", + "columnName": "path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "permissions", + "columnName": "permissions", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sharedDate", + "columnName": "shared_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "expirationDate", + "columnName": "expiration_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "token", + "columnName": "token", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "shareWithDisplayName", + "columnName": "shared_with_display_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "isDirectory", + "columnName": "is_directory", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "userId", + "columnName": "user_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "idRemoteShared", + "columnName": "id_remote_shared", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "accountOwner", + "columnName": "owner_share", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "isPasswordProtected", + "columnName": "is_password_protected", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "note", + "columnName": "note", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "hideDownload", + "columnName": "hide_download", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "shareLink", + "columnName": "share_link", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "shareLabel", + "columnName": "share_label", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "synced_folders", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `local_path` TEXT, `remote_path` TEXT, `wifi_only` INTEGER, `charging_only` INTEGER, `existing` INTEGER, `enabled` INTEGER, `enabled_timestamp_ms` INTEGER, `subfolder_by_date` INTEGER, `account` TEXT, `upload_option` INTEGER, `name_collision_policy` INTEGER, `type` INTEGER, `hidden` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "localPath", + "columnName": "local_path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "remotePath", + "columnName": "remote_path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "wifiOnly", + "columnName": "wifi_only", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "chargingOnly", + "columnName": "charging_only", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "existing", + "columnName": "existing", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "enabled", + "columnName": "enabled", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "enabledTimestampMs", + "columnName": "enabled_timestamp_ms", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "subfolderByDate", + "columnName": "subfolder_by_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "account", + "columnName": "account", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "uploadAction", + "columnName": "upload_option", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "nameCollisionPolicy", + "columnName": "name_collision_policy", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "hidden", + "columnName": "hidden", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "list_of_uploads", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `local_path` TEXT, `remote_path` TEXT, `account_name` TEXT, `file_size` INTEGER, `status` INTEGER, `local_behaviour` INTEGER, `upload_time` INTEGER, `name_collision_policy` INTEGER, `is_create_remote_folder` INTEGER, `upload_end_timestamp` INTEGER, `last_result` INTEGER, `is_while_charging_only` INTEGER, `is_wifi_only` INTEGER, `created_by` INTEGER, `folder_unlock_token` TEXT)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "localPath", + "columnName": "local_path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "remotePath", + "columnName": "remote_path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "accountName", + "columnName": "account_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "fileSize", + "columnName": "file_size", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "status", + "columnName": "status", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "localBehaviour", + "columnName": "local_behaviour", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "uploadTime", + "columnName": "upload_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "nameCollisionPolicy", + "columnName": "name_collision_policy", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "isCreateRemoteFolder", + "columnName": "is_create_remote_folder", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "uploadEndTimestamp", + "columnName": "upload_end_timestamp", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lastResult", + "columnName": "last_result", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "isWhileChargingOnly", + "columnName": "is_while_charging_only", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "isWifiOnly", + "columnName": "is_wifi_only", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "createdBy", + "columnName": "created_by", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "folderUnlockToken", + "columnName": "folder_unlock_token", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "virtual", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `type` TEXT, `ocfile_id` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "ocFileId", + "columnName": "ocfile_id", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "_id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'be969fd72e75dd6116b4fa746bcf5b6a')" + ] + } +} diff --git a/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java b/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java index f4883f4ce8..fe41bbc104 100644 --- a/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java +++ b/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerContentProviderClientIT.java @@ -24,9 +24,14 @@ package com.owncloud.android.datamodel; import com.owncloud.android.db.ProviderMeta; -public class FileDataStorageManagerContentProviderClientIT extends FileDataStorageManagerIT { +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class FileDataStorageManagerContentProviderClientIT extends FileDataStorageManagerIT { + protected FileDataStorageManager sut; - @Override public void before() { sut = new FileDataStorageManager(user, targetContext @@ -36,4 +41,25 @@ public class FileDataStorageManagerContentProviderClientIT extends FileDataStora super.before(); } + + @Test + public void saveFile() { + before(); + + String path = "/1.txt"; + OCFile file = new OCFile(path); + file.setRemoteId("00000008ocjycgrudn78"); + + // TODO check via reflection that every parameter is set + + file.setFileLength(1024000); + file.setModificationTimestamp(1582019340); + sut.saveNewFile(file); + + + OCFile read = sut.getFileByPath(path); + assertNotNull(read); + + assertEquals(file.getRemotePath(), read.getRemotePath()); + } } diff --git a/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java b/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java index 7a4e44e4c0..9736a9a6ec 100644 --- a/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java +++ b/app/src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerIT.java @@ -369,4 +369,5 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT { assertEquals(capability.getUserStatus(), newCapability.getUserStatus()); } + } diff --git a/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt b/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt index 64b19a55a8..770f4467a9 100644 --- a/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt +++ b/app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt @@ -58,7 +58,8 @@ import com.owncloud.android.db.ProviderMeta ], version = ProviderMeta.DB_VERSION, autoMigrations = [ - AutoMigration(from = 65, to = 66) + AutoMigration(from = 65, to = 66), + AutoMigration(from = 66, to = 67) ], exportSchema = true ) diff --git a/app/src/main/java/com/nextcloud/client/database/entity/FileEntity.kt b/app/src/main/java/com/nextcloud/client/database/entity/FileEntity.kt index f02a06af2a..b6a4aea7be 100644 --- a/app/src/main/java/com/nextcloud/client/database/entity/FileEntity.kt +++ b/app/src/main/java/com/nextcloud/client/database/entity/FileEntity.kt @@ -70,6 +70,8 @@ data class FileEntity( val permissions: String?, @ColumnInfo(name = ProviderTableMeta.FILE_REMOTE_ID) val remoteId: String?, + @ColumnInfo(name = ProviderTableMeta.FILE_LOCAL_ID) + val localId: Long?, @ColumnInfo(name = ProviderTableMeta.FILE_UPDATE_THUMBNAIL) val updateThumbnail: Int?, @ColumnInfo(name = ProviderTableMeta.FILE_IS_DOWNLOADING) diff --git a/app/src/main/java/com/nextcloud/client/media/LoadUrlTask.kt b/app/src/main/java/com/nextcloud/client/media/LoadUrlTask.kt index fdd93606a1..be44239c7f 100644 --- a/app/src/main/java/com/nextcloud/client/media/LoadUrlTask.kt +++ b/app/src/main/java/com/nextcloud/client/media/LoadUrlTask.kt @@ -28,7 +28,7 @@ import com.owncloud.android.lib.common.OwnCloudClient internal class LoadUrlTask( private val client: OwnCloudClient, - private val fileId: String, + private val fileId: Long, private val onResult: (String?) -> Unit ) : AsyncTask() { diff --git a/app/src/main/java/com/nextcloud/client/media/Player.kt b/app/src/main/java/com/nextcloud/client/media/Player.kt index 48d8660949..fc135cc94a 100644 --- a/app/src/main/java/com/nextcloud/client/media/Player.kt +++ b/app/src/main/java/com/nextcloud/client/media/Player.kt @@ -96,7 +96,7 @@ internal class Player( checkNotNull(user) playedFile?.let { val client = clientFactory.create(user) - val task = LoadUrlTask(client, it.remoteId, this@Player::onDownloaded) + val task = LoadUrlTask(client, it.localId, this@Player::onDownloaded) task.execute() loadUrlTask = task } diff --git a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index 4e8ebbb27b..fe296bc0d4 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -458,6 +458,7 @@ public class FileDataStorageManager { cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, fileOrFolder.isSharedWithSharee() ? 1 : 0); cv.put(ProviderTableMeta.FILE_PERMISSIONS, fileOrFolder.getPermissions()); cv.put(ProviderTableMeta.FILE_REMOTE_ID, fileOrFolder.getRemoteId()); + cv.put(ProviderTableMeta.FILE_LOCAL_ID, fileOrFolder.getLocalId()); cv.put(ProviderTableMeta.FILE_FAVORITE, fileOrFolder.isFavorite()); cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, fileOrFolder.getUnreadCommentsCount()); cv.put(ProviderTableMeta.FILE_OWNER_ID, fileOrFolder.getOwnerId()); diff --git a/app/src/main/java/com/owncloud/android/datamodel/OCFile.java b/app/src/main/java/com/owncloud/android/datamodel/OCFile.java index ce7fe72e0a..214ea0a4a4 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/OCFile.java +++ b/app/src/main/java/com/owncloud/android/datamodel/OCFile.java @@ -45,6 +45,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.core.content.FileProvider; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import third_parties.daveKoeller.AlphanumComparator; public class OCFile implements Parcelable, Comparable, ServerFileInterface { @@ -83,6 +84,7 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa private String etagOnServer; private boolean sharedViaLink; private String permissions; + private long localId; // unique fileId for the file within the instance private String remoteId; // The fileid namespaced by the instance fileId, globally unique private boolean updateThumbnailNeeded; private boolean downloading; @@ -166,6 +168,7 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa etagOnServer = source.readString(); sharedViaLink = source.readInt() == 1; permissions = source.readString(); + localId = source.readLong(); remoteId = source.readString(); updateThumbnailNeeded = source.readInt() == 1; downloading = source.readInt() == 1; @@ -208,6 +211,7 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa dest.writeString(etagOnServer); dest.writeInt(sharedViaLink ? 1 : 0); dest.writeString(permissions); + dest.writeLong(localId); dest.writeString(remoteId); dest.writeInt(updateThumbnailNeeded ? 1 : 0); dest.writeInt(downloading ? 1 : 0); @@ -284,8 +288,7 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa } /** - * Can be used to check, whether or not this file exists in the database - * already + * Can be used to check, whether or not this file exists in the database already * * @return true, if the file exists in the database */ @@ -486,6 +489,7 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa etagOnServer = null; sharedViaLink = false; permissions = null; + localId = -1; remoteId = null; updateThumbnailNeeded = false; downloading = false; @@ -594,17 +598,14 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa return !TextUtils.isEmpty(getFileName()) && getFileName().charAt(0) == '.'; } - /** - * The unique fileId for the file within the instance - * - * @return file fileId, unique within the instance - */ - @Nullable - public String getLocalId() { - if (getRemoteId() != null) { - return getRemoteId().substring(0, 8).replaceAll("^0*", ""); + @SuppressFBWarnings("STT") + public long getLocalId() { + if (localId > 0) { + return localId; + } else if (remoteId != null) { + return Long.parseLong(remoteId.substring(0, 8).replaceAll("^0*", "")); } else { - return null; + return -1; } } @@ -772,6 +773,10 @@ public class OCFile implements Parcelable, Comparable, ServerFileInterfa this.fileId = fileId; } + public void setLocalId(long localId) { + this.localId = localId; + } + public void setParentId(long parentId) { this.parentId = parentId; } diff --git a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 621e5d35c9..bb69b26015 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -689,7 +689,7 @@ public final class ThumbnailsCacheManager { Bitmap bitmap; if (MimeTypeUtil.isVideo(ocFile)) { bitmap = ThumbnailUtils.createVideoThumbnail(ocFile.getStoragePath(), - MediaStore.Images.Thumbnails.MINI_KIND); + MediaStore.Images.Thumbnails.MINI_KIND); } else { bitmap = BitmapUtils.decodeSampledBitmapFromFile(ocFile.getStoragePath(), pxW, pxH); } @@ -733,16 +733,16 @@ public final class ThumbnailsCacheManager { pxW + "/" + pxH + Uri.encode(file.getRemotePath(), "/"); } else { uri = mClient.getBaseUri() + "/index.php/apps/files_trashbin/preview?fileId=" + - file.getLocalId() + "&x=" + pxW + "&y=" + pxH; + file.getLocalId() + "&x=" + pxW + "&y=" + pxH; } Log_OC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri); getMethod = new GetMethod(uri); getMethod.setRequestHeader("Cookie", - "nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true"); + "nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true"); getMethod.setRequestHeader(RemoteOperation.OCS_API_HEADER, - RemoteOperation.OCS_API_HEADER_VALUE); + RemoteOperation.OCS_API_HEADER_VALUE); int status = mClient.executeMethod(getMethod, READ_TIMEOUT, CONNECTION_TIMEOUT); if (status == HttpStatus.SC_OK) { diff --git a/app/src/main/java/com/owncloud/android/db/ProviderMeta.java b/app/src/main/java/com/owncloud/android/db/ProviderMeta.java index 9a05b9a1c3..cf4246ea27 100644 --- a/app/src/main/java/com/owncloud/android/db/ProviderMeta.java +++ b/app/src/main/java/com/owncloud/android/db/ProviderMeta.java @@ -35,7 +35,7 @@ import java.util.List; */ public class ProviderMeta { public static final String DB_NAME = "filelist"; - public static final int DB_VERSION = 66; + public static final int DB_VERSION = 67; private ProviderMeta() { // No instance @@ -101,6 +101,7 @@ public class ProviderMeta { public static final String FILE_SHARED_VIA_LINK = "share_by_link"; public static final String FILE_SHARED_WITH_SHAREE = "shared_via_users"; public static final String FILE_PERMISSIONS = "permissions"; + public static final String FILE_LOCAL_ID = "local_id"; public static final String FILE_REMOTE_ID = "remote_id"; public static final String FILE_UPDATE_THUMBNAIL = "update_thumbnail"; public static final String FILE_IS_DOWNLOADING = "is_downloading"; @@ -148,6 +149,7 @@ public class ProviderMeta { FILE_SHARED_WITH_SHAREE, FILE_PERMISSIONS, FILE_REMOTE_ID, + FILE_LOCAL_ID, FILE_UPDATE_THUMBNAIL, FILE_IS_DOWNLOADING, FILE_ETAG_IN_CONFLICT, diff --git a/app/src/main/java/com/owncloud/android/files/StreamMediaFileOperation.java b/app/src/main/java/com/owncloud/android/files/StreamMediaFileOperation.java index 39e32b400c..30fe36d619 100644 --- a/app/src/main/java/com/owncloud/android/files/StreamMediaFileOperation.java +++ b/app/src/main/java/com/owncloud/android/files/StreamMediaFileOperation.java @@ -37,7 +37,7 @@ public class StreamMediaFileOperation extends RemoteOperation { private static final int SYNC_CONNECTION_TIMEOUT = 5000; private static final String STREAM_MEDIA_URL = "/ocs/v2.php/apps/dav/api/v1/direct"; - private String fileID; + private final long fileID; // JSON node names private static final String NODE_OCS = "ocs"; @@ -45,7 +45,7 @@ public class StreamMediaFileOperation extends RemoteOperation { private static final String NODE_URL = "url"; private static final String JSON_FORMAT = "?format=json"; - public StreamMediaFileOperation(String fileID) { + public StreamMediaFileOperation(long fileID) { this.fileID = fileID; } @@ -55,7 +55,7 @@ public class StreamMediaFileOperation extends RemoteOperation { try { postMethod = new Utf8PostMethod(client.getBaseUri() + STREAM_MEDIA_URL + JSON_FORMAT); - postMethod.setParameter("fileId", fileID); + postMethod.setParameter("fileId", String.valueOf(fileID)); // remote request postMethod.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE); diff --git a/app/src/main/java/com/owncloud/android/operations/CommentFileOperation.java b/app/src/main/java/com/owncloud/android/operations/CommentFileOperation.java index f90905de0f..3878a5db4c 100644 --- a/app/src/main/java/com/owncloud/android/operations/CommentFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/CommentFileOperation.java @@ -33,14 +33,14 @@ import com.owncloud.android.lib.resources.comments.CommentFileRemoteOperation; public class CommentFileOperation extends RemoteOperation { private final String message; - private final String fileId; + private final long fileId; /** * Constructor * * @param message Comment to store */ - public CommentFileOperation(String message, String fileId) { + public CommentFileOperation(String message, long fileId) { this.message = message; this.fileId = fileId; } diff --git a/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java b/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java index 2a27f60d72..5f30194726 100644 --- a/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java @@ -62,12 +62,12 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation { private static final int REMOVE_READ_TIMEOUT = 30000; private static final int REMOVE_CONNECTION_TIMEOUT = 5000; - private String remotePath; - private String parentId; + private final String remotePath; + private final long parentId; private User user; - private ArbitraryDataProvider arbitraryDataProvider; - private String fileName; + private final ArbitraryDataProvider arbitraryDataProvider; + private final String fileName; /** * Constructor @@ -76,7 +76,7 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation { * @param parentId local id of parent folder */ RemoveRemoteEncryptedFileOperation(String remotePath, - String parentId, + long parentId, User user, Context context, String fileName) { diff --git a/app/src/main/java/com/owncloud/android/operations/RichDocumentsUrlOperation.java b/app/src/main/java/com/owncloud/android/operations/RichDocumentsUrlOperation.java index 2270435388..2fb2edcfa6 100644 --- a/app/src/main/java/com/owncloud/android/operations/RichDocumentsUrlOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/RichDocumentsUrlOperation.java @@ -51,10 +51,10 @@ public class RichDocumentsUrlOperation extends RemoteOperation { private static final String NODE_URL = "url"; private static final String JSON_FORMAT = "?format=json"; - private String fileID; + private final long fileId; - public RichDocumentsUrlOperation(String fileID) { - this.fileID = fileID; + public RichDocumentsUrlOperation(long fileID) { + this.fileId = fileID; } @NextcloudServer(max = 18) @@ -64,7 +64,7 @@ public class RichDocumentsUrlOperation extends RemoteOperation { try { postMethod = new Utf8PostMethod(client.getBaseUri() + DOCUMENT_URL + JSON_FORMAT); - postMethod.setParameter(FILE_ID, fileID); + postMethod.setParameter(FILE_ID, String.valueOf(fileId)); // remote request postMethod.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE); @@ -86,7 +86,7 @@ public class RichDocumentsUrlOperation extends RemoteOperation { } } catch (Exception e) { result = new RemoteOperationResult(e); - Log_OC.e(TAG, "Get rich document url for file with id " + fileID + " failed: " + result.getLogMessage(), + Log_OC.e(TAG, "Get rich document url for file with id " + fileId + " failed: " + result.getLogMessage(), result.getException()); } finally { if (postMethod != null) { diff --git a/app/src/main/java/com/owncloud/android/services/OperationsService.java b/app/src/main/java/com/owncloud/android/services/OperationsService.java index 01bccc728e..35db51a579 100644 --- a/app/src/main/java/com/owncloud/android/services/OperationsService.java +++ b/app/src/main/java/com/owncloud/android/services/OperationsService.java @@ -721,7 +721,7 @@ public class OperationsService extends Service { case ACTION_RESTORE_VERSION: FileVersion fileVersion = operationIntent.getParcelableExtra(EXTRA_FILE_VERSION); - operation = new RestoreFileVersionRemoteOperation(fileVersion.getRemoteId(), + operation = new RestoreFileVersionRemoteOperation(fileVersion.getLocalId(), fileVersion.getFileName()); break; diff --git a/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.java b/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.java index 384af18937..4d7ad5c069 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.java +++ b/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.java @@ -23,12 +23,12 @@ package com.owncloud.android.ui.events; * Event for set folder as encrypted/decrypted */ public class EncryptionEvent { - public final String localId; + public final long localId; public final String remotePath; public final String remoteId; public final boolean shouldBeEncrypted; - public EncryptionEvent(String localId, String remoteId, String remotePath, boolean shouldBeEncrypted) { + public EncryptionEvent(long localId, String remoteId, String remotePath, boolean shouldBeEncrypted) { this.localId = localId; this.remoteId = remoteId; this.remotePath = remotePath; diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java index 9c4865423a..8991de8c55 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java @@ -457,12 +457,14 @@ public class FileDetailActivitiesFragment extends Fragment implements private static class SubmitCommentTask extends AsyncTask { - private String message; - private String fileId; - private VersionListInterface.CommentCallback callback; - private OwnCloudClient client; + private final String message; + private final long fileId; + private final VersionListInterface.CommentCallback callback; + private final OwnCloudClient client; - private SubmitCommentTask(String message, String fileId, VersionListInterface.CommentCallback callback, + private SubmitCommentTask(String message, + long fileId, + VersionListInterface.CommentCallback callback, OwnCloudClient client) { this.message = message; this.fileId = fileId; diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index b2386c32e4..c08cae71d3 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -1696,7 +1696,7 @@ public class OCFileListFragment extends ExtendedListFragment implements } } - private void encryptFolder(String localId, String remoteId, String remotePath, boolean shouldBeEncrypted) { + private void encryptFolder(long localId, String remoteId, String remotePath, boolean shouldBeEncrypted) { try { User user = accountManager.getUser(); OwnCloudClient client = clientFactory.create(user); diff --git a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java index 2ff871163d..85d58a7c68 100755 --- a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java +++ b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java @@ -456,7 +456,7 @@ public class FileOperationsHelper { fileActivity.showLoadingDialog(fileActivity.getString(R.string.wait_a_moment)); final User user = currentAccount.getUser(); new Thread(() -> { - StreamMediaFileOperation sfo = new StreamMediaFileOperation(file.getRemoteId()); + StreamMediaFileOperation sfo = new StreamMediaFileOperation(file.getLocalId()); RemoteOperationResult result = sfo.execute(user, fileActivity); fileActivity.dismissLoadingDialog(); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java index 103b83aa0d..f8b012551d 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -471,7 +471,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene playVideoUri(getFile().getStorageUri()); } else { try { - new LoadStreamUrl(this, user, clientFactory).execute(getFile().getRemoteId()); + new LoadStreamUrl(this, user, clientFactory).execute(getFile().getLocalId()); } catch (Exception e) { Log_OC.e(TAG, "Loading stream url not possible: " + e); } @@ -498,7 +498,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene Log_OC.e(TAG, "Fullscreen: " + isFullScreen); } - private static class LoadStreamUrl extends AsyncTask { + private static class LoadStreamUrl extends AsyncTask { private final ClientFactory clientFactory; private final User user; @@ -511,7 +511,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene } @Override - protected Uri doInBackground(String... fileId) { + protected Uri doInBackground(Long... fileId) { OwnCloudClient client; try { client = clientFactory.create(user); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java index 2a3c93e446..a26988735d 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java @@ -64,6 +64,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.widget.SearchView; import androidx.core.view.MenuItemCompat; import androidx.fragment.app.FragmentManager; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; public class PreviewTextFileFragment extends PreviewTextFragment { private static final String EXTRA_FILE = "FILE"; @@ -228,6 +229,7 @@ public class PreviewTextFileFragment extends PreviewTextFragment { } @Override + @SuppressFBWarnings("STT") protected void onPostExecute(final StringWriter stringWriter) { final TextView textView = textViewReference.get(); diff --git a/app/src/main/java/com/owncloud/android/utils/FileStorageUtils.java b/app/src/main/java/com/owncloud/android/utils/FileStorageUtils.java index d72325d688..ae44e5208d 100644 --- a/app/src/main/java/com/owncloud/android/utils/FileStorageUtils.java +++ b/app/src/main/java/com/owncloud/android/utils/FileStorageUtils.java @@ -222,6 +222,7 @@ public final class FileStorageUtils { file.setEtag(remote.getEtag()); file.setPermissions(remote.getPermissions()); file.setRemoteId(remote.getRemoteId()); + file.setLocalId(remote.getLocalId()); file.setFavorite(remote.isFavorite()); if (file.isFolder()) { file.setEncrypted(remote.isEncrypted()); diff --git a/app/src/test/java/com/owncloud/android/datamodel/OCFileTest.kt b/app/src/test/java/com/owncloud/android/datamodel/OCFileTest.kt new file mode 100644 index 0000000000..75234d899d --- /dev/null +++ b/app/src/test/java/com/owncloud/android/datamodel/OCFileTest.kt @@ -0,0 +1,46 @@ +/* + * + * Nextcloud Android client application + * + * @author Tobias Kaminsky + * Copyright (C) 2022 Tobias Kaminsky + * Copyright (C) 2022 Nextcloud GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package com.owncloud.android.datamodel + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotEquals +import org.junit.Test + +class OCFileTest { + @Test + fun testLongIds() { + val sut = OCFile("/") + + sut.remoteId = "12345678ocjycgrudn78" + assertEquals(12345678, sut.localId) + + sut.remoteId = "00000008ocjycgrudn78" + assertEquals(8, sut.localId) + + // this will fail as fileId is too large + sut.remoteId = "1234567891011ocjycgrudn78" + assertNotEquals(1234567891011L, sut.localId) + + sut.localId = 1234567891011L + assertEquals(1234567891011L, sut.localId) + } +} diff --git a/build.gradle b/build.gradle index a7862c5667..93aa6ceaa9 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { daggerVersion = "2.44.2" markwonVersion = "4.6.2" prismVersion = "2.0.0" - androidLibraryVersion = "master-SNAPSHOT" + androidLibraryVersion = "localId-SNAPSHOT" mockitoVersion = "4.11.0" mockitoKotlinVersion = "4.1.0" mockkVersion = "1.13.3"