diff --git a/lib/providers/user_profile_provider.dart b/lib/providers/user_profile_provider.dart index b1131a30..eb0577d1 100644 --- a/lib/providers/user_profile_provider.dart +++ b/lib/providers/user_profile_provider.dart @@ -223,14 +223,13 @@ class UserProfileProvider extends ChangeNotifier { } } - Future switchToUser(PlexHomeUser user, BuildContext? context) async { + Future switchToUser(PlexHomeUser user, BuildContext? context, {bool verifyPin = false}) async { if (_authService == null || _storageService == null) { _setError('Services not initialized'); return false; } - if (user.uuid == _currentUser?.uuid) { - // Already on this user + if (user.uuid == _currentUser?.uuid && !(verifyPin && user.requiresPassword)) { return true; } diff --git a/lib/screens/profile/profile_list_tile.dart b/lib/screens/profile/profile_list_tile.dart index c822ec12..fc607ec1 100644 --- a/lib/screens/profile/profile_list_tile.dart +++ b/lib/screens/profile/profile_list_tile.dart @@ -13,6 +13,7 @@ class ProfileListTile extends StatelessWidget { final VoidCallback onTap; final bool isCurrentUser; final bool showTrailingIcon; + final bool allowCurrentUserTap; const ProfileListTile({ super.key, @@ -20,6 +21,7 @@ class ProfileListTile extends StatelessWidget { required this.onTap, this.isCurrentUser = false, this.showTrailingIcon = true, + this.allowCurrentUserTap = false, }); @override @@ -53,7 +55,7 @@ class ProfileListTile extends StatelessWidget { title: Text(user.displayName), subtitle: _hasUserAttributes() ? Row(children: _buildUserAttributes(theme)) : null, trailing: trailing, - onTap: isCurrentUser ? null : onTap, + onTap: isCurrentUser && !allowCurrentUserTap ? null : onTap, ); } diff --git a/lib/screens/profile/profile_switch_screen.dart b/lib/screens/profile/profile_switch_screen.dart index e45d4b48..ff522c88 100644 --- a/lib/screens/profile/profile_switch_screen.dart +++ b/lib/screens/profile/profile_switch_screen.dart @@ -98,11 +98,12 @@ class _ProfileSwitchScreenState extends State { autofocus: isFirstSelectable, focusNode: isFirstSelectable ? _firstSelectableFocusNode : null, disableScale: true, - onSelect: isCurrentUser ? null : () => _switchToUser(context, user), + onSelect: isCurrentUser && !widget.requireSelection ? null : () => _switchToUser(context, user), child: Card( child: ProfileListTile( user: user, isCurrentUser: isCurrentUser, + allowCurrentUserTap: widget.requireSelection, onTap: () => _switchToUser(context, user), ), ), @@ -120,7 +121,7 @@ class _ProfileSwitchScreenState extends State { void _switchToUser(BuildContext context, PlexHomeUser user) async { final userProvider = context.userProfile; final navigator = Navigator.of(context); - final success = await userProvider.switchToUser(user, context); + final success = await userProvider.switchToUser(user, context, verifyPin: widget.requireSelection); if (success) { if (widget.requireSelection) {