Skip to content

Commit

Permalink
feat: [MOBC-608] auth ui setting page (#320)
Browse files Browse the repository at this point in the history
* feat: setting page

* fix: depricated issues

* fix: change package_info_plus to match packages

* fix: future void callback

* refactor: move regex_helper func to deriv_ui

* fix: remove sahani repo from yaml files

* fix: deriv_auth_ui pubspec

* fix: remove appEnv related to deriv ez

as deriv ez is removed from production we dont need to include it in this package anymore

* fix: revert back the appEnv and change the comment
  • Loading branch information
ahrar-deriv authored Nov 21, 2023
1 parent b2c282e commit ce8d202
Show file tree
Hide file tree
Showing 9 changed files with 345 additions and 8 deletions.
6 changes: 4 additions & 2 deletions packages/deriv_auth_ui/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2

deriv_auth_ui:
path: ../

deriv_auth:
git:
url: [email protected]:sahani-deriv/flutter-deriv-packages.git
url: [email protected]:regentmarkets/flutter-deriv-packages.git
path: packages/deriv_auth
ref: auth-ui-update
ref: dev

deriv_theme:
git:
Expand Down
1 change: 1 addition & 0 deletions packages/deriv_auth_ui/lib/deriv_auth_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export 'src/features/login/layouts/deriv_login_layout.dart';
export 'src/features/reset_pass/layouts/deriv_choose_new_pass_layout.dart';
export 'src/features/reset_pass/layouts/deriv_reset_pass_layout.dart';
export 'src/features/reset_pass/layouts/deriv_success_pass_change_layout.dart';
export 'src/features/setting_page/layouts/deriv_setting_layout.dart';
export 'src/features/signup/cubits/deriv_country_selection_cubit.dart';
export 'src/features/signup/layouts/deriv_country_selection_layout.dart';
export 'src/features/signup/layouts/deriv_email_not_received_layout.dart';
Expand Down
11 changes: 11 additions & 0 deletions packages/deriv_auth_ui/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class MessageLookup extends MessageLookupByLibrary {
"informVerificationEmailSent": m1,
"informYourPassHasBeenReset": MessageLookupByLibrary.simpleMessage(
"Your password has been reset"),
"labelApplicationID":
MessageLookupByLibrary.simpleMessage("Application ID"),
"labelCheckEmail":
MessageLookupByLibrary.simpleMessage("Check your email"),
"labelChooseCountry":
Expand All @@ -122,6 +124,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Create a password"),
"labelCreatePassword":
MessageLookupByLibrary.simpleMessage("Create a password"),
"labelDeveloper": MessageLookupByLibrary.simpleMessage("Developer"),
"labelDontHaveAnAccountYet":
MessageLookupByLibrary.simpleMessage("Don’t have an account yet?"),
"labelEmail": MessageLookupByLibrary.simpleMessage("Email"),
Expand All @@ -135,6 +138,7 @@ class MessageLookup extends MessageLookupByLibrary {
"The email address you entered had a mistake or typo (happens to the best of us)."),
"labelEmailIssueWrongEmail": MessageLookupByLibrary.simpleMessage(
"You accidentally gave us another email address (Usually a work or a personal one instead of the one you meant)."),
"labelEndpoint": MessageLookupByLibrary.simpleMessage("Endpoint"),
"labelGotReferralCode":
MessageLookupByLibrary.simpleMessage("Got a referral code?"),
"labelHaveAccount":
Expand Down Expand Up @@ -167,8 +171,15 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("2FA code"),
"labelVerifyYourEmail":
MessageLookupByLibrary.simpleMessage("Verify your email"),
"semanticApplicationID":
MessageLookupByLibrary.simpleMessage("Application ID"),
"semanticEndpoint": MessageLookupByLibrary.simpleMessage("Endpoint"),
"warnCountryNotAvailable": MessageLookupByLibrary.simpleMessage(
"Unfortunately, Deriv is not available in your country."),
"warnInvalidApplicationID":
MessageLookupByLibrary.simpleMessage("invalid application ID"),
"warnInvalidEndpoint":
MessageLookupByLibrary.simpleMessage("invalid endpoint"),
"warnNotAvailableCountries": MessageLookupByLibrary.simpleMessage(
"If you have any questions, contact us via "),
"warnNotAvailableCountriesTitle": m2,
Expand Down
70 changes: 70 additions & 0 deletions packages/deriv_auth_ui/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion packages/deriv_auth_ui/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,12 @@
"informExpiredAccount": "Your account is expired",
"labelCountryConsentBrazil": "I hereby confirm that my request for opening an account with Deriv to trade OTC products issued and offered exclusively outside Brazil was initiated by me. I fully understand that Deriv is not regulated by CVM and by approaching Deriv I intend to set up a relation with a foreign company.",
"informConnectionError": "Connection error. Please try again later.",
"informSwitchAccountError": "Switch account error. Please try again later."
"informSwitchAccountError": "Switch account error. Please try again later.",
"labelDeveloper": "Developer",
"labelEndpoint": "Endpoint",
"semanticEndpoint": "Endpoint",
"warnInvalidEndpoint": "invalid endpoint",
"labelApplicationID": "Application ID",
"semanticApplicationID": "Application ID",
"warnInvalidApplicationID": "invalid application ID"
}
36 changes: 36 additions & 0 deletions packages/deriv_auth_ui/lib/src/core/helpers/endpoint_helper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// Default auth endpoint.
const String defaultAuthEndpoint = 'oauth.deriv.com';

/// Default ws endpoint.
const String defaultEndpoint = 'blue.binaryws.com';

/// Default app id.
const String defaultAppId = '23789';

/// Parses an [endpoint] argument and generates a url that points to QA servers
/// if [endpoint] starts with `qa` or a url that points to production servers if
/// [endpoint] contains `derivws` or `binaryws` and [isAuthUrl] is `true`.
///
/// [endpoint] argument is required.
/// [isAuthUrl] is optional and has a default value of `false`.
String? generateEndpointUrl({
required String? endpoint,
bool isAuthUrl = false,
}) {
if (endpoint == null) {
return null;
}

final RegExp qaRegExp = RegExp('^(qa[0-9]+)\$', caseSensitive: false);
final RegExp derivRegExp =
RegExp('(binary|deriv)ws\.(com|app)\$', caseSensitive: false);

if (isAuthUrl && derivRegExp.hasMatch(endpoint)) {
// Since Deriv app is under Deriv.app, the oauth url should be always `oauth.deriv.com`.
return defaultAuthEndpoint;
} else if (qaRegExp.hasMatch(endpoint)) {
return '$endpoint.deriv.dev';
}

return endpoint;
}
Loading

0 comments on commit ce8d202

Please sign in to comment.