Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.9.2 #141

Merged
merged 4 commits into from
Nov 14, 2023
Merged

1.9.2 #141

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/src/presentation/controllers/chat_view_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class ChatViewController extends GetxController
alertColor.value = const Color(0xFF1DBF1D);
} else {
isChatConnected.value = false;
alertMessage.value = "DISCONNECTED";
alertColor.value = const Color.fromARGB(255, 191, 37, 29);
}
});

Expand Down
8 changes: 7 additions & 1 deletion lib/src/presentation/controllers/home_view_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,13 @@ class HomeViewController extends GetxController
clientId: kTwitchAuthClientId,
);
twitchChat.connect();
twitchChat.sendMessage(message);

twitchChat.isConnected.addListener(() {
if (twitchChat.isConnected.value) {
twitchChat.sendMessage(message);
twitchChat.close();
}
});

chatInputController.text = '';
selectedMessage.value = null;
Expand Down
12 changes: 11 additions & 1 deletion lib/src/presentation/widgets/chat_message/author_name.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import 'package:flutter/material.dart';

class AuthorName extends StatelessWidget {
final bool isAction;
final String username;
final String displayName;
final String color;
final double textSize;

const AuthorName({
super.key,
required this.isAction,
required this.username,
required this.displayName,
required this.color,
required this.textSize,
Expand All @@ -18,13 +20,21 @@ class AuthorName extends StatelessWidget {
Widget build(BuildContext context) {
return RichText(
text: TextSpan(
text: displayName,
text: username != displayName.toLowerCase() ? username : displayName,
style: TextStyle(
color: Color(int.parse(color.replaceAll('#', '0xff'))),
fontSize: textSize,
fontWeight: FontWeight.bold,
),
children: [
TextSpan(
text: username != displayName.toLowerCase() ? "($displayName)" : "",
style: TextStyle(
color: Color(int.parse(color.replaceAll('#', '0xff'))),
fontSize: textSize,
fontWeight: FontWeight.normal,
),
),
TextSpan(
text: isAction ? " " : ": ",
style: TextStyle(
Expand Down
1 change: 1 addition & 0 deletions lib/src/presentation/widgets/chat_message/message_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class MessageRow extends StatelessWidget {
),
AuthorName(
isAction: message.isAction,
username: message.username,
displayName: message.displayName,
color: message.color,
textSize: textSize,
Expand Down
21 changes: 21 additions & 0 deletions lib/src/presentation/widgets/chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@ class ChatView extends StatelessWidget {
}
FocusScope.of(context).unfocus();
},
onDoubleTap: () {
// Open a confirmation dialog to reconnect to the chat
Get.defaultDialog(
backgroundColor: Theme.of(context).colorScheme.background,
title: "Confirmation",
middleText: "Do you want to reconnect ?",
textConfirm: "Yes",
textCancel: "No",
confirmTextColor: Theme.of(context).textTheme.bodyLarge!.color,
cancelTextColor: Theme.of(context).textTheme.bodyLarge!.color,
buttonColor: Theme.of(context).colorScheme.tertiary,
onConfirm: () {
controller?.twitchChat?.close();
controller?.twitchChat?.connect();
Get.back();
},
onCancel: () {
Get.back();
},
);
},
child: Container(
width: width,
height: double.infinity,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,10 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: "6e09f1a08ea249796b27d3b792a879e390688c54"
resolved-ref: ff0eb0ec9aab2af28ea6249da5c161744adffd35
url: "https://github.com/LezdCS/twitch_chat.git"
source: git
version: "0.0.3"
version: "0.0.4"
typed_data:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.9.1+38
version: 1.9.2+39

environment:
sdk: '>=2.19.0-0 <4.0.0'
Expand Down