Loading...
Searching...
No Matches
FOnlineFriendsAccelByte Class Reference

#include <OnlineFriendsInterfaceAccelByte.h>

Inheritance diagram for FOnlineFriendsAccelByte:

Public Member Functions

 DEFINE_ONLINE_PLAYER_DELEGATE_ONE_PARAM (MAX_LOCAL_PLAYERS, OnSyncThirdPartyPlatformFriendsComplete, const FOnlineError &)
 DEFINE_ONLINE_PLAYER_DELEGATE_TWO_PARAM (MAX_LOCAL_PLAYERS, OnSyncThirdPartyPlatformFriendsV2Complete, const FOnlineError &, const TArray< FAccelByteModelsSyncThirdPartyFriendsResponse > &)
 DEFINE_ONLINE_PLAYER_DELEGATE_TWO_PARAM (MAX_LOCAL_PLAYERS, OnSyncThirdPartyBlockListComplete, const FOnlineError &, const TArray< FAccelByteModelsSyncThirdPartyBlockListResponse > &)
 DEFINE_ONLINE_PLAYER_DELEGATE_THREE_PARAM (MAX_LOCAL_PLAYERS, OnQueryRecentTeamPlayersComplete, const FString &, bool, const FString &)
virtual bool ReadFriendsList (int32 LocalUserNum, const FString &ListName, const FOnReadFriendsListComplete &Delegate=FOnReadFriendsListComplete()) override
virtual bool DeleteFriendsList (int32 LocalUserNum, const FString &ListName, const FOnDeleteFriendsListComplete &Delegate=FOnDeleteFriendsListComplete()) override
virtual bool SendInvite (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName, const FOnSendInviteComplete &Delegate=FOnSendInviteComplete()) override
virtual bool AcceptInvite (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName, const FOnAcceptInviteComplete &Delegate=FOnAcceptInviteComplete()) override
virtual bool RejectInvite (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName) override
virtual bool DeleteFriend (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName) override
virtual void SetFriendAlias (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName, const FString &Alias, const FOnSetFriendAliasComplete &Delegate=FOnSetFriendAliasComplete()) override
virtual void DeleteFriendAlias (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName, const FOnDeleteFriendAliasComplete &Delegate=FOnDeleteFriendAliasComplete()) override
virtual void AddRecentPlayers (const FUniqueNetId &UserId, const TArray< FReportPlayedWithUser > &InRecentPlayers, const FString &ListName, const FOnAddRecentPlayersComplete &InCompletionDelegate) override
virtual bool QueryRecentPlayers (const FUniqueNetId &UserId, const FString &Namespace) override
bool QueryRecentTeamPlayers (int32 LocalUserNum, const FUniqueNetId &UserId, const FString &Namespace)
virtual bool BlockPlayer (int32 LocalUserNum, const FUniqueNetId &PlayerId) override
virtual bool UnblockPlayer (int32 LocalUserNum, const FUniqueNetId &PlayerId) override
virtual bool QueryBlockedPlayers (const FUniqueNetId &UserId) override
virtual bool GetFriendsList (int32 LocalUserNum, const FString &ListName, TArray< TSharedRef< FOnlineFriend > > &OutFriends) override
virtual TSharedPtr< FOnlineFriend > GetFriend (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName) override
virtual bool IsFriend (int32 LocalUserNum, const FUniqueNetId &FriendId, const FString &ListName) override
virtual bool GetRecentPlayers (const FUniqueNetId &UserId, const FString &Namespace, TArray< TSharedRef< FOnlineRecentPlayer > > &OutRecentPlayers) override
bool GetRecentTeamPlayers (const FUniqueNetId &UserId, const FString &Namespace, TArray< TSharedRef< FOnlineRecentPlayer > > &OutRecentPlayers) const
virtual bool GetBlockedPlayers (const FUniqueNetId &UserId, TArray< TSharedRef< FOnlineBlockedPlayer > > &OutBlockedPlayers) override
virtual void DumpRecentPlayers () const override
virtual void DumpBlockedPlayers () const override
virtual bool SendInvite (int32 LocalUserNum, const FString &InFriendCode, const FString &ListName=TEXT(""), const FOnSendInviteComplete &Delegate=FOnSendInviteComplete())
virtual bool IsPlayerBlocked (const FUniqueNetId &UserId, const FUniqueNetId &BlockedId)
virtual bool SyncThirdPartyPlatformFriend (int32 LocalUserNum, const FString &NativeFriendListName, const FString &AccelByteFriendListName=TEXT(""))
virtual bool SyncPlatformFriends (int32 LocalUserNum, const EAccelBytePlatformType NativePlatform)
virtual bool SyncThirdPartyPlatformFriendV2 (int32 LocalUserNum, const FAccelByteModelsSyncThirdPartyFriendsRequest &Request)
virtual bool SyncThirdPartyPlatformBlockList (int32 LocalUserNum, const FAccelByteModelsSyncThirdPartyBlockListRequest &Request)
virtual bool ReadFriendsList (int32 LocalUserNum, const EInviteStatus::Type &InviteStatus=EInviteStatus::Unknown, int32 Offset=0, int32 Limit=20, const FOnReadFriendsListComplete &Delegate=FOnReadFriendsListComplete())

Static Public Member Functions

static bool GetFromSubsystem (const IOnlineSubsystem *Subsystem, TSharedPtr< FOnlineFriendsAccelByte, ESPMode::ThreadSafe > &OutInterfaceInstance)
static bool GetFromWorld (const UWorld *World, TSharedPtr< FOnlineFriendsAccelByte, ESPMode::ThreadSafe > &OutInterfaceInstance)

Protected Member Functions

 FOnlineFriendsAccelByte ()
void OnFriendRequestAcceptedNotificationReceived (const FAccelByteModelsAcceptFriendsNotif &Notification, int32 LocalUserNum)
void OnFriendRequestReceivedNotificationReceived (const FAccelByteModelsRequestFriendsNotif &Notification, int32 LocalUserNum)
void OnUnfriendNotificationReceived (const FAccelByteModelsUnfriendNotif &Notification, int32 LocalUserNum)
void OnRejectFriendRequestNotificationReceived (const FAccelByteModelsRejectFriendsNotif &Notification, int32 LocalUserNum)
void OnCancelFriendRequestNotificationReceived (const FAccelByteModelsCancelFriendsNotif &Notification, int32 LocalUserNum)
void OnPresenceReceived (const FUniqueNetId &UserId, const TSharedRef< FOnlineUserPresence > &Presence, int32 LocalUserNum)

Static Protected Member Functions

static bool IsBlockedPlayersListChanged (const TArray< TSharedPtr< FOnlineBlockedPlayer > > &OldBlockedPlayersList, const TArray< TSharedPtr< FOnlineBlockedPlayer > > &NewBlockedPlayersList)

Protected Attributes

FOnlineSubsystemAccelByteWPtr AccelByteSubsystem = nullptr
TMap< int32, TArray< TSharedPtr< FOnlineFriend > > > LocalUserNumToFriendsMap
FUserIdToBlockedPlayersMap UserIdToBlockedPlayersMap
FCriticalSection UserIdToBlockedPlayersMapLock

Detailed Description

Implementation of the IOnlineFriends interface using AccelByte services.

Constructor & Destructor Documentation

◆ FOnlineFriendsAccelByte()

FOnlineFriendsAccelByte::FOnlineFriendsAccelByte ( )
inlineprotected

Hidden default constructor, the constructor that takes in a subsystem instance should be used instead.

Member Function Documentation

◆ GetFromSubsystem()

bool FOnlineFriendsAccelByte::GetFromSubsystem ( const IOnlineSubsystem * Subsystem,
TSharedPtr< FOnlineFriendsAccelByte, ESPMode::ThreadSafe > & OutInterfaceInstance )
static

Convenience method to get an instance of this interface from the subsystem passed in.

Parameters
SubsystemSubsystem instance that we wish to get this interface from
OutInterfaceInstanceInstance of the interface that we got from the subsystem, or nullptr if not found
Returns
boolean that is true if we could get an instance of the interface, false otherwise

◆ GetFromWorld()

bool FOnlineFriendsAccelByte::GetFromWorld ( const UWorld * World,
TSharedPtr< FOnlineFriendsAccelByte, ESPMode::ThreadSafe > & OutInterfaceInstance )
static

Convenience method to get an instance of this interface from the subsystem associated with the world passed in.

Parameters
WorldWorld instance that we wish to get the interface from
OutInterfaceInstanceInstance of the interface that we got from the subsystem, or nullptr if not found
Returns
boolean that is true if we could get an instance of the interface, false otherwise

◆ IsPlayerBlocked()

bool FOnlineFriendsAccelByte::IsPlayerBlocked ( const FUniqueNetId & UserId,
const FUniqueNetId & BlockedId )
virtual

Check on the cached list whether player is blocked

Parameters
UserIdId of user that made the request
BlockedIdId of user to check
Returns
true if blocked, false otherwise

◆ OnCancelFriendRequestNotificationReceived()

void FOnlineFriendsAccelByte::OnCancelFriendRequestNotificationReceived ( const FAccelByteModelsCancelFriendsNotif & Notification,
int32 LocalUserNum )
protected

Delegate handler for when another user cancels their friend request to us

◆ OnFriendRequestAcceptedNotificationReceived()

void FOnlineFriendsAccelByte::OnFriendRequestAcceptedNotificationReceived ( const FAccelByteModelsAcceptFriendsNotif & Notification,
int32 LocalUserNum )
protected

Delegate handler for when another user accepts our friend request

◆ OnFriendRequestReceivedNotificationReceived()

void FOnlineFriendsAccelByte::OnFriendRequestReceivedNotificationReceived ( const FAccelByteModelsRequestFriendsNotif & Notification,
int32 LocalUserNum )
protected

Delegate handler for when we receive a friend request from another user

◆ OnRejectFriendRequestNotificationReceived()

void FOnlineFriendsAccelByte::OnRejectFriendRequestNotificationReceived ( const FAccelByteModelsRejectFriendsNotif & Notification,
int32 LocalUserNum )
protected

Delegate handler for when another user rejects our friend request

◆ OnUnfriendNotificationReceived()

void FOnlineFriendsAccelByte::OnUnfriendNotificationReceived ( const FAccelByteModelsUnfriendNotif & Notification,
int32 LocalUserNum )
protected

Delegate handler for when another user removes us as a friend

◆ ReadFriendsList()

bool FOnlineFriendsAccelByte::ReadFriendsList ( int32 LocalUserNum,
const EInviteStatus::Type & InviteStatus = EInviteStatus::Unknown,
int32 Offset = 0,
int32 Limit = 20,
const FOnReadFriendsListComplete & Delegate = FOnReadFriendsListComplete() )
virtual

Partially read friends list.

Parameters
LocalUserNumthe user that sending read friends list request
InviteStatusthe status of friends to request. For now only support Accepted, PendingInbound, and PendingOutbound. Unknown will query all of them. Default is Unknown.
Offsetoffset to start the query. Default is 0.
Limitlimit of the query. Use -1 to query all data. Default is 20.

◆ SendInvite()

bool FOnlineFriendsAccelByte::SendInvite ( int32 LocalUserNum,
const FString & InFriendCode,
const FString & ListName = TEXT(""),
const FOnSendInviteComplete & Delegate = FOnSendInviteComplete() )
virtual

Starts an async task that sends an invite to another player.

Parameters
LocalUserNumthe user that is sending the invite
InFriendCodeFriend's PublicCode
ListNamename of the friends list to invite to. Not yet implemented on AccelByte you can leave it blank
Delegatefired when the request is complete
Returns
true if the request was started successfully, false otherwise

◆ SyncThirdPartyPlatformBlockList()

bool FOnlineFriendsAccelByte::SyncThirdPartyPlatformBlockList ( int32 LocalUserNum,
const FAccelByteModelsSyncThirdPartyBlockListRequest & Request )
virtual

Sync third party platform block list to AccelByte's block list. Makes a S2S request to the platform given to sync block list.

Parameters
LocalUserNumthe user that sending block list sync request
Requestrequest parameters for block list sync
Returns
true if the request was started successfully, false otherwise

◆ SyncThirdPartyPlatformFriend()

bool FOnlineFriendsAccelByte::SyncThirdPartyPlatformFriend ( int32 LocalUserNum,
const FString & NativeFriendListName,
const FString & AccelByteFriendListName = TEXT("") )
virtual

Sync third party platform friend to AccelByte service, this will automatically add the third party friends to AccelByte service if they already linked their account to AccelByte service. The native friend list is retrieved using native OSS.

Parameters
LocalUserNumthe user that sending friend sync request
NativeFriendListNamefriend list name in native platform
AccelByteFriendListNamefriend list name in AccelByte service (optional)
Returns
true if the request was started successfully, false otherwise

◆ SyncThirdPartyPlatformFriendV2()

bool FOnlineFriendsAccelByte::SyncThirdPartyPlatformFriendV2 ( int32 LocalUserNum,
const FAccelByteModelsSyncThirdPartyFriendsRequest & Request )
virtual

Sync third party platform friend to AccelByte service, this will make an S2S call to platform of choice to sync friends.

Parameters
LocalUserNumthe user that sending friend sync request
Requestrequest parameters for friend sync
Returns
true if the request was started successfully, false otherwise

Member Data Documentation

◆ AccelByteSubsystem

FOnlineSubsystemAccelByteWPtr FOnlineFriendsAccelByte::AccelByteSubsystem = nullptr
protected

Instance of the subsystem that created this interface

◆ LocalUserNumToFriendsMap

TMap<int32, TArray<TSharedPtr<FOnlineFriend> > > FOnlineFriendsAccelByte::LocalUserNumToFriendsMap
protected

Map of user IDs representing local users to an array of FOnlineFriend instances

◆ UserIdToBlockedPlayersMap

FUserIdToBlockedPlayersMap FOnlineFriendsAccelByte::UserIdToBlockedPlayersMap
protected

Map of user IDs representing local users to an array of FOnlineBlockedPlayer instances