Skip to content

Commit 74a6e6d

Browse files
committed
a first version of livesync page reload
1 parent 337fc78 commit 74a6e6d

File tree

3 files changed

+445
-1
lines changed

3 files changed

+445
-1
lines changed

src/src/com/tns/NativeScriptApplication.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,25 @@ public void onCreate() {
734734
appBuilderCallbackImpl.onCreate(this);
735735
}
736736

737-
NativeScriptSyncHelper.sync(logger, this);
737+
if (NativeScriptSyncService.isSyncEnabled(this))
738+
{
739+
NativeScriptSyncService syncService = new NativeScriptSyncService(logger, this);
740+
741+
syncService.sync();
742+
syncService.startServer();
743+
744+
//preserve this instance as strong reference
745+
//do not preserve in NativeScriptApplication field inorder to make the code more portable
746+
Platform.getOrCreateJavaObjectID(syncService);
747+
}
748+
else
749+
{
750+
if (logger.isEnabled())
751+
{
752+
logger.write("NativeScript LiveSync is not enabled.");
753+
}
754+
}
755+
738756

739757
String appName = this.getPackageName();
740758
File rootDir = new File(this.getApplicationInfo().dataDir);

0 commit comments

Comments
 (0)