Refactor code for improved readability and null safety in various files Also updated PR to allow login via map.
This commit is contained in:
1 parent
be3b920b3f
commit
8c3ffa5472
5 files changed
+54
-22
No files matched your search
@@ -18,6 +18,7 @@ import 'channels_screen.dart';
|
||||
import 'chat_screen.dart';
|
||||
import 'contacts_screen.dart';
|
||||
import '../widgets/repeater_login_dialog.dart';
|
||||
import '../widgets/room_login_dialog.dart';
|
||||
import 'repeater_hub_screen.dart';
|
||||
import 'settings_screen.dart';
|
||||
|
||||
@@ -572,6 +573,25 @@ class _MapScreenState extends State<MapScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showRoomLogin(BuildContext context, Contact room) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => RoomLoginDialog(
|
||||
room: room,
|
||||
onLogin: (password) {
|
||||
// Navigate to chat screen after successful login
|
||||
context.read<MeshCoreConnector>().markContactRead(room.publicKeyHex);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChatScreen(contact: room),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showNodeInfo(BuildContext context, Contact contact) {
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -624,6 +644,14 @@ class _MapScreenState extends State<MapScreen> {
|
||||
},
|
||||
child: const Text('Manage Repeater'),
|
||||
),
|
||||
if (contact.type == advTypeRoom)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
_showRoomLogin(context, contact);
|
||||
},
|
||||
child: const Text('Join Room'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user