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

fixed Open links of About page in browser #270

Closed
wants to merge 11 commits into from
Closed

fixed Open links of About page in browser #270

wants to merge 11 commits into from

Conversation

sainideepanshu199
Copy link

@sainideepanshu199 sainideepanshu199 commented Feb 27, 2023

Fixes #259

Describe the changes you have made in this PR -
fixed email and slack opening links to default email app and browser respectively.

Screenshots of the changes (If any) -

Note: Please check Allow edits from maintainers. if you would like us to assist in the PR.

@sainideepanshu199 sainideepanshu199 changed the title fixed Open links of About page in browser fixed Open links of About page and Contributors Page in browser Feb 27, 2023
Comment on lines 26 to 31
if (choice == 1) {
final url = Uri.parse('mailto:[email protected]');
await launchUrl(url);
} else {
launchURL(url);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can consider to manage this from the function itself rather than overriding it here and adding new argument.
You can override it in the lib/utils/url_launcher.dart , launchURL function , to check whether the url starts with mailto, if match you can parse the uri and call required function

@@ -108,12 +108,14 @@ class _AboutViewState extends State<AboutView> {
title: AppLocalizations.of(context)!.email_us_at,
description: '[email protected]',
url: 'mailto:[email protected]',
choice: 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this argument, as it is required only to check mail

),
CircuitVerseSocialCard(
imagePath: 'assets/images/contribute/slack.png',
title: AppLocalizations.of(context)!.join_slack,
description: AppLocalizations.of(context)!.slack_channel,
url: 'https://circuitverse.org/slack',
choice: 2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this argument, as it is required only to check mail

@@ -29,19 +29,21 @@ class ContributorsView extends StatelessWidget {
title: 'Email us at',
description: '[email protected]',
url: 'mailto:[email protected]',
choice: 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this argument, as it is required only to check mail

),
CircuitVerseSocialCard(
imagePath: 'assets/images/contribute/slack.png',
title: 'Join and chat with us at',
description: 'Slack channel',
url: 'https://circuitverse.org/slack',
choice: 2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this argument, as it is required only to check mail

title: 'Contribute to open source',
description: 'Github',
url: 'https://github.com/CircuitVerse',
choice: 3),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this argument, as it is required only to check mail

Comment on lines 3 to 8
void launchURL(String url) async {
Future<void> launchURL(String url) async {
if (await canLaunchUrlString(url)) {
await launchUrlString(url);
await launchUrlString(url, mode: LaunchMode.externalApplication);
} else {
throw 'Could not launch $url';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems fine ! Check whether the url starts with mailto and take action on that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed the use of extra parameter's and function and made changes accordingly. Now mail and slack link on about page can open in mail app and browser respectively with just the url_launcher utils. please review the code and suggest if any other changes can be made.

Copy link
Member

@vedant-jain03 vedant-jain03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sainideepanshu199 You can't work on 2 issues at a time, also #260 has been assigned to other contributor, kindly remove the required code to fix #260 issue!

@sainideepanshu199 sainideepanshu199 changed the title fixed Open links of About page and Contributors Page in browser fixed Open links of About page in browser Mar 1, 2023
@sainideepanshu199
Copy link
Author

@sainideepanshu199 You can't work on 2 issues at a time, also #260 has been assigned to other contributor, kindly remove the required code to fix #260 issue!

I have removed the code required to fix #260 issue

@sainideepanshu199 sainideepanshu199 requested review from vedant-jain03 and tanmoysrt and removed request for vedant-jain03 and tanmoysrt March 1, 2023 11:49
@vedant-jain03 vedant-jain03 requested a review from tanmoysrt March 1, 2023 11:55
Comment on lines 5 to 6
var str1 = 'mailto';
if (url.startsWith(str1)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly write the string inside startswith(...) as str1 is not used anywhere else

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used the string directly and removed str1.

@tanmoysrt
Copy link
Member

@sainideepanshu199 run dart format . to format for your code.

@tanmoysrt
Copy link
Member

@sainideepanshu199 great 👍

@sainideepanshu199
Copy link
Author

@sainideepanshu199 great 👍

Can u please review the code

Copy link
Member

@tanmoysrt tanmoysrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine !

@tanmoysrt
Copy link
Member

@sainideepanshu199 please wait a bit. The CI pipeline has some issue, so it can delay the merge a bit.

@sainideepanshu199
Copy link
Author

@sainideepanshu199 please wait a bit. The CI pipeline has some issue, so it can delay the merge a bit.

can i work on issue #261 as it is not assigned to anyone.

@tanmoysrt
Copy link
Member

@sainideepanshu199 please wait a bit. The CI pipeline has some issue, so it can delay the merge a bit.

can i work on issue #261 as it is not assigned to anyone.

Comment on the specfic issue for get assigned

Copy link
Member

@vedant-jain03 vedant-jain03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tanmoy741127 Do we need to update pubspec.lock, if not @sainideepanshu199 kindly remove that change from commit!

@tanmoysrt
Copy link
Member

@Tanmoy741127 Do we need to update pubspec.lock, if not @sainideepanshu199 kindly remove that change from commit!

It's not needed, @sainideepanshu199 remove the file from commit

@manjotsidhu
Copy link
Member

@Tanmoy741127 Can you verify launchUrl function is only called from these links, we don't want to open externally any other links.

@tanmoysrt
Copy link
Member

@Tanmoy741127 Can you verify launchUrl function is only called from these links, we don't want to open externally any other links.

Ok ! as per the updates, it is going to update all links externally, so that behaviour need to be changed

} else {
throw 'Could not launch $url';
await launchUrlString(url, mode: LaunchMode.externalApplication);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only use LaunchMode.externalApplication for this urls

  1. https://circuitverse.org/slack
  2. https://circuitverse.org/slack
  3. https://github.com/CircuitVerse

In any other case open in the app webview itself

@sainideepanshu199
Copy link
Author

@Tanmoy741127 Do we need to update pubspec.lock, if not @sainideepanshu199 kindly remove that change from commit!

It's not needed, @sainideepanshu199 remove the file from commit

do i need to delete it from my commit?

@sainideepanshu199
Copy link
Author

now only mail, slack and github opens in external application rest opens in app webview

please review and tell for any further changes

@tanmoysrt
Copy link
Member

now only mail, slack and github opens in external application rest opens in app webview

please review and tell for any further changes

Will check soon.

Comment on lines +6 to +7
final url = Uri.parse('mailto:[email protected]');
await launchUrl(url);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For mail consider to open in external application.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it opens in default mail app of smartphone

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have sent you a video regarding all links on slack, please watch it , it will clear all doubts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then it's fine

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sainideepanshu199 remove the pubspec.lock file

shall i delete the file or revert the changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just delete the file and commit. It will work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@tanmoysrt
Copy link
Member

@sainideepanshu199 remove the pubspec.lock file

@tanmoysrt
Copy link
Member

cc: @manjotsidhu is any other changes required ?

@manjotsidhu
Copy link
Member

There are merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open links of About Page in browser
4 participants