pronta para a pap?

This commit is contained in:
2026-06-15 15:47:24 +01:00
parent 29e887cb14
commit 144a6c71a5

View File

@@ -31,7 +31,6 @@
final GameSharingController _sharingController = GameSharingController(); final GameSharingController _sharingController = GameSharingController();
String? _sessionId; String? _sessionId;
String? _shareCode; String? _shareCode;
String _sharedWithName = '';
StreamSubscription? _syncSubscription; StreamSubscription? _syncSubscription;
bool _isApplyingRemoteSync = false; bool _isApplyingRemoteSync = false;
final Set<String> _appliedSyncEventIds = {}; final Set<String> _appliedSyncEventIds = {};
@@ -164,11 +163,8 @@
_sessionId = activeSession['id']?.toString(); _sessionId = activeSession['id']?.toString();
_shareCode = activeSession['share_code']?.toString(); _shareCode = activeSession['share_code']?.toString();
final sharedWith = activeSession['shared_with_user_id']?.toString();
if (sharedWith != null && sharedWith.isNotEmpty) { // Partner info intentionally ignored because share label is hidden.
_sharedWithName = await _resolveUserName(sharedWith);
}
await _setupSyncListener(); await _setupSyncListener();
setState(() {}); setState(() {});
@@ -285,14 +281,12 @@
.eq('session_id', _sessionId!) .eq('session_id', _sessionId!)
.order('created_at', ascending: true); .order('created_at', ascending: true);
if (response is List) { for (final item in response as List) {
for (final item in response) {
final id = item['id']?.toString(); final id = item['id']?.toString();
if (id != null) { if (id != null) {
_appliedSyncEventIds.add(id); _appliedSyncEventIds.add(id);
} }
} }
}
} catch (e) { } catch (e) {
print('⚠️ Erro ao semear eventos históricos de sync: $e'); print('⚠️ Erro ao semear eventos históricos de sync: $e');
} }
@@ -450,35 +444,14 @@
if (result != null) { if (result != null) {
_sessionId = result['session_id']?.toString(); _sessionId = result['session_id']?.toString();
_shareCode = result['share_code']?.toString(); _shareCode = result['share_code']?.toString();
_sharedWithName = result['creator_name']?.toString() ?? '';
await _setupSyncListener(); await _setupSyncListener();
setState(() {}); setState(() {});
} }
} }
Widget _buildShareStatus(double sf) { Widget _buildShareStatus(double sf) {
if (_sessionId == null) return const SizedBox.shrink(); // Não mostrar qualquer indicação de partilha (nome ou código).
return const SizedBox.shrink();
final text = _sharedWithName.isNotEmpty
? 'Partilhado com $_sharedWithName'
: 'Sessão partilhada: $_shareCode';
return Container(
padding: EdgeInsets.symmetric(horizontal: 14 * sf, vertical: 8 * sf),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.55),
borderRadius: BorderRadius.circular(14 * sf),
border: Border.all(color: Colors.white24),
),
child: Text(
text,
style: TextStyle(
color: Colors.white,
fontSize: 13 * sf,
fontWeight: FontWeight.bold,
),
),
);
} }
@override @override