Add force_verify OAuth parameter & fixes
The `force_verify` parameter will allow users to be verified in the webview when logging in and allow them to switch accounts. [skip ci]
This commit is contained in:
parent
9007cd9d9f
commit
41b5fefa32
5 changed files with 47 additions and 36 deletions
|
|
@ -78,6 +78,7 @@ abstract class _AuthBase with Store {
|
|||
'redirect_uri': 'auth://',
|
||||
'response_type': 'token',
|
||||
'scope': 'chat:read chat:edit user:read:follows',
|
||||
'force_verify': 'true',
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@ class BadgeImagesTwitch {
|
|||
@JsonKey(name: 'image_url_4x')
|
||||
final String imageUrl4x;
|
||||
|
||||
const BadgeImagesTwitch(this.id, this.imageUrl1x, this.imageUrl2x, this.imageUrl4x);
|
||||
const BadgeImagesTwitch(
|
||||
this.id,
|
||||
this.imageUrl1x,
|
||||
this.imageUrl2x,
|
||||
this.imageUrl4x,
|
||||
);
|
||||
|
||||
factory BadgeImagesTwitch.fromJson(Map<String, dynamic> json) => _$BadgeImagesTwitchFromJson(json);
|
||||
}
|
||||
|
|
@ -23,7 +28,10 @@ class BadgesTwitch {
|
|||
final String setId;
|
||||
final List<BadgeImagesTwitch> versions;
|
||||
|
||||
const BadgesTwitch(this.setId, this.versions);
|
||||
const BadgesTwitch(
|
||||
this.setId,
|
||||
this.versions,
|
||||
);
|
||||
|
||||
factory BadgesTwitch.fromJson(Map<String, dynamic> json) => _$BadgesTwitchFromJson(json);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ abstract class _ChatStoreBase with Store {
|
|||
// Listen for new messages and forward them to the handler.
|
||||
_channel.stream.listen(
|
||||
(data) => _handleIRCData(data.toString()),
|
||||
onError: (error) => debugPrint('Failed to connect to chat: ${error.toString()}'),
|
||||
onDone: () => debugPrint("Disconnected from $channelName's chat."),
|
||||
);
|
||||
|
||||
|
|
@ -144,6 +145,7 @@ abstract class _ChatStoreBase with Store {
|
|||
debugPrint('Unknown command: ${parsedIRCMessage.command}');
|
||||
continue;
|
||||
}
|
||||
|
||||
_deleteAndScrollToEnd();
|
||||
} else if (message == 'PING :tmi.twitch.tv') {
|
||||
_channel.sink.add('PONG :tmi.twitch.tv');
|
||||
|
|
@ -152,28 +154,6 @@ abstract class _ChatStoreBase with Store {
|
|||
}
|
||||
}
|
||||
|
||||
/// Sends the given string message by the logged-in user and adds it to [messages].
|
||||
@action
|
||||
void sendMessage(String message) {
|
||||
// Do not send if the message is blank/empty.
|
||||
if (message.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send the message to the IRC chat room.
|
||||
_channel.sink.add('PRIVMSG #$channelName :$message');
|
||||
|
||||
// Obtain the logged-in user's appearance in chat with USERSTATE and create the full message to render.
|
||||
if (_userState != null) {
|
||||
final userChatMessage = IRCMessage.fromString(_userState!);
|
||||
userChatMessage.message = message;
|
||||
toSend = userChatMessage;
|
||||
}
|
||||
|
||||
// Clear the previous input in the TextField.
|
||||
textController.clear();
|
||||
}
|
||||
|
||||
/// If [_autoScroll] is enabled, removes messages if [messages] is too large and scrolls to the latest message.
|
||||
@action
|
||||
void _deleteAndScrollToEnd() {
|
||||
|
|
@ -207,6 +187,28 @@ abstract class _ChatStoreBase with Store {
|
|||
});
|
||||
}
|
||||
|
||||
/// Sends the given string message by the logged-in user and adds it to [messages].
|
||||
@action
|
||||
void sendMessage(String message) {
|
||||
// Do not send if the message is blank/empty.
|
||||
if (message.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send the message to the IRC chat room.
|
||||
_channel.sink.add('PRIVMSG #$channelName :$message');
|
||||
|
||||
// Obtain the logged-in user's appearance in chat with USERSTATE and create the full message to render.
|
||||
if (_userState != null) {
|
||||
final userChatMessage = IRCMessage.fromString(_userState!);
|
||||
userChatMessage.message = message;
|
||||
toSend = userChatMessage;
|
||||
}
|
||||
|
||||
// Clear the previous input in the TextField.
|
||||
textController.clear();
|
||||
}
|
||||
|
||||
/// Fetches global and channel assets (badges and emotes) and stores them in [_assetToUrl]
|
||||
Future<void> getAssets() async {
|
||||
// Fetch the desired channel/user's information.
|
||||
|
|
|
|||
|
|
@ -57,17 +57,6 @@ mixin _$ChatStore on _ChatStoreBase, Store {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void sendMessage(String message) {
|
||||
final _$actionInfo = _$_ChatStoreBaseActionController.startAction(
|
||||
name: '_ChatStoreBase.sendMessage');
|
||||
try {
|
||||
return super.sendMessage(message);
|
||||
} finally {
|
||||
_$_ChatStoreBaseActionController.endAction(_$actionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void _deleteAndScrollToEnd() {
|
||||
final _$actionInfo = _$_ChatStoreBaseActionController.startAction(
|
||||
|
|
@ -90,6 +79,17 @@ mixin _$ChatStore on _ChatStoreBase, Store {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void sendMessage(String message) {
|
||||
final _$actionInfo = _$_ChatStoreBaseActionController.startAction(
|
||||
name: '_ChatStoreBase.sendMessage');
|
||||
try {
|
||||
return super.sendMessage(message);
|
||||
} finally {
|
||||
_$_ChatStoreBaseActionController.endAction(_$actionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '''
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ abstract class _FollowedStreamsStoreBase with Store {
|
|||
bool get hasMore => _isLoading == false && _followedStreamsCurrentCursor != null;
|
||||
|
||||
_FollowedStreamsStoreBase({required this.authStore}) {
|
||||
getFollowedStreams();
|
||||
if (authStore.isLoggedIn) getFollowedStreams();
|
||||
}
|
||||
|
||||
/// Fetches the followed streams based on the current cursor.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue