chore: Add language to OwnUser
This commit is contained in:
@@ -27,6 +27,7 @@ class OwnUser extends User {
|
||||
Map<String, Object?> extraData = const {},
|
||||
bool banned = false,
|
||||
List<String> teams = const [],
|
||||
String? language,
|
||||
}) : super(
|
||||
id: id,
|
||||
role: role,
|
||||
@@ -37,6 +38,7 @@ class OwnUser extends User {
|
||||
extraData: extraData,
|
||||
banned: banned,
|
||||
teams: teams,
|
||||
language: language,
|
||||
);
|
||||
|
||||
/// Create a new instance from a json
|
||||
@@ -54,6 +56,7 @@ class OwnUser extends User {
|
||||
banned: user.banned,
|
||||
extraData: user.extraData,
|
||||
teams: user.teams,
|
||||
language: user.language,
|
||||
);
|
||||
|
||||
/// Creates a copy of [OwnUser] with specified attributes overridden.
|
||||
@@ -73,6 +76,7 @@ class OwnUser extends User {
|
||||
List<Mute>? mutes,
|
||||
int? totalUnreadCount,
|
||||
int? unreadChannels,
|
||||
String? language,
|
||||
}) =>
|
||||
OwnUser(
|
||||
id: id ?? this.id,
|
||||
@@ -89,6 +93,7 @@ class OwnUser extends User {
|
||||
mutes: mutes ?? this.mutes,
|
||||
totalUnreadCount: totalUnreadCount ?? this.totalUnreadCount,
|
||||
unreadChannels: unreadChannels ?? this.unreadChannels,
|
||||
language: language ?? this.language,
|
||||
);
|
||||
|
||||
/// Returns a new [OwnUser] that is a combination of this ownUser
|
||||
@@ -113,6 +118,7 @@ class OwnUser extends User {
|
||||
totalUnreadCount: other.totalUnreadCount,
|
||||
unreadChannels: other.unreadChannels,
|
||||
updatedAt: other.updatedAt,
|
||||
language: other.language,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ class User extends Equatable {
|
||||
'online',
|
||||
'banned',
|
||||
'teams',
|
||||
'language',
|
||||
];
|
||||
|
||||
/// User id
|
||||
@@ -126,6 +127,7 @@ class User extends Equatable {
|
||||
Map<String, Object?>? extraData,
|
||||
bool? banned,
|
||||
List<String>? teams,
|
||||
String? language,
|
||||
}) =>
|
||||
User(
|
||||
id: id ?? this.id,
|
||||
@@ -137,6 +139,7 @@ class User extends Equatable {
|
||||
extraData: extraData ?? this.extraData,
|
||||
banned: banned ?? this.banned,
|
||||
teams: teams ?? this.teams,
|
||||
language: language ?? this.language,
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -150,5 +153,6 @@ class User extends Equatable {
|
||||
online,
|
||||
banned,
|
||||
extraData,
|
||||
language,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -24,11 +24,15 @@ void main() async {
|
||||
/// Please see the following for more information:
|
||||
/// https://getstream.io/chat/docs/ios_user_setup_and_tokens/
|
||||
await client.connectUser(
|
||||
User(id: 'super-band-9'),
|
||||
User(id: 'super-band-9', language: 'fr'),
|
||||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.'
|
||||
'0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A',
|
||||
);
|
||||
|
||||
client.on().listen((e) {
|
||||
print('e.user.language ${e.me?.language}');
|
||||
});
|
||||
|
||||
final channel = client.channel('messaging', id: 'godevs');
|
||||
|
||||
await channel.watch();
|
||||
|
||||
@@ -29,6 +29,7 @@ class MessageText extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//print(StreamChat.of(context).user);
|
||||
final text = _replaceMentions(message.text ?? '').replaceAll('\n', '\n\n');
|
||||
|
||||
final themeData = Theme.of(context);
|
||||
|
||||
Reference in New Issue
Block a user