Repos
C++
1.0 KB36 lines Opens in site
Directory
Raw
Download
#pragma once
// Spec: FR-AUTH-01, PG-10, INV-shell 12. Sign in, presented as a full screen cover.
#include <memory>
#include <string>
#include "ui/Navigation.hpp"
#include "ui/TextInput.hpp"
namespace dp {
class LoginScreen : public ui::Screen {
public:
LoginScreen();
~LoginScreen() override { *alive_ = false; }
ui::ViewPtr body() override;
std::string title() const override;
TitleMode titleMode() const override { return TitleMode::Inline; }
ui::ViewPtr toolbarLeading() override;
bool busy() const override { return isLoading_; }
bool canSubmit() const { return !email_.empty() && !password_.empty(); }
void submit();
private:
void logIn();
std::shared_ptr<bool> alive_ = std::make_shared<bool>(true);
std::string email_;
std::string password_;
bool isLoading_ = false;
std::shared_ptr<ui::TextInputHandle> emailHandle_ = std::make_shared<ui::TextInputHandle>();
std::shared_ptr<ui::TextInputHandle> passwordHandle_ = std::make_shared<ui::TextInputHandle>();
};
} // namespace dp