Commit 2cf38162 authored by narinder Rana's avatar narinder Rana
Browse files

now it's working

parent 0f69bbb2
Pipeline #137152 failed with stage
in 10 seconds
......@@ -28,6 +28,7 @@ http://www.gnu.org/licenses/gpl.html
android:allowBackup="true"
android:icon="@mipmap/ic_eelo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_eelo_round">
<!-- Providers -->
<provider
......
......@@ -138,7 +138,7 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
//if upload is a success
if( uploadResult.isSuccess() ){
InitializerService.files.remove(file);
// InitializerService.files.remove(file);
Object data = uploadResult.getSingleData();
if(data != null){
......
......@@ -42,17 +42,17 @@ public class ScreenOffReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "onReceive");
if(InitializerService.files.size()!=0){
try {
Intent observersServiceIntent = new Intent(context, foundation.e.drive.services.ObserverService.class);
Bundle mBundle = new Bundle();
mBundle.putBoolean("isFileObserverService", true);
observersServiceIntent.putExtras(mBundle);
context.startService(observersServiceIntent);
}catch (Exception exception){
exception.printStackTrace();
}
}
// if(InitializerService.files.size()!=0){
// try {
// Intent observersServiceIntent = new Intent(context, foundation.e.drive.services.ObserverService.class);
// Bundle mBundle = new Bundle();
// mBundle.putBoolean("isFileObserverService", true);
// observersServiceIntent.putExtras(mBundle);
// context.startService(observersServiceIntent);
// }catch (Exception exception){
// exception.printStackTrace();
// }
// }
/*String intentAction = intent.getAction();
......
......@@ -31,7 +31,7 @@ public class FileObserverService extends Service {
private final static String TAG = FileObserverService.class.getSimpleName();
RecursiveFileObserver mFileObserver = null;
private int observerFlag=-1;
//List<SyncedFileState> syncedFileStatesList=new ArrayList<>();
List<File> files=new ArrayList<>();
@Override
......@@ -66,10 +66,10 @@ public class FileObserverService extends Service {
Log.e("TAG", "file.isDirectory() ...."+file+"......"+file.isDirectory());
if(!file.isDirectory()){
// if(!InitializerService.files.contains(file)){
if(!files.contains(file)){
InitializerService.files.add(file);
// }
files.add(file);
}
if(!ConnectivityReceiver.isConnected()){
InitializerService.fileObserverFlag=true;
}
......@@ -134,14 +134,14 @@ public class FileObserverService extends Service {
try {
Log.e("Tag", "onPostExecute..........");
for(File f:InitializerService.files){
for(File f:files){
Log.e("TAG", "...........file name in post execute.."+f.getAbsolutePath());
}
Intent observersServiceIntent = new Intent(getApplicationContext(), foundation.e.drive.services.ObserverService.class);
Bundle mBundle = new Bundle();
mBundle.putBoolean("isFileObserverService", true);
// mBundle.putByteArray("fileObserverObject", CommonUtils.convertToBytes(new foundation.e.drive.models.FileObserver(files)));
mBundle.putByteArray("fileObserverObject", CommonUtils.convertToBytes(new foundation.e.drive.models.FileObserver(files)));
observersServiceIntent.putExtras(mBundle);
startService(observersServiceIntent);
}catch (Exception exception){
......
......@@ -62,7 +62,7 @@ public class InitializerService extends Service
private int restartFolderCreationCounter =0;
private ConnectivityReceiver connectivityReceiver;
public static List<File> files=new ArrayList<>();
// public static List<File> files=new ArrayList<>();
public static boolean schedulerFlag=false;
public static boolean fileObserverFlag=false;
......
......@@ -41,6 +41,7 @@ import foundation.e.drive.database.DbHelper;
import foundation.e.drive.fileFilters.CrashlogsFileFilter;
import foundation.e.drive.fileFilters.FileFilterFactory;
import foundation.e.drive.fileFilters.OnlyFileFilter;
import foundation.e.drive.models.FileObserver;
import foundation.e.drive.models.SyncedFolder;
import foundation.e.drive.models.SyncedFileState;
import foundation.e.drive.operations.DownloadFileOperation;
......@@ -71,7 +72,8 @@ public class ObserverService extends Service implements OnRemoteOperationListene
private Account mAccount;
private HashMap<Integer, Parcelable> operationsForIntent;
private Boolean isFileObserverService=false;
// private foundation.e.drive.models.FileObserver fileObserverObject;
private FileObserver fileObserverObject;
// private foundation.e.drive.models.FileObserver fileObserverObject;
/* Lifecycle Methods */
@Override
......@@ -89,7 +91,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
Bundle bundle = intent.getExtras();
if(null!=bundle){
isFileObserverService = bundle.getBoolean("isFileObserverService");
// fileObserverObject = (foundation.e.drive.models.FileObserver)CommonUtils.convertFromBytes(bundle.getByteArray("fileObserverObject"));
fileObserverObject = (foundation.e.drive.models.FileObserver)CommonUtils.convertFromBytes(bundle.getByteArray("fileObserverObject"));
}
}catch (Exception ex){
ex.printStackTrace();
......@@ -262,8 +264,8 @@ public class ObserverService extends Service implements OnRemoteOperationListene
List<SyncedFileState> syncedFileStates = DbHelper.getSyncedFileStatesByFolders(this,
getIdsFromFolderToScan());
if(!syncedFileStates.isEmpty() || !InitializerService.files.isEmpty() ) {
handleLocalFiles(InitializerService.files, syncedFileStates);
if(!syncedFileStates.isEmpty() || !fileObserverObject.getFiles().isEmpty() ) {
handleLocalFiles(fileObserverObject.getFiles(), syncedFileStates);
}
// handleLocalFiles(fileObserverObject.getFiles(), fileObserverObject.getSyncedFileStatesList());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment