Skip to content

Commit b13da90

Browse files
committed
Add a sleep after initLiveSync for files sync and restart
1 parent 7feebdb commit b13da90

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

test-app/app/src/main/java/com/tns/RuntimeHelper.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ public static Runtime initRuntime(Application app) {
193193
// if app is in debuggable mode run livesync service
194194
// runtime needs to be initialized before the NativeScriptSyncService is enabled because it uses runtime.runScript(...)
195195
initLiveSync(runtime, logger, app);
196+
197+
// CLI will create this file when initial sync is needed and then will remove it after syncing the fails and restarting the app
198+
File liveSyncFile = new File("/data/local/tmp/" + app.getPackageName() + "-livesync-in-progress");
199+
if(liveSyncFile.exists()) {
200+
try {
201+
// wait for the livesync to complete
202+
Thread.sleep(30000);
203+
} catch (Exception ex) {
204+
205+
}
206+
}
196207
}
197208

198209
runtime.runScript(new File(appDir, "internal/ts_helpers.js"));

test-app/runtime/src/main/java/com/tns/Runtime.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ private void createJSInstance(Object instance) {
645645
if (jsImpl != null) {
646646
File jsFile = new File(jsImpl.javaScriptFile());
647647
runModule(jsFile);
648+
} else {
649+
logger.write("Couldn't find JavaScriptImplementation annotation for class " + clazz.toString());
648650
}
649651
loadedJavaScriptExtends.put(clazz, jsImpl);
650652
}

0 commit comments

Comments
 (0)