|
1 | 1 | package com.tns; |
2 | 2 |
|
3 | | -import java.io.BufferedReader; |
4 | 3 | import java.io.Closeable; |
5 | 4 | import java.io.DataInputStream; |
6 | 5 | import java.io.File; |
|
10 | 9 | import java.io.FileOutputStream; |
11 | 10 | import java.io.IOException; |
12 | 11 | import java.io.InputStream; |
13 | | -import java.io.InputStreamReader; |
14 | | -import java.io.UnsupportedEncodingException; |
15 | | -import java.net.ServerSocket; |
16 | | -import java.net.Socket; |
17 | | -import java.util.ArrayList; |
18 | | -import java.util.NoSuchElementException; |
19 | | -import java.util.Scanner; |
20 | 12 |
|
21 | 13 | import android.content.Context; |
22 | 14 | import android.content.pm.ApplicationInfo; |
@@ -154,7 +146,7 @@ public void run() |
154 | 146 | input.readFully(new byte[length]); //ignore the payload |
155 | 147 | executePartialSync(context, syncDir); |
156 | 148 |
|
157 | | - Platform.callJSMethod(NativeScriptApplication.getInstance(), "onLiveSync", Void.class); |
| 149 | + Platform.runScript(new File(NativeScriptSyncService.this.context.getFilesDir(), "internal/livesync.js")); |
158 | 150 |
|
159 | 151 | socket.close(); |
160 | 152 | } |
@@ -411,35 +403,4 @@ private boolean copyFile(String sourceFile, String destinationFile) |
411 | 403 |
|
412 | 404 | return true; |
413 | 405 | } |
414 | | - |
415 | | -// private static String getSyncThumb(String syncThumbFilePath) |
416 | | -// { |
417 | | -// try |
418 | | -// { |
419 | | -// File syncThumbFile = new File(syncThumbFilePath); |
420 | | -// if (syncThumbFile.exists()) |
421 | | -// { |
422 | | -// return null; |
423 | | -// } |
424 | | -// |
425 | | -// FileInputStream in = new FileInputStream(syncThumbFile); |
426 | | -// BufferedReader reader = new BufferedReader(new InputStreamReader(in)); |
427 | | -// String syncThumb = reader.readLine(); |
428 | | -// reader.close(); |
429 | | -// in.close(); |
430 | | -// return syncThumb; |
431 | | -// } |
432 | | -// catch (FileNotFoundException e) |
433 | | -// { |
434 | | -// Log.e(Platform.DEFAULT_LOG_TAG, "Error while reading sync command"); |
435 | | -// e.printStackTrace(); |
436 | | -// } |
437 | | -// catch (IOException e) |
438 | | -// { |
439 | | -// Log.e(Platform.DEFAULT_LOG_TAG, "Error while reading sync command"); |
440 | | -// e.printStackTrace(); |
441 | | -// } |
442 | | -// |
443 | | -// return null; |
444 | | -// } |
445 | 406 | } |
0 commit comments