chore: Pause on display receipts

This commit is contained in:
Christian Pauly 2021-12-26 11:40:18 +01:00
parent ee06ead651
commit eba4418c8d

View File

@ -44,11 +44,11 @@ class StoryPageController extends State<StoryPage> {
Event? get currentEvent => index < events.length ? events[index] : null; Event? get currentEvent => index < events.length ? events[index] : null;
bool replyLoading = false; bool replyLoading = false;
bool _emojiSelector = false; bool _modalOpened = false;
void replyEmojiAction() async { void replyEmojiAction() async {
if (replyLoading) return; if (replyLoading) return;
_emojiSelector = true; _modalOpened = true;
await showModalBottomSheet( await showModalBottomSheet(
context: context, context: context,
builder: (context) => EmojiPicker( builder: (context) => EmojiPicker(
@ -58,7 +58,7 @@ class StoryPageController extends State<StoryPage> {
}, },
), ),
); );
_emojiSelector = false; _modalOpened = false;
} }
void replyAction([String? message]) async { void replyAction([String? message]) async {
@ -103,24 +103,28 @@ class StoryPageController extends State<StoryPage> {
[]; [];
} }
void displaySeenByUsers() => showModalBottomSheet( void displaySeenByUsers() async {
context: context, _modalOpened = true;
builder: (context) => Scaffold( await showModalBottomSheet(
appBar: AppBar( context: context,
title: Text(seenByUsersTitle), builder: (context) => Scaffold(
), appBar: AppBar(
body: ListView.builder( title: Text(seenByUsersTitle),
itemCount: currentSeenByUsers.length, ),
itemBuilder: (context, i) => ListTile( body: ListView.builder(
leading: Avatar( itemCount: currentSeenByUsers.length,
mxContent: currentSeenByUsers[i].avatarUrl, itemBuilder: (context, i) => ListTile(
name: currentSeenByUsers[i].calcDisplayname(), leading: Avatar(
), mxContent: currentSeenByUsers[i].avatarUrl,
title: Text(currentSeenByUsers[i].calcDisplayname()), name: currentSeenByUsers[i].calcDisplayname(),
), ),
title: Text(currentSeenByUsers[i].calcDisplayname()),
), ),
), ),
); ),
);
_modalOpened = false;
}
String get seenByUsersTitle { String get seenByUsersTitle {
final seenByUsers = currentSeenByUsers; final seenByUsers = currentSeenByUsers;
@ -147,7 +151,7 @@ class StoryPageController extends State<StoryPage> {
_progressTimer?.cancel(); _progressTimer?.cancel();
if (reset) progress = Duration.zero; if (reset) progress = Duration.zero;
_progressTimer = Timer.periodic(_step, (_) { _progressTimer = Timer.periodic(_step, (_) {
if (replyFocus.hasFocus || _emojiSelector) return; if (replyFocus.hasFocus || _modalOpened) return;
if (!mounted) { if (!mounted) {
_progressTimer?.cancel(); _progressTimer?.cancel();
return; return;