Skip to content

Commit

Permalink
Merge branch 'master' into deriv_auth_user_tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
abedelaziz-deriv authored Jun 25, 2024
2 parents 1693f06 + b0b66da commit 4235550
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/deriv_web_view/lib/deriv_web_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Future<void> openLoggedInWebPage({
required String appToken,
required String userAgent,
required String platform,
String? languageCode,
HttpClientPredicate? getHttpClient,
String destinationAppId = '16929',
String? action,
Expand All @@ -179,6 +180,7 @@ Future<void> openLoggedInWebPage({
action: action,
code: code,
platform: platform,
languageCode: languageCode
);

if (oneTimeToken == null) {
Expand Down Expand Up @@ -219,6 +221,7 @@ Future<void> openLoggedInWebPage({
action: action,
code: code,
platform: platform,
languageCode: languageCode,
);
}

Expand Down Expand Up @@ -252,6 +255,7 @@ Future<String?> _fetchOneTimeToken({
HttpClientPredicate? getHttpClient,
String? action,
String? code,
String? languageCode,
}) async {
loadingDialog(context);

Expand All @@ -267,6 +271,7 @@ Future<String?> _fetchOneTimeToken({
code: code,
getHttpClient: getHttpClient,
platform: platform,
languageCode: languageCode,
);

Navigator.of(context, rootNavigator: rootNavigator).pop();
Expand All @@ -287,6 +292,7 @@ Future<String?> _getOneTimeToken({
HttpClientPredicate? getHttpClient,
String? action,
String? code,
String? languageCode,
}) async {
try {
final String? token = await performPassThroughAuthentication(
Expand All @@ -301,6 +307,7 @@ Future<String?> _getOneTimeToken({
code: code,
getHttpClient: getHttpClient,
platform: platform,
languageCode: languageCode,
);

return token;
Expand All @@ -327,6 +334,7 @@ Future<String?> _validateCredentials({
HttpClientPredicate? getHttpClient,
String? action,
String? code,
String? languageCode,
}) async {
final String? oneTimeToken = await _fetchOneTimeToken(
context: context,
Expand All @@ -343,6 +351,7 @@ Future<String?> _validateCredentials({
action: action,
code: code,
platform: platform,
languageCode: languageCode,
);

if (oneTimeToken == null) {
Expand Down
2 changes: 2 additions & 0 deletions packages/deriv_web_view/lib/helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Future<String?> performPassThroughAuthentication({
HttpClientPredicate? getHttpClient,
String? action,
String? code,
String? languageCode,
}) async {
final url = getPtaLoginUrl(host: endpoint);

Expand All @@ -47,6 +48,7 @@ Future<String?> performPassThroughAuthentication({
platform: platform,
action: action,
code: code,
languageCode: languageCode,
),
).toJson();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -50,12 +51,16 @@ class UrlParamsModel {
/// Code.
final String? code;

/// language code
final String? languageCode;

/// Converts a instance of this class to json.
Map<String, dynamic> toJson() => <String, dynamic>{
'redirect_url': redirectUrl,
'selected_acct': selectedAccount,
if (action != null) 'action': action,
if (code != null) 'code': code,
'platform': platform,
if (languageCode != null) 'lang': languageCode,
};
}

0 comments on commit 4235550

Please sign in to comment.