some small UI fixes, disale moderation toggle
This commit is contained in:
parent
19fb4cfbf7
commit
dc7029be97
3 changed files with 42 additions and 37 deletions
|
|
@ -350,12 +350,13 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
try {
|
||||
await loadTimelineFuture;
|
||||
// #Pangea
|
||||
if (timeline != null) {
|
||||
final String? targetId =
|
||||
timeline?.events.firstWhereOrNull((e) => e.isVisibleInGui)?.eventId;
|
||||
if (targetId != null) {
|
||||
choreographer.pangeaController.instructions.show(
|
||||
context,
|
||||
InstructionsEnum.clickMessage,
|
||||
timeline!.events.firstWhereOrNull((e) => e.isVisibleInGui)?.eventId ??
|
||||
'',
|
||||
targetId,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
|
@ -399,6 +400,16 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
animateInEventIndex = i;
|
||||
}
|
||||
|
||||
// #Pangea
|
||||
List<Event> get visibleEvents =>
|
||||
timeline?.events
|
||||
.where(
|
||||
(x) => x.isVisibleInGui,
|
||||
)
|
||||
.toList() ??
|
||||
<Event>[];
|
||||
// Pangea#
|
||||
|
||||
Future<void> _getTimeline({
|
||||
String? eventContextId,
|
||||
}) async {
|
||||
|
|
@ -415,22 +426,15 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
onInsert: onInsert,
|
||||
);
|
||||
// #Pangea
|
||||
List<Event>? messageEvents =
|
||||
timeline?.events.where((x) => x.type == 'm.room.message').toList();
|
||||
if (messageEvents != null && messageEvents.length < 10) {
|
||||
if (visibleEvents.length < 10) {
|
||||
int prevNumEvents = timeline!.events.length;
|
||||
await requestHistory();
|
||||
messageEvents =
|
||||
timeline?.events.where((x) => x.type == 'm.room.message').toList();
|
||||
int numRequests = 0;
|
||||
while (timeline!.events.length > prevNumEvents &&
|
||||
messageEvents!.length < 10 &&
|
||||
visibleEvents.length < 10 &&
|
||||
numRequests <= 5) {
|
||||
prevNumEvents = timeline!.events.length;
|
||||
await requestHistory();
|
||||
messageEvents = timeline?.events
|
||||
.where((x) => x.type == 'm.room.message')
|
||||
.toList();
|
||||
numRequests++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class MessageUnsubscribedCard extends StatelessWidget {
|
|||
MatrixState.pangeaController.subscriptionController
|
||||
.showPaywall(context);
|
||||
}
|
||||
MatrixState.pAnyState.closeOverlay();
|
||||
}
|
||||
|
||||
return Padding(
|
||||
|
|
|
|||
|
|
@ -190,31 +190,31 @@ class ConversationBotSettingsState extends State<ConversationBotSettings> {
|
|||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16),
|
||||
child: SwitchListTile.adaptive(
|
||||
title: Text(
|
||||
L10n.of(context)!.enableModeration,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
subtitle: Text(L10n.of(context)!.enableModerationDesc),
|
||||
secondary: CircleAvatar(
|
||||
backgroundColor:
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor:
|
||||
Theme.of(context).textTheme.bodyLarge!.color,
|
||||
child: const Icon(Icons.shield_outlined),
|
||||
),
|
||||
activeColor: AppConfig.activeToggleColor,
|
||||
value: botOptions.safetyModeration,
|
||||
onChanged: (bool newValue) => updateBotOption(() {
|
||||
botOptions.safetyModeration = newValue;
|
||||
}),
|
||||
),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 16),
|
||||
// child: SwitchListTile.adaptive(
|
||||
// title: Text(
|
||||
// L10n.of(context)!.enableModeration,
|
||||
// style: TextStyle(
|
||||
// color: Theme.of(context).colorScheme.secondary,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
// subtitle: Text(L10n.of(context)!.enableModerationDesc),
|
||||
// secondary: CircleAvatar(
|
||||
// backgroundColor:
|
||||
// Theme.of(context).scaffoldBackgroundColor,
|
||||
// foregroundColor:
|
||||
// Theme.of(context).textTheme.bodyLarge!.color,
|
||||
// child: const Icon(Icons.shield_outlined),
|
||||
// ),
|
||||
// activeColor: AppConfig.activeToggleColor,
|
||||
// value: botOptions.safetyModeration,
|
||||
// onChanged: (bool newValue) => updateBotOption(() {
|
||||
// botOptions.safetyModeration = newValue;
|
||||
// }),
|
||||
// ),
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 16, 0, 0),
|
||||
child: Text(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue