forked from cwtch.im/cwtch-ui
parent
f4b4458d4c
commit
9029386344
|
@ -1 +1 @@
|
|||
v1.0.0-27-g4d218df-2021-07-07-23-27
|
||||
v1.0.0-29-g41ae09d-2021-07-08-20-22
|
||||
|
|
|
@ -105,6 +105,14 @@ class CwtchNotifier {
|
|||
}
|
||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.totalMessages++;
|
||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["RemotePeer"], DateTime.now());
|
||||
|
||||
// We only ever see messages from authenticated peers.
|
||||
// If the contact is marked as offline then override this - can happen when the contact is removed from the front
|
||||
// end during syncing.
|
||||
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.isOnline() == false) {
|
||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.status = "Authenticated";
|
||||
}
|
||||
|
||||
break;
|
||||
case "PeerAcknowledgement":
|
||||
// We don't use these anymore, IndexedAcknowledgement is more suited to the UI front end...
|
||||
|
@ -118,6 +126,12 @@ class CwtchNotifier {
|
|||
try {
|
||||
var message = Provider.of<MessageMetadata>(key.currentContext!, listen: false);
|
||||
if (message == null) break;
|
||||
// We only ever see acks from authenticated peers.
|
||||
// If the contact is marked as offline then override this - can happen when the contact is removed from the front
|
||||
// end during syncing.
|
||||
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.isOnline() == false) {
|
||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.status = "Authenticated";
|
||||
}
|
||||
message.ackd = true;
|
||||
} catch (e) {
|
||||
// ignore, we received an ack for a message that hasn't loaded onto the screen yet...
|
||||
|
@ -136,7 +150,7 @@ class CwtchNotifier {
|
|||
} else {
|
||||
// from me (already displayed - do not update counter)
|
||||
var idx = data["Signature"];
|
||||
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.getMessageKey(idx);
|
||||
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])?.getMessageKey(idx);
|
||||
if (key == null) break;
|
||||
try {
|
||||
var message = Provider.of<MessageMetadata>(key.currentContext!, listen: false);
|
||||
|
@ -155,7 +169,7 @@ class CwtchNotifier {
|
|||
case "IndexedFailure":
|
||||
EnvironmentConfig.debugLog("IndexedFailure");
|
||||
var idx = data["Index"];
|
||||
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.getMessageKey(idx);
|
||||
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])?.getMessageKey(idx);
|
||||
try {
|
||||
var message = Provider.of<MessageMetadata>(key!.currentContext!, listen: false);
|
||||
message.error = true;
|
||||
|
|
|
@ -49,7 +49,7 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
),
|
||||
Expanded(
|
||||
child: Text("%1 » %2".replaceAll("%1", Provider.of<ProfileInfoState>(context).nickname).replaceAll("%2", AppLocalizations.of(context)!.titleManageContacts),
|
||||
overflow: TextOverflow.ellipsis, style: TextStyle(color: Provider.of<Settings>(context).current().mainTextColor()))), //todo
|
||||
overflow: TextOverflow.ellipsis, style: TextStyle(color: Provider.of<Settings>(context).current().mainTextColor()))),
|
||||
])),
|
||||
actions: [
|
||||
IconButton(icon: TorIcon(), onPressed: _pushTorStatus),
|
||||
|
|
|
@ -33,7 +33,8 @@ class _DoubleColumnViewState extends State<DoubleColumnView> {
|
|||
: //dev
|
||||
MultiProvider(providers: [
|
||||
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context)),
|
||||
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context).contactList.getContact(flwtch.selectedConversation!)!),
|
||||
ChangeNotifierProvider.value(
|
||||
value: flwtch.selectedConversation != null ? Provider.of<ProfileInfoState>(context).contactList.getContact(flwtch.selectedConversation!)! : ContactInfoState("", "")),
|
||||
], child: Container(child: MessageView())),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -47,6 +47,11 @@ class _MessageViewState extends State<MessageView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// After leaving a conversation the selected conversation is set to null...
|
||||
if (Provider.of<ContactInfoState>(context).profileOnion == "") {
|
||||
return Card(child: Center(child: Text(AppLocalizations.of(context)!.addContactFirst)));
|
||||
}
|
||||
|
||||
var appState = Provider.of<AppState>(context);
|
||||
return WillPopScope(
|
||||
onWillPop: _onWillPop,
|
||||
|
@ -65,7 +70,11 @@ class _MessageViewState extends State<MessageView> {
|
|||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(Provider.of<ContactInfoState>(context).nickname)
|
||||
Expanded(
|
||||
child: Text(
|
||||
Provider.of<ContactInfoState>(context).nickname,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
))
|
||||
]),
|
||||
actions: [
|
||||
//IconButton(icon: Icon(Icons.chat), onPressed: _pushContactSettings),
|
||||
|
|
Loading…
Reference in New Issue