Skip to content

Commit

Permalink
Merge branch 'master' into updating_deriv_localizations_for_passkeys_…
Browse files Browse the repository at this point in the history
…package
  • Loading branch information
abedelaziz-deriv authored May 17, 2024
2 parents 5e479cd + 54770b7 commit 037fbe7
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 44 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2024-05-15

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`deriv_auth` - `v6.5.0`](#deriv_auth---v650)

---

#### `deriv_auth` - `v6.5.0`

- **FEAT**(deriv_auth): Add language selector in auth package ([#576](https://github.com/regentmarkets/flutter-deriv-packages/issues/576)). ([cd3768ef](https://github.com/regentmarkets/flutter-deriv-packages/commit/cd3768ef2b6bd7420e7957277461e95e78eee545))


## 2024-05-07

### Changes
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ This repository contains private packages & plugins that are used by the company

## Using the packages

Each package has been released as git tag with convention as **packageName-vVersionNumber**`(Example: deriv_auth-v6.4.2)`. To use the package, add the following to your pubspec.yaml file:
Each package has been released as git tag with convention as **packageName-vVersionNumber**`(Example: deriv_auth-v6.5.0)`. To use the package, add the following to your pubspec.yaml file:


```yaml
deriv_ui:
git:
url: [email protected]:regentmarkets/flutter-deriv-packages.git
path: packages/deriv_ui
ref: deriv_ui-v0.0.7+3 #your prefered version
ref: deriv_ui-v0.0.7+4 #your prefered version
```
## Packages
| Name | Description | Version |
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [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. | [v6.4.2 ](./packages/deriv_auth/CHANGELOG.md) |
| [analytics](./packages/analytics) | Used to collect and send analytical information to 'Firebase' and 'Segment'. | [v1.0.4](./packages/analytics/CHANGELOG.md) |
| [deriv_auth](./packages/deriv_auth) | A Dart package that provides Authentication logic for Deriv applications. | [v6.5.0 ](./packages/deriv_auth/CHANGELOG.md) |
| [deriv_banner](./packages/deriv_banner) | A widget to show banner in apps. | [v0.0.1+1](./packages/deriv_banner/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) |
Expand All @@ -31,18 +31,18 @@ deriv_ui:
| [deriv_http_client](./packages/deriv_http_client) | A package that provides a wrapper for http package. | [v2.0.0](./packages/deriv_http_client/CHANGELOG.md) |
| [deriv_lint](./packages/deriv_lint) | A Dart package that provides lint rules for Dart and Flutter. | [v1.0.0](./packages/deriv_lint/CHANGELOG.md) |
| [deriv_live_chat](./packages/deriv_live_chat) | A plugin for live chat SDK support to dart. | [v0.0.1+1](./packages/deriv_live_chat/CHANGELOG.md) |
| [deriv_language_selector](./packages/deriv_language_selector) | A package to handle language change of the app. | [v0.0.2+1](./packages/deriv_language_selector/CHANGELOG.md) |
| [deriv_localizations](./packages/deriv_localizations) | A Package that contains the localization arb(coming from Crowdin) and dart generated files for flutter_deriv_packages. | [v1.1.1](./packages/deriv_localizations/CHANGELOG.md) | | [v1.3.0](./packages/deriv_localizations/CHANGELOG.md) |
| [deriv_language_selector](./packages/deriv_language_selector) | A package to handle language change of the app. | [v0.0.2+2](./packages/deriv_language_selector/CHANGELOG.md) |
| [deriv_localizations](./packages/deriv_localizations) | A Package that contains the localization arb(coming from Crowdin) and dart generated files for flutter_deriv_packages. | [v1.1.1](./packages/deriv_localizations/CHANGELOG.md) | | [v1.3.1](./packages/deriv_localizations/CHANGELOG.md) |
| [deriv_numpad](./packages/deriv_numpad) | Number Pad Widget for number input. | [v1.1.3](./packages/deriv_numpad/CHANGELOG.md) |
| [deriv_rudderstack](./packages/deriv_rudderstack) | A plugin that add RudderStack SDK support to Flutter. | [v1.1.0](./packages/deriv_rudderstack/CHANGELOG.md) |
| [deriv_store_launcher](./packages/deriv_store_launcher) | A plugin to launch app stores base on platform and manufacturer. | [v0.0.1+1](./packages/deriv_store_launcher/CHANGELOG.md) |
| [deriv_technical_analysis](./packages/deriv_technical_analysis) | A Dart package for Technical Analysis. | [v0.0.1](./packages/deriv_technical_analysis/CHANGELOG.md) |
| [deriv_theme](./packages/deriv_theme) | A package that contains the theme used by Deriv products. | [v2.4.0](./packages/deriv_theme/CHANGELOG.md) |
| [deriv_ui](./packages/deriv_ui) | A package that contains the UI components used by Deriv products. | [v0.0.7+3](./packages/deriv_ui/CHANGELOG.md) |
| [deriv_ui](./packages/deriv_ui) | A package that contains the UI components used by Deriv products. | [v0.0.7+4](./packages/deriv_ui/CHANGELOG.md) |
| [deriv_utilities](./packages/deriv_utilities) | A package that contains the utilities including helper functions, mixins, and extensions. | [v1.0.0](./packages/deriv_utilities/CHANGELOG.md) |
| [deriv_websocket](./packages/deriv_web_socket_client) | A package that provides a easy to use websocket client. | [v1.0.1](./packages/deriv_web_socket_client/CHANGELOG.md) |
| [deriv_web_view](./packages/deriv_web_view) | Deriv web view package. | [v0.2.2+1](./packages/deriv_web_view/CHANGELOG.md) |
| [deriv_widgetbook](./packages/deriv_widgetbook) |Storybook for Deriv UI Widgets and Components | [v0.0.2+3](./packages/deriv_widgetbook/CHANGELOG.md) |
| [deriv_widgetbook](./packages/deriv_widgetbook) |Storybook for Deriv UI Widgets and Components | [v0.0.2+4](./packages/deriv_widgetbook/CHANGELOG.md) |
| [form_builder](./packages/form_builder) | A simpler and cleaner way to create, validate and submit forms. | [v1.0.0+1](./packages/form_builder/CHANGELOG.md) |
| [update_checker](./packages/update_checker) | Check and retrieve update information from the server for the given package. | [v1.2.2](./packages/update_checker/CHANGELOG.md) |
| [deriv_feature_flag](./packages/deriv_feature_flag) | A package to provide feature flag functionality for apps. | [v0.1.0+1](./packages/deriv_feature_flag/CHANGELOG.md) |
Expand Down
4 changes: 4 additions & 0 deletions packages/deriv_auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.5.0

- **FEAT**(deriv_auth): Add language selector in auth package ([#576](https://github.com/regentmarkets/flutter-deriv-packages/issues/576)). ([cd3768ef](https://github.com/regentmarkets/flutter-deriv-packages/commit/cd3768ef2b6bd7420e7957277461e95e78eee545))

## 6.4.3

- Update a dependency to the latest release.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:math' as math;
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_language_selector/deriv_language_selector.dart';
import 'package:deriv_theme/deriv_theme.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -110,6 +111,17 @@ class _DerivGetStartedLayoutState extends State<DerivGetStartedLayout> {
title: AppSettingGestureDetector(
onTapNavigation: widget.onTapNavigation,
child: SvgPicture.asset(widget.appLogoIconPath)),
actions: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(
horizontal: ThemeProvider.margin16,
vertical: ThemeProvider.margin08,
),
child: LanguageSelector.button(
bottomsheetTitle: context.derivAuthLocalization.labelLanguage,
),
),
],
);

Timer _buildNewScrollTimer() => Timer.periodic(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:deriv_auth/features/auth/cubit/deriv_auth_cubit.dart';
import 'package:deriv_auth/features/reset_password/cubit/reset_password_cubit.dart';
import 'package:deriv_auth/features/signup/cubit/signup_cubit.dart';
import 'package:deriv_auth/features/social_auth/cubit/social_auth_cubit.dart';
import 'package:deriv_language_selector/deriv_language_selector.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

Expand All @@ -14,6 +15,7 @@ class AuthProvider extends StatelessWidget {
required this.socialAuthCubit,
required this.derivResetPassCubit,
required this.derivSignupCubit,
required this.languageCubit,
});

/// Child widget
Expand All @@ -31,6 +33,9 @@ class AuthProvider extends StatelessWidget {
/// Instance of Signup Cubit
final DerivSignupCubit derivSignupCubit;

/// Instance of language Cubit
final LanguageCubit languageCubit;

Widget build(BuildContext context) => MultiBlocProvider(
providers: [
BlocProvider<DerivAuthCubit>.value(
Expand All @@ -45,6 +50,9 @@ class AuthProvider extends StatelessWidget {
BlocProvider<DerivSignupCubit>.value(
value: derivSignupCubit,
),
BlocProvider<LanguageCubit>.value(
value: languageCubit,
),
],
child: widget,
);
Expand Down
8 changes: 7 additions & 1 deletion packages/deriv_auth/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: deriv_auth
description: Provides deriv authentication functionalities for dart/flutter apps.
version: 6.4.3
version: 6.5.0


environment:
Expand Down Expand Up @@ -48,6 +48,12 @@ dependencies:
path: packages/deriv_localizations
ref: deriv_localizations-v1.3.1

deriv_language_selector:
git:
url: [email protected]:regentmarkets/flutter-deriv-packages.git
path: packages/deriv_language_selector
ref: deriv_language_selector-v0.0.2+1

flutter_bloc: ^8.1.3
flutter_svg: ^2.0.7
smooth_page_indicator: ^1.1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// ignore_for_file: always_specify_types

import 'package:bloc_test/bloc_test.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:deriv_language_selector/deriv_language_selector.dart';
import 'package:deriv_localizations/l10n/generated/deriv_auth/deriv_auth_localizations.dart';
import 'package:deriv_localizations/l10n/generated/deriv_auth/deriv_auth_localizations_ar.dart';
import 'package:deriv_ui/deriv_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:patrol_finders/patrol_finders.dart';
Expand All @@ -13,50 +18,62 @@ import '../../../../pump_app.dart';
class MockDerivGetStartedSlideModel extends Mock
implements DerivGetStartedSlideModel {}

class MockLanguageCubit extends MockCubit<LanguageState>
implements LanguageCubit {}

void main() {
group('DerivGetStartedLayout', () {
late MockDerivGetStartedSlideModel mockSlideModel;

const String appLogoIconPath = 'assets/icons/ic_logo_extended.svg';
const String backgroundImagePath = 'assets/images/triangles.svg';

final MockLanguageCubit mockLanguageCubit = MockLanguageCubit();

setUpAll(() {
mockSlideModel = MockDerivGetStartedSlideModel();
when(() => mockSlideModel.imagePath)
.thenReturn('assets/images/charts.svg');
when(() => mockSlideModel.supportingText).thenReturn('Supporting text');
});

patrolWidgetTest('should render DerivGetStartedLayout',
(PatrolTester $) async {
await $.pumpApp(DerivGetStartedLayout(
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
onLoginTapped: () {},
onSignupTapped: () {},
));

expect($(DerivGetStartedLayout), findsOneWidget);
expect($(AppBar), findsOneWidget);
expect($(PrimaryButton), findsOneWidget);
expect($(SecondaryButton), findsOneWidget);
final LanguageModel languageModel = LanguageModel(
code: 'en',
flag: 'assets/icons/flags/ic_flag_en.png',
name: 'English',
);

when(() => mockLanguageCubit.state).thenReturn(
LanguageLoadedState(
activeLanguages: [
languageModel,
],
language: languageModel,
),
);
});

patrolWidgetTest('should call onLoginTapped when login button is pressed',
(PatrolTester $) async {
bool loginTapped = false;

await $.pumpApp(DerivGetStartedLayout(
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
onLoginTapped: () {
loginTapped = true;
},
onSignupTapped: () {},
await $.pumpApp(BlocProvider<LanguageCubit>(
create: (_) => mockLanguageCubit,
child: MaterialApp(
localizationsDelegates: const [DerivAuthLocalizations.delegate],
locale: const Locale('en'),
home: Scaffold(
body: DerivGetStartedLayout(
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
onLoginTapped: () {
loginTapped = true;
},
onSignupTapped: () {},
),
),
),
));

await $.tap($(SecondaryButton));
Expand All @@ -68,16 +85,27 @@ void main() {
(PatrolTester $) async {
bool signupTapped = false;

await $.pumpApp(DerivGetStartedLayout(
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
onLoginTapped: () {},
onSignupTapped: () {
signupTapped = true;
},
));
await $.pumpApp(
BlocProvider<LanguageCubit>(
create: (_) => mockLanguageCubit,
child: MaterialApp(
localizationsDelegates: const [DerivAuthLocalizations.delegate],
locale: const Locale('en'),
home: Scaffold(
body: DerivGetStartedLayout(
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
onLoginTapped: () {},
onSignupTapped: () {
signupTapped = true;
},
),
),
),
),
);

await $.tap($(PrimaryButton));

Expand Down

0 comments on commit 037fbe7

Please sign in to comment.