parent
274256dfe4
commit
d1aa91fbbd
2 changed files with 0 additions and 31 deletions
|
|
@ -3,7 +3,6 @@ import "dart:math";
|
||||||
|
|
||||||
import "package:collection/collection.dart";
|
import "package:collection/collection.dart";
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter/foundation.dart";
|
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:fluttertagger/fluttertagger.dart";
|
import "package:fluttertagger/fluttertagger.dart";
|
||||||
import "package:nexus/controllers/attachment.dart";
|
import "package:nexus/controllers/attachment.dart";
|
||||||
|
|
@ -84,14 +83,6 @@ class RoomChatController(final ChatParams info)
|
||||||
.where((rowId) => room.events[rowId]?.threadRoot == null)
|
.where((rowId) => room.events[rowId]?.threadRoot == null)
|
||||||
.toIList();
|
.toIList();
|
||||||
|
|
||||||
// TODO: remove, debugging replies not showing
|
|
||||||
debugPrint(
|
|
||||||
"[timeline] build ${info.roomId}: "
|
|
||||||
"syncedTail=${room.timeline.entries.sortedBy<num>((entry) => entry.key).reversed.take(5).map((entry) => "${entry.key}:${entry.value}").toList()} "
|
|
||||||
"clientSticky=${room.clientSticky.toList()} "
|
|
||||||
"chatTail=${timeline.reversed.take(5).toList()}",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (info.contextualEvent == null ||
|
if (info.contextualEvent == null ||
|
||||||
timeline.contains(info.contextualEvent)) {
|
timeline.contains(info.contextualEvent)) {
|
||||||
ref.watch(
|
ref.watch(
|
||||||
|
|
@ -465,11 +456,6 @@ class RoomChatController(final ChatParams info)
|
||||||
|
|
||||||
/// Shows [event], which was just sent, until it comes down sync.
|
/// Shows [event], which was just sent, until it comes down sync.
|
||||||
void addSent(Event? event) {
|
void addSent(Event? event) {
|
||||||
// TODO: remove, debugging replies not showing
|
|
||||||
debugPrint(
|
|
||||||
"[timeline] addSent: rowId=${event?.rowId} eventId=${event?.eventId} "
|
|
||||||
"alreadySynced=${ref.read(RoomsController.provider)[info.roomId]?.timeline.values.contains(event?.rowId)}",
|
|
||||||
);
|
|
||||||
if (event case final event?) {
|
if (event case final event?) {
|
||||||
ref
|
ref
|
||||||
.read(RoomsController.provider.notifier)
|
.read(RoomsController.provider.notifier)
|
||||||
|
|
|
||||||
|
|
@ -101,13 +101,6 @@ final class ChatScroll({
|
||||||
final anchorIndex = items.indexOf(anchor);
|
final anchorIndex = items.indexOf(anchor);
|
||||||
|
|
||||||
final historyLength = anchorIndex == -1 ? items.length : anchorIndex + 1;
|
final historyLength = anchorIndex == -1 ? items.length : anchorIndex + 1;
|
||||||
// TODO: remove, debugging replies not showing
|
|
||||||
debugPrint(
|
|
||||||
"[timeline] split: anchor=$anchor anchorIndex=$anchorIndex "
|
|
||||||
"length=${items.length} "
|
|
||||||
"historyTail=${items.take(historyLength).toList().reversed.take(3).toList()} "
|
|
||||||
"live=${items.skip(historyLength).toList()}",
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
history: items.take(historyLength).toIList().reversed.toIList(),
|
history: items.take(historyLength).toIList().reversed.toIList(),
|
||||||
live: items.skip(historyLength).toIList(),
|
live: items.skip(historyLength).toIList(),
|
||||||
|
|
@ -120,11 +113,6 @@ final class ChatScroll({
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
final previous = previousLastRowId.value;
|
final previous = previousLastRowId.value;
|
||||||
previousLastRowId.value = lastRowId;
|
previousLastRowId.value = lastRowId;
|
||||||
// TODO: remove, debugging replies not showing
|
|
||||||
debugPrint(
|
|
||||||
"[timeline] lastRowId: previous=$previous last=$lastRowId "
|
|
||||||
"atBottom=${atBottom.value} contextualEvent=${contextualEvent.value}",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (previous == null || lastRowId == null || previous == lastRowId) {
|
if (previous == null || lastRowId == null || previous == lastRowId) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -132,11 +120,6 @@ final class ChatScroll({
|
||||||
if (!atBottom.value || contextualEvent.value != null) return null;
|
if (!atBottom.value || contextualEvent.value != null) return null;
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
// TODO: remove, debugging replies not showing
|
|
||||||
debugPrint(
|
|
||||||
"[timeline] re-anchoring to $lastRowId "
|
|
||||||
"hasClients=${scrollController.hasClients}",
|
|
||||||
);
|
|
||||||
if (!scrollController.hasClients) return;
|
if (!scrollController.hasClients) return;
|
||||||
|
|
||||||
anchorId.value = lastRowId;
|
anchorId.value = lastRowId;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue