-
Notifications
You must be signed in to change notification settings - Fork 0
Refatrcor auth hints for demo envirement #24
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0842fbc
feat(authentication): display demo email hint in demo env
fulleni fd24eb7
feat(authentication): update demo code hint for consistency
fulleni 2947b27
feat(l10n): add english localization for demo auth hints
fulleni 2f85ee2
feat(l10n): add arabic localization for demo auth hints
fulleni 9995880
feat(l10n): add demo email and code hints for localization
fulleni af2aa48
feat(authentication): use localized strings for demo hints
fulleni ec8d5a7
fix(app): ensure environment is set in initial AppState
fulleni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:ht_dashboard/app/bloc/app_bloc.dart'; | ||
import 'package:ht_dashboard/app/config/config.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:ht_dashboard/authentication/bloc/authentication_bloc.dart'; | ||
import 'package:ht_dashboard/l10n/l10n.dart'; | ||
|
@@ -129,6 +131,26 @@ class _RequestCodeView extends StatelessWidget { | |
), | ||
textAlign: TextAlign.center, | ||
), | ||
// Display demo email if in demo environment | ||
BlocSelector<AppBloc, AppState, AppEnvironment?>( | ||
selector: (state) => state.environment, | ||
builder: (context, environment) { | ||
if (environment == AppEnvironment.demo) { | ||
return Padding( | ||
padding: const EdgeInsets.only(top: AppSpacing.lg), | ||
child: Text( | ||
l10n.demoEmailHint('[email protected]'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The demo email |
||
style: textTheme.bodyMedium?.copyWith( | ||
color: colorScheme.secondary, | ||
fontWeight: FontWeight.bold, | ||
), | ||
textAlign: TextAlign.center, | ||
), | ||
); | ||
} | ||
return const SizedBox.shrink(); | ||
}, | ||
), | ||
const SizedBox(height: AppSpacing.xxl), | ||
_EmailLinkForm(isLoading: isLoading), | ||
], | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -893,5 +893,25 @@ | |
"appStatusDisabled": "معطل", | ||
"@appStatusDisabled": { | ||
"description": "نص حالة التطبيق 'معطل'" | ||
}, | ||
"demoEmailHint": "للعرض التجريبي، استخدم البريد الإلكتروني: {email}", | ||
"@demoEmailHint": { | ||
"description": "Hint text shown in demo environment for the login email.", | ||
"placeholders": { | ||
"email": { | ||
"type": "String", | ||
"example": "[email protected]" | ||
} | ||
} | ||
}, | ||
"demoCodeHint": "للعرض التجريبي، استخدم الرمز: {code}", | ||
"@demoCodeHint": { | ||
"description": "Hint text shown in demo environment for the verification code.", | ||
"placeholders": { | ||
"code": { | ||
"type": "String", | ||
"example": "123456" | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -893,5 +893,26 @@ | |
"appStatusDisabled": "Disabled", | ||
"@appStatusDisabled": { | ||
"description": "Text for the 'Disabled' app status" | ||
}, | ||
"demoEmailHint": "For demo, use email: {email}", | ||
"@demoEmailHint": { | ||
"description": "Hint text shown in demo environment for the login email.", | ||
"placeholders": { | ||
"email": { | ||
"type": "String", | ||
"example": "[email protected]" | ||
} | ||
} | ||
}, | ||
"demoCodeHint": "For demo, use code: {code}", | ||
"@demoCodeHint": { | ||
"description": "Hint text shown in demo environment for the verification code.", | ||
"placeholders": { | ||
"code": { | ||
"type": "String", | ||
"example": "123456" | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refactoring appears to be incomplete. The hint for the demo verification code should only be displayed in the demo environment.
There are two issues here:
kDebugMode
(which is outside the diff but can be inferred from similar code), but it should be conditional onstate.environment == AppEnvironment.demo
. Please use aBlocSelector
to check the environment, similar to the implementation inrequest_code_page.dart
. This will fix the bug where the hint is shown in non-demo debug builds and hidden in release demo builds.'123456'
is hardcoded. For better maintainability, consider moving this value intoAppConfig
.