Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update PTA model #557

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};
}
Loading