add shared chat session support (#424)

* dispose overlay timer

* fix pip

* add channel indicators to messages for shared chat sessions

* add tooltip to chat message pfp

* remove tooltip marign/padding

* return null instead of throwing error

* fix build error
This commit is contained in:
Tommy Chow 2024-12-23 16:05:07 -05:00 • committed by GitHub
parent 4f28408be6
commit 817289a01d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 142 additions and 2 deletions

View file

@ -6,6 +6,7 @@ import 'package:frosty/apis/twitch_api.dart';
import 'package:frosty/models/emotes.dart';
import 'package:frosty/models/events.dart';
import 'package:frosty/models/irc.dart';
import 'package:frosty/models/user.dart';
import 'package:frosty/screens/channel/chat/details/chat_details_store.dart';
import 'package:frosty/screens/channel/chat/stores/chat_assets_store.dart';
import 'package:frosty/screens/settings/stores/auth_store.dart';
@ -152,6 +153,8 @@ abstract class ChatStoreBase with Store {
@observable
IRCMessage? replyingToMessage;
final channelIdToUserTwitch = ObservableMap<String, UserTwitch>();
ChatStoreBase({
required this.twitchApi,
required this.auth,
@ -204,6 +207,24 @@ abstract class ChatStoreBase with Store {
assetsStore.init();
// Get the shared chat session and the profile pictures of the participants.
twitchApi
.getSharedChatSession(
broadcasterId: channelId,
headers: auth.headersTwitch,
)
.then((sharedChatSession) {
if (sharedChatSession == null) return;
for (final participant in sharedChatSession.participants) {
twitchApi
.getUser(id: participant.broadcasterId, headers: auth.headersTwitch)
.then((user) {
channelIdToUserTwitch[participant.broadcasterId] = user;
});
}
});
_messages.add(IRCMessage.createNotice(message: 'Connecting to chat...'));
if (settings.showVideo && settings.chatDelay > 0) {