Search in sources :

Example 1 with NewNoteCreatedEvent

use of io.jawg.osmcontributor.ui.events.map.NewNoteCreatedEvent in project osm-contributor by jawg.

the class NoteManager method onPleaseApplyNewComment.

@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseApplyNewComment(PleaseApplyNewComment event) {
    Timber.d("please apply new comment");
    if (loginManager.checkCredentials()) {
        Note note = syncNoteManager.remoteAddComment(createComment(event.getNote(), event.getAction(), event.getText()));
        if (note != null) {
            mergeBackendNote(note);
            bus.post(new NewNoteCreatedEvent(note.getId()));
            bus.post(new SyncFinishUploadNote(note));
        }
    } else {
        bus.post(new ApplyNewCommentFailedEvent());
    }
}
Also used : NewNoteCreatedEvent(io.jawg.osmcontributor.ui.events.map.NewNoteCreatedEvent) SyncFinishUploadNote(io.jawg.osmcontributor.rest.events.SyncFinishUploadNote) SyncFinishUploadNote(io.jawg.osmcontributor.rest.events.SyncFinishUploadNote) Note(io.jawg.osmcontributor.model.entities.Note) ApplyNewCommentFailedEvent(io.jawg.osmcontributor.ui.events.note.ApplyNewCommentFailedEvent) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

Note (io.jawg.osmcontributor.model.entities.Note)1 SyncFinishUploadNote (io.jawg.osmcontributor.rest.events.SyncFinishUploadNote)1 NewNoteCreatedEvent (io.jawg.osmcontributor.ui.events.map.NewNoteCreatedEvent)1 ApplyNewCommentFailedEvent (io.jawg.osmcontributor.ui.events.note.ApplyNewCommentFailedEvent)1 Subscribe (org.greenrobot.eventbus.Subscribe)1