| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using System.Linq; |
| | 5 | | using DCL; |
| | 6 | | using DCL.Helpers; |
| | 7 | | using TMPro; |
| | 8 | | using UnityEngine; |
| | 9 | | using UnityEngine.UI; |
| | 10 | |
|
| | 11 | | public class FriendRequestsTabComponentView : BaseComponentView |
| | 12 | | { |
| | 13 | | private const string FRIEND_ENTRIES_POOL_NAME_PREFIX = "FriendRequestEntriesPool_"; |
| | 14 | | private const string NOTIFICATIONS_ID = "Friends"; |
| | 15 | | private const int PRE_INSTANTIATED_ENTRIES = 25; |
| | 16 | | private const float NOTIFICATIONS_DURATION = 3; |
| | 17 | | private const int AVATAR_SNAPSHOTS_PER_FRAME = 5; |
| | 18 | | private const int CREATION_AMOUNT_PER_FRAME = 5; |
| | 19 | | private const float REQUEST_MORE_ENTRIES_SCROLL_THRESHOLD = 0.005f; |
| | 20 | | private const float MIN_TIME_TO_REQUIRE_MORE_ENTRIES = 0.5f; |
| | 21 | |
|
| | 22 | | [SerializeField] private GameObject enabledHeader; |
| | 23 | | [SerializeField] private GameObject disabledHeader; |
| | 24 | | [SerializeField] private GameObject emptyStateContainer; |
| | 25 | | [SerializeField] private GameObject filledStateContainer; |
| | 26 | | [SerializeField] private FriendRequestEntry entryPrefab; |
| | 27 | | [SerializeField] private CollapsableSortedFriendEntryList receivedRequestsList; |
| | 28 | | [SerializeField] private CollapsableSortedFriendEntryList sentRequestsList; |
| | 29 | | [SerializeField] private SearchBarComponentView searchBar; |
| | 30 | | [SerializeField] private TMP_Text receivedRequestsCountText; |
| | 31 | | [SerializeField] private TMP_Text sentRequestsCountText; |
| | 32 | | [SerializeField] private UserContextMenu contextMenuPanel; |
| | 33 | | [SerializeField] private RectTransform viewport; |
| | 34 | | [SerializeField] internal ScrollRect scroll; |
| | 35 | |
|
| | 36 | | [Header("Notifications")] [SerializeField] |
| | 37 | | private Notification requestSentNotification; |
| | 38 | |
|
| | 39 | | [SerializeField] private Notification friendSearchFailedNotification; |
| | 40 | | [SerializeField] private Notification acceptedFriendNotification; |
| | 41 | | [SerializeField] private Notification alreadyFriendsNotification; |
| | 42 | | [SerializeField] private Model model; |
| | 43 | |
|
| | 44 | | [Header("Load More Entries")] |
| | 45 | | [SerializeField] internal GameObject loadMoreEntriesContainer; |
| | 46 | | [SerializeField] internal TMP_Text loadMoreEntriesLabel; |
| | 47 | | [SerializeField] internal GameObject loadMoreEntriesSpinner; |
| | 48 | |
|
| 24 | 49 | | private readonly Dictionary<string, PoolableObject> pooleableEntries = new Dictionary<string, PoolableObject>(); |
| 24 | 50 | | private readonly Dictionary<string, FriendRequestEntry> entries = new Dictionary<string, FriendRequestEntry>(); |
| 24 | 51 | | private readonly Dictionary<string, FriendRequestEntryModel> creationQueue = |
| | 52 | | new Dictionary<string, FriendRequestEntryModel>(); |
| | 53 | | private Pool entryPool; |
| | 54 | | private string lastRequestSentUserName; |
| | 55 | | private int currentAvatarSnapshotIndex; |
| | 56 | | private bool isLayoutDirty; |
| 24 | 57 | | private Vector2 lastScrollPosition = Vector2.one; |
| | 58 | | private Coroutine requireMoreEntriesRoutine; |
| | 59 | | private float loadMoreEntriesRestrictionTime; |
| | 60 | |
|
| 0 | 61 | | public Dictionary<string, FriendRequestEntry> Entries => entries; |
| | 62 | |
|
| 14 | 63 | | public int Count => Entries.Count + creationQueue.Keys.Count(s => !Entries.ContainsKey(s)); |
| | 64 | |
|
| 0 | 65 | | public int ReceivedCount => receivedRequestsList.Count() + |
| 0 | 66 | | creationQueue.Count(pair => pair.Value.isReceived && !Entries.ContainsKey(pair.Key)); |
| 0 | 67 | | public int SentCount => sentRequestsList.Count() + |
| 0 | 68 | | creationQueue.Count(pair => !pair.Value.isReceived && !Entries.ContainsKey(pair.Key)); |
| | 69 | |
|
| | 70 | | public event Action<FriendRequestEntryModel> OnCancelConfirmation; |
| | 71 | | public event Action<FriendRequestEntryModel> OnRejectConfirmation; |
| | 72 | | public event Action<FriendRequestEntryModel> OnFriendRequestApproved; |
| | 73 | | public event Action<string> OnFriendRequestSent; |
| | 74 | | public event Action OnRequireMoreEntries; |
| | 75 | |
|
| | 76 | | public override void OnEnable() |
| | 77 | | { |
| 7 | 78 | | base.OnEnable(); |
| 7 | 79 | | searchBar.Configure(new SearchBarComponentModel {placeHolderText = "Search a friend you want to add"}); |
| 7 | 80 | | searchBar.OnSubmit += SendFriendRequest; |
| 7 | 81 | | searchBar.OnSearchText += OnSearchInputValueChanged; |
| 7 | 82 | | contextMenuPanel.OnBlock += HandleFriendBlockRequest; |
| 7 | 83 | | scroll.onValueChanged.AddListener(RequestMoreEntries); |
| 7 | 84 | | UpdateLayout(); |
| 7 | 85 | | } |
| | 86 | |
|
| | 87 | | public override void OnDisable() |
| | 88 | | { |
| 7 | 89 | | base.OnDisable(); |
| 7 | 90 | | searchBar.OnSubmit -= SendFriendRequest; |
| 7 | 91 | | searchBar.OnSearchText -= OnSearchInputValueChanged; |
| 7 | 92 | | contextMenuPanel.OnBlock -= HandleFriendBlockRequest; |
| 7 | 93 | | scroll.onValueChanged.RemoveListener(RequestMoreEntries); |
| 7 | 94 | | NotificationsController.i?.DismissAllNotifications(NOTIFICATIONS_ID); |
| 7 | 95 | | } |
| | 96 | |
|
| | 97 | | public override void Update() |
| | 98 | | { |
| 331 | 99 | | base.Update(); |
| | 100 | |
|
| 331 | 101 | | if (isLayoutDirty) |
| 8 | 102 | | Utils.ForceRebuildLayoutImmediate((RectTransform) filledStateContainer.transform); |
| 331 | 103 | | isLayoutDirty = false; |
| | 104 | |
|
| 331 | 105 | | SetQueuedEntries(); |
| 331 | 106 | | FetchProfilePicturesForVisibleEntries(); |
| 331 | 107 | | } |
| | 108 | |
|
| | 109 | | public void Expand() |
| | 110 | | { |
| 23 | 111 | | receivedRequestsList.Expand(); |
| 23 | 112 | | sentRequestsList.Expand(); |
| 23 | 113 | | } |
| | 114 | |
|
| | 115 | | public void Show() |
| | 116 | | { |
| 7 | 117 | | gameObject.SetActive(true); |
| 7 | 118 | | enabledHeader.SetActive(true); |
| 7 | 119 | | disabledHeader.SetActive(false); |
| 7 | 120 | | searchBar.ClearSearch(); |
| 7 | 121 | | } |
| | 122 | |
|
| | 123 | | public void Hide() |
| | 124 | | { |
| 8 | 125 | | gameObject.SetActive(false); |
| 8 | 126 | | enabledHeader.SetActive(false); |
| 8 | 127 | | disabledHeader.SetActive(true); |
| 8 | 128 | | contextMenuPanel.Hide(); |
| 8 | 129 | | } |
| | 130 | |
|
| | 131 | | public override void RefreshControl() |
| | 132 | | { |
| 0 | 133 | | Clear(); |
| | 134 | |
|
| 0 | 135 | | foreach (var friend in model.friends) |
| 0 | 136 | | Set(friend.userId, friend.model); |
| | 137 | |
|
| 0 | 138 | | if (model.isReceivedRequestsExpanded) |
| 0 | 139 | | receivedRequestsList.Expand(); |
| | 140 | | else |
| 0 | 141 | | receivedRequestsList.Collapse(); |
| | 142 | |
|
| 0 | 143 | | if (model.isSentRequestsExpanded) |
| 0 | 144 | | sentRequestsList.Expand(); |
| | 145 | | else |
| 0 | 146 | | sentRequestsList.Collapse(); |
| 0 | 147 | | } |
| | 148 | |
|
| | 149 | | public void Remove(string userId) |
| | 150 | | { |
| 12 | 151 | | if (creationQueue.ContainsKey(userId)) |
| 0 | 152 | | creationQueue.Remove(userId); |
| | 153 | |
|
| 23 | 154 | | if (!entries.ContainsKey(userId)) return; |
| | 155 | |
|
| 1 | 156 | | if (pooleableEntries.TryGetValue(userId, out var pooleableObject)) |
| | 157 | | { |
| 1 | 158 | | entryPool.Release(pooleableObject); |
| 1 | 159 | | pooleableEntries.Remove(userId); |
| | 160 | | } |
| | 161 | |
|
| 1 | 162 | | entries.Remove(userId); |
| 1 | 163 | | receivedRequestsList.Remove(userId); |
| 1 | 164 | | sentRequestsList.Remove(userId); |
| | 165 | |
|
| 1 | 166 | | UpdateEmptyOrFilledState(); |
| 1 | 167 | | UpdateCounterLabel(); |
| 1 | 168 | | UpdateLayout(); |
| 1 | 169 | | } |
| | 170 | |
|
| | 171 | | public void Clear() |
| | 172 | | { |
| 1 | 173 | | HideMoreFriendsLoadingSpinner(); |
| 1 | 174 | | loadMoreEntriesRestrictionTime = Time.realtimeSinceStartup; |
| 1 | 175 | | scroll.verticalNormalizedPosition = 1f; |
| 1 | 176 | | creationQueue.Clear(); |
| 1 | 177 | | entries.ToList().ForEach(pair => Remove(pair.Key)); |
| 1 | 178 | | receivedRequestsList.Clear(); |
| 1 | 179 | | sentRequestsList.Clear(); |
| 1 | 180 | | UpdateEmptyOrFilledState(); |
| 1 | 181 | | UpdateCounterLabel(); |
| 1 | 182 | | } |
| | 183 | |
|
| 37 | 184 | | public FriendRequestEntry Get(string userId) => entries.ContainsKey(userId) ? entries[userId] : null; |
| | 185 | |
|
| 6 | 186 | | public void Enqueue(string userId, FriendRequestEntryModel model) => creationQueue[userId] = model; |
| | 187 | |
|
| | 188 | | public void Set(string userId, FriendRequestEntryModel model) |
| | 189 | | { |
| 6 | 190 | | if (creationQueue.ContainsKey(userId)) |
| | 191 | | { |
| 0 | 192 | | creationQueue[userId] = model; |
| 0 | 193 | | return; |
| | 194 | | } |
| | 195 | |
|
| 6 | 196 | | if (!entries.ContainsKey(userId)) |
| | 197 | | { |
| 6 | 198 | | CreateEntry(userId); |
| 6 | 199 | | UpdateLayout(); |
| | 200 | | } |
| | 201 | |
|
| 6 | 202 | | Populate(userId, model); |
| 6 | 203 | | UpdateEmptyOrFilledState(); |
| 6 | 204 | | UpdateCounterLabel(); |
| 6 | 205 | | } |
| | 206 | |
|
| | 207 | | public void Populate(string userId, FriendRequestEntryModel model) |
| | 208 | | { |
| 6 | 209 | | if (!entries.ContainsKey(userId)) |
| | 210 | | { |
| 0 | 211 | | if (creationQueue.ContainsKey(userId)) |
| 0 | 212 | | creationQueue[userId] = model; |
| 0 | 213 | | return; |
| | 214 | | } |
| | 215 | |
|
| 6 | 216 | | var entry = entries[userId]; |
| 6 | 217 | | entry.Populate(model); |
| | 218 | |
|
| 6 | 219 | | if (model.isReceived) |
| 4 | 220 | | receivedRequestsList.Add(userId, entry); |
| | 221 | | else |
| 2 | 222 | | sentRequestsList.Add(userId, entry); |
| 2 | 223 | | } |
| | 224 | |
|
| | 225 | | public void ShowUserNotFoundNotification() |
| | 226 | | { |
| 0 | 227 | | friendSearchFailedNotification.model.timer = NOTIFICATIONS_DURATION; |
| 0 | 228 | | friendSearchFailedNotification.model.groupID = NOTIFICATIONS_ID; |
| 0 | 229 | | NotificationsController.i?.ShowNotification(friendSearchFailedNotification); |
| 0 | 230 | | } |
| | 231 | |
|
| 0 | 232 | | private void UpdateLayout() => isLayoutDirty = true; |
| | 233 | |
|
| | 234 | | private void CreateEntry(string userId) |
| | 235 | | { |
| 6 | 236 | | entryPool = GetEntryPool(); |
| 6 | 237 | | var newFriendEntry = entryPool.Get(); |
| 6 | 238 | | pooleableEntries.Add(userId, newFriendEntry); |
| 6 | 239 | | var entry = newFriendEntry.gameObject.GetComponent<FriendRequestEntry>(); |
| 6 | 240 | | if (entry == null) return; |
| 6 | 241 | | entries.Add(userId, entry); |
| | 242 | |
|
| 6 | 243 | | entry.OnAccepted -= OnFriendRequestReceivedAccepted; |
| 6 | 244 | | entry.OnAccepted += OnFriendRequestReceivedAccepted; |
| 6 | 245 | | entry.OnRejected -= OnEntryRejectButtonPressed; |
| 6 | 246 | | entry.OnRejected += OnEntryRejectButtonPressed; |
| 6 | 247 | | entry.OnCancelled -= OnEntryCancelButtonPressed; |
| 6 | 248 | | entry.OnCancelled += OnEntryCancelButtonPressed; |
| 6 | 249 | | entry.OnMenuToggle -= OnEntryMenuToggle; |
| 6 | 250 | | entry.OnMenuToggle += OnEntryMenuToggle; |
| 6 | 251 | | } |
| | 252 | |
|
| | 253 | | private Pool GetEntryPool() |
| | 254 | | { |
| 6 | 255 | | var entryPool = PoolManager.i.GetPool(FRIEND_ENTRIES_POOL_NAME_PREFIX + name + GetInstanceID()); |
| 6 | 256 | | if (entryPool != null) return entryPool; |
| | 257 | |
|
| 6 | 258 | | entryPool = PoolManager.i.AddPool( |
| | 259 | | FRIEND_ENTRIES_POOL_NAME_PREFIX + name + GetInstanceID(), |
| | 260 | | Instantiate(entryPrefab).gameObject, |
| | 261 | | maxPrewarmCount: PRE_INSTANTIATED_ENTRIES, |
| | 262 | | isPersistent: true); |
| 6 | 263 | | entryPool.ForcePrewarm(); |
| | 264 | |
|
| 6 | 265 | | return entryPool; |
| | 266 | | } |
| | 267 | |
|
| | 268 | | private void SendFriendRequest(string friendUserName) |
| | 269 | | { |
| 0 | 270 | | friendUserName = friendUserName.Trim() |
| | 271 | | .Replace("\n", "") |
| | 272 | | .Replace("\r", ""); |
| 0 | 273 | | if (string.IsNullOrEmpty(friendUserName)) return; |
| | 274 | |
|
| 0 | 275 | | searchBar.ClearSearch(); |
| 0 | 276 | | lastRequestSentUserName = friendUserName; |
| 0 | 277 | | OnFriendRequestSent?.Invoke(friendUserName); |
| 0 | 278 | | } |
| | 279 | |
|
| | 280 | | public void ShowAlreadyFriendsNotification() |
| | 281 | | { |
| 0 | 282 | | alreadyFriendsNotification.model.timer = NOTIFICATIONS_DURATION; |
| 0 | 283 | | alreadyFriendsNotification.model.groupID = NOTIFICATIONS_ID; |
| 0 | 284 | | NotificationsController.i?.ShowNotification(alreadyFriendsNotification); |
| 0 | 285 | | } |
| | 286 | |
|
| | 287 | | public void ShowRequestSuccessfullySentNotification() |
| | 288 | | { |
| 0 | 289 | | requestSentNotification.model.timer = NOTIFICATIONS_DURATION; |
| 0 | 290 | | requestSentNotification.model.groupID = NOTIFICATIONS_ID; |
| 0 | 291 | | requestSentNotification.model.message = $"Your request to {lastRequestSentUserName} successfully sent!"; |
| 0 | 292 | | NotificationsController.i?.ShowNotification(requestSentNotification); |
| 0 | 293 | | } |
| | 294 | |
|
| | 295 | | public void HideMoreFriendsToLoadHint() |
| | 296 | | { |
| 1 | 297 | | loadMoreEntriesContainer.SetActive(false); |
| 1 | 298 | | UpdateLayout(); |
| 1 | 299 | | } |
| | 300 | |
|
| | 301 | | public void ShowMoreEntriesToLoadHint(int hiddenCount) |
| | 302 | | { |
| 2 | 303 | | loadMoreEntriesLabel.text = $"{hiddenCount} requests hidden. Scroll down to show more."; |
| 2 | 304 | | loadMoreEntriesContainer.SetActive(true); |
| 2 | 305 | | UpdateLayout(); |
| 2 | 306 | | } |
| | 307 | |
|
| 1 | 308 | | private void ShowMoreFriendsLoadingSpinner() => loadMoreEntriesSpinner.SetActive(true); |
| | 309 | |
|
| 7 | 310 | | private void HideMoreFriendsLoadingSpinner() => loadMoreEntriesSpinner.SetActive(false); |
| | 311 | |
|
| | 312 | | private void UpdateEmptyOrFilledState() |
| | 313 | | { |
| 8 | 314 | | emptyStateContainer.SetActive(entries.Count == 0); |
| 8 | 315 | | filledStateContainer.SetActive(entries.Count > 0); |
| 8 | 316 | | } |
| | 317 | |
|
| | 318 | | private void OnSearchInputValueChanged(string friendUserName) |
| | 319 | | { |
| 8 | 320 | | if (!string.IsNullOrEmpty(friendUserName)) |
| 0 | 321 | | NotificationsController.i?.DismissAllNotifications(NOTIFICATIONS_ID); |
| 8 | 322 | | } |
| | 323 | |
|
| | 324 | | private void OnFriendRequestReceivedAccepted(FriendRequestEntry requestEntry) |
| | 325 | | { |
| 0 | 326 | | ShowFriendAcceptedNotification(requestEntry); |
| 0 | 327 | | Remove(requestEntry.Model.userId); |
| 0 | 328 | | OnFriendRequestApproved?.Invoke((FriendRequestEntryModel) requestEntry.Model); |
| 0 | 329 | | } |
| | 330 | |
|
| | 331 | | private void ShowFriendAcceptedNotification(FriendRequestEntry requestEntry) |
| | 332 | | { |
| 0 | 333 | | acceptedFriendNotification.model.timer = NOTIFICATIONS_DURATION; |
| 0 | 334 | | acceptedFriendNotification.model.groupID = NOTIFICATIONS_ID; |
| 0 | 335 | | acceptedFriendNotification.model.message = $"You and {requestEntry.Model.userName} are now friends!"; |
| 0 | 336 | | NotificationsController.i?.ShowNotification(acceptedFriendNotification); |
| 0 | 337 | | } |
| | 338 | |
|
| | 339 | | private void OnEntryRejectButtonPressed(FriendRequestEntry requestEntry) |
| | 340 | | { |
| 0 | 341 | | Remove(requestEntry.Model.userId); |
| 0 | 342 | | OnRejectConfirmation?.Invoke((FriendRequestEntryModel) requestEntry.Model); |
| 0 | 343 | | } |
| | 344 | |
|
| | 345 | | private void OnEntryCancelButtonPressed(FriendRequestEntry requestEntry) |
| | 346 | | { |
| 0 | 347 | | Remove(requestEntry.Model.userId); |
| 0 | 348 | | OnCancelConfirmation?.Invoke((FriendRequestEntryModel) requestEntry.Model); |
| 0 | 349 | | } |
| | 350 | |
|
| | 351 | | private void OnEntryMenuToggle(FriendEntryBase friendEntry) |
| | 352 | | { |
| 0 | 353 | | contextMenuPanel.Show(friendEntry.Model.userId); |
| 0 | 354 | | contextMenuPanel.SetFriendshipContentActive(false); |
| 0 | 355 | | friendEntry.Dock(contextMenuPanel); |
| 0 | 356 | | } |
| | 357 | |
|
| | 358 | | private void UpdateCounterLabel() |
| | 359 | | { |
| 8 | 360 | | receivedRequestsCountText.SetText("RECEIVED ({0})", receivedRequestsList.Count()); |
| 8 | 361 | | sentRequestsCountText.SetText("SENT ({0})", sentRequestsList.Count()); |
| 8 | 362 | | } |
| | 363 | |
|
| | 364 | | private void HandleFriendBlockRequest(string userId, bool blockUser) |
| | 365 | | { |
| 0 | 366 | | var friendEntryToBlock = Get(userId); |
| 0 | 367 | | if (friendEntryToBlock == null) return; |
| | 368 | | // instantly refresh ui |
| 0 | 369 | | friendEntryToBlock.Model.blocked = blockUser; |
| 0 | 370 | | Set(userId, (FriendRequestEntryModel) friendEntryToBlock.Model); |
| 0 | 371 | | } |
| | 372 | |
|
| | 373 | | private void FetchProfilePicturesForVisibleEntries() |
| | 374 | | { |
| 1322 | 375 | | foreach (var entry in entries.Values.Skip(currentAvatarSnapshotIndex).Take(AVATAR_SNAPSHOTS_PER_FRAME)) |
| | 376 | | { |
| 330 | 377 | | if (entry.IsVisible(viewport)) |
| 330 | 378 | | entry.EnableAvatarSnapshotFetching(); |
| | 379 | | else |
| 0 | 380 | | entry.DisableAvatarSnapshotFetching(); |
| | 381 | | } |
| | 382 | |
|
| 331 | 383 | | currentAvatarSnapshotIndex += AVATAR_SNAPSHOTS_PER_FRAME; |
| | 384 | |
|
| 331 | 385 | | if (currentAvatarSnapshotIndex >= entries.Count) |
| 331 | 386 | | currentAvatarSnapshotIndex = 0; |
| 331 | 387 | | } |
| | 388 | |
|
| | 389 | | private void SetQueuedEntries() |
| | 390 | | { |
| 656 | 391 | | if (creationQueue.Count == 0) return; |
| | 392 | |
|
| 24 | 393 | | for (var i = 0; i < CREATION_AMOUNT_PER_FRAME && creationQueue.Count != 0; i++) |
| | 394 | | { |
| 6 | 395 | | var pair = creationQueue.FirstOrDefault(); |
| 6 | 396 | | creationQueue.Remove(pair.Key); |
| 6 | 397 | | Set(pair.Key, pair.Value); |
| | 398 | | } |
| | 399 | |
|
| 6 | 400 | | HideMoreFriendsLoadingSpinner(); |
| 6 | 401 | | } |
| | 402 | |
|
| | 403 | | private void RequestMoreEntries(Vector2 position) |
| | 404 | | { |
| 1 | 405 | | if (!loadMoreEntriesContainer.activeInHierarchy || |
| | 406 | | loadMoreEntriesSpinner.activeInHierarchy || |
| 0 | 407 | | (Time.realtimeSinceStartup - loadMoreEntriesRestrictionTime) < MIN_TIME_TO_REQUIRE_MORE_ENTRIES) return; |
| | 408 | |
|
| 1 | 409 | | if (position.y < REQUEST_MORE_ENTRIES_SCROLL_THRESHOLD && lastScrollPosition.y >= REQUEST_MORE_ENTRIES_SCROLL_TH |
| | 410 | | { |
| 1 | 411 | | if (requireMoreEntriesRoutine != null) |
| 0 | 412 | | StopCoroutine(requireMoreEntriesRoutine); |
| | 413 | |
|
| 1 | 414 | | ShowMoreFriendsLoadingSpinner(); |
| 1 | 415 | | requireMoreEntriesRoutine = StartCoroutine(WaitThenRequireMoreEntries()); |
| | 416 | |
|
| 1 | 417 | | loadMoreEntriesRestrictionTime = Time.realtimeSinceStartup; |
| | 418 | | } |
| | 419 | |
|
| 1 | 420 | | lastScrollPosition = position; |
| 1 | 421 | | } |
| | 422 | |
|
| | 423 | | private IEnumerator WaitThenRequireMoreEntries() |
| | 424 | | { |
| 1 | 425 | | yield return new WaitForSeconds(1f); |
| 1 | 426 | | OnRequireMoreEntries?.Invoke(); |
| 1 | 427 | | } |
| | 428 | |
|
| | 429 | | [Serializable] |
| | 430 | | private class Model |
| | 431 | | { |
| | 432 | | [Serializable] |
| | 433 | | public struct UserIdAndEntry |
| | 434 | | { |
| | 435 | | public string userId; |
| | 436 | | public bool received; |
| | 437 | | public SerializableEntryModel model; |
| | 438 | | } |
| | 439 | |
|
| | 440 | | [Serializable] |
| | 441 | | public class SerializableEntryModel : FriendRequestEntryModel |
| | 442 | | { |
| | 443 | | } |
| | 444 | |
|
| | 445 | | public UserIdAndEntry[] friends; |
| 24 | 446 | | public bool isReceivedRequestsExpanded = true; |
| 24 | 447 | | public bool isSentRequestsExpanded = true; |
| | 448 | | } |
| | 449 | | } |