Merge pull request 'group functionality fixes from storage engine; tor status include percent; crate group enhancement' (#265) from groupFixes into trunk
continuous-integration/drone/push Build is pending
Details
continuous-integration/drone/push Build is pending
Details
Reviewed-on: #265 Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
commit
ffb518b47d
|
@ -92,8 +92,8 @@ class CwtchNotifier {
|
||||||
if (serverInfoState != null) {
|
if (serverInfoState != null) {
|
||||||
status = serverInfoState.status;
|
status = serverInfoState.status;
|
||||||
}
|
}
|
||||||
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"]) == null) {
|
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(int.parse(data["ConversationID"])) == null) {
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.add(ContactInfoState(data["ProfileOnion"], data["ConversationID"], data["GroupID"],
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.add(ContactInfoState(data["ProfileOnion"], int.parse(data["ConversationID"]), data["GroupID"],
|
||||||
authorization: ContactAuthorization.approved,
|
authorization: ContactAuthorization.approved,
|
||||||
imagePath: data["PicturePath"],
|
imagePath: data["PicturePath"],
|
||||||
nickname: data["GroupName"],
|
nickname: data["GroupName"],
|
||||||
|
@ -101,7 +101,7 @@ class CwtchNotifier {
|
||||||
server: data["GroupServer"],
|
server: data["GroupServer"],
|
||||||
isGroup: true,
|
isGroup: true,
|
||||||
lastMessageTime: DateTime.now()));
|
lastMessageTime: DateTime.now()));
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["GroupID"], DateTime.now());
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(int.parse(data["ConversationID"]), DateTime.now());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "PeerDeleted":
|
case "PeerDeleted":
|
||||||
|
@ -300,12 +300,6 @@ class CwtchNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "AcceptGroupInvite":
|
|
||||||
EnvironmentConfig.debugLog("accept group invite");
|
|
||||||
|
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.authorization = ContactAuthorization.approved;
|
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["GroupID"], DateTime.fromMillisecondsSinceEpoch(0));
|
|
||||||
break;
|
|
||||||
case "ServerStateChange":
|
case "ServerStateChange":
|
||||||
// Update the Server Cache
|
// Update the Server Cache
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.updateServerStatusCache(data["GroupServer"], data["ConnectionState"]);
|
profileCN.getProfile(data["ProfileOnion"])?.updateServerStatusCache(data["GroupServer"], data["ConnectionState"]);
|
||||||
|
@ -316,19 +310,6 @@ class CwtchNotifier {
|
||||||
});
|
});
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.resort();
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.resort();
|
||||||
break;
|
break;
|
||||||
case "SetGroupAttribute":
|
|
||||||
if (data["Key"] == "local.name") {
|
|
||||||
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"]) != null) {
|
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.nickname = data["Data"];
|
|
||||||
}
|
|
||||||
} else if (data["Key"] == "local.archived") {
|
|
||||||
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"]) != null) {
|
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.isArchived = data["Data"] == "true";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
EnvironmentConfig.debugLog("unhandled set group attribute event: ${data['Key']}");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "SetPeerAttribute":
|
case "SetPeerAttribute":
|
||||||
if (data["Key"] == "local.name") {
|
if (data["Key"] == "local.name") {
|
||||||
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"]) != null) {
|
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"]) != null) {
|
||||||
|
|
|
@ -149,6 +149,7 @@ class ContactListState extends ChangeNotifier {
|
||||||
servers?.addGroup(contact);
|
servers?.addGroup(contact);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
resort();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +158,7 @@ class ContactListState extends ChangeNotifier {
|
||||||
if (newContact.isGroup) {
|
if (newContact.isGroup) {
|
||||||
servers?.addGroup(newContact);
|
servers?.addGroup(newContact);
|
||||||
}
|
}
|
||||||
|
resort();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,12 +166,18 @@ class ContactListState extends ChangeNotifier {
|
||||||
_contacts.sort((ContactInfoState a, ContactInfoState b) {
|
_contacts.sort((ContactInfoState a, ContactInfoState b) {
|
||||||
// return -1 = a first in list
|
// return -1 = a first in list
|
||||||
// return 1 = b first in list
|
// return 1 = b first in list
|
||||||
|
|
||||||
// blocked contacts last
|
// blocked contacts last
|
||||||
if (a.isBlocked == true && b.isBlocked != true) return 1;
|
if (a.isBlocked == true && b.isBlocked != true) return 1;
|
||||||
if (a.isBlocked != true && b.isBlocked == true) return -1;
|
if (a.isBlocked != true && b.isBlocked == true) return -1;
|
||||||
// archive is next...
|
// archive is next...
|
||||||
if (!a.isArchived && b.isArchived) return -1;
|
if (!a.isArchived && b.isArchived) return -1;
|
||||||
if (a.isArchived && !b.isArchived) return 1;
|
if (a.isArchived && !b.isArchived) return 1;
|
||||||
|
|
||||||
|
// unapproved top
|
||||||
|
if (a.isInvitation && !b.isInvitation) return -1;
|
||||||
|
if (!a.isInvitation && b.isInvitation) return 1;
|
||||||
|
|
||||||
// special sorting for contacts with no messages in either history
|
// special sorting for contacts with no messages in either history
|
||||||
if (a.lastMessageTime.millisecondsSinceEpoch == 0 && b.lastMessageTime.millisecondsSinceEpoch == 0) {
|
if (a.lastMessageTime.millisecondsSinceEpoch == 0 && b.lastMessageTime.millisecondsSinceEpoch == 0) {
|
||||||
// online contacts first
|
// online contacts first
|
||||||
|
|
|
@ -18,6 +18,9 @@ class TorStatus extends ChangeNotifier {
|
||||||
|
|
||||||
progress = new_progress;
|
progress = new_progress;
|
||||||
status = new_status;
|
status = new_status;
|
||||||
|
if (new_progress != 100) {
|
||||||
|
status = "$new_progress% - $new_status";
|
||||||
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,11 +197,15 @@ class _AddContactViewState extends State<AddContactView> {
|
||||||
},
|
},
|
||||||
isExpanded: true, // magic property
|
isExpanded: true, // magic property
|
||||||
value: server,
|
value: server,
|
||||||
items: Provider.of<ProfileInfoState>(context).serverList.servers.map<DropdownMenuItem<String>>((RemoteServerInfoState serverInfo) {
|
items: Provider.of<ProfileInfoState>(context)
|
||||||
|
.serverList
|
||||||
|
.servers
|
||||||
|
.where((serverInfo) => serverInfo.status == "Synced")
|
||||||
|
.map<DropdownMenuItem<String>>((RemoteServerInfoState serverInfo) {
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<String>(
|
||||||
value: serverInfo.onion,
|
value: serverInfo.onion,
|
||||||
child: Text(
|
child: Text(
|
||||||
serverInfo.onion,
|
serverInfo.description,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,6 +30,7 @@ class _ServersView extends State<ServersView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: Provider.of<Settings>(context, listen: false).theme.backgroundMainColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(MediaQuery.of(context).size.width > 600 ? AppLocalizations.of(context)!.serversManagerTitleLong : AppLocalizations.of(context)!.serversManagerTitleShort),
|
title: Text(MediaQuery.of(context).size.width > 600 ? AppLocalizations.of(context)!.serversManagerTitleLong : AppLocalizations.of(context)!.serversManagerTitleShort),
|
||||||
actions: getActions(),
|
actions: getActions(),
|
||||||
|
|
Loading…
Reference in New Issue