@@ -97,6 +97,7 @@ private class LiveSyncWorker implements Runnable {
9797 public static final int CONTENT_LENGTH_BYTE_SIZE = 10 ;
9898 public static final int DELETE_FILE_OPERATION = 7 ;
9999 public static final int CREATE_FILE_OPERATION = 8 ;
100+ public static final int DO_SYNC_OPERATION = 9 ;
100101 public static final String FILE_NAME = "fileName" ;
101102 public static final String FILE_NAME_LENGTH = FILE_NAME + "Length" ;
102103 public static final String OPERATION = "operation" ;
@@ -143,7 +144,6 @@ public void run() {
143144 do {
144145 int operation = getOperation ();
145146
146- System .out .println ("Operation: " + input .available ());
147147 if (operation == DELETE_FILE_OPERATION ) {
148148
149149 String fileName = getFileName ();
@@ -155,15 +155,17 @@ public void run() {
155155 byte [] content = getFileContent (fileName );
156156 createOrOverrideFile (fileName , content );
157157
158+ } else if (operation == DO_SYNC_OPERATION ) {
159+
160+ runtime .runScript (new File (NativeScriptSyncService .this .context .getFilesDir (), "internal/livesync.js" ));
161+
158162 } else if (operation == DEFAULT_OPERATION ) {
159163 logger .write ("LiveSync: input stream is empty!" );
160164 break ;
161165 } else {
162166 throw new IllegalArgumentException (String .format ("\n LiveSync: Operation not recognised. %s" , LIVESYNC_ERROR_SUGGESTION ));
163167 }
164168
165- //TODO: do debouncing
166- runtime .runScript (new File (NativeScriptSyncService .this .context .getFilesDir (), "internal/livesync.js" ));
167169 } while (true );
168170
169171 } catch (Exception e ) {
0 commit comments