From fdf4df1979ddb8710dba8925ef779cca25d60615 Mon Sep 17 00:00:00 2001 From: sagar-deriv <146091240+sagar-deriv@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:54:22 +0400 Subject: [PATCH 1/2] refactor(deriv_ui): [DERG-3500] return inputted amount based on the formatter in numpad (#624) --- .../numpad/core/exchange_notifier.dart | 4 ++-- .../numpad/models/currency_detail.dart | 17 ++++++++++------- .../components/numpad/widgets/number_pad.dart | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/deriv_ui/lib/components/numpad/core/exchange_notifier.dart b/packages/deriv_ui/lib/components/numpad/core/exchange_notifier.dart index e823e458b..29decb525 100644 --- a/packages/deriv_ui/lib/components/numpad/core/exchange_notifier.dart +++ b/packages/deriv_ui/lib/components/numpad/core/exchange_notifier.dart @@ -118,9 +118,9 @@ class ExchangeController extends ChangeNotifier { /// what user send by default in primaryCurrency when coming to numpad.) double finalAmount() { if (_exchangeRate.baseCurrency == primaryCurrency.currencyType) { - return primaryCurrency.amount; + return primaryCurrency.formattedAmount; } else { - return secondaryCurrency.amount; + return secondaryCurrency.formattedAmount; } } } diff --git a/packages/deriv_ui/lib/components/numpad/models/currency_detail.dart b/packages/deriv_ui/lib/components/numpad/models/currency_detail.dart index 1cb784034..15f388a0d 100644 --- a/packages/deriv_ui/lib/components/numpad/models/currency_detail.dart +++ b/packages/deriv_ui/lib/components/numpad/models/currency_detail.dart @@ -20,7 +20,7 @@ class CurrencyDetail { ]; /// Available stable coin currency that Deriv supports. - static List stableCurrencies = [ + static List stableCryptoCurrencies = [ 'USDC', 'USDT', 'TUSDT', @@ -37,8 +37,11 @@ class CurrencyDetail { bool get isFiat => fiatCurrencies.contains(currencyType); /// This will check if the currency is stable coin currency(USDC,tUSDT,eUSDT) or not. - bool get isStableCurrency => - stableCurrencies.contains(currencyType.toUpperCase()); + bool get isStableCryptoCurrency => + stableCryptoCurrencies.contains(currencyType.toUpperCase()); + + /// This will give the formatted amount to do processing based on type of currency it is like fiat or crypto currency. + double get formattedAmount => double.parse(formatter.format(amount)); /// Amount that is used to display for user. String get displayAmount { @@ -46,17 +49,17 @@ class CurrencyDetail { return ''; } - return isFiat || isStableCurrency + return isFiat || isStableCryptoCurrency ? amount.toStringAsFixed(2) : amount.toStringAsFixed(8); } /// This will give a specific currency formatter based on what type of currency it is like fiat or crypto currency. NumberFormat get formatter { - if (isFiat || isStableCurrency) { - return NumberFormat.decimalPattern()..maximumFractionDigits = 2; + if (isFiat || isStableCryptoCurrency) { + return NumberFormat('#0.##', 'en_US'); } else { - return NumberFormat.decimalPattern()..maximumFractionDigits = 8; + return NumberFormat('#0.########', 'en_US'); } } diff --git a/packages/deriv_ui/lib/components/numpad/widgets/number_pad.dart b/packages/deriv_ui/lib/components/numpad/widgets/number_pad.dart index 5bbd15020..24472b652 100644 --- a/packages/deriv_ui/lib/components/numpad/widgets/number_pad.dart +++ b/packages/deriv_ui/lib/components/numpad/widgets/number_pad.dart @@ -661,7 +661,7 @@ class _NumpadWithExchange extends NumberPad { NumberPadCloseCallback? onClose, }) : super( numberPadType: NumberPadWidgetType.singleInput, - formatter: NumberFormat.decimalPattern()..maximumFractionDigits = 8, + formatter: primaryCurrency.formatter, label: label, firstInputTitle: title, onClose: onClose, From 5ac1e5285f66e388dcf44990c7ebf372d7a1cf03 Mon Sep 17 00:00:00 2001 From: mobile-apps-deriv <134251399+mobile-apps-deriv@users.noreply.github.com> Date: Tue, 25 Jun 2024 02:10:54 +0800 Subject: [PATCH 2/2] chore(version): bump version and update changelog (#632) Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: sagar-deriv --- CHANGELOG.md | 34 +++++++++++++++++++ README.md | 12 +++---- packages/deriv_auth/CHANGELOG.md | 4 +++ packages/deriv_auth/pubspec.yaml | 10 +++--- packages/deriv_language_selector/CHANGELOG.md | 4 +++ packages/deriv_language_selector/pubspec.yaml | 4 +-- packages/deriv_passkeys/CHANGELOG.md | 4 +++ packages/deriv_passkeys/pubspec.yaml | 4 +-- packages/deriv_ui/CHANGELOG.md | 4 +++ packages/deriv_ui/pubspec.yaml | 2 +- packages/deriv_widgetbook/CHANGELOG.md | 4 +++ packages/deriv_widgetbook/pubspec.yaml | 4 +-- 12 files changed, 72 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f149e381e..648ca89cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,40 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2024-06-24 + +### Changes + +--- + +Packages with breaking changes: + + - There are no breaking changes in this release. + +Packages with other changes: + + - [`deriv_ui` - `v0.0.7+7`](#deriv_ui---v0077) + - [`deriv_auth` - `v6.6.9`](#deriv_auth---v669) + - [`deriv_passkeys` - `v0.0.2+1`](#deriv_passkeys---v0021) + - [`deriv_widgetbook` - `v0.0.2+7`](#deriv_widgetbook---v0027) + - [`deriv_language_selector` - `v0.0.2+5`](#deriv_language_selector---v0025) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `deriv_auth` - `v6.6.9` + - `deriv_passkeys` - `v0.0.2+1` + - `deriv_widgetbook` - `v0.0.2+7` + - `deriv_language_selector` - `v0.0.2+5` + +--- + +#### `deriv_ui` - `v0.0.7+7` + + - **REFACTOR**(deriv_ui): [DERG-3500] return inputted amount based on the formatter in numpad ([#624](https://github.com/regentmarkets/flutter-deriv-packages/issues/624)). ([fdf4df19](https://github.com/regentmarkets/flutter-deriv-packages/commit/fdf4df1979ddb8710dba8925ef779cca25d60615)) + + ## 2024-06-21 ### Changes diff --git a/README.md b/README.md index 28ded8060..1d6a3ea04 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 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.6.7)`. 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.6.9)`. To use the package, add the following to your pubspec.yaml file: ```yaml @@ -12,7 +12,7 @@ deriv_ui: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_ui - ref: deriv_ui-v0.0.7+6 #your prefered version + ref: deriv_ui-v0.0.7+7 #your prefered version ``` ## Packages @@ -20,7 +20,7 @@ deriv_ui: | Name | Description | Version | | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | | [analytics](./packages/analytics) | Used to collect and send analytical information to 'Firebase' and 'Segment'. | [v2.0.0](./packages/analytics/CHANGELOG.md) | -| [deriv_auth](./packages/deriv_auth) | A Dart package that provides Authentication logic for Deriv applications. | [v6.6.7 ](./packages/deriv_auth/CHANGELOG.md) | +| [deriv_auth](./packages/deriv_auth) | A Dart package that provides Authentication logic for Deriv applications. | [v6.6.9 ](./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) | @@ -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+2](./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+4](./packages/deriv_language_selector/CHANGELOG.md) | +| [deriv_language_selector](./packages/deriv_language_selector) | A package to handle language change of the app. | [v0.0.2+5](./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.4.4](./packages/deriv_localizations/CHANGELOG.md) | | [deriv_numpad](./packages/deriv_numpad) | Number Pad Widget for number input. | [v1.1.5](./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+6](./packages/deriv_ui/CHANGELOG.md) | +| [deriv_ui](./packages/deriv_ui) | A package that contains the UI components used by Deriv products. | [v0.0.7+7](./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+6](./packages/deriv_widgetbook/CHANGELOG.md) | +| [deriv_widgetbook](./packages/deriv_widgetbook) |Storybook for Deriv UI Widgets and Components | [v0.0.2+7](./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.3.0](./packages/update_checker/CHANGELOG.md) | | [deriv_feature_flag](./packages/deriv_feature_flag) | A package to provide feature flag functionality for apps. | [v0.1.1](./packages/deriv_feature_flag/CHANGELOG.md) | diff --git a/packages/deriv_auth/CHANGELOG.md b/packages/deriv_auth/CHANGELOG.md index f6108faa2..4c1180287 100644 --- a/packages/deriv_auth/CHANGELOG.md +++ b/packages/deriv_auth/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.6.9 + + - Update a dependency to the latest release. + ## 6.6.8 - Update a dependency to the latest release. diff --git a/packages/deriv_auth/pubspec.yaml b/packages/deriv_auth/pubspec.yaml index 7d058b6b5..6b66d4e4a 100644 --- a/packages/deriv_auth/pubspec.yaml +++ b/packages/deriv_auth/pubspec.yaml @@ -1,6 +1,6 @@ name: deriv_auth description: Provides deriv authentication functionalities for dart/flutter apps. -version: 6.6.8 +version: 6.6.9 environment: sdk: ">=3.0.0 <4.0.0" @@ -22,7 +22,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_ui - ref: deriv_ui-v0.0.7+6 + ref: deriv_ui-v0.0.7+7 deriv_http_client: git: @@ -51,13 +51,13 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_passkeys - ref: deriv_passkeys-v0.0.2 + ref: deriv_passkeys-v0.0.2+1 deriv_language_selector: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_language_selector - ref: deriv_language_selector-v0.0.2+4 + ref: deriv_language_selector-v0.0.2+5 flutter_bloc: ^8.1.3 flutter_svg: ^2.0.7 @@ -73,7 +73,7 @@ dependency_overrides: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_ui - ref: deriv_ui-v0.0.7+6 + ref: deriv_ui-v0.0.7+7 dev_dependencies: mocktail: ^1.0.3 diff --git a/packages/deriv_language_selector/CHANGELOG.md b/packages/deriv_language_selector/CHANGELOG.md index 4eb2f1faf..527f6375f 100644 --- a/packages/deriv_language_selector/CHANGELOG.md +++ b/packages/deriv_language_selector/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.2+5 + + - Update a dependency to the latest release. + ## 0.0.2+4 - Update a dependency to the latest release. diff --git a/packages/deriv_language_selector/pubspec.yaml b/packages/deriv_language_selector/pubspec.yaml index 3b0c952eb..a1e11f930 100644 --- a/packages/deriv_language_selector/pubspec.yaml +++ b/packages/deriv_language_selector/pubspec.yaml @@ -1,6 +1,6 @@ name: deriv_language_selector description: A package to select language for the app. It provides both UI and logic for language selection. -version: 0.0.2+4 +version: 0.0.2+5 publish_to: "none" environment: @@ -14,7 +14,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_ui - ref: deriv_ui-v0.0.7+6 + ref: deriv_ui-v0.0.7+7 shared_preferences: ^2.2.2 flutter_bloc: ^8.1.4 equatable: ^2.0.5 diff --git a/packages/deriv_passkeys/CHANGELOG.md b/packages/deriv_passkeys/CHANGELOG.md index 4a8a4e3b9..863c60366 100644 --- a/packages/deriv_passkeys/CHANGELOG.md +++ b/packages/deriv_passkeys/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.2+1 + + - Update a dependency to the latest release. + ## 0.0.2 - **REFACTOR**(deriv_passkeys): Removed deprecated linter rules ([#625](https://github.com/regentmarkets/flutter-deriv-packages/issues/625)). ([2fdc28f2](https://github.com/regentmarkets/flutter-deriv-packages/commit/2fdc28f20b8efe2ddc3a9a261c40b533307f25e3)) diff --git a/packages/deriv_passkeys/pubspec.yaml b/packages/deriv_passkeys/pubspec.yaml index f51b9c42d..353df4251 100644 --- a/packages/deriv_passkeys/pubspec.yaml +++ b/packages/deriv_passkeys/pubspec.yaml @@ -1,6 +1,6 @@ name: deriv_passkeys description: Deriv Passkeys Flutter Plugin -version: 0.0.2 +version: 0.0.2+1 publish_to: "none" environment: @@ -32,7 +32,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_ui - ref: deriv_ui-v0.0.7+6 + ref: deriv_ui-v0.0.7+7 deriv_http_client: git: diff --git a/packages/deriv_ui/CHANGELOG.md b/packages/deriv_ui/CHANGELOG.md index 1441b306e..567ab709b 100644 --- a/packages/deriv_ui/CHANGELOG.md +++ b/packages/deriv_ui/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.7+7 + + - **REFACTOR**(deriv_ui): [DERG-3500] return inputted amount based on the formatter in numpad ([#624](https://github.com/regentmarkets/flutter-deriv-packages/issues/624)). ([fdf4df19](https://github.com/regentmarkets/flutter-deriv-packages/commit/fdf4df1979ddb8710dba8925ef779cca25d60615)) + ## 0.0.7+6 - **REFACTOR**: update dependencies. ([af89e148](https://github.com/regentmarkets/flutter-deriv-packages/commit/af89e148dfecb6dbc8552b2b883cbad4102a56f8)) diff --git a/packages/deriv_ui/pubspec.yaml b/packages/deriv_ui/pubspec.yaml index f32c6ff6e..39c84205d 100644 --- a/packages/deriv_ui/pubspec.yaml +++ b/packages/deriv_ui/pubspec.yaml @@ -1,6 +1,6 @@ name: deriv_ui description: A new Flutter package project. -version: 0.0.7+6 +version: 0.0.7+7 publish_to: none environment: diff --git a/packages/deriv_widgetbook/CHANGELOG.md b/packages/deriv_widgetbook/CHANGELOG.md index edd0b2854..55de88fb6 100644 --- a/packages/deriv_widgetbook/CHANGELOG.md +++ b/packages/deriv_widgetbook/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.2+7 + + - Update a dependency to the latest release. + ## 0.0.2+6 - **REFACTOR**: update dependencies. ([af89e148](https://github.com/regentmarkets/flutter-deriv-packages/commit/af89e148dfecb6dbc8552b2b883cbad4102a56f8)) diff --git a/packages/deriv_widgetbook/pubspec.yaml b/packages/deriv_widgetbook/pubspec.yaml index 9ced126dc..8a08de817 100644 --- a/packages/deriv_widgetbook/pubspec.yaml +++ b/packages/deriv_widgetbook/pubspec.yaml @@ -1,7 +1,7 @@ name: deriv_widgetbook description: Storybook for Deriv UI widgets and components. publish_to: "none" -version: 0.0.2+6 +version: 0.0.2+7 environment: sdk: ">=3.0.0 <4.0.0" @@ -16,7 +16,7 @@ dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_ui - ref: deriv_ui-v0.0.7+6 + ref: deriv_ui-v0.0.7+7 deriv_theme: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git