use of im.actor.core.modules.messaging.router.entity.ActiveDialogStorage in project actor-platform by actorapp.
the class RouterActor method preStart.
@Override
public void preStart() {
super.preStart();
conversationStates = context().getMessagesModule().getConversationStates().getEngine();
//
// Loading Active Dialogs
//
activeDialogStorage = new ActiveDialogStorage();
byte[] data = context().getStorageModule().getBlobStorage().loadItem(AbsModule.BLOB_DIALOGS_ACTIVE);
if (data != null) {
try {
activeDialogStorage = new ActiveDialogStorage(data);
} catch (IOException e) {
e.printStackTrace();
}
}
if (!activeDialogStorage.isLoaded()) {
api(new RequestLoadGroupedDialogs(ApiSupportConfiguration.OPTIMIZATIONS)).chain(r -> updates().applyRelatedData(r.getUsers(), r.getGroups())).chain(r -> updates().loadRequiredPeers(r.getUserPeers(), r.getGroupPeers())).then(r -> {
boolean showArchived = false;
boolean showInvite = false;
if (r.showArchived() != null) {
showArchived = r.showArchived();
}
if (r.showInvite() != null) {
showInvite = r.showInvite();
}
onActiveDialogsChanged(r.getDialogs(), showArchived, showInvite);
context().getConductor().getConductor().onDialogsLoaded();
});
} else {
notifyActiveDialogsVM();
context().getConductor().getConductor().onDialogsLoaded();
}
}
Aggregations