Stream Chat Unreal SDK
Loading...
Searching...
No Matches
Reactions.h
1// Copyright 2022 Stream.IO, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Kismet/BlueprintFunctionLibrary.h"
7#include "ReactionGroup.h"
8
9#include "Reactions.generated.h"
10
11struct FUserRef;
12struct FReaction;
13struct FReactionDto;
14
19USTRUCT(BlueprintType)
20struct STREAMCHAT_API FReactions
21{
22 GENERATED_BODY()
23
24
25 static FReactions CollectReactions(
26 UUserManager* UserManager,
27 const TMap<FName, int32>& ReactionCounts,
28 const TMap<FName, int32>& ReactionScores,
29 const TArray<FReactionDto>& LatestReactions,
30 const TArray<FReactionDto>& OwnReactions);
31
33 void AddReaction(const FReaction&, bool bUpdateCounts);
34
36 void RemoveReactionWhere(TFunctionRef<bool(const FReaction&)> Predicate);
37
39 bool IsEmpty() const;
40
42 int LocalCount() const;
43
44 // If the reaction data complete, or do we still need to fetch some?
45 bool HasAllDataLocally() const;
46
48 TOptional<FReaction> GetOwnReaction(const FName& ReactionType, const UUserManager*) const;
49
51 const TMap<FName, FReactionGroup>& GetReactionGroups() const;
52
54 TMap<FName, int32> GetScores() const;
55
56private:
58 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stream Chat|Message", meta = (AllowPrivateAccess))
59 TMap<FName, FReactionGroup> ReactionGroups;
60};
61
66UCLASS()
67class STREAMCHAT_API UReactionsBlueprintLibrary final : public UBlueprintFunctionLibrary
68{
69 GENERATED_BODY()
70
71public:
73 UFUNCTION(BlueprintPure, Category = "Stream Chat|Reactions", meta = (DisplayName = "Has Own Reaction"))
74 static bool HasOwnReaction(const FReactions& Reactions, const FName& ReactionType);
75
77 UFUNCTION(BlueprintPure, Category = "Stream Chat|Reactions")
78 static bool IsEmpty(const FReactions& Reactions);
79};
Blueprint functions for the Reactions struct.
Definition: Reactions.h:68
#/components/schemas/Reaction Represents user reaction to a message
Definition: ReactionDto.h:17
An individual reaction to a message.
Definition: Reaction.h:18
Encapsulates a collection of reactions for a message.
Definition: Reactions.h:21
A reference to a unique User.
Definition: UserRef.h:23