mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Fix 1911
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
b4d6545971
commit
8a865ee638
2 changed files with 4 additions and 2 deletions
|
@ -396,6 +396,7 @@ public class FileUploader extends Service
|
|||
currentAccount = failedUpload.getAccount(context);
|
||||
}
|
||||
|
||||
charging = charging || Device.getBatteryStatus(context).getBatteryPercent() == 1;
|
||||
if (!isPowerSaving && gotNetwork && checkIfUploadCanBeRetried(failedUpload, gotWifi, charging)) {
|
||||
retry(context, currentAccount, failedUpload);
|
||||
}
|
||||
|
@ -942,7 +943,7 @@ public class FileUploader extends Service
|
|||
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
|
||||
, ResultCode.DELAYED_FOR_WIFI);
|
||||
} else if (mCurrentUpload.getIsChargingRequired() &&
|
||||
!Device.getBatteryStatus(MainApp.getAppContext()).isCharging()) {
|
||||
(!Device.getBatteryStatus(MainApp.getAppContext()).isCharging())) {
|
||||
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
|
||||
, ResultCode.DELAYED_FOR_CHARGING);
|
||||
} else if (!mCurrentUpload.getIsIgnoringPowerSaveMode() &&
|
||||
|
|
|
@ -354,7 +354,8 @@ public class UploadFileOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
// Check if charging conditions are met and delays the upload otherwise
|
||||
if (mWhileChargingOnly && !Device.getBatteryStatus(mContext).isCharging()) {
|
||||
if (mWhileChargingOnly && (!Device.getBatteryStatus(mContext).isCharging() && Device.getBatteryStatus
|
||||
(mContext).getBatteryPercent() < 1)) {
|
||||
Log_OC.d(TAG, "Upload delayed until the device is charging: " + getRemotePath());
|
||||
return new RemoteOperationResult(ResultCode.DELAYED_FOR_CHARGING);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue