Skip to content

Instantly share code, notes, and snippets.

@kombadzomba
Created September 16, 2016 21:37
Show Gist options
  • Save kombadzomba/d1ed45dcd06c5047aba04e39c267e3a9 to your computer and use it in GitHub Desktop.
Save kombadzomba/d1ed45dcd06c5047aba04e39c267e3a9 to your computer and use it in GitHub Desktop.
// inicijalizacija baze treba da je gotova tek kada se dovuku svi dokumenti replikacijom
public void checkIfInitializationDone() {
Log.d(TAG, "checkIfInitializationDone");
if (!isInitialized() && database.getDocumentCount() > 0) { // <-- LINE 375 IN FIRST LOGCAT: 36 09-13 22:45:23.180 E/Event (29395): at net.dzomba.termin3.model.couchdb.CouchDbManager.checkIfInitializationDone(CouchDbManager.java:375)
switch (databaseType) {
case ORG:
// initialization is done whenorg document exists
// and pull sync is over
if (CouchDbFacade.getInstance().getOrganization() != null && !isSyncInProgress()) {
setInitialized(true);
EventBus.getDefault().post(new OrgDbInitializedEvent());
}
break;
case USER:
// initialization is done when user document exists
// and pull sync is over
if (CouchDbFacade.getInstance().getUser() != null && !isSyncInProgress()) {
setInitialized(true);
EventBus.getDefault().post(new UserDbInitializedEvent());
}
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment