PICO Unreal Platform SDK
PicoPresenceInterface.h
1/*******************************************************************************
2Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
3
4NOTICE:All information contained herein is, and remains the property of
5PICO Technology Co., Ltd. The intellectual and technical concepts
6contained herein are proprietary to PICO Technology Co., Ltd. and may be
7covered by patents, patents in process, and are protected by trade secret or
8copyright law. Dissemination of this information or reproduction of this
9material is strictly forbidden unless prior written permission is obtained from
10PICO Technology Co., Ltd.
11*******************************************************************************/
12// This plugin incorporates portions of the Unreal® Engine. Unreal® is a trademark or registered trademark of Epic Games, Inc.In the United States of America and elsewhere.
13// Unreal® Engine, Copyright 1998 – 2022, Epic Games, Inc.All rights reserved.
14
15#pragma once
16
17#include "CoreMinimal.h"
18#include "OnlineSubsystemPico.h"
19#include "OnlineSubsystemPicoPackage.h"
20#include "OnlineSubsystemPicoNames.h"
21
22
24
26
39DECLARE_LOG_CATEGORY_EXTERN(PresenceInterface, Log, All);
40
41// Request
42DECLARE_DELEGATE_TwoParams(FOnPresenceClearComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
43DECLARE_DELEGATE_TwoParams(FOnReadInvitableUserComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
44DECLARE_DELEGATE_TwoParams(FOnPresenceSetComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
45DECLARE_DELEGATE_TwoParams(FOnPresenceSetDestinationComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
46DECLARE_DELEGATE_TwoParams(FOnPresenceSetIsJoinableComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
47DECLARE_DELEGATE_TwoParams(FOnPresenceSetLobbySessionComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
48DECLARE_DELEGATE_TwoParams(FOnPresenceSetMatchSessionComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
49DECLARE_DELEGATE_TwoParams(FOnPresenceSetPresenceExtraComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
50DECLARE_DELEGATE_TwoParams(FOnReadSentInvitesComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
51DECLARE_DELEGATE_TwoParams(FOnSentInvitesComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
52DECLARE_DELEGATE_TwoParams(FOnGetDestinationsComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
53DECLARE_DELEGATE_TwoParams(FOnLaunchInvitePanelComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
54DECLARE_DELEGATE_TwoParams(FOnShareMediaComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
55
56
57DECLARE_MULTICAST_DELEGATE_FiveParams(FJoinIntentReceived, const FString& /*DeeplinkMessage*/, const FString& /*DestinationApiName*/, const FString&/*LobbySessionId*/, const FString& /*MatchSessionId*/, const FString& /*Extra*/);
58DECLARE_MULTICAST_DELEGATE_ThreeParams(FLeaveIntentReceived, const FString& /*DestinationApiName*/, const FString&/*LobbySessionId*/, const FString& /*MatchSessionId*/);
59
61class ONLINESUBSYSTEMPICO_API FPicoPresenceInterface
62{
63
64private:
65
66 FOnlineSubsystemPico& PicoSubsystem;
67
68 TMap<FString, TSharedRef<FOnlinePicoFriend>> InvitableUsers;
69
70 TArray<FPicoApplicationInvite> InvitesArray;
71
72 TArray<FPicoDestination> DestinationArray;
73
74public:
75 FPicoPresenceInterface(FOnlineSubsystemPico& InSubsystem);
77
87 bool PresenceClear(const FOnPresenceClearComplete& Delegate = FOnPresenceClearComplete());
88 void OnQueryPresenceClearComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceClearComplete& Delegate);
89
102 bool ReadInvitableUser(TArray<FString> SuggestedUserList, const FOnReadInvitableUserComplete& Delegate = FOnReadInvitableUserComplete());
103 void OnQueryReadInvitableUserComplete(ppfMessageHandle Message, bool bIsError, TMap<FString, TSharedRef<FOnlinePicoFriend>>& OutList, bool bAppendToExistingMap, const FOnReadInvitableUserComplete& Delegate);
104
113 bool GetInvitableFriendList(TArray<TSharedRef<FOnlinePicoFriend>>& OutFriends);
114
134 bool PresenceSet(const FString& ApiName, const FString& LobbySessionId, const FString& MatchSessionId, bool bIsJoinable, const FString& Extra, const FOnPresenceSetComplete& Delegate = FOnPresenceSetComplete());
135 void OnQueryPresenceSetComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetComplete& Delegate);
136
149 bool PresenceSetDestination(const FString& ApiName, const FOnPresenceSetDestinationComplete& Delegate = FOnPresenceSetDestinationComplete());
150 void OnQueryPresenceSetDestinationComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetDestinationComplete& Delegate);
151
168 bool PresenceSetSetIsJoinable(bool bIsJoinable, const FOnPresenceSetIsJoinableComplete& Delegate = FOnPresenceSetIsJoinableComplete());
169 void OnQueryPresenceSetSetIsJoinableComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetIsJoinableComplete& Delegate);
170
183 bool PresenceSetLobbySession(const FString& LobbySession, const FOnPresenceSetLobbySessionComplete& Delegate = FOnPresenceSetLobbySessionComplete());
184 void OnQueryPresenceSetLobbySessionComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetLobbySessionComplete& Delegate);
185
198 bool PresenceSetMatchSession(const FString& MatchSession, const FOnPresenceSetMatchSessionComplete& Delegate = FOnPresenceSetMatchSessionComplete());
199 void OnQueryPresenceSetMatchSessionComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetMatchSessionComplete& Delegate);
200
213 bool PresenceSetExtra(const FString& Extra, const FOnPresenceSetPresenceExtraComplete& Delegate = FOnPresenceSetPresenceExtraComplete());
214 void OnQueryPresenceSetExtraComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetPresenceExtraComplete& Delegate);
215
227 bool PresenceReadSendInvites(const FOnReadSentInvitesComplete& Delegate = FOnReadSentInvitesComplete());
228 void OnQueryPresenceReadSendInvitesComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoApplicationInvite>& OutList, bool bAppendToExistingArray, const FOnReadSentInvitesComplete& Delegate);
229
242 bool PresenceSendInvites(TArray<FString> UserIdArray, const FOnSentInvitesComplete& Delegate = FOnSentInvitesComplete());
243 void OnQuerySendInvitesComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoApplicationInvite>& OutList, bool bAppendToExistingArray, const FOnSentInvitesComplete& Delegate);
244
253 bool GetSendInvitesList(TArray<FPicoApplicationInvite>& OutList);
254
266 bool PresenceGetDestinations(const FOnGetDestinationsComplete& Delegate = FOnGetDestinationsComplete());
267 void OnQueryGetDestinationsComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoDestination>& OutList, bool bAppendToExistingArray, const FOnGetDestinationsComplete& Delegate);
268
277 bool PresenceGetDestnationsList(TArray<FPicoDestination>& OutList);
278
286 bool LaunchInvitePanel(const FOnLaunchInvitePanelComplete& Delegate = FOnLaunchInvitePanelComplete());
287
317 bool ShareMedia(EShareMediaType InMediaType, const FString& InVideoPath, const FString& InVideoThumbPath, TArray<FString> InImagePaths, EShareAppTyp InShareType, const FOnShareMediaComplete& Delegate = FOnShareMediaComplete());
318
319PACKAGE_SCOPE:
320
321 FDelegateHandle OnJoinIntentReceivedHandle;
322 void OnJoinIntentReceiveResult(ppfMessageHandle Message, bool bIsError);
323
324 FDelegateHandle OnLeaveIntentReceivedHandle;
325 void OnLeaveIntentReceiveResult(ppfMessageHandle Message, bool bIsError);
326public:
327
329 FJoinIntentReceived JoinIntentReceivedCallback;
330
331 // unavailable
332 FLeaveIntentReceived LeaveIntentReceivedCallback;
333}; // end of Presence // end of Function
OnlinePicoFriend class inherited from FOnlineFriend(Unreal Engine).
Definition: OnlineFriendsInterfacePico.h:30
Pico Presence interface class.
Definition: PicoPresenceInterface.h:62
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:329
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:601
EShareAppTyp
Share to app type.
Definition: OnlineSubsystemPicoNames.h:610