~aleteoryx/muditaos

ref: 3005b048247b095e9d6a63a654c1e8e2f01ed2e7 muditaos/module-apps/application-notes/presenter/NoteEditWindowPresenter.cpp -rw-r--r-- 663 bytes
3005b048 — DariuszSabala [BH-386] Turned app messages into lib 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "NoteEditWindowPresenter.hpp"

namespace app::notes
{
    NoteEditWindowPresenter::NoteEditWindowPresenter(std::unique_ptr<AbstractNotesRepository> &&notesRepository)
        : notesRepository{std::move(notesRepository)}
    {}

    void NoteEditWindowPresenter::save(std::shared_ptr<NotesRecord> &note)
    {
        notesRepository->save(*note, [this, note](bool succeed, std::uint32_t noteId) {
            if (succeed) {
                note->ID = noteId;
            }
        });
    }
} // namespace app::notes