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

TW-136 feat: set avatar group chat at creation #156

Closed
wants to merge 9 commits into from

Conversation

imGok
Copy link
Contributor

@imGok imGok commented Jun 13, 2023

This Closes

DEMO :
Create group with avatar :
creategroupfinaldemo1

Create group without avatar :
creategroupfinaldemo2

Avatar too big :
creategroupfinaldemo3

@imGok imGok changed the title feat: set avatar group chat at creation TW-136 feat: set avatar group chat at creation Jun 13, 2023
@hoangdat
Copy link
Member

Great!!! but what is the limitation of avatar?

@hoangdat
Copy link
Member

hoangdat commented Jun 14, 2023

as I saw in the demo, user need to wait for a long time after submitting the creation. Not a good UX.

Please create the interactor with the output is the stream of state we will find the way to show the progress of creation in UI.

Copy link
Member

@hoangdat hoangdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anw, I like the way you are working now. 💪

lib/di/room/room_di.dart Show resolved Hide resolved
lib/di/room/room_di.dart Outdated Show resolved Hide resolved
lib/di/room/room_di.dart Outdated Show resolved Hide resolved
lib/domain/model/contact/new_room_informations.dart Outdated Show resolved Hide resolved
lib/domain/usecase/create_room_interactor.dart Outdated Show resolved Hide resolved
lib/domain/usecase/create_room_interactor.dart Outdated Show resolved Hide resolved
lib/domain/usecase/create_room_interactor.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group_info_controller.dart Outdated Show resolved Hide resolved
@imGok imGok force-pushed the tw_136_create_grp_photo branch 2 times, most recently from 3226bff to e66fe7b Compare June 15, 2023 18:01
lib/domain/app_state/room/create_room_success.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group.dart Show resolved Hide resolved
lib/pages/new_private_chat/create_room_controller.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group.dart Outdated Show resolved Hide resolved
@hoangdat
Copy link
Member

image

It is hard for me to follow the previous comments, DONT DO IT. It wastes a lot of time of reviewers

lib/domain/app_state/room/create_room_success.dart Outdated Show resolved Hide resolved
lib/domain/app_state/room/create_room_success.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group.dart Outdated Show resolved Hide resolved
lib/pages/new_group/new_group.dart Outdated Show resolved Hide resolved
@imGok
Copy link
Contributor Author

imGok commented Jun 19, 2023

I put a default value to prevent blink blink @hoangdat
blinkblink


final selectedContactsMapNotifier = ValueNotifier<Map<PresentationContact, bool>>({});
final haveSelectedContactsNotifier = ValueNotifier(false);
final haveGroupNameNotifier = ValueNotifier(false);
final isEnableEEEncryptionNotifier = ValueNotifier(true);
final avatarNotifier = ValueNotifier<MatrixFile?>(null);

final int maxFileSizeDefault = 5 * 1024 * 1024;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should clarify this variable. is it in MB or KB or GB ?. maxFileSizeDefault => maxFileSizeDefaultInMB

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoangdat I think it's a good solution in case there is no upload size limit in the config, low connection etc. It prevents having a blank space. you have the final word

@imGok
Copy link
Contributor Author

imGok commented Jun 20, 2023

@hoangdat I didn't manage to find a solution with VROUTER library. I removed an useless listening stream since it's an action. The interactor stream is being listened when the user creates a room then every listeners are unsubscribed after done event.

When the "done" event is fired, subscribers are unsubscribed before receiving the event. After the event has been sent, the stream has no subscribers. Adding new subscribers to a broadcast stream after this point is allowed, but they will just receive a new "done" event as soon as possible.

dondone

Comment on lines 30 to 31
final Stream<Either<Failure, Success>> setRoomAvatarStream = setRoomAvatarInteractor.execute(matrixClient, roomId, newRoomInformations.avatar);
yield* setRoomAvatarStream;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final Stream<Either<Failure, Success>> setRoomAvatarStream = setRoomAvatarInteractor.execute(matrixClient, roomId, newRoomInformations.avatar);
yield* setRoomAvatarStream;
yield* setRoomAvatarInteractor.execute(matrixClient, roomId, newRoomInformations.avatar);

),
FutureBuilder<ServerConfig>(
future: Matrix.of(context).client.getConfig(),
builder: (context, snapshot) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it any blink blink effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
The value switches from 5 to 100 to wait for data. I can put a loading indicator instead if_ you want

assets/l10n/intl_en.arb Outdated Show resolved Hide resolved

final selectedContactsMapNotifier = ValueNotifier<Map<PresentationContact, bool>>({});
final haveSelectedContactsNotifier = ValueNotifier(false);
final haveGroupNameNotifier = ValueNotifier(false);
final isEnableEEEncryptionNotifier = ValueNotifier(true);
final avatarNotifier = ValueNotifier<MatrixFile?>(null);

final int maxFileSizeDefault = 5 * 1024 * 1024;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove it?

@dab246
Copy link
Member

dab246 commented Jun 21, 2023

Demo

Screen.Recording.2023-06-21.at.12.46.00.mov

@imGok
Copy link
Contributor Author

imGok commented Jun 21, 2023

Thank you for the help @dab246 !

The main point of this feature is to be redirected right after clicking creating the room.
Scenario should be like this :
Click : Redirection to new room and meanwhile creating / settings new avatar.

That's why we can't cancel the stream until set avatar is finished.

But if @hoangdat changed his idea about the UX, we can use your commit

(You can see the intended UX on GIF description)

@hoangdat
Copy link
Member

I will close this PR, but still keep it to make some reference. I explain more information in the ticket #136

@hoangdat hoangdat closed this Jul 11, 2023
@hoangdat hoangdat deleted the tw_136_create_grp_photo branch August 8, 2023 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants