Commit b5416a46 authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

merge branch fix-e/apps/eDrive#23-nougat

parent 42a47542
Pipeline #3554 passed with stage
in 2 minutes and 4 seconds
......@@ -4,6 +4,8 @@ stages:
- build
before_script:
- git submodule sync
- git submodule update --init --recursive
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
......
[submodule "nextcloud-android-lib"]
path = nextcloud-android-lib
url = ../nextcloud-android-lib.git
\ No newline at end of file
......@@ -9,6 +9,7 @@
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/nextcloud-android-lib" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
......
......@@ -3,6 +3,7 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Drive.iml" filepath="$PROJECT_DIR$/Drive.iml" />
<module fileurl="file://$PROJECT_DIR$/nextcloud-android-lib/NextcloudLib.iml" filepath="$PROJECT_DIR$/nextcloud-android-lib/NextcloudLib.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/eDrive.iml" filepath="$PROJECT_DIR$/eDrive.iml" />
</modules>
......
......@@ -36,9 +36,7 @@ android {
unitTests.returnDefaultValues = true
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
......@@ -49,6 +47,6 @@ dependencies {
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
api 'com.github.nextcloud:android-library:1.1.0'
api 'com.android.support:support-annotations:27.1.1'
api project(':NextcloudLib')
}
......@@ -14,7 +14,7 @@ import android.util.Log;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.CreateRemoteFolderOperation;
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
import java.io.File;
......@@ -25,15 +25,15 @@ import io.eelo.drive.models.SyncedFolder;
* @author Vincent Bourgmayer
* Perform initial folder creation
*/
public class CreateInitialRemoteFolderOperation extends RemoteOperation {
private static final String TAG = CreateInitialRemoteFolderOperation.class.getSimpleName();
public class CreateInitialFolderRemoteOperation extends RemoteOperation {
private static final String TAG = CreateInitialFolderRemoteOperation.class.getSimpleName();
private SyncedFolder mSyncedFolder;
private String mRemotePath;
private boolean mCreateFullPath;//should recreate parent path if not exist or not
private final Context mContext;
public CreateInitialRemoteFolderOperation(SyncedFolder root, boolean createFullPath, Context context) {
public CreateInitialFolderRemoteOperation(SyncedFolder root, boolean createFullPath, Context context) {
super();
this.mSyncedFolder = root;
this.mRemotePath = root.getRemoteFolder();
......@@ -48,7 +48,7 @@ public class CreateInitialRemoteFolderOperation extends RemoteOperation {
Log.e(TAG, "Local folder doesn't exist, so create it");
folder.mkdirs();
}
CreateRemoteFolderOperation createFolderOperation = new CreateRemoteFolderOperation(mRemotePath, mCreateFullPath);
CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation(mRemotePath, mCreateFullPath);
RemoteOperationResult createOperationResult;
createOperationResult = createFolderOperation.execute(client, true);
......
......@@ -15,7 +15,7 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import java.io.File;
......@@ -101,7 +101,7 @@ public class DownloadFileOperation extends RemoteOperation implements Comparable
return new RemoteOperationResult(RemoteOperationResult.ResultCode.ETAG_UNCHANGED );
}
String tmpTargetPath = mContext.getExternalCacheDir()+ FileUtils.PATH_SEPARATOR+mSyncedState.getName();
DownloadRemoteFileOperation downloadOperation = new DownloadRemoteFileOperation(mRFile.getRemotePath(),
DownloadFileRemoteOperation downloadOperation = new DownloadFileRemoteOperation(mRFile.getRemotePath(),
tmpTargetPath);
RemoteOperationResult downloadResult = downloadOperation.execute( ownCloudClient );
......
......@@ -25,7 +25,6 @@
package io.eelo.drive.operations;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.operations.OperationCancelledException;
import com.owncloud.android.lib.common.operations.RemoteOperation;
......@@ -41,9 +40,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
/**
......@@ -54,11 +50,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
* @author Vincent Bourgmayer
*/
class DownloadRemoteFileOperation extends RemoteOperation {
class DownloadFileRemoteOperation extends RemoteOperation {
private static final String TAG = DownloadRemoteFileOperation.class.getSimpleName();
private final Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>();
private static final String TAG = DownloadFileRemoteOperation.class.getSimpleName();
private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
private long mModificationTimestamp = 0;
private String mEtag = "";
......@@ -73,7 +67,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* @param remotePath Path of file on the server
* @param localFolderPath Path of file on the device
*/
public DownloadRemoteFileOperation(String remotePath, String localFolderPath) {
public DownloadFileRemoteOperation(String remotePath, String localFolderPath) {
mRemotePath = remotePath;
mLocalFolderPath = localFolderPath;
}
......@@ -105,7 +99,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
int status = -1;
boolean savedFile = false;
mGet = new GetMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
Iterator<OnDatatransferProgressListener> dataTransferListenerIterator = null;
FileOutputStream fos = null;
try {
......@@ -132,13 +125,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
}
fos.write(bytes, 0, readResult);
transferred += readResult;
synchronized (mDataTransferListeners) {
dataTransferListenerIterator = mDataTransferListeners.iterator();
while (dataTransferListenerIterator.hasNext()) {
dataTransferListenerIterator.next().onTransferProgress(readResult, transferred, totalToTransfer,
targetFile.getName());
}
}
}
// Check if the file is completed
// if transfer-encoding: chunked we cannot check if the file is complete
......
......@@ -14,8 +14,8 @@ import android.util.Log;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.resources.files.LightReadFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import java.io.File;
import java.util.ArrayList;
......@@ -25,20 +25,22 @@ import java.util.ListIterator;
import io.eelo.drive.database.DbHelper;
import io.eelo.drive.models.SyncedFolder;
import static org.apache.jackrabbit.webdav.DavConstants.DEPTH_1;
/**
*
* @author Vincent Bourgmayer
* Created by Vincent on 04/05/2018.
*/
public class ListRemoteFileOperation extends RemoteOperation {
private final String TAG = ListRemoteFileOperation.class.getSimpleName();
public class ListFileRemoteOperation extends RemoteOperation {
private final String TAG = ListFileRemoteOperation.class.getSimpleName();
private final List<SyncedFolder> mSyncedFolders;
private final Context mContext;
private final int initialFolderNumber;
public ListRemoteFileOperation(List<SyncedFolder> syncedFolders, Context context, int initialFolderNumber){
public ListFileRemoteOperation(List<SyncedFolder> syncedFolders, Context context, int initialFolderNumber){
Log.i(TAG, "Constructor of ListRemoteFileOperation");
this.mSyncedFolders = syncedFolders;
this.mContext = context;
......@@ -76,7 +78,7 @@ public class ListRemoteFileOperation extends RemoteOperation {
}
if(syncedFolder.getId() > 0){
//Create ReadRemoteOperation
ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(syncedFolder.getRemoteFolder());
LightReadFolderRemoteOperation operation = new LightReadFolderRemoteOperation(syncedFolder.getRemoteFolder(), DEPTH_1, false);
RemoteOperationResult result = operation.execute(ownCloudClient);
if(result.isSuccess() ){
......@@ -108,8 +110,13 @@ public class ListRemoteFileOperation extends RemoteOperation {
atLeastOneDirAsChanged = true;
}
}else if(dataSize == 1){ //Empty folder
syncedFolder.setLastEtag( ( (RemoteFile) result.getData().get(0) ).getEtag() ).setToSync(true);
}//Last else correspond to error 404 at readRemoteFolderOperation (see below)
RemoteFile directory = (RemoteFile) result.getData().get(0);
if(!directory.getEtag().equals(syncedFolder.getLastEtag())) {
syncedFolder.setLastEtag(directory.getEtag()).setToSync(true);
atLeastOneDirAsChanged = true;
}
}//Last else correspond to error 404 at LightReadFolderRemoteOperation (see below)
}else{ //Result isn't a success
if(result.getHttpCode() == 404){ //File not found
atLeastOneDirAsChanged = true;
......@@ -128,7 +135,7 @@ public class ListRemoteFileOperation extends RemoteOperation {
mSyncedFolderIterator.remove();
}
}
Log.w(TAG, "ReadRemoteFolderOperation failed : http " + result.getHttpCode() + ", " + result.getLogMessage()+" => Ignored");
Log.w(TAG, "LightReadFolderRemoteOperation failed : http " + result.getHttpCode() + ", " + result.getLogMessage()+" => Ignored");
}
}else{
mSyncedFolderIterator.remove();
......@@ -146,4 +153,12 @@ public class ListRemoteFileOperation extends RemoteOperation {
Log.v(TAG, "end of run()");
return finalResult;
}
/**
*
* @return list of syncedFolder
*/
public List<SyncedFolder> getSyncedFolderList(){
return this.mSyncedFolders;
}
}
......@@ -9,7 +9,7 @@
package io.eelo.drive.operations;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.resources.files.RemoveRemoteFileOperation;
import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation;
import io.eelo.drive.models.SyncedFileState;
......@@ -19,7 +19,7 @@ import io.eelo.drive.models.SyncedFileState;
* Created by Vincent on 19/06/2018.
* Class to be able to wrap concerned SyncedFileState in operation, so it can be retrieve at the end
*/
public class RemoveFileOperation extends RemoveRemoteFileOperation implements ComparableOperation{
public class RemoveFileOperation extends RemoveFileRemoteOperation implements ComparableOperation{
private SyncedFileState mSyncedFileState;
......
......@@ -8,22 +8,20 @@
package io.eelo.drive.operations;
import android.app.NotificationManager;
import android.content.Context;
import android.util.Log;
import java.io.File;
import java.util.ArrayList;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.CreateRemoteFolderOperation;
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.resources.files.UploadRemoteFileOperation;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation;
import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import io.eelo.drive.database.DbHelper;
import io.eelo.drive.models.SyncedFileState;
......@@ -38,7 +36,7 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
private int restartCounter =0;
private long previousLastModified;
private long previousLastModified; //get to restore real value if all trials fails
private boolean checkEtag;
private String mTargetPath;
......@@ -46,6 +44,8 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
private final Context mContext;
private SyncedFileState mSyncedState;
private long availableQuota = -1;
@Override
public RemoteOperation toRemoteOperation() {
return this;
......@@ -62,23 +62,25 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
this.mFile = file;
this.mContext = context;
this.mTargetPath = targetPath;
String localPath = CommonUtils.getLocalPath( mFile );
//Try to load syncedFileState from DB
this.mSyncedState = DbHelper.loadSyncedFile( mContext,
CommonUtils.getLocalPath( mFile ), true );
localPath, true );
//Create a new instance and stored it if not stored in DB before
if( this.mSyncedState == null ){
//It's the first synchronisation of this file
Log.d( TAG, "it's first synchronisation of:"+mFile.getName() );
this.mSyncedState = new SyncedFileState(-1, mFile.getName(),
CommonUtils.getLocalPath(mFile),
localPath,
mTargetPath ,
"",
mFile.lastModified(),
0,
syncedFolderId, syncedFolderIsMediaType);
}
Log.v(TAG, ""+mSyncedState.getLocalLastModified() );
this.previousLastModified = mSyncedState.getLocalLastModified();
}
......@@ -114,7 +116,7 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
//as operation isn't executed immediatly, file might have been deleted since creation of operation
if(mSyncedState == null || mTargetPath == null || !mFile.exists()){
Log.e(TAG, "run(client): no syncedFileState or target path, can't perform upload operation");
return new RemoteOperationResult(RemoteOperationResult.ResultCode.FORBIDDEN);
return new RemoteOperationResult(ResultCode.FORBIDDEN);
}
if(mSyncedState.getId() == -1){
this.mSyncedState.setId( DbHelper.manageSyncedFileStateDB(this.mSyncedState, "INSERT", mContext) );
......@@ -123,85 +125,72 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
//If an Etag is already Stored and LastModified from DB is the same as real file
if (mSyncedState.isLastEtagStored()
&& mSyncedState.getLocalLastModified() == mFile.lastModified()) {
return new RemoteOperationResult(RemoteOperationResult.ResultCode.SYNC_CONFLICT);
Log.d(TAG, "mySyncedState last modified: "+mSyncedState.getLocalLastModified()+" <=> mFile last modified: "+mFile.lastModified() +": So return sync_conflict");
return new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
}
String timeStamp = ( (Long) ( mFile.lastModified() / 1000) ).toString() ;
if(this.availableQuota == -1){
RemoteOperationResult checkQuotaResult = checkAvailableSpace(client);
if( checkQuotaResult.getCode() != ResultCode.OK ){
return new RemoteOperationResult(checkQuotaResult.getCode());
}
}
UploadFileRemoteOperation uploadOperation = buildUploadOperation();
//create UploadFileOperation
UploadRemoteFileOperation uploadRemoteFileOperation = new UploadRemoteFileOperation( mSyncedState.getLocalPath(),
( mTargetPath != null ) ? mTargetPath : mSyncedState.getRemotePath(),
CommonUtils.getMimeType( mFile ),
( !checkEtag || mSyncedState.getLastETAG().isEmpty() )? null : mSyncedState.getLastETAG(), //If not null, This can cause error 412; that means remote file has change
timeStamp );
// Execute UploadFileOperation
RemoteOperationResult uploadResult = uploadRemoteFileOperation.execute( client );
RemoteOperationResult.ResultCode mResultCode;
RemoteOperationResult uploadResult = uploadOperation.execute( client );
ResultCode mResultCode;
boolean mustRestart = true;
//if upload is a success
if( uploadResult.isSuccess() ){
// get new Etag of the file on the server
ReadRemoteFileOperation getEtagOp = new ReadRemoteFileOperation( mTargetPath );
RemoteOperationResult readRemoteOpResult = getEtagOp.execute( client );
//if readRemoteFile is a success
if ( readRemoteOpResult.isSuccess() ) {
List<Object> datas = readRemoteOpResult.getData();
if(datas != null) {
//extract new Etag and update SyncedFileState;
RemoteFile rf = (RemoteFile) datas.get(0);
//If length differs then there is an issue during transfer
if( rf.getLength() != this.mFile.length() ){
Log.e(TAG, "Local and remote file doesn't have the same size.\n"+restartCounter
+" unsuccessfull trial(s) of uploading file "
+rf.getRemotePath() );
mResultCode = RemoteOperationResult.ResultCode.INVALID_OVERWRITE;
}else {
mSyncedState.setLastETAG(rf.getEtag());
mSyncedState.setLocalLastModified(mFile.lastModified());
mResultCode = RemoteOperationResult.ResultCode.OK;
mustRestart = false;
}
}else{
Log.e(TAG, "No data in readRemoteResult ");
mResultCode = RemoteOperationResult.ResultCode.CONFLICT;
}
}else{
//readRemoteOperation failed
Log.e( TAG, "ReadRemoteFileOperation => Uploaded file not found on server " );
mResultCode = RemoteOperationResult.ResultCode.CONFLICT;
Object data = uploadResult.getSingleData();
if(data != null) {
mSyncedState.setLastETAG((String) data);
}
mSyncedState.setLocalLastModified(mFile.lastModified());
mResultCode = uploadResult.getCode();
mustRestart = false;
}else{
//Si les répértoires ou mettre le fichier n'existe pas, on les ajoutes.
if( uploadResult.getCode() == RemoteOperationResult.ResultCode.FILE_NOT_FOUND ){
if( uploadResult.getCode() == ResultCode.FILE_NOT_FOUND ){
Log.d(TAG, "Catched a File not found result for : "+mFile.getName()+", create missing remote path then retry");
String remoteFoldersPath = mTargetPath.substring( 0, mTargetPath.lastIndexOf(FileUtils.PATH_SEPARATOR)+1 );
mResultCode = RemoteOperationResult.ResultCode.FILE_NOT_FOUND;
CreateRemoteFolderOperation createFolderOperation = new CreateRemoteFolderOperation( remoteFoldersPath, true );
mResultCode = ResultCode.FILE_NOT_FOUND;
CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation( remoteFoldersPath, true );
try{
createFolderOperation.execute( client );
RemoteOperationResult createFolderResult = createFolderOperation.execute( client );
if(!createFolderResult.isSuccess() && createFolderResult.getCode() != ResultCode.FOLDER_ALREADY_EXISTS){
mResultCode = createFolderResult.getCode();
Log.e(TAG, createFolderResult.getLogMessage());
mustRestart = false;
mSyncedState.setLocalLastModified( this.previousLastModified);
}
}catch(Exception e){
return new RemoteOperationResult(e);
Log.e(TAG, e.toString() );
mSyncedState.setLocalLastModified( this.previousLastModified);
mustRestart = false;
}
}else if(uploadResult.getCode() == RemoteOperationResult.ResultCode.QUOTA_EXCEEDED){
mResultCode = RemoteOperationResult.ResultCode.QUOTA_EXCEEDED;
}else if(uploadResult.getCode() == ResultCode.QUOTA_EXCEEDED){
mResultCode = ResultCode.QUOTA_EXCEEDED;
mustRestart = false;
}else{
//Upload failed
Log.e(TAG, "UploadRemoteFileOperation for : " + mFile.getName() + " failed => code: " + uploadResult.getCode());
mResultCode = RemoteOperationResult.ResultCode.UNKNOWN_ERROR;
Log.e(TAG, "UploadFileRemoteOperation for : " + mFile.getName() + " failed => code: " + uploadResult.getCode());
mResultCode = ResultCode.UNKNOWN_ERROR;
mustRestart = false;
}
}
if(mustRestart) {
if (this.restartCounter < 3) {
if (this.restartCounter < 1) {
this.restartCounter += 1;
//if we encounter more than three times same error, stop trying to download.
return this.run(client);
......@@ -219,6 +208,49 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
return finalResult;
}
/**
* Build the operation to put the file on server
* @return the operation to execute
*/
private UploadFileRemoteOperation buildUploadOperation(){
String timeStamp = ( (Long) ( mFile.lastModified() / 1000) ).toString() ;
//create UploadFileOperation
UploadFileRemoteOperation uploadRemoteFileOperation = new UploadFileRemoteOperation( mSyncedState.getLocalPath(),
( mTargetPath != null ) ? mTargetPath : mSyncedState.getRemotePath(),
CommonUtils.getMimeType( mFile ),
( !checkEtag || mSyncedState.getLastETAG().isEmpty() )? null : mSyncedState.getLastETAG(), //If not null, This can cause error 412; that means remote file has change
timeStamp );
uploadRemoteFileOperation.askResultEtag(true);
return uploadRemoteFileOperation;
}
/**
* Perform an operation to check available space on server before to upload
* @param client OwnCloudClient
* @return RemoteOperationResult
*/
private RemoteOperationResult checkAvailableSpace(OwnCloudClient client){
GetRemoteUserInfoOperation getRemoteUserInfoOperation = new GetRemoteUserInfoOperation();
RemoteOperationResult ocsResult = getRemoteUserInfoOperation.execute(client);
if(ocsResult.isSuccess() && ocsResult.getData() != null){
UserInfo userInfo = (UserInfo) ocsResult.getData().get(0);
this.availableQuota = userInfo.getQuota().getFree();
if( ((UserInfo) ocsResult.getData().get(0)).getQuota().getFree() < mFile.length() ) {
Log.w(TAG, "quota exceeded!");
return new RemoteOperationResult(ResultCode.QUOTA_EXCEEDED);
}else{
Log.d(TAG, "Quota Okay");
return new RemoteOperationResult(ResultCode.OK);
}
}else{
Log.w(TAG, "getRemoteUserInfoOperation failed: "+ocsResult.getHttpCode() );
return new RemoteOperationResult(ocsResult.getCode());
}
}
/**
* Return the file that should be uploading
* @return File given to this operation
......
......@@ -31,7 +31,7 @@ import java.util.Arrays;
import java.util.List;
import io.eelo.drive.models.SyncedFolder;
import io.eelo.drive.operations.CreateInitialRemoteFolderOperation;
import io.eelo.drive.operations.CreateInitialFolderRemoteOperation;
import io.eelo.drive.utils.AppConstants;
import io.eelo.drive.utils.CommonUtils;
import io.eelo.drive.utils.IGetOCClient;
......@@ -39,9 +39,7 @@ import io.eelo.drive.utils.JobUtils;
import static com.owncloud.android.lib.resources.files.FileUtils.PATH_SEPARATOR;
import static io.eelo.drive.utils.AppConstants.INITIALFOLDERS_NUMBER;
import static io.eelo.drive.utils.AppConstants.MEDIASYNC_PROVIDER_AUTHORITY;
import static io.eelo.drive.utils.AppConstants.MEDIA_SYNCABLE_CATEGORIES;
import static io.eelo.drive.utils.AppConstants.SETTINGSYNC_PROVIDER_AUTHORITY;
import static io.eelo.drive.utils.AppConstants.SETTINGS_SYNCABLE_CATEGORIES;
/**
......@@ -74,7 +72,6 @@ public class InitializerService extends Service implements OnRemoteOperationList
if( prefs.getBoolean( AppConstants.INITIALIZATION_HAS_BEEN_DONE, false ) ) {
//JobUtils.scheduleScannerJob(this, 120000);
Log.w(TAG, "Initializer has already been run");
stopSelf(); //@TODO, do not keep it when you'll enable initializer job because, it will kill running process at the same time.
}else{
String accountName = prefs.getString( AccountManager.KEY_ACCOUNT_NAME, "" );
String accountType = prefs.getString( AccountManager.KEY_ACCOUNT_TYPE, "" );
......@@ -225,8 +222,8 @@ public class InitializerService extends Service implements OnRemoteOperationList
if( this.mHandler == null ) this.mHandler = new Handler();
CreateInitialRemoteFolderOperation createFolderOperation =
new CreateInitialRemoteFolderOperation(
CreateInitialFolderRemoteOperation createFolderOperation =
new CreateInitialFolderRemoteOperation(
this.mSyncedFolders.get( this.existingRemoteFolderCounter ),
true,
this);
......@@ -246,7 +243,7 @@ public class InitializerService extends Service implements OnRemoteOperationList
@Override
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
Log.i(TAG, "onRemoteOperationFinish()");
if(operation instanceof CreateInitialRemoteFolderOperation){
if(operation instanceof CreateInitialFolderRemoteOperation){
if(result.isSuccess() || result.getCode() == RemoteOperationResult.ResultCode.FOLDER_ALREADY_EXISTS){
this.existingRemoteFolderCounter+=1;
......
......@@ -27,7 +27,6 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import