| | 1 | | using Cysharp.Threading.Tasks; |
| | 2 | | using DCL.Interface; |
| | 3 | | using DCL.UserProfiles; |
| | 4 | | using System; |
| | 5 | | using System.Collections.Generic; |
| | 6 | | using System.Linq; |
| | 7 | | using System.Threading; |
| | 8 | | using UnityEngine; |
| | 9 | |
|
| | 10 | | public class UserProfileWebInterfaceBridge : IUserProfileBridge |
| | 11 | | { |
| | 12 | | public UniTask<UserProfile> SaveVerifiedName(string name, CancellationToken cancellationToken) => |
| 0 | 13 | | UserProfileController.i.SaveVerifiedName(name, cancellationToken); |
| | 14 | |
|
| | 15 | | public UniTask<UserProfile> SaveUnverifiedName(string name, CancellationToken cancellationToken) => |
| 0 | 16 | | UserProfileController.i.SaveUnverifiedName(name, cancellationToken); |
| | 17 | |
|
| | 18 | | public UniTask<UserProfile> SaveDescription(string description, CancellationToken cancellationToken) => |
| 0 | 19 | | UserProfileController.i.SaveDescription(description, cancellationToken); |
| | 20 | |
|
| | 21 | | public UniTask<UserProfile> SaveAdditionalInfo(AdditionalInfo additionalInfo, |
| | 22 | | CancellationToken cancellationToken) => |
| 0 | 23 | | UserProfileController.i.SaveAdditionalInfo(additionalInfo, cancellationToken); |
| | 24 | |
|
| 0 | 25 | | public void RequestFullUserProfile(string userId) => WebInterface.SendRequestUserProfile(userId); |
| | 26 | |
|
| | 27 | | public void RequestOwnProfileUpdate() => |
| 0 | 28 | | WebInterface.RequestOwnProfileUpdate(); |
| | 29 | |
|
| | 30 | | public UniTask<UserProfile> RequestFullUserProfileAsync(string userId, CancellationToken cancellationToken) => |
| 0 | 31 | | UserProfileController.i.RequestFullUserProfileAsync(userId, cancellationToken); |
| | 32 | |
|
| 860 | 33 | | public UserProfile GetOwn() => UserProfile.GetOwnUserProfile(); |
| | 34 | |
|
| | 35 | | public UserProfile Get(string userId) |
| | 36 | | { |
| 0 | 37 | | if (userId == null) return null; |
| 0 | 38 | | return UserProfileController.userProfilesCatalog.Get(userId); |
| | 39 | | } |
| | 40 | |
|
| | 41 | | public UserProfile GetByName(string userName, bool caseSensitive) |
| | 42 | | { |
| 0 | 43 | | return UserProfileController.userProfilesCatalog.GetValues() |
| | 44 | | .FirstOrDefault(p => |
| | 45 | | { |
| 0 | 46 | | if (caseSensitive) |
| 0 | 47 | | return p.userName == userName; |
| | 48 | |
|
| 0 | 49 | | return p.userName.Equals(userName, StringComparison.OrdinalIgnoreCase); |
| | 50 | | }); |
| | 51 | | } |
| | 52 | |
|
| 0 | 53 | | public void SignUp() => WebInterface.RedirectToSignUp(); |
| | 54 | |
|
| | 55 | | public void SendSaveAvatar(AvatarModel avatar, Texture2D face256Snapshot, Texture2D bodySnapshot, bool isSignUpFlow |
| 0 | 56 | | WebInterface.SendSaveAvatar(avatar, face256Snapshot, bodySnapshot, isSignUpFlow); |
| | 57 | |
|
| | 58 | | public UniTask<UserProfile> SaveLinks(List<UserProfileModel.Link> links, CancellationToken cancellationToken) => |
| 0 | 59 | | UserProfileController.i.SaveLinks(links, cancellationToken); |
| | 60 | |
|
| | 61 | | public void LogOut() => |
| 0 | 62 | | WebInterface.LogOut(); |
| | 63 | | } |