-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [MOBC-608] auth ui setting page (#320)
* feat: setting page * fix: depricated issues * fix: change package_info_plus to match packages * fix: future void callback * refactor: move regex_helper func to deriv_ui * fix: remove sahani repo from yaml files * fix: deriv_auth_ui pubspec * fix: remove appEnv related to deriv ez as deriv ez is removed from production we dont need to include it in this package anymore * fix: revert back the appEnv and change the comment
- Loading branch information
1 parent
b2c282e
commit ce8d202
Showing
9 changed files
with
345 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,15 @@ dependencies: | |
flutter: | ||
sdk: flutter | ||
cupertino_icons: ^1.0.2 | ||
|
||
deriv_auth_ui: | ||
path: ../ | ||
|
||
deriv_auth: | ||
git: | ||
url: [email protected]:sahani-deriv/flutter-deriv-packages.git | ||
url: [email protected]:regentmarkets/flutter-deriv-packages.git | ||
path: packages/deriv_auth | ||
ref: auth-ui-update | ||
ref: dev | ||
|
||
deriv_theme: | ||
git: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/deriv_auth_ui/lib/src/core/helpers/endpoint_helper.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// Default auth endpoint. | ||
const String defaultAuthEndpoint = 'oauth.deriv.com'; | ||
|
||
/// Default ws endpoint. | ||
const String defaultEndpoint = 'blue.binaryws.com'; | ||
|
||
/// Default app id. | ||
const String defaultAppId = '23789'; | ||
|
||
/// Parses an [endpoint] argument and generates a url that points to QA servers | ||
/// if [endpoint] starts with `qa` or a url that points to production servers if | ||
/// [endpoint] contains `derivws` or `binaryws` and [isAuthUrl] is `true`. | ||
/// | ||
/// [endpoint] argument is required. | ||
/// [isAuthUrl] is optional and has a default value of `false`. | ||
String? generateEndpointUrl({ | ||
required String? endpoint, | ||
bool isAuthUrl = false, | ||
}) { | ||
if (endpoint == null) { | ||
return null; | ||
} | ||
|
||
final RegExp qaRegExp = RegExp('^(qa[0-9]+)\$', caseSensitive: false); | ||
final RegExp derivRegExp = | ||
RegExp('(binary|deriv)ws\.(com|app)\$', caseSensitive: false); | ||
|
||
if (isAuthUrl && derivRegExp.hasMatch(endpoint)) { | ||
// Since Deriv app is under Deriv.app, the oauth url should be always `oauth.deriv.com`. | ||
return defaultAuthEndpoint; | ||
} else if (qaRegExp.hasMatch(endpoint)) { | ||
return '$endpoint.deriv.dev'; | ||
} | ||
|
||
return endpoint; | ||
} |
Oops, something went wrong.