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
5 changes: 3 additions & 2 deletions lib/ui/components/cv_social_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:mobile_app/cv_theme.dart';
import 'package:mobile_app/utils/url_launcher.dart';


class CircuitVerseSocialCard extends StatelessWidget {
const CircuitVerseSocialCard({
required this.imagePath,
Expand All @@ -20,8 +21,8 @@ class CircuitVerseSocialCard extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () async {
launchURL(url);
},
launchURL(url);
},
child: Card(
color: Theme.of(context).brightness == Brightness.dark
? CVTheme.primaryColor
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/views/about/about_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ class _AboutViewState extends State<AboutView> {
title: AppLocalizations.of(context)!.email_us_at,
description: 'support@circuitverse.org',
url: 'mailto:support@circuitverse.org',

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

),
const Divider(),
CVSubheader(
Expand Down
12 changes: 7 additions & 5 deletions lib/ui/views/contributors/contributors_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@ class ContributorsView extends StatelessWidget {
title: 'Email us at',
description: 'support@circuitverse.org',
url: 'mailto:support@circuitverse.org',

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

),
CircuitVerseSocialCard(
imagePath: 'assets/images/contribute/github.png',
title: 'Contribute to open source',
description: 'Github',
url: 'https://github.com/CircuitVerse',
),
imagePath: 'assets/images/contribute/github.png',
title: 'Contribute to open source',
description: 'Github',
url: 'https://github.com/CircuitVerse',
),
SizedBox(height: 32),
CVSubheader(title: 'How to Support ?'),
ContributeSupportCard(
Expand Down
9 changes: 6 additions & 3 deletions lib/utils/url_launcher.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';

void launchURL(String url) async {
if (await canLaunchUrlString(url)) {
await launchUrlString(url);
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.

final url = Uri.parse('mailto:support@circuitverse.org');
await launchUrl(url);
Comment on lines +6 to +7
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

} 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

}
}
Loading