-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: friends rpc integration (#3076)
- Loading branch information
Showing
17 changed files
with
601 additions
and
95 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
Explorer/Assets/AddressableAssetsData/ProfileDataSourceSettings.asset.meta
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace DCL.Friends | ||
{ | ||
public enum FriendshipStatus | ||
{ | ||
NONE, | ||
FRIEND, | ||
REQUEST_SENT, | ||
REQUEST_RECEIVED, | ||
BLOCKED, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,70 @@ | ||
using Cysharp.Threading.Tasks; | ||
using DCL.Profiles; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using UnityEngine.Pool; | ||
|
||
namespace DCL.Friends | ||
{ | ||
public interface IFriendsService | ||
public interface IFriendsService : IDisposable | ||
{ | ||
UniTask<PaginatedFriendsResult> GetFriendsAsync(int pageNum, int pageSize, CancellationToken ct); | ||
|
||
UniTask<bool> IsFriendAsync(string friendId, CancellationToken ct); | ||
UniTask<FriendshipStatus> GetFriendshipStatusAsync(string userId, CancellationToken ct); | ||
|
||
UniTask<PaginatedFriendRequestsResult> GetReceivedFriendRequestsAsync(int pageNum, int pageSize, CancellationToken ct); | ||
|
||
UniTask<PaginatedFriendRequestsResult> GetSentFriendRequestsAsync(int pageNum, int pageSize, CancellationToken ct); | ||
|
||
UniTask RejectFriendshipAsync(string friendId, CancellationToken cancellationToken = default); | ||
UniTask RejectFriendshipAsync(string friendId, CancellationToken ct); | ||
|
||
UniTask CancelFriendshipAsync(string friendId, CancellationToken cancellationToken = default); | ||
UniTask CancelFriendshipAsync(string friendId, CancellationToken ct); | ||
|
||
UniTask AcceptFriendshipAsync(string friendId, CancellationToken cancellationToken = default); | ||
UniTask AcceptFriendshipAsync(string friendId, CancellationToken ct); | ||
|
||
UniTask DeleteFriendshipAsync(string friendId, CancellationToken cancellationToken = default); | ||
UniTask DeleteFriendshipAsync(string friendId, CancellationToken ct); | ||
|
||
UniTask<FriendRequest> AddFriendshipAsync(string friendId, string messageBody, CancellationToken cancellationToken = default); | ||
|
||
UniTask RemoveFriendAsync(string friendId, CancellationToken ct); | ||
UniTask<FriendRequest> RequestFriendshipAsync(string friendId, string messageBody, CancellationToken ct); | ||
} | ||
|
||
public struct PaginatedFriendsResult | ||
public readonly struct PaginatedFriendsResult : IDisposable | ||
{ | ||
public IReadOnlyList<Profile> Friends; | ||
public int TotalAmount; | ||
private readonly List<Profile> friends; | ||
|
||
public IReadOnlyList<Profile> Friends => friends; | ||
public int TotalAmount { get; } | ||
|
||
public PaginatedFriendsResult(IEnumerable<Profile> profiles, int totalAmount) | ||
{ | ||
friends = ListPool<Profile>.Get(); | ||
friends.AddRange(profiles); | ||
TotalAmount = totalAmount; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
ListPool<Profile>.Release(friends); | ||
} | ||
} | ||
|
||
public struct PaginatedFriendRequestsResult | ||
public readonly struct PaginatedFriendRequestsResult : IDisposable | ||
{ | ||
public IReadOnlyList<FriendRequest> Requests; | ||
public int TotalAmount; | ||
private readonly List<FriendRequest> requests; | ||
|
||
public IReadOnlyList<FriendRequest> Requests => requests; | ||
public int TotalAmount { get; } | ||
|
||
public PaginatedFriendRequestsResult(IEnumerable<FriendRequest> requests, int totalAmount) | ||
{ | ||
this.requests = ListPool<FriendRequest>.Get(); | ||
this.requests.AddRange(requests); | ||
TotalAmount = totalAmount; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
ListPool<FriendRequest>.Release(requests); | ||
} | ||
} | ||
} |
Oops, something went wrong.