Skip to content

Commit 13e076b

Browse files
committed
feat: real account management path
1 parent f8fc442 commit 13e076b

4 files changed

Lines changed: 12 additions & 61 deletions

File tree

lib/src/core/l10n/app_localizations.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,18 +1048,6 @@ abstract class AppLocalizations {
10481048
/// **'Are you sure you want to remove \"{name}\"?'**
10491049
String dialogRemoveFeedConfirm(String name);
10501050

1051-
/// Dialog title for opening Bluesky account management
1052-
///
1053-
/// In en, this message translates to:
1054-
/// **'Open Bluesky account management?'**
1055-
String get dialogOpenBlueskyAccount;
1056-
1057-
/// Description for opening Bluesky account management dialog
1058-
///
1059-
/// In en, this message translates to:
1060-
/// **'This opens the Bluesky account management screen. You may have to log in again.\n\nIf prompted for an account provider, use:\n{pdsUrl}'**
1061-
String dialogOpenBlueskyAccountDescription(String pdsUrl);
1062-
10631051
/// Replies page title
10641052
///
10651053
/// In en, this message translates to:

lib/src/core/l10n/app_localizations_en.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,6 @@ class AppLocalizationsEn extends AppLocalizations {
515515
return 'Are you sure you want to remove \"$name\"?';
516516
}
517517

518-
@override
519-
String get dialogOpenBlueskyAccount => 'Open Bluesky account management?';
520-
521-
@override
522-
String dialogOpenBlueskyAccountDescription(String pdsUrl) {
523-
return 'This opens the Bluesky account management screen. You may have to log in again.\n\nIf prompted for an account provider, use:\n$pdsUrl';
524-
}
525-
526518
@override
527519
String get pageTitleReplies => 'Replies';
528520

lib/src/core/l10n/intl_en.arb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -833,21 +833,6 @@
833833
}
834834
},
835835

836-
"dialogOpenBlueskyAccount": "Open Bluesky account management?",
837-
"@dialogOpenBlueskyAccount": {
838-
"description": "Dialog title for opening Bluesky account management"
839-
},
840-
841-
"dialogOpenBlueskyAccountDescription": "This opens the Bluesky account management screen. You may have to log in again.\n\nIf prompted for an account provider, use:\n{pdsUrl}",
842-
"@dialogOpenBlueskyAccountDescription": {
843-
"description": "Description for opening Bluesky account management dialog",
844-
"placeholders": {
845-
"pdsUrl": {
846-
"type": "String"
847-
}
848-
}
849-
},
850-
851836
"pageTitleReplies": "Replies",
852837
"@pageTitleReplies": {
853838
"description": "Replies page title"

lib/src/features/settings/ui/pages/settings_page.dart

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ class SettingsPage extends ConsumerStatefulWidget {
2020
}
2121

2222
class _SettingsPageState extends ConsumerState<SettingsPage> {
23-
static final Uri _manageAccountUri = Uri.parse(
24-
'https://bsky.app/settings/account',
25-
);
26-
2723
Future<void> _handleLogout() async {
2824
try {
2925
// Show loading indicator
@@ -54,35 +50,25 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
5450
Future<void> _handleManageAccount() async {
5551
final l10n = AppLocalizations.of(context);
5652
final authRepository = GetIt.instance<AuthRepository>();
57-
final pdsUrl = authRepository.pdsEndpoint ?? 'your PDS URL';
58-
final shouldOpen = await showDialog<bool>(
59-
context: context,
60-
builder: (context) => AlertDialog(
61-
title: Text(l10n.dialogOpenBlueskyAccount),
62-
content: Text(l10n.dialogOpenBlueskyAccountDescription(pdsUrl)),
63-
actions: [
64-
TextButton(
65-
onPressed: () => Navigator.of(context).pop(false),
66-
child: Text(l10n.buttonCancel),
67-
),
68-
FilledButton(
69-
onPressed: () => Navigator.of(context).pop(true),
70-
child: Text(l10n.buttonOpen),
71-
),
72-
],
73-
),
74-
);
53+
final pdsUrl = authRepository.pdsEndpoint;
54+
if (pdsUrl == null) {
55+
ScaffoldMessenger.of(
56+
context,
57+
).showSnackBar(SnackBar(content: Text(l10n.errorUnableToOpenLink)));
58+
return;
59+
}
60+
final manageAccountUri = Uri.parse(pdsUrl).resolve('/account/manage');
7561

76-
if (shouldOpen != true || !mounted) {
62+
if (!mounted) {
7763
return;
7864
}
7965

8066
final logger = GetIt.instance<LogService>().getLogger('Settings');
8167

8268
try {
8369
final didLaunch = await launchUrl(
84-
_manageAccountUri,
85-
mode: LaunchMode.externalApplication,
70+
manageAccountUri,
71+
mode: LaunchMode.inAppBrowserView,
8672
);
8773

8874
if (!didLaunch && mounted) {
@@ -92,7 +78,7 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
9278
}
9379
} catch (error, stackTrace) {
9480
logger.e(
95-
'Failed to launch manage account URL: $_manageAccountUri',
81+
'Failed to launch manage account URL: $manageAccountUri',
9682
error: error,
9783
stackTrace: stackTrace,
9884
);

0 commit comments

Comments
 (0)