Merge branch 'spike/block2-derisking'
This commit is contained in:
commit
bd6938c62d
18 changed files with 308 additions and 150 deletions
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../i18n/strings.g.dart';
|
||||
import '../services/message_store.dart';
|
||||
import '../services/social_service.dart';
|
||||
import '../services/social_settings.dart';
|
||||
import '../state/messages_cubit.dart';
|
||||
|
|
@ -18,6 +19,7 @@ class ChatScreen extends StatefulWidget {
|
|||
required this.social,
|
||||
required this.settings,
|
||||
required this.peerPubkey,
|
||||
this.messageStore,
|
||||
super.key,
|
||||
});
|
||||
|
||||
|
|
@ -25,6 +27,9 @@ class ChatScreen extends StatefulWidget {
|
|||
final SocialSettings settings;
|
||||
final String peerPubkey;
|
||||
|
||||
/// Optional persistence for chat history (keystore-backed); null in tests.
|
||||
final MessageStore? messageStore;
|
||||
|
||||
@override
|
||||
State<ChatScreen> createState() => _ChatScreenState();
|
||||
}
|
||||
|
|
@ -59,9 +64,12 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||
return;
|
||||
}
|
||||
final self = widget.social.publicKeyHex;
|
||||
final messages = MessagesCubit(session?.messages,
|
||||
peerPubkey: widget.peerPubkey, selfPubkey: self)
|
||||
..start();
|
||||
final messages = MessagesCubit(
|
||||
session?.messages,
|
||||
peerPubkey: widget.peerPubkey,
|
||||
selfPubkey: self,
|
||||
store: widget.messageStore,
|
||||
)..start();
|
||||
final trust = TrustCubit(session?.trust,
|
||||
peerPubkey: widget.peerPubkey, selfPubkey: self);
|
||||
unawaited(trust.load());
|
||||
|
|
@ -173,20 +181,31 @@ class _TrustBanner extends StatelessWidget {
|
|||
builder: (context, state) {
|
||||
final cubit = context.read<TrustCubit>();
|
||||
if (!cubit.isOnline || state.loading) return const SizedBox.shrink();
|
||||
final known = state.knownToYou;
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: seedPrimaryContainer.withValues(alpha: 0.5),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.verified_user_outlined, size: 18, color: seedGreen),
|
||||
Icon(
|
||||
known ? Icons.verified : Icons.verified_user_outlined,
|
||||
size: 18,
|
||||
color: seedGreen,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
state.certifierCount == 0
|
||||
? t.trust.none
|
||||
: t.trust.count(n: state.certifierCount),
|
||||
style: const TextStyle(color: seedOnSurface, fontSize: 13),
|
||||
known
|
||||
? t.trust.circle
|
||||
: state.certifierCount == 0
|
||||
? t.trust.none
|
||||
: t.trust.count(n: state.certifierCount),
|
||||
style: TextStyle(
|
||||
color: known ? seedGreen : seedOnSurface,
|
||||
fontSize: 13,
|
||||
fontWeight: known ? FontWeight.w600 : FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue