This commit is contained in:
Tommy Chow 2026-01-06 20:22:14 -05:00
parent c378b9b2fd
commit 71efc3cfa5
4 changed files with 63 additions and 51 deletions

View file

@ -61,9 +61,11 @@ void main() async {
// Don't block - run in background after app starts.
// This is safe because first run means no active session depends on this data.
unawaited(storage.deleteAll().catchError((e) {
debugPrint('Error clearing secure storage: $e');
}));
unawaited(
storage.deleteAll().catchError((e) {
debugPrint('Error clearing secure storage: $e');
}),
);
}
await initUtils();
@ -190,9 +192,10 @@ class _MyAppState extends State<MyApp> {
// Handle the initial link if app was opened from a link.
// Add timeout to prevent indefinite blocking on certain Android lifecycle states.
final initialLink = await _appLinks
.getInitialLink()
.timeout(const Duration(seconds: 3), onTimeout: () => null);
final initialLink = await _appLinks.getInitialLink().timeout(
const Duration(seconds: 3),
onTimeout: () => null,
);
if (initialLink != null) {
handleDeepLink(initialLink);
}

View file

@ -279,8 +279,11 @@ abstract class ChatStoreBase with Store {
@computed
List<String> get matchingChatters {
if (!_showMentionAutocomplete) return const [];
final searchTerm =
_inputText.split(' ').last.replaceFirst('@', '').toLowerCase();
final searchTerm = _inputText
.split(' ')
.last
.replaceFirst('@', '')
.toLowerCase();
return chatDetailsStore.chatUsers
.where((chatter) => chatter.contains(searchTerm))
.toList();
@ -623,8 +626,9 @@ abstract class ChatStoreBase with Store {
// Transform reconnect message to summary on successful connection
if (_reconnectMessage != null && _reconnectStartTime != null) {
final elapsed =
DateTime.now().difference(_reconnectStartTime!).inSeconds;
final elapsed = DateTime.now()
.difference(_reconnectStartTime!)
.inSeconds;
final attempts = _retries;
final index = _messages.indexOf(_reconnectMessage!);
if (index != -1) {
@ -896,7 +900,8 @@ abstract class ChatStoreBase with Store {
void updateReconnectMessage(String text) {
final msg = IRCMessage.createNotice(message: text);
if (_reconnectMessage == null) {
_reconnectStartTime ??= DateTime.now(); // Record when reconnection started
_reconnectStartTime ??=
DateTime.now(); // Record when reconnection started
_reconnectMessage = msg;
_messages.add(_reconnectMessage!);
} else {
@ -1108,9 +1113,7 @@ abstract class ChatStoreBase with Store {
if (_isWaitingForAck) {
_isWaitingForAck = false;
toSend = null;
updateNotification(
'Message may not have been sent. Please try again.',
);
updateNotification('Message may not have been sent. Please try again.');
}
});
@ -1131,8 +1134,7 @@ abstract class ChatStoreBase with Store {
userChatMessage.tags['user-id'] = auth.user.details!.id;
}
if (replyingToMessage != null &&
replyingToMessage!.tags['id'] != null) {
if (replyingToMessage != null && replyingToMessage!.tags['id'] != null) {
userChatMessage.tags['reply-parent-msg-id'] =
replyingToMessage!.tags['id']!;
userChatMessage.tags['reply-parent-display-name'] =

View file

@ -96,17 +96,17 @@ class ChatBottomBar extends StatelessWidget {
preferBelow: false,
child: Text.rich(
TextSpan(
children:
chatStore.replyingToMessage!.generateSpan(
context,
assetsStore: chatStore.assetsStore,
emoteScale: chatStore.settings.emoteScale,
badgeScale: chatStore.settings.badgeScale,
launchExternal:
chatStore.settings.launchUrlExternal,
timestamp: chatStore.settings.timestampType,
currentChannelId: chatStore.channelId,
),
children: chatStore.replyingToMessage!
.generateSpan(
context,
assetsStore: chatStore.assetsStore,
emoteScale: chatStore.settings.emoteScale,
badgeScale: chatStore.settings.badgeScale,
launchExternal:
chatStore.settings.launchUrlExternal,
timestamp: chatStore.settings.timestampType,
currentChannelId: chatStore.channelId,
),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@ -265,11 +265,13 @@ class ChatBottomBar extends StatelessWidget {
maxLines: 3,
enabled: isEnabled,
specialTextSpanBuilder: EmoteTextSpanBuilder(
emoteToObject: chatStore.assetsStore.emoteToObject,
emoteToObject:
chatStore.assetsStore.emoteToObject,
userEmoteToObject:
chatStore.assetsStore.userEmoteToObject,
emoteSize:
chatStore.settings.emoteScale * defaultEmoteSize,
chatStore.settings.emoteScale *
defaultEmoteSize,
),
decoration: InputDecoration(
prefixIcon:
@ -291,16 +293,16 @@ class ChatBottomBar extends StatelessWidget {
hintText: !isLoggedIn
? loginTooltipMessage
: !isConnected
? (hasConnected
? 'Chat disconnected'
: 'Connecting...')
: isWaitingForAck
? 'Sending...'
: chatStore.replyingToMessage != null
? 'Reply'
: hasChatDelay
? 'Chat (${chatStore.settings.chatDelay.toInt()}s delay)'
: 'Chat',
? (hasConnected
? 'Chat disconnected'
: 'Connecting...')
: isWaitingForAck
? 'Sending...'
: chatStore.replyingToMessage != null
? 'Reply'
: hasChatDelay
? 'Chat (${chatStore.settings.chatDelay.toInt()}s delay)'
: 'Chat',
),
controller: chatStore.textController,
onSubmitted: chatStore.sendMessage,
@ -313,7 +315,8 @@ class ChatBottomBar extends StatelessWidget {
),
),
TextFieldTapRegion(
child: chatStore.showSendButton &&
child:
chatStore.showSendButton &&
(chatStore.settings.chatWidth >= 0.3 ||
chatStore.expandChat ||
context.isPortrait)
@ -344,16 +347,18 @@ class ChatBottomBar extends StatelessWidget {
: IconButton(
icon: Icon(Icons.adaptive.more_rounded),
tooltip: 'More',
onPressed: () => showModalBottomSheetWithProperFocus(
isScrollControlled: true,
context: context,
builder: (_) => ChatDetails(
chatDetailsStore: chatStore.chatDetailsStore,
chatStore: chatStore,
userLogin: chatStore.channelName,
onAddChat: onAddChat,
),
),
onPressed: () =>
showModalBottomSheetWithProperFocus(
isScrollControlled: true,
context: context,
builder: (_) => ChatDetails(
chatDetailsStore:
chatStore.chatDetailsStore,
chatStore: chatStore,
userLogin: chatStore.channelName,
onAddChat: onAddChat,
),
),
),
),
],

View file

@ -305,7 +305,9 @@ abstract class VideoStoreBase with Store {
} else {
// Stop tracker if both settings are now disabled
try {
videoWebViewController.runJavaScript('window._latencyTracker?.stop()');
videoWebViewController.runJavaScript(
'window._latencyTracker?.stop()',
);
} catch (e) {
debugPrint(e.toString());
}