Skip to content

Commit

Permalink
Merge pull request #2374 from nextcloud/fix/avatar-brightness-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Aug 14, 2024
2 parents d7294ae + a0f7826 commit 361b6e8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/neon/neon_talk/lib/src/widgets/room_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,23 @@ class TalkRoomAvatar extends StatelessWidget {
Widget build(BuildContext context) {
if (room.isCustomAvatar) {
final brightness = Theme.of(context).brightness;
final account = NeonProvider.of<Account>(context);

return CircleAvatar(
child: ClipOval(
child: NeonApiImage(
getRequest: (client) => switch (brightness) {
Brightness.dark => client.spreed.avatar.$getAvatarDark_Request(token: room.token),
Brightness.light => client.spreed.avatar.$getAvatar_Request(token: room.token),
},
key: Key('room-avatar-${account.id}-${room.token}-$brightness'),
account: account,
etag: room.avatarVersion,
expires: null,
account: NeonProvider.of<Account>(context),
getRequest: (client) => switch (brightness) {
Brightness.dark => client.spreed.avatar.$getAvatarDark_Request(
token: room.token,
),
Brightness.light => client.spreed.avatar.$getAvatar_Request(
token: room.token,
),
},
),
),
);
Expand Down
1 change: 1 addition & 0 deletions packages/neon/neon_talk/test/message_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,7 @@ void main() {
.thenAnswer((_) => BehaviorSubject.seeded(Result.success(userDetails)));

final account = MockAccount();
when(() => account.id).thenReturn('id');
when(() => account.username).thenReturn('username');
when(() => account.client).thenReturn(NextcloudClient(Uri()));

Expand Down
1 change: 1 addition & 0 deletions packages/neon/neon_talk/test/rich_object_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void main() {

setUp(() {
account = MockAccount();
when(() => account.id).thenReturn('id');
when(() => account.username).thenReturn('username');
when(() => account.serverURL).thenReturn(Uri.parse('http://example.com'));
when(() => account.client).thenReturn(
Expand Down
1 change: 1 addition & 0 deletions packages/neon/neon_talk/test/room_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ void main() {
when(() => bloc.reactions).thenAnswer((_) => BehaviorSubject.seeded(BuiltMap()));

final account = MockAccount();
when(() => account.id).thenReturn('id');
when(() => account.client).thenReturn(NextcloudClient(Uri.parse('')));

await tester.pumpWidgetWithAccessibility(
Expand Down
1 change: 1 addition & 0 deletions packages/neon_framework/lib/src/widgets/user_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class _UserAvatarState extends State<NeonUserAvatar> {
radius: size / 2,
child: ClipOval(
child: NeonApiImage(
key: Key('avatar-${widget.account.id}-$username-$brightness-$pixelSize'),
account: widget.account,
etag: null,
expires: null,
Expand Down

0 comments on commit 361b6e8

Please sign in to comment.