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

Generosity challenge chat is integrated with the challenge itself #717

Merged
merged 10 commits into from
May 7, 2024

Conversation

pavelpavelko
Copy link
Contributor

Description

  • day chat status moved to higher level and integrated with the generosity challenge
  • navigation is implemented for the challenge pages
  • chat icon with red dot indication is implemented (kids-871)
  • half-hidden "close" button is added to the chat page - it clears challenge progress and chat (for testing)

@pavelpavelko pavelpavelko requested a review from a team as a code owner May 7, 2024 08:00
@github-actions github-actions bot added the enhancement New feature or request label May 7, 2024
final challengeCubit = state.extra! as GenerosityChallengeCubit;
return BlocProvider.value(
value: challengeCubit,
child: const GenerosityChallengeIntorduction(),
Copy link
Contributor

Choose a reason for hiding this comment

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

interoduction => introduction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -28,6 +48,7 @@ class GenerosityChallengeCubit extends Cubit<GenerosityChallengeState> {
);

void dayDetails(int dayIndex) => emit(
//maybe here i need logic
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer if you'd elaborate the comment or if you make a ticket in Linear and then add a TODO, like:

// TODO KIDS-999 title

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that is not mine, but I'll delete 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.

deleted

@@ -1,29 +1,52 @@
import 'package:equatable/equatable.dart';
import 'package:givt_app/features/children/generosity_challenge/models/enums/day_chat_status.dart';
import 'package:givt_app/features/children/generosity_challenge_chat/chat_scripts/models/chat_script_item.dart';

class Day extends Equatable {
const Day({
required this.dateCompleted,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why we're not using nullable for dateCompleted? I see in several places in the code that an empty string is assigned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

afaik we don't have clear rules here,
however my personal prefs is to avoid nullable when possible)

final showBackButton = context
.read<GenerosityChallengeCubit>()
.state
.availableChatDayIndex !=
Copy link
Contributor

Choose a reason for hiding this comment

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

So I can understand this PR better, "availableChatDayIndex" refers to the "latest" available day (so not the current active index or anything else)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

availableChatDayIndex actually it refers to the first non completed chat. There could be cases when active day index is not the same as active day chat index (for ex user still needs to pass through post chat of day 1, but the day 2 already available)

Comment on lines 135 to 139
builder: (context, state) {
final challengeCubit = state.extra! as GenerosityChallengeCubit;
return BlocProvider.value(
value: challengeCubit,
child: const GenerosityChallengeIntorduction(),
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need for a BlocProvider here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we do need it, since we use it inside the introduction page here:
context.goNamed( Pages.generosityChallengeChat.name, extra: context.read<GenerosityChallengeCubit>(), );

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah that's tricky, because the redirection to this page happens within _redirectFromExternalLink and we are not providing GenerosityChallengeCubit through there state.extra is null and i get a red exception screen when i get to this page currently. Funny enough when i removed the GenerosityChallengeCubit provider everything still worked as expected in the chat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed based on talk with Daniela

Comment on lines 870 to 873
if (navigatingPage == Pages.generosityChallenge.path &&
!GenerosityChallengeHelper.isActivated) {
return Pages.generosityChallengeIntroduction.path;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

because this is now a subroute it needs to be '${Pages.generosityChallenge.path}/${Pages.generosityChallengeIntroduction.path}'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

according to the tests, subroutes are working with just a subroute part

Copy link
Contributor

Choose a reason for hiding this comment

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

i am not getting correctly redirected using the current code:
simulator_screenshot_7324FCEF-8A32-4758-B4D5-FB06B9221570
if i update using the whole path then i do get to the correct page

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ohh, let me fix it then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

I think using only the subroute works when redirecting by name, but this is using the path so it needs to be full 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed based on talk with Daniela: show intro from challenge itself, instead of redirection

extra: context.read<GenerosityChallengeCubit>(),
);
},
icon: const Icon(FontAwesomeIcons.solidComments),
Copy link
Contributor

Choose a reason for hiding this comment

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

tiny thing but the icon color should be AppTheme.givtGreen40, to match the color of the text in the appbar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -855,10 +867,6 @@ class AppRouter {
return Pages.generosityChallenge.path;
Copy link
Contributor

Choose a reason for hiding this comment

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

if (GenerosityChallengeHelper.isActivated || navigatingPage == Pages.generosityChallenge.path) - it's important for when users launch the app from link

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@pavelpavelko pavelpavelko merged commit c340d94 into develop May 7, 2024
1 check passed
@pavelpavelko pavelpavelko deleted the feature/kids-877-save-user-data branch May 7, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants