Skip to content

Commit 3737732

Browse files
authored
Bugfix/fix example project fetching older messages (#136)
* Fix excessive TryLoadPreviousMessagesAsync calling - ScrollRect after finished scrolling can have like 1.00005 so we need to add threshold when detecting user scrolling * cleanup
1 parent b26d09e commit 3737732

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

Assets/Plugins/StreamChat/Core/State/Caches/CacheRepository.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,5 @@ internal CacheRepository(ConstructorHandler constructor, ICache cache)
117117

118118
private readonly ConstructorHandler _constructor;
119119
private readonly ICache _cache;
120-
private readonly IStatefulModelsFactory _statefulModelsFactory;
121120
}
122121
}

Assets/Plugins/StreamChat/Core/State/StatefulModelsFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ public StreamUser CreateStreamUser(string uniqueId)
3838
private readonly ILogs _logs;
3939
private readonly StreamChatClient _streamChatClient;
4040
private readonly IStatefulModelContext _context;
41-
private readonly Cache _cache;
41+
private readonly ICache _cache;
4242
}
4343
}

Assets/Plugins/StreamChat/Core/State/StreamStatefulModelBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal StreamStatefulModelBase(string uniqueId, ICacheRepository<TStatefulMode
3636
Repository.Track(Self);
3737
}
3838

39+
//StreamTodo: wrap completely the _additionalProperties in StreamCustomData and not operate on both
3940
protected Dictionary<string, object> GetInternalAdditionalPropertiesDictionary() => _additionalProperties;
4041

4142
protected abstract string InternalUniqueId { get; set; }

Assets/Plugins/StreamChat/SampleProject/Scripts/Views/MessageListView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ protected override void OnUpdate()
4242
return;
4343
}
4444

45-
if (_scrollRect.verticalNormalizedPosition >= 1f && !IsScrollListRebuilding)
45+
// Check against 1f + threshold because idle ScrollRect after scrolling can have fractional values above 1f
46+
if (_scrollRect.verticalNormalizedPosition >= 1.05f && !IsScrollListRebuilding)
4647
{
4748
TryLoadPreviousMessagesAsync().LogIfFailed();
4849
}
@@ -283,9 +284,8 @@ private void HideContextMenuIfTouchedOutside()
283284
return;
284285
}
285286

286-
if (Input.touchCount == 0)
287+
if (Input.touchCount == 0 || _activePopup == null)
287288
{
288-
289289
return;
290290
}
291291

0 commit comments

Comments
 (0)