-
Notifications
You must be signed in to change notification settings - Fork 97
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
fixed Open links of About page in browser #270
Conversation
if (choice == 1) { | ||
final url = Uri.parse('mailto:[email protected]'); | ||
await launchUrl(url); | ||
} else { | ||
launchURL(url); | ||
} |
There was a problem hiding this comment.
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
lib/ui/views/about/about_view.dart
Outdated
@@ -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, |
There was a problem hiding this comment.
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
lib/ui/views/about/about_view.dart
Outdated
), | ||
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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
lib/utils/url_launcher.dart
Outdated
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'; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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!
mails to open with default mail app and other links to open in default browser
I have removed the code required to fix #260 issue |
lib/utils/url_launcher.dart
Outdated
var str1 = 'mailto'; | ||
if (url.startsWith(str1)) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@sainideepanshu199 run |
@sainideepanshu199 great 👍 |
Can u please review the code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine !
@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 |
There was a problem hiding this 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!
It's not needed, @sainideepanshu199 remove the file from commit |
@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 |
lib/utils/url_launcher.dart
Outdated
} else { | ||
throw 'Could not launch $url'; | ||
await launchUrlString(url, mode: LaunchMode.externalApplication); |
There was a problem hiding this comment.
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
In any other case open in the app webview itself
do i need to delete it from my commit? |
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. |
final url = Uri.parse('mailto:[email protected]'); | ||
await launchUrl(url); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@sainideepanshu199 remove the pubspec.lock file |
cc: @manjotsidhu is any other changes required ? |
There are merge conflicts |
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.