PICO Unreal Platform SDK
PicoPresenceInterface.h
1// Copyright® 2015-2023 PICO Technology Co., Ltd. All rights reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "OnlineSubsystemPico.h"
7#include "OnlineSubsystemPicoPackage.h"
8#include "OnlineSubsystemPicoNames.h"
9
10
12
14
27DECLARE_LOG_CATEGORY_EXTERN(PresenceInterface, Log, All);
28
29// Request
30DECLARE_DELEGATE_TwoParams(FOnPresenceClearComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
31DECLARE_DELEGATE_TwoParams(FOnReadInvitableUserComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
32DECLARE_DELEGATE_TwoParams(FOnPresenceSetComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
33DECLARE_DELEGATE_TwoParams(FOnPresenceSetDestinationComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
34DECLARE_DELEGATE_TwoParams(FOnPresenceSetIsJoinableComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
35DECLARE_DELEGATE_TwoParams(FOnPresenceSetLobbySessionComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
36DECLARE_DELEGATE_TwoParams(FOnPresenceSetMatchSessionComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
37DECLARE_DELEGATE_TwoParams(FOnPresenceSetPresenceExtraComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
38DECLARE_DELEGATE_TwoParams(FOnReadSentInvitesComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
39DECLARE_DELEGATE_TwoParams(FOnSentInvitesComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
40DECLARE_DELEGATE_TwoParams(FOnGetDestinationsComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
41DECLARE_DELEGATE_TwoParams(FOnLaunchInvitePanelComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
42DECLARE_DELEGATE_TwoParams(FOnShareMediaComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
43
44
45DECLARE_MULTICAST_DELEGATE_FiveParams(FJoinIntentReceived, const FString& /*DeeplinkMessage*/, const FString& /*DestinationApiName*/, const FString&/*LobbySessionId*/, const FString& /*MatchSessionId*/, const FString& /*Extra*/);
46DECLARE_MULTICAST_DELEGATE_ThreeParams(FLeaveIntentReceived, const FString& /*DestinationApiName*/, const FString&/*LobbySessionId*/, const FString& /*MatchSessionId*/);
47
49class ONLINESUBSYSTEMPICO_API FPicoPresenceInterface
50{
51
52private:
53
54 FOnlineSubsystemPico& PicoSubsystem;
55
56 TMap<FString, TSharedRef<FOnlinePicoFriend>> InvitableUsers;
57
58 TArray<FPicoApplicationInvite> InvitesArray;
59
60 TArray<FPicoDestination> DestinationArray;
61
62public:
63 FPicoPresenceInterface(FOnlineSubsystemPico& InSubsystem);
65
75 bool PresenceClear(const FOnPresenceClearComplete& Delegate = FOnPresenceClearComplete());
76 void OnQueryPresenceClearComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceClearComplete& Delegate);
77
90 bool ReadInvitableUser(TArray<FString> SuggestedUserList, const FOnReadInvitableUserComplete& Delegate = FOnReadInvitableUserComplete());
91 void OnQueryReadInvitableUserComplete(ppfMessageHandle Message, bool bIsError, TMap<FString, TSharedRef<FOnlinePicoFriend>>& OutList, bool bAppendToExistingMap, const FOnReadInvitableUserComplete& Delegate);
92
101 bool GetInvitableFriendList(TArray<TSharedRef<FOnlinePicoFriend>>& OutFriends);
102
122 bool PresenceSet(const FString& ApiName, const FString& LobbySessionId, const FString& MatchSessionId, bool bIsJoinable, const FString& Extra, const FOnPresenceSetComplete& Delegate = FOnPresenceSetComplete());
123 void OnQueryPresenceSetComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetComplete& Delegate);
124
137 bool PresenceSetDestination(const FString& ApiName, const FOnPresenceSetDestinationComplete& Delegate = FOnPresenceSetDestinationComplete());
138 void OnQueryPresenceSetDestinationComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetDestinationComplete& Delegate);
139
156 bool PresenceSetSetIsJoinable(bool bIsJoinable, const FOnPresenceSetIsJoinableComplete& Delegate = FOnPresenceSetIsJoinableComplete());
157 void OnQueryPresenceSetSetIsJoinableComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetIsJoinableComplete& Delegate);
158
171 bool PresenceSetLobbySession(const FString& LobbySession, const FOnPresenceSetLobbySessionComplete& Delegate = FOnPresenceSetLobbySessionComplete());
172 void OnQueryPresenceSetLobbySessionComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetLobbySessionComplete& Delegate);
173
186 bool PresenceSetMatchSession(const FString& MatchSession, const FOnPresenceSetMatchSessionComplete& Delegate = FOnPresenceSetMatchSessionComplete());
187 void OnQueryPresenceSetMatchSessionComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetMatchSessionComplete& Delegate);
188
201 bool PresenceSetExtra(const FString& Extra, const FOnPresenceSetPresenceExtraComplete& Delegate = FOnPresenceSetPresenceExtraComplete());
202 void OnQueryPresenceSetExtraComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetPresenceExtraComplete& Delegate);
203
215 bool PresenceReadSendInvites(const FOnReadSentInvitesComplete& Delegate = FOnReadSentInvitesComplete());
216 void OnQueryPresenceReadSendInvitesComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoApplicationInvite>& OutList, bool bAppendToExistingArray, const FOnReadSentInvitesComplete& Delegate);
217
230 bool PresenceSendInvites(TArray<FString> UserIdArray, const FOnSentInvitesComplete& Delegate = FOnSentInvitesComplete());
231 void OnQuerySendInvitesComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoApplicationInvite>& OutList, bool bAppendToExistingArray, const FOnSentInvitesComplete& Delegate);
232
241 bool GetSendInvitesList(TArray<FPicoApplicationInvite>& OutList);
242
254 bool PresenceGetDestinations(const FOnGetDestinationsComplete& Delegate = FOnGetDestinationsComplete());
255 void OnQueryGetDestinationsComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoDestination>& OutList, bool bAppendToExistingArray, const FOnGetDestinationsComplete& Delegate);
256
265 bool PresenceGetDestnationsList(TArray<FPicoDestination>& OutList);
266
274 bool LaunchInvitePanel(const FOnLaunchInvitePanelComplete& Delegate = FOnLaunchInvitePanelComplete());
275
305 bool ShareMedia(EShareMediaType InMediaType, const FString& InVideoPath, const FString& InVideoThumbPath, TArray<FString> InImagePaths, EShareAppTyp InShareType, const FOnShareMediaComplete& Delegate = FOnShareMediaComplete());
306
307PACKAGE_SCOPE:
308
309 FDelegateHandle OnJoinIntentReceivedHandle;
310 void OnJoinIntentReceiveResult(ppfMessageHandle Message, bool bIsError);
311
312 FDelegateHandle OnLeaveIntentReceivedHandle;
313 void OnLeaveIntentReceiveResult(ppfMessageHandle Message, bool bIsError);
314public:
315
317 FJoinIntentReceived JoinIntentReceivedCallback;
318
319 // unavailable
320 FLeaveIntentReceived LeaveIntentReceivedCallback;
321}; // end of Presence // end of Function
OnlinePicoFriend class inherited from FOnlineFriend(Unreal Engine).
Definition: OnlineFriendsInterfacePico.h:18
Pico Presence interface class.
Definition: PicoPresenceInterface.h:50
bool PresenceReadSendInvites(const FOnReadSentInvitesComplete &Delegate=FOnReadSentInvitesComplete())
Reads a list of sent invitations.
bool ShareMedia(EShareMediaType InMediaType, const FString &InVideoPath, const FString &InVideoThumbPath, TArray< FString > InImagePaths, EShareAppTyp InShareType, const FOnShareMediaComplete &Delegate=FOnShareMediaComplete())
Share videos or images to Douyin (a video app in Mainland China). Currently, this function is availab...
bool GetInvitableFriendList(TArray< TSharedRef< FOnlinePicoFriend > > &OutFriends)
Gets a list of invitable friends for a user. These friends are previously retrieved from the online s...
FJoinIntentReceived JoinIntentReceivedCallback
Gets notified when the join intent has been received.
Definition: PicoPresenceInterface.h:317
bool PresenceGetDestnationsList(TArray< FPicoDestination > &OutList)
Gets a list of destinations when PresenceGetDestinations is complete.
bool PresenceClear(const FOnPresenceClearComplete &Delegate=FOnPresenceClearComplete())
Clears a user's presence data in the current app.
bool ReadInvitableUser(TArray< FString > SuggestedUserList, const FOnReadInvitableUserComplete &Delegate=FOnReadInvitableUserComplete())
Reads a list of invitable users for a user.
bool PresenceSetSetIsJoinable(bool bIsJoinable, const FOnPresenceSetIsJoinableComplete &Delegate=FOnPresenceSetIsJoinableComplete())
Sets whether a user is joinable.
bool GetSendInvitesList(TArray< FPicoApplicationInvite > &OutList)
Gets a list of sent invitations when PresenceSendInvites or PresenceReadSendInvites is complete.
bool PresenceSetDestination(const FString &ApiName, const FOnPresenceSetDestinationComplete &Delegate=FOnPresenceSetDestinationComplete())
Replaces a user's current destination with the provided one.
bool PresenceSetExtra(const FString &Extra, const FOnPresenceSetPresenceExtraComplete &Delegate=FOnPresenceSetPresenceExtraComplete())
Sets extra presence data for a user.
bool PresenceSetLobbySession(const FString &LobbySession, const FOnPresenceSetLobbySessionComplete &Delegate=FOnPresenceSetLobbySessionComplete())
Replaces a user's current lobby session ID with the provided one.
bool LaunchInvitePanel(const FOnLaunchInvitePanelComplete &Delegate=FOnLaunchInvitePanelComplete())
Call up the system panel to invite friends.
bool PresenceSetMatchSession(const FString &MatchSession, const FOnPresenceSetMatchSessionComplete &Delegate=FOnPresenceSetMatchSessionComplete())
Replaces a user's current match session ID with the provided one.
bool PresenceSendInvites(TArray< FString > UserIdArray, const FOnSentInvitesComplete &Delegate=FOnSentInvitesComplete())
Sends invitations to users.
bool PresenceGetDestinations(const FOnGetDestinationsComplete &Delegate=FOnGetDestinationsComplete())
Gets all the destinations that can be set for a user.
bool PresenceSet(const FString &ApiName, const FString &LobbySessionId, const FString &MatchSessionId, bool bIsJoinable, const FString &Extra, const FOnPresenceSetComplete &Delegate=FOnPresenceSetComplete())
Sets presence data for a user in the current app.
EShareMediaType
Share media type.
Definition: OnlineSubsystemPicoNames.h:589
EShareAppTyp
Share to app type.
Definition: OnlineSubsystemPicoNames.h:598