Skip to content

Open patron page in external browser - #3355

Open
sawirricardo wants to merge 1 commit into
lichess-org:mainfrom
sawirricardo:fix/patron-link-external-browser
Open

Open patron page in external browser#3355
sawirricardo wants to merge 1 commit into
lichess-org:mainfrom
sawirricardo:fix/patron-link-external-browser

Conversation

@sawirricardo

@sawirricardo sawirricardo commented Jun 19, 2026

Copy link
Copy Markdown

Summary

  • Add a shared patron page launcher that requests the external application launch mode.
  • Use it from the Android donation entry points so the donation thank-you page is not kept on top of the app task.

Fixes #3345

Testing

  • flutter analyze lib/src/utils/launch.dart lib/src/view/home/home_tab_screen.dart lib/src/view/more/more_tab_screen.dart lib/src/view/account/account_menu.dart test/utils/launch_test.dart
  • flutter test test/utils/launch_test.dart

@sawirricardo
sawirricardo marked this pull request as ready for review June 19, 2026 10:46
Comment thread lib/src/utils/launch.dart

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

launch.dart is not a very clear, better name it launch_url.dart so we know what it is about.

Comment thread lib/src/utils/launch.dart
@@ -0,0 +1,13 @@
import 'package:url_launcher/url_launcher.dart';

const _patronUri = 'https://lichess.org/patron';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could also declare a final and parse it once for all:

Suggested change
const _patronUri = 'https://lichess.org/patron';
final _patronUri = Uri.parse('https://lichess.org/patron');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also rename it to launch_uri_test.dart

@veloce

veloce commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@sawirricardo if you were able to reproduce this behaviour, I'd like to see a screenshot/screen recording of it. Thank you!

title: Text(context.l10n.patronDonate),
enabled: isOnline,
onTap: () => launchUrl(Uri.parse('https://lichess.org/patron')),
onTap: () => launchPatronPage(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since launchPatronPage has only optional parameters, I think we can remove closure wrapper ( () => ) . Avoiding unnecessary object instantiations on every widget build pass.

onTap: launchPatronPage

We can do the same in other invocations as well.

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.

Thank you message after donating

3 participants