Skip to content

Commit

Permalink
fix(deriv_web_view): update PTA model (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza-deriv authored Apr 22, 2024
1 parent f4a4b68 commit 49583f8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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 @@ -153,6 +153,7 @@ Future<void> openLoggedInWebPage({
required bool rootNavigator,
required String appToken,
required String userAgent,
required String platform,
HttpClientPredicate? getHttpClient,
String destinationAppId = '16929',
String? action,
Expand All @@ -177,6 +178,7 @@ Future<void> openLoggedInWebPage({
getHttpClient: getHttpClient,
action: action,
code: code,
platform: platform,
);

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

Expand Down Expand Up @@ -245,6 +248,7 @@ Future<String?> _fetchOneTimeToken({
required void Function(BuildContext context) loadingDialog,
required bool rootNavigator,
required String appToken,
required String platform,
HttpClientPredicate? getHttpClient,
String? action,
String? code,
Expand All @@ -262,6 +266,7 @@ Future<String?> _fetchOneTimeToken({
action: action,
code: code,
getHttpClient: getHttpClient,
platform: platform,
);

Navigator.of(context, rootNavigator: rootNavigator).pop();
Expand All @@ -278,6 +283,7 @@ Future<String?> _getOneTimeToken({
required String? refreshToken,
required String? defaultAccount,
required String appToken,
required String platform,
HttpClientPredicate? getHttpClient,
String? action,
String? code,
Expand All @@ -294,6 +300,7 @@ Future<String?> _getOneTimeToken({
action: action,
code: code,
getHttpClient: getHttpClient,
platform: platform,
);

return token;
Expand All @@ -311,6 +318,7 @@ Future<String?> _validateCredentials({
required String appId,
required String destinationAppId,
required String? refreshToken,
required String platform,
required String? defaultAccount,
required void Function(BuildContext context) loadingDialog,
required Future<void> Function(BuildContext context) tokenExpiredDialog,
Expand All @@ -334,6 +342,7 @@ Future<String?> _validateCredentials({
getHttpClient: getHttpClient,
action: action,
code: code,
platform: platform,
);

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 @@ -22,6 +22,7 @@ Future<String?> performPassThroughAuthentication({
required String endpoint,
required String appId,
required String appToken,
required String platform,
HttpClientPredicate? getHttpClient,
String? action,
String? code,
Expand All @@ -43,6 +44,7 @@ Future<String?> performPassThroughAuthentication({
urlParams: UrlParamsModel(
redirectUrl: redirectPath,
selectedAccount: defaultAccount ?? '',
platform: platform,
action: action,
code: code,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class UrlParamsModel {
UrlParamsModel({
required this.redirectUrl,
required this.selectedAccount,
required this.platform,
this.action,
this.code,
});
Expand All @@ -40,6 +41,9 @@ class UrlParamsModel {
/// Login Id of account.
final String selectedAccount;

/// Platform.
final String platform;

/// The action that caused redirect for example `passthrough_authentication`.
final String? action;

Expand All @@ -52,6 +56,6 @@ class UrlParamsModel {
'selected_acct': selectedAccount,
if (action != null) 'action': action,
if (code != null) 'code': code,
'platform': 'derivgo',
'platform': platform,
};
}

0 comments on commit 49583f8

Please sign in to comment.