Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,323 changes: 1,323 additions & 0 deletions app/schemas/com.nextcloud.client.database.NextcloudDatabase/103.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ import com.owncloud.android.db.ProviderMeta
AutoMigration(from = 98, to = 99),
// manual migration used for 99 to 100
AutoMigration(from = 100, to = 101, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
AutoMigration(from = 101, to = 102, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class)
AutoMigration(from = 101, to = 102, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
AutoMigration(from = 102, to = 103, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class)
],
exportSchema = true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ data class CapabilityEntity(
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_CLIENT_INTEGRATION_JSON)
val clientIntegrationJson: String?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_MOD_REWRITE_WORKING)
val modRewriteWorking: Int?
val modRewriteWorking: Int?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_CHUNKED_UPLOAD_MAX_SIZE)
val chunkedUploadMaxSize: Long?
)

@Suppress("LongMethod", "ReturnCount")
Expand Down Expand Up @@ -238,6 +240,7 @@ fun CapabilityEntity?.toOCCapability(): OCCapability {
capability.hasValidSubscription = intToBoolean(this.hasValidSubscription)
capability.clientIntegrationJson = this.clientIntegrationJson
capability.modRewriteWorking = intToBoolean(this.modRewriteWorking)
capability.chunkedUploadMaxSize = this.chunkedUploadMaxSize ?: OCCapability.CHUNKED_UPLOAD_MAX_SIZE_UNKNOWN

return capability
}
Original file line number Diff line number Diff line change
Expand Up @@ -2442,6 +2442,8 @@ private ContentValues createContentValues(String accountName, OCCapability capab

contentValues.put(ProviderTableMeta.CAPABILITIES_MOD_REWRITE_WORKING, capability.getModRewriteWorking().getValue());

contentValues.put(ProviderTableMeta.CAPABILITIES_CHUNKED_UPLOAD_MAX_SIZE, capability.getChunkedUploadMaxSize());

return contentValues;
}

Expand Down Expand Up @@ -2642,6 +2644,9 @@ private OCCapability createCapabilityInstance(Cursor cursor) {
capability.setClientIntegrationJson(getString(cursor, ProviderTableMeta.CAPABILITIES_CLIENT_INTEGRATION_JSON));

capability.setModRewriteWorking(getBoolean(cursor, ProviderTableMeta.CAPABILITIES_MOD_REWRITE_WORKING));

capability.setChunkedUploadMaxSize(
getLong(cursor, ProviderTableMeta.CAPABILITIES_CHUNKED_UPLOAD_MAX_SIZE));
}

return capability;
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/owncloud/android/db/ProviderMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
public class ProviderMeta {
public static final String DB_NAME = "filelist";
public static final int DB_VERSION = 102;
public static final int DB_VERSION = 103;

private ProviderMeta() {
// No instance
Expand Down Expand Up @@ -296,6 +296,7 @@ static public class ProviderTableMeta implements BaseColumns {
public static final String CAPABILITIES_HAS_VALID_SUBSCRIPTION = "has_valid_subscription";
public static final String CAPABILITIES_CLIENT_INTEGRATION_JSON = "client_integration_json";
public static final String CAPABILITIES_MOD_REWRITE_WORKING = "mod_rewrite_working";
public static final String CAPABILITIES_CHUNKED_UPLOAD_MAX_SIZE = "chunked_upload_max_size";

//Columns of Uploads table
public static final String UPLOADS_LOCAL_PATH = "local_path";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public class UploadFileOperation extends SyncOperation {
private volatile int mCreatedBy;
private boolean mOnWifiOnly;
private boolean mWhileChargingOnly;
private volatile boolean mIgnoringPowerSaveMode;
private boolean mIgnoringPowerSaveMode;
private final boolean mDisableRetries;

private volatile boolean mWasRenamed;
Expand Down Expand Up @@ -294,8 +294,8 @@ public boolean isIgnoringPowerSaveMode() {
return mIgnoringPowerSaveMode;
}

public void setIgnoringPowerSaveMode(boolean ignoringPowerSaveMode) {
mIgnoringPowerSaveMode = ignoringPowerSaveMode;
public void setIgnoringPowerSaveMode(boolean value) {
this.mIgnoringPowerSaveMode = value;
}

public User getUser() {
Expand Down Expand Up @@ -705,7 +705,8 @@ private void setUploadOperationForE2E(String token,
long creationTimestamp,
long size) {

if (size > ChunkedFileUploadRemoteOperation.MIN_CHUNK_SIZE) {
final long serverMaxChunkSize = getCapabilities().getChunkedUploadMaxSize();
if (size > ChunkedFileUploadRemoteOperation.chunkSize(mOnWifiOnly, serverMaxChunkSize)) {
boolean onWifiConnection = connectivityService.getConnectivity().isWifi();

mUploadOperation = new ChunkedFileUploadRemoteOperation(encryptedTempFile.getAbsolutePath(),
Expand All @@ -716,7 +717,8 @@ private void setUploadOperationForE2E(String token,
onWifiConnection,
token,
creationTimestamp,
mDisableRetries
mDisableRetries,
serverMaxChunkSize
);
} else {
mUploadOperation = new UploadFileRemoteOperation(encryptedTempFile.getAbsolutePath(),
Expand Down Expand Up @@ -1006,38 +1008,38 @@ private RemoteOperationResult releaseLocksAndUnlockE2EFolder(FileLock fileLock,
}
// endregion

private RemoteOperationResult<Object> checkConditions(File originalFile) {
RemoteOperationResult<Object> remoteOperationResult = null;
private RemoteOperationResult checkConditions(File originalFile) {
RemoteOperationResult remoteOperationResult = null;

// check that connectivity conditions are met and delays the upload otherwise
Connectivity connectivity = connectivityService.getConnectivity();
if (mOnWifiOnly && (!connectivity.isWifi() || connectivity.isMetered())) {
Log_OC.d(TAG, "Upload delayed until WiFi is available: " + getRemotePath());
remoteOperationResult = new RemoteOperationResult<>(ResultCode.DELAYED_FOR_WIFI);
remoteOperationResult = new RemoteOperationResult(ResultCode.DELAYED_FOR_WIFI);
}

// check if charging conditions are met and delays the upload otherwise
final BatteryStatus battery = powerManagementService.getBattery();
if (mWhileChargingOnly && !battery.isCharging()) {
Log_OC.d(TAG, "Upload delayed until the device is charging: " + getRemotePath());
remoteOperationResult = new RemoteOperationResult<>(ResultCode.DELAYED_FOR_CHARGING);
remoteOperationResult = new RemoteOperationResult(ResultCode.DELAYED_FOR_CHARGING);
}

// check that device is not in power save mode
if (!mIgnoringPowerSaveMode && powerManagementService.isPowerSavingEnabled()) {
Log_OC.d(TAG, "Upload delayed because device is in power save mode: " + getRemotePath());
remoteOperationResult = new RemoteOperationResult<>(ResultCode.DELAYED_IN_POWER_SAVE_MODE);
remoteOperationResult = new RemoteOperationResult(ResultCode.DELAYED_IN_POWER_SAVE_MODE);
}

// check if the file continues existing before schedule the operation
if (!originalFile.exists()) {
Log_OC.d(TAG, mOriginalStoragePath + " does not exist anymore");
remoteOperationResult = new RemoteOperationResult<>(ResultCode.LOCAL_FILE_NOT_FOUND);
remoteOperationResult = new RemoteOperationResult(ResultCode.LOCAL_FILE_NOT_FOUND);
}

// check that internet is not behind walled garden
if (!connectivityService.getConnectivity().isConnected() || connectivityService.isInternetWalled()) {
remoteOperationResult = new RemoteOperationResult<>(ResultCode.NO_NETWORK_CONNECTION);
remoteOperationResult = new RemoteOperationResult(ResultCode.NO_NETWORK_CONNECTION);
}

return remoteOperationResult;
Expand Down Expand Up @@ -1129,15 +1131,15 @@ private RemoteOperationResult normalUpload(OwnCloudClient client) {
updateSize(size);
Log_OC.d(TAG, "file size set to " + formattedFileSize);

// decide whether chunked or not
if (size > ChunkedFileUploadRemoteOperation.MIN_CHUNK_SIZE) {
final long serverMaxChunkSize = getCapabilities().getChunkedUploadMaxSize();
if (size > ChunkedFileUploadRemoteOperation.chunkSize(mOnWifiOnly, serverMaxChunkSize)) {
Log_OC.d(TAG, "chunked upload operation will be used");

boolean onWifiConnection = connectivityService.getConnectivity().isWifi();
mUploadOperation = new ChunkedFileUploadRemoteOperation(
mFile.getStoragePath(), mFile.getRemotePath(), mFile.getMimeType(),
mFile.getEtagInConflict(), lastModifiedTimestamp, creationTimestamp,
onWifiConnection, mDisableRetries);
onWifiConnection, mDisableRetries, serverMaxChunkSize);
} else {
Log_OC.d(TAG, "upload file operation will be used");

Expand Down Expand Up @@ -1421,7 +1423,7 @@ private void handleLocalBehaviour(File temporalFile,
}

private OCCapability getCapabilities() {
return CapabilityUtils.getCapability(mContext);
return CapabilityUtils.getCapability(user, mContext);
}

/**
Expand Down
35 changes: 35 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</trusted-artifacts>
<ignored-keys>
<ignored-key id="655CCC51B9BD2C38" reason="Key couldn't be downloaded from any key server"/>
<ignored-key id="6751E1A6E2001B8D" reason="Key couldn't be downloaded from any key server"/>
<ignored-key id="80EF47E549604C05" reason="Key couldn't be downloaded from any key server"/>
</ignored-keys>
<trusted-keys>
Expand Down Expand Up @@ -21100,6 +21101,14 @@
<sha256 value="3ee73f7565f5b56e22def8affaca37f0bd7fb85fbb1fd0653271ed95b7caa766" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="232d9b92db">
<artifact name="android-library-232d9b92db.aar">
<sha256 value="922c7cbc86d6ecfadbaaf072324ac11e87e0da790c74837d1a89b3587deaab20" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="android-library-232d9b92db.module">
<sha256 value="ced0eaec0b05aa707bf2e4f3481722532221dd0bee0d0a7e4c288bf9b0f5ca91" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="android-library" version="25bd90c0f21b9b16acee6a7f433063040c75f30d">
<artifact name="android-library-25bd90c0f21b9b16acee6a7f433063040c75f30d.aar">
<sha256 value="4fe766c7f7359013ed072d60062996dd98358c8a7ed8d90c71285c373ee23f12" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -27835,6 +27844,11 @@
<sha256 value="e720a383fdc3eb1df4aac77a085e61b7730837364151de867093fdbcafcb44aa" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.squareup.okhttp3" name="okhttp" version="5.5.0">
<artifact name="okhttp-5.5.0.module">
<sha256 value="1d667d70d7c4994927afd46d840e31e4a454935fa58f0c3429a26b425dc0abe0" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="com.squareup.okhttp3" name="okhttp-android" version="5.1.0">
<artifact name="okhttp-android-5.1.0.module">
<sha256 value="efd455ff92cc8880daa2adabc4a48db05a6aae40e84266c2185a4dcedfdb53e3" origin="Generated by Gradle"/>
Expand All @@ -27851,6 +27865,14 @@
<sha256 value="f1a78812ebeef4d45eee0dbeb4f27347210f564d2b8ee411f012ce8573b0a658" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.squareup.okhttp3" name="okhttp-android" version="5.5.0">
<artifact name="okhttp-android-5.5.0.module">
<sha256 value="a2589cd0455bd01f34ecc1635d198689ccbdd00adbe028ffd34624df7cfe618e" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
<artifact name="okhttp.aar">
<sha256 value="6c7fd12f092e64ca2eae0b8a8023900c0d7ffec57888cf8abc8085c6f42e1dcc" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="com.squareup.okhttp3" name="okhttp-jvm" version="5.0.0-alpha.12">
<artifact name="okhttp-jvm-5.0.0-alpha.12.jar">
<sha256 value="05bea20bc7831d1507612b12b82ba94a06750711ed1d6f092bc37e0b8a0d1276" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -27880,6 +27902,11 @@
<sha256 value="c9964f394c4cd32b79bf338afbfa2f2297221eee08311787061cea55f87dd60e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.squareup.okio" name="okio" version="3.18.1">
<artifact name="okio-3.18.1.module">
<sha256 value="1616f212eabcb6c1c2d04ff5c80d9132c0e5f4e408c659d5ee47aef28ebc5d10" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="com.squareup.okio" name="okio" version="3.3.0">
<artifact name="okio-3.3.0.module">
<sha256 value="661d3b3c33a764014c738021c9225c2cf09598970918313fed64dcb04022f54b" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -27938,6 +27965,14 @@
<sha256 value="9008d5a2954a068c6848274f6eebdff48b14a70dbc693d3302e08c570cca032f" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.squareup.okio" name="okio-jvm" version="3.18.1">
<artifact name="okio-jvm-3.18.1.jar">
<sha256 value="b97b640557a650d15411f2be29aef558c4e422a83653cb18ba494311dbed18be" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
<artifact name="okio-jvm-3.18.1.module">
<sha256 value="3581865143cbe7556e1975be4c823834a7b775534de856d0b355c77af946027b" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
</artifact>
</component>
<component group="com.squareup.okio" name="okio-jvm" version="3.6.0">
<artifact name="okio-jvm-3.6.0.jar">
<sha256 value="67543f0736fc422ae927ed0e504b98bc5e269fda0d3500579337cb713da28412" origin="Generated by Gradle"/>
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ dependencyResolutionManagement {

/*
Needed for local android library

includeBuild("../android_library") {
dependencySubstitution {
substitute(module("com.github.nextcloud:android-library"))
Expand Down
Loading