Commit 5326fdc0 authored by narinder Rana's avatar narinder Rana
Browse files

manage fileObserver event when data sync from server

parent f51f103e
Pipeline #138066 passed with stage
in 3 minutes and 26 seconds
......@@ -42,6 +42,8 @@ import java.io.IOException;
import java.util.Date;
import java.util.concurrent.atomic.AtomicBoolean;
import foundation.e.drive.services.InitializerService;
/**
* Remote operation performing the download of a remote file in the ownCloud server.
*
......@@ -123,8 +125,8 @@ class DownloadFileRemoteOperation extends RemoteOperation {
fos.write(bytes, 0, readResult);
transferred += readResult;
}
Log.e(TAG, "....line no..127 ..."+targetFile.getName());
// Log.e(TAG, "...DownLoad ...."+targetFile.getName());
InitializerService.remoteDownloadFile.add(targetFile);
// Check if the file is completed
// if transfer-encoding: chunked we cannot check if the file is complete
......
......@@ -32,6 +32,7 @@ public class FileObserverService extends Service {
RecursiveFileObserver mFileObserver = null;
private int observerFlag=-1;
public static List<File> files=new ArrayList<>();
private boolean remoteFileFlag;
@Override
......@@ -63,11 +64,18 @@ public class FileObserverService extends Service {
if(event== FileObserver.CREATE || event==FileObserver.MODIFY || event== FileObserver.DELETE || event ==FileObserver.MOVED_TO){
Log.i(TAG, "...Event ..." + event+"...file ..." + file);
Log.e("TAG", "file.isDirectory() ...."+file+"......"+file.isDirectory());
remoteFileFlag=false;
if(!file.isDirectory()){
if(!files.contains(file)){
for(File remoteFile:InitializerService.remoteDownloadFile){
if(remoteFile.getName().equals(file.getName())){
remoteFileFlag=true;
break;
}
}
if(!files.contains(file) && !remoteFileFlag){
files.add(file);
}
if(!ConnectivityReceiver.isConnected()){
......@@ -132,11 +140,6 @@ public class FileObserverService extends Service {
protected void onPostExecute(String s) {
super.onPostExecute(s);
try {
Log.e("Tag", "onPostExecute..........");
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();
......
......@@ -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> remoteDownloadFile=new ArrayList<>();
public static boolean schedulerFlag=false;
public static boolean fileObserverFlag=false;
......
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