Skip to content
Repos

DevPlaceApp

C++ 940 B24 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-posts 6.2 (QuoteComposer environment), 3.2 (NavigationLink to ProfileView), 3.1 and 5.2 (single and
// double tap gestures of a card or comment). Values SwiftUI passes down the environment; here an explicit struct
// handed to every post and comment view.
#include <functional>
#include <string>

#include "screens/components/QuoteComposer.hpp"

namespace dp {

struct TapHandlers {
  std::function<void()> single;     // empty = ignore
  std::function<void()> doubleTap;  // empty = ignore; when set, a single tap waits PostsTiming::kDoubleTapMs
  bool any() const { return static_cast<bool>(single) || static_cast<bool>(doubleTap); }
};

struct PostEnvironment {
  std::function<void(const std::string& username)> openProfile;  // push ProfileView(username)
  QuoteComposer quote;
  TapHandlers taps;  // gestures of the enclosing card or comment, forwarded by text that owns a long press
};

}  // namespace dp
41.1ms