[READ ONLY MIRROR] Open Source TikTok alternative built on AT Protocol github.com/sprksocial/client
flutter atproto video dart
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: account management screen

+91
+3
lib/src/core/auth/data/repositories/auth_repository.dart
··· 15 15 /// Gets the current user's handle 16 16 String? get handle; 17 17 18 + /// Gets the current user's PDS endpoint 19 + String? get pdsEndpoint; 20 + 18 21 /// Gets the AT Protocol client 19 22 ATProto? get atproto; 20 23
+3
lib/src/core/auth/data/repositories/auth_repository_impl.dart
··· 67 67 String? get handle => _handle; 68 68 69 69 @override 70 + String? get pdsEndpoint => _pdsEndpoint; 71 + 72 + @override 70 73 ATProto? get atproto => _atProto; 71 74 72 75 Future<void> _initialize() async {
+85
lib/src/features/settings/ui/pages/settings_page.dart
··· 10 10 import 'package:spark/src/core/utils/logging/log_service.dart'; 11 11 import 'package:spark/src/features/auth/auth.dart'; 12 12 import 'package:spark/src/features/auth/providers/auth_providers.dart'; 13 + import 'package:url_launcher/url_launcher.dart'; 13 14 14 15 @RoutePage() 15 16 class SettingsPage extends ConsumerStatefulWidget { ··· 20 21 } 21 22 22 23 class _SettingsPageState extends ConsumerState<SettingsPage> { 24 + static final Uri _manageAccountUri = Uri.parse( 25 + 'https://bsky.app/settings/account', 26 + ); 27 + 23 28 Future<void> _handleLogout() async { 24 29 try { 25 30 // Show loading indicator ··· 43 48 // Close loading dialog if it's open 44 49 if (mounted) { 45 50 context.router.maybePop(); 51 + } 52 + } 53 + } 54 + 55 + Future<void> _handleManageAccount() async { 56 + 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: const Text('Open Bluesky account management?'), 62 + content: Text( 63 + 'This opens the Bluesky account management screen. ' 64 + 'You may have to log in again.\n\n' 65 + 'If prompted for an account provider, use:\n$pdsUrl', 66 + ), 67 + actions: [ 68 + TextButton( 69 + onPressed: () => Navigator.of(context).pop(false), 70 + child: const Text('Cancel'), 71 + ), 72 + FilledButton( 73 + onPressed: () => Navigator.of(context).pop(true), 74 + child: const Text('Open'), 75 + ), 76 + ], 77 + ), 78 + ); 79 + 80 + if (shouldOpen != true || !mounted) { 81 + return; 82 + } 83 + 84 + final logger = GetIt.instance<LogService>().getLogger('Settings'); 85 + 86 + try { 87 + final didLaunch = await launchUrl( 88 + _manageAccountUri, 89 + mode: LaunchMode.externalApplication, 90 + ); 91 + 92 + if (!didLaunch && mounted) { 93 + ScaffoldMessenger.of(context).showSnackBar( 94 + const SnackBar(content: Text('Unable to open link right now.')), 95 + ); 96 + } 97 + } catch (error, stackTrace) { 98 + logger.e( 99 + 'Failed to launch manage account URL: $_manageAccountUri', 100 + error: error, 101 + stackTrace: stackTrace, 102 + ); 103 + 104 + if (mounted) { 105 + ScaffoldMessenger.of(context).showSnackBar( 106 + const SnackBar(content: Text('Unable to open link right now.')), 107 + ); 46 108 } 47 109 } 48 110 } ··· 298 360 ), 299 361 trailing: const Icon(FluentIcons.prohibited_24_regular), 300 362 onTap: () => context.router.push(const BlocksRoute()), 363 + contentPadding: const EdgeInsets.symmetric( 364 + horizontal: 16, 365 + vertical: 4, 366 + ), 367 + ), 368 + ), 369 + ), 370 + Padding( 371 + padding: const EdgeInsets.symmetric(vertical: 8), 372 + child: Container( 373 + decoration: BoxDecoration( 374 + color: Theme.of( 375 + context, 376 + ).colorScheme.surfaceContainerHighest.withValues(alpha: 0.5), 377 + borderRadius: BorderRadius.circular(12), 378 + ), 379 + child: ListTile( 380 + title: const Text( 381 + 'Manage Account', 382 + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), 383 + ), 384 + trailing: const Icon(FluentIcons.open_24_regular), 385 + onTap: _handleManageAccount, 301 386 contentPadding: const EdgeInsets.symmetric( 302 387 horizontal: 16, 303 388 vertical: 4,