From 9b857999f479486830671f8b8e8b7fc26dcd769b Mon Sep 17 00:00:00 2001 From: emad-deriv <134991873+emad-deriv@users.noreply.github.com> Date: Tue, 25 Jun 2024 09:57:06 +0800 Subject: [PATCH 1/3] fix(deriv_webview): add language parameter to needed classes (#600) --- packages/deriv_web_view/lib/deriv_web_view.dart | 9 +++++++++ packages/deriv_web_view/lib/helper.dart | 2 ++ .../lib/models/pta_login_request_model.dart | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/packages/deriv_web_view/lib/deriv_web_view.dart b/packages/deriv_web_view/lib/deriv_web_view.dart index 8580ac4e7..e8777a60a 100644 --- a/packages/deriv_web_view/lib/deriv_web_view.dart +++ b/packages/deriv_web_view/lib/deriv_web_view.dart @@ -154,6 +154,7 @@ Future openLoggedInWebPage({ required String appToken, required String userAgent, required String platform, + String? languageCode, HttpClientPredicate? getHttpClient, String destinationAppId = '16929', String? action, @@ -179,6 +180,7 @@ Future openLoggedInWebPage({ action: action, code: code, platform: platform, + languageCode: languageCode ); if (oneTimeToken == null) { @@ -219,6 +221,7 @@ Future openLoggedInWebPage({ action: action, code: code, platform: platform, + languageCode: languageCode, ); } @@ -252,6 +255,7 @@ Future _fetchOneTimeToken({ HttpClientPredicate? getHttpClient, String? action, String? code, + String? languageCode, }) async { loadingDialog(context); @@ -267,6 +271,7 @@ Future _fetchOneTimeToken({ code: code, getHttpClient: getHttpClient, platform: platform, + languageCode: languageCode, ); Navigator.of(context, rootNavigator: rootNavigator).pop(); @@ -287,6 +292,7 @@ Future _getOneTimeToken({ HttpClientPredicate? getHttpClient, String? action, String? code, + String? languageCode, }) async { try { final String? token = await performPassThroughAuthentication( @@ -301,6 +307,7 @@ Future _getOneTimeToken({ code: code, getHttpClient: getHttpClient, platform: platform, + languageCode: languageCode, ); return token; @@ -327,6 +334,7 @@ Future _validateCredentials({ HttpClientPredicate? getHttpClient, String? action, String? code, + String? languageCode, }) async { final String? oneTimeToken = await _fetchOneTimeToken( context: context, @@ -343,6 +351,7 @@ Future _validateCredentials({ action: action, code: code, platform: platform, + languageCode: languageCode, ); if (oneTimeToken == null) { diff --git a/packages/deriv_web_view/lib/helper.dart b/packages/deriv_web_view/lib/helper.dart index 37a4ed291..1860b7b61 100644 --- a/packages/deriv_web_view/lib/helper.dart +++ b/packages/deriv_web_view/lib/helper.dart @@ -26,6 +26,7 @@ Future performPassThroughAuthentication({ HttpClientPredicate? getHttpClient, String? action, String? code, + String? languageCode, }) async { final url = getPtaLoginUrl(host: endpoint); @@ -47,6 +48,7 @@ Future performPassThroughAuthentication({ platform: platform, action: action, code: code, + languageCode: languageCode, ), ).toJson(); diff --git a/packages/deriv_web_view/lib/models/pta_login_request_model.dart b/packages/deriv_web_view/lib/models/pta_login_request_model.dart index 4dfee0910..3edce537f 100644 --- a/packages/deriv_web_view/lib/models/pta_login_request_model.dart +++ b/packages/deriv_web_view/lib/models/pta_login_request_model.dart @@ -33,6 +33,7 @@ class UrlParamsModel { required this.platform, this.action, this.code, + this.languageCode, }); /// URL that user should be redirected to for example `/cashier`. @@ -50,6 +51,9 @@ class UrlParamsModel { /// Code. final String? code; + /// language code + final String? languageCode; + /// Converts a instance of this class to json. Map toJson() => { 'redirect_url': redirectUrl, @@ -57,5 +61,6 @@ class UrlParamsModel { if (action != null) 'action': action, if (code != null) 'code': code, 'platform': platform, + if (languageCode != null) 'lang': languageCode, }; } From 2379af73c5c6c6b6ee8c4a5ce4466a08261a4894 Mon Sep 17 00:00:00 2001 From: emad-deriv <134991873+emad-deriv@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:01:48 +0800 Subject: [PATCH 2/3] chore(deriv_web_view): update deriv view readme file (#636) --- packages/deriv_web_view/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/deriv_web_view/README.md b/packages/deriv_web_view/README.md index 9b9bbfd61..95c78de3b 100644 --- a/packages/deriv_web_view/README.md +++ b/packages/deriv_web_view/README.md @@ -239,4 +239,4 @@ Future showTokenExpiredDialog(BuildContext context) => showAlertDialog( dismissible: false, onPositiveActionPressed: () { ... }, // Redirect to login page. ); -``` +``` \ No newline at end of file From b0b66dadb6cb1b30dc3ad759f2eee031673b6bbf Mon Sep 17 00:00:00 2001 From: emad-deriv <134991873+emad-deriv@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:11:49 +0800 Subject: [PATCH 3/3] fix(deriv_web_view): update deriv web view readme file (#637) --- packages/deriv_web_view/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/deriv_web_view/README.md b/packages/deriv_web_view/README.md index 95c78de3b..9b9bbfd61 100644 --- a/packages/deriv_web_view/README.md +++ b/packages/deriv_web_view/README.md @@ -239,4 +239,4 @@ Future showTokenExpiredDialog(BuildContext context) => showAlertDialog( dismissible: false, onPositiveActionPressed: () { ... }, // Redirect to login page. ); -``` \ No newline at end of file +```