Skip to content

Commit

Permalink
refactor!: [MOBC-701] [MOBC-702] combine deriv_auth_ui with deriv_aut…
Browse files Browse the repository at this point in the history
…h and remove deriv_auth_ui (#388)

* refactor: combine deriv_auth_ui with deriv_auth

* chore: fix patrol finder version

* chore: add exports for layouts

* refactor!: remove deriv auth ui

* chore: remove deriv_auth_ui from README.md

* chore: add setting page to example
  • Loading branch information
ahrar-deriv authored Jan 8, 2024
1 parent 725cf08 commit 853bcbf
Show file tree
Hide file tree
Showing 188 changed files with 296 additions and 812 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ deriv_ui:
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [analytics](./packages/analytics) | Used to collect and send analytical information to 'Firebase' and 'Segment'. | [v1.0.2](./packages/analytics/CHANGELOG.md) |
| [deriv_auth](./packages/deriv_auth) | A Dart package that provides Authentication logic for Deriv applications. | [v1.2.1 ](./packages/deriv_auth/CHANGELOG.md) |
| [deriv_auth_ui](./packages/deriv_auth_ui) | A Dart package that provides Authentication UI for Deriv applications. | [v0.0.3+1](./packages/deriv_auth_ui/CHANGELOG.md) |
| [deriv_banner](./packages/deriv_banner) | A widget to show banner in apps. | [v0.0.1](./packages/deriv_banner/CHANGELOG.md) |
| [flutter_deriv_bloc_manager](./packages/deriv_bloc_manager) | Provides some tools to manage blocs. | [v0.0.1](./packages/flutter_deriv_bloc_manager/CHANGELOG.md) |
| [deriv_bloc_manager](./packages/deriv_bloc_manager) | Provides some tools to manage blocs. | [v0.0.1](./packages/deriv_bloc_manager/CHANGELOG.md) |
| [deriv_datadog](./packages/deriv_datadog) | A package that helps you monitor the performance and user interactions of your Flutter app by sending data to Datadog. | [v0.0.1](./packages/deriv_datadog/CHANGELOG.md) |
| [deriv_date_range_picker](./packages/deriv_date_range_picker) | Provides a widget that allows users to select a date range either by calendar mode or input mode. | [v0.0.1+2](./packages/deriv_date_range_picker/CHANGELOG.md) |
| [deriv_dependency_injector](./packages/deriv_dependency_injector) | A package for handling dependency injection in Dart. | [v1.0.2](./packages/deriv_dependency_injector/CHANGELOG.md) |
Expand Down
30 changes: 30 additions & 0 deletions packages/deriv_auth/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,33 @@ build/
# Omit committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock

# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/core/states/states.dart';
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:flutter/material.dart';

final class ExampleAuthErrorStateHandler extends AuthErrorStateHandler {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/get_started/models/deriv_get_started_slide_model.dart';
import 'package:deriv_auth/features/get_started/presentation/layouts/deriv_get_started_layout.dart';
import 'package:example/features/login/pages/login_page.dart';
import 'package:example/features/settings/pages/settings_page.dart';
import 'package:example/features/signup/pages/signup_page.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/features/auth/cubit/deriv_auth_cubit.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/login/presentation/layouts/deriv_login_layout.dart';
import 'package:example/core/example_auth_error_state_handler.dart';
import 'package:example/features/home/pages/home_page.dart';
import 'package:example/features/reset_pass/pages/reset_pass_page.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/features/reset_password/cubit/reset_password_cubit.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/reset_password/presentation/layouts/deriv_choose_new_pass_layout.dart';
import 'package:example/features/reset_pass/pages/reset_pass_success_page.dart';
import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';

import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/reset_password/presentation/layouts/deriv_reset_pass_layout.dart';
import 'package:example/features/reset_pass/pages/choose_new_password_page.dart';
import 'package:example/features/reset_pass/services/example_reset_pass_service.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/reset_password/presentation/layouts/deriv_success_pass_change_layout.dart';
import 'package:example/features/get_started/pages/get_started_page.dart';
import 'package:example/features/login/pages/login_page.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:developer' as logger;
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/deriv_auth.dart';
import 'package:flutter/material.dart';

class SettingsPage extends StatefulWidget {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/signup/models/deriv_residence_model.dart';
import 'package:deriv_auth/features/signup/presentation/layouts/deriv_country_selection_layout.dart';
import 'package:example/features/signup/pages/set_password_page.dart';
import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/signup/presentation/layouts/deriv_set_password_layout.dart';
import 'package:example/core/example_auth_error_state_handler.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/signup/presentation/layouts/deriv_signup_layout.dart';
import 'package:example/core/example_auth_error_state_handler.dart';
import 'package:example/features/login/pages/login_page.dart';
import 'package:example/features/signup/pages/verify_email_page.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/signup/presentation/layouts/deriv_verification_done_layout.dart';
import 'package:example/features/signup/pages/country_selection_page.dart';
import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth/features/signup/presentation/layouts/deriv_email_not_received_layout.dart';
import 'package:deriv_auth/features/signup/presentation/layouts/deriv_verify_email_layout.dart';
import 'package:example/features/signup/pages/verification_done_page.dart';
import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/generated/l10n.dart';
import 'package:deriv_auth/generated/l10n.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:example/features/get_started/pages/get_started_page.dart';
import 'package:example/features/login/repositories/example_login_repository.dart';
Expand Down Expand Up @@ -39,7 +39,7 @@ class MyApp extends StatelessWidget {
initialTheme: ThemeMode.dark,
builder: (context) => MaterialApp(
theme: context.themeData,
localizationsDelegates: const [DerivAuthUILocalization.delegate],
localizationsDelegates: const [DerivAuthLocalization.delegate],
home: const GetStartedPage(),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
deriv_auth_ui:
deriv_auth:
path: ../
flutter_bloc: ^8.1.3
http: ^0.13.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:deriv_auth_ui/generated/l10n.dart';
import 'package:deriv_auth/generated/l10n.dart';
import 'package:flutter/material.dart';

/// Extension methods for [BuildContext].
extension ContextExtension on BuildContext {
/// Gets [DerivAuthUILocalization].
DerivAuthUILocalization get localization => DerivAuthUILocalization.of(this);
DerivAuthLocalization get localization => DerivAuthLocalization.of(this);
}
1 change: 1 addition & 0 deletions packages/deriv_auth/lib/core/extensions/extensions.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export 'account_extensions.dart';
export 'authorize_extensions.dart';
export 'string_extensions.dart';
export 'context_extension.dart';
15 changes: 15 additions & 0 deletions packages/deriv_auth/lib/core/extensions/string_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:deriv_ui/utils/regex_helpers.dart';

/// String extensions.
extension StringExtension on String {
/// Returns all contents between first XML [tag].
Expand All @@ -10,3 +12,16 @@ extension StringExtension on String {
(Match match) => '_${match[0]}',
).toLowerCase();
}

/// Extension methods for input validation on [String] using regex.
extension RegexExtension on String {
/// Indicates whether the input is a valid email.
bool get isValidEmail => validEmailRegex.hasMatch(this);

/// Apart from signup (8-char password), login should support 6-char password as there will be legacy accounts having 6 chars.
bool get isValidLoginPasswordLength =>
validLoginPasswordLengthRegex.hasMatch(this);

/// Signup valid Password Regex.
bool get isValidSignupPassword => validPasswordRegex.hasMatch(this);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth/core/extensions/extensions.dart';
import 'package:flutter/material.dart';

/// Returns `true` if the country is not in the [notAllowedCountryCodes] set,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth_ui/src/core/helpers/assets.dart';
import 'package:deriv_auth/core/extensions/extensions.dart';
import 'package:deriv_auth/core/helpers/assets.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:deriv_ui/models/custom_icon_data_model.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/core/states/states.dart';
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';

/// Maps the [DerivAuthErrorState] to the corresponding [AuthErrorStateHandler].
void authErrorStateMapper({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth/core/states/states.dart';
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

Expand Down
20 changes: 20 additions & 0 deletions packages/deriv_auth/lib/deriv_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,23 @@ export 'features/signup/models/signup_error_type.dart';
export 'features/signup/repository/base_signup_repository.dart';
export 'features/signup/services/deriv_signup_service.dart';
export 'features/social_auth/social_auth.dart';
export 'core/layouts/deriv_unavailable_country_layout.dart';
export 'features/get_started/presentation/layouts/deriv_get_started_layout.dart';
export 'features/get_started/models/deriv_get_started_slide_model.dart';
export 'features/login/presentation/layouts/deriv_2fa_layout.dart';
export 'features/login/presentation/layouts/deriv_login_layout.dart';
export 'features/reset_password/presentation/layouts/deriv_choose_new_pass_layout.dart';
export 'features/reset_password/presentation/layouts/deriv_reset_pass_layout.dart';
export 'features/reset_password/presentation/layouts/deriv_success_pass_change_layout.dart';
export 'features/setting_page/presentation/layouts/deriv_setting_layout.dart';
export 'features/signup/cubit/deriv_country_selection_cubit.dart';
export 'features/signup/presentation/layouts/deriv_country_selection_layout.dart';
export 'features/signup/presentation/layouts/deriv_email_not_received_layout.dart';
export 'features/signup/presentation/layouts/deriv_set_password_layout.dart';
export 'features/signup/presentation/layouts/deriv_signup_layout.dart';
export 'features/signup/presentation/layouts/deriv_verification_done_layout.dart';
export 'features/signup/presentation/layouts/deriv_verify_email_layout.dart';
export 'features/signup/models/deriv_auth_utm_model.dart';
export 'features/signup/models/deriv_password_policy_model.dart';
export 'features/signup/models/deriv_residence_model.dart';
export 'core/states/states.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import 'dart:async';
import 'dart:math' as math;

import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth_ui/src/core/helpers/semantic_labels.dart';
import 'package:deriv_auth_ui/src/features/get_started/models/deriv_get_started_slide_model.dart';
import 'package:deriv_auth/core/extensions/context_extension.dart';
import 'package:deriv_auth/core/helpers/semantic_labels.dart';
import 'package:deriv_auth/features/get_started/models/deriv_get_started_slide_model.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth_ui/src/core/helpers/assets.dart';
import 'package:deriv_auth/core/helpers/assets.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'dart:async';

import 'package:deriv_auth/core/helpers/semantic_labels.dart';
import 'package:deriv_auth/core/states/auth_error_state_handler.dart';
import 'package:deriv_auth/core/states/auth_error_state_mapper.dart';
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/deriv_auth_ui.dart';
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth_ui/src/core/extensions/string_extension.dart';
import 'package:deriv_auth_ui/src/core/helpers/semantic_labels.dart';
import 'package:deriv_auth_ui/src/features/login/widgets/deriv_social_auth_divider.dart';
import 'package:deriv_auth_ui/src/features/login/widgets/deriv_social_auth_panel.dart';
import 'package:deriv_auth/features/login/presentation/widgets/deriv_social_auth_divider.dart';
import 'package:deriv_auth/features/login/presentation/widgets/deriv_social_auth_panel.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DerivSocialAuthPanel extends StatelessWidget {
opacity: getOpacity(isEnabled: isEnabled),
child: SvgPicture.asset(
_getSocialMediaIcon(socialAuthProvider),
package: 'deriv_auth_ui',
package: 'deriv_auth',
),
),
onPressed: isEnabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'dart:async';

import 'package:deriv_auth/core/helpers/assets.dart';
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth_ui/src/core/extensions/string_extension.dart';
import 'package:deriv_auth_ui/src/core/helpers/assets.dart';
import 'package:deriv_auth_ui/src/features/signup/widgets/password_policy_checker_widget.dart';
import 'package:deriv_auth/features/signup/presentation/widgets/password_policy_checker_widget.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -98,7 +95,7 @@ class _DerivChooseNewPassLayoutState extends State<DerivChooseNewPassLayout> {
Center(
child: SvgPicture.asset(
Assets.chooseNewPassIcon,
package: 'deriv_auth_ui',
package: 'deriv_auth',
width: ThemeProvider.iconSize96,
height: ThemeProvider.iconSize32,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import 'dart:async';

import 'package:deriv_auth/core/helpers/assets.dart';
import 'package:deriv_auth/core/helpers/semantic_labels.dart';
import 'package:deriv_auth/deriv_auth.dart';
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth_ui/src/core/extensions/string_extension.dart';
import 'package:deriv_auth_ui/src/core/helpers/assets.dart';
import 'package:deriv_auth_ui/src/core/helpers/semantic_labels.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -82,7 +80,7 @@ class _DerivResetPassLayoutState extends State<DerivResetPassLayout> {
Assets.mailIcon,
width: ThemeProvider.iconSize96,
height: ThemeProvider.iconSize96,
package: 'deriv_auth_ui',
package: 'deriv_auth',
),
const SizedBox(height: ThemeProvider.margin24),
Text(
Expand Down Expand Up @@ -116,7 +114,7 @@ class _DerivResetPassLayoutState extends State<DerivResetPassLayout> {
Assets.resetPassIcon,
width: ThemeProvider.iconSize96,
height: ThemeProvider.iconSize96,
package: 'deriv_auth_ui',
package: 'deriv_auth',
),
const SizedBox(height: ThemeProvider.margin16),
Text(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth/core/extensions/context_extension.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/presentation/widgets/loading_indicator.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deriv_auth_ui/src/core/extensions/context_extension.dart';
import 'package:deriv_auth_ui/src/core/helpers/endpoint_helper.dart';
import 'package:deriv_auth/core/extensions/context_extension.dart';
import 'package:deriv_auth/core/helpers/endpoint_helper.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/utils/regex_helpers.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:deriv_auth_ui/src/core/helpers/country_selection_helper.dart';
import 'package:deriv_auth/core/helpers/country_selection_helper.dart';
import 'package:deriv_auth/features/signup/models/deriv_residence_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:deriv_auth_ui/src/features/signup/models/deriv_residence_model.dart';

part 'deriv_country_selection_state.dart';

Expand Down
Loading

0 comments on commit 853bcbf

Please sign in to comment.