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

Remove uni_links from the project #49

Closed
mkobuolys opened this issue Apr 9, 2024 · 4 comments · Fixed by #50
Closed

Remove uni_links from the project #49

mkobuolys opened this issue Apr 9, 2024 · 4 comments · Fixed by #50
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mkobuolys
Copy link

The https://pub.dev/packages/uni_links package is almost deprecated - the last update was published 2 years ago. Since it is a transitive dependency in the crowdin-sdk, it causes some issues. E.g. for Android, apps cannot be migrated to Gradle 8.4. Are there any plans to remove this package and replace it with an alternative?

@mkobuolys mkobuolys added the enhancement New feature or request label Apr 9, 2024
@andrii-bodnar
Copy link
Member

Hi @mkobuolys, thanks for the suggestion!

Are there any good alternatives to the uni_links package?

@mkobuolys
Copy link
Author

Hi @mkobuolys, thanks for the suggestion!

Are there any good alternatives to the uni_links package?

Well, I am not entirely sure what are you using this package for, but:
a) Maybe you do not need to use any package at all and can handle custom deep links using a router, but...
b) ... I assume you do not have any router in the package (since it's not UI-related). https://pub.dev/packages/app_links looks like an alternative for it.
c) If you only use this package for a specific task, it should not hurt much to maintain this part yourself by implementing the native portion of the code.

@andrii-bodnar
Copy link
Member

As I can see, it is only used in the crowdin_oauth.dart module.

The methods used are parse, uriLinkStream.listen:

Future<void> authenticate() async {
final authorizationEndpoint = Uri.parse(_kAuthorizationEndpoint);
final tokenEndpoint = Uri.parse(_kTokenEndpoint);
var grant = oauth2.AuthorizationCodeGrant(
config.clientId,
authorizationEndpoint,
tokenEndpoint,
secret: config.clientSecret,
basicAuth: false,
);
var authorizationUrl = grant.getAuthorizationUrl(
Uri.parse(config.redirectUri),
scopes: ['project.translation']);
_sub = uriLinkStream.listen((Uri? uri) async {
if (uri != null && uri.toString().startsWith(config.redirectUri)) {
var client =
await grant.handleAuthorizationResponse(uri.queryParameters);
_client = client;
dispose();
onAuthenticated(_client.credentials);
}
});

@mkobuolys
Copy link
Author

Uri.parse is a standard Dart core method, so you should take care of uriLinkStream.listen. It seems that you only need to be notified about deep links happening on the native side. Having this in mind, app_links should work (https://pub.dev/packages/app_links#applinks-usage). I think developers (or QA after the change) just need to verify whether the same information is provided, and you should be good to go.

@andrii-bodnar andrii-bodnar added the good first issue Good for newcomers label Apr 10, 2024
@andrii-bodnar andrii-bodnar linked a pull request May 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants