group functionality fixes from storage engine; tor status include percent; crate group enhancement
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dan Ballard 2021-12-16 13:36:14 -05:00
parent abf4d79e80
commit cde6962b8e
3 changed files with 19 additions and 11 deletions

View File

@ -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":
@ -303,8 +303,8 @@ class CwtchNotifier {
case "AcceptGroupInvite": case "AcceptGroupInvite":
EnvironmentConfig.debugLog("accept group invite"); EnvironmentConfig.debugLog("accept group invite");
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.authorization = ContactAuthorization.approved; profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(int.parse(data["ConversationID"]))!.authorization = ContactAuthorization.approved;
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["GroupID"], DateTime.fromMillisecondsSinceEpoch(0)); profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(int.parse(data["ConversationID"]), DateTime.fromMillisecondsSinceEpoch(0));
break; break;
case "ServerStateChange": case "ServerStateChange":
// Update the Server Cache // Update the Server Cache
@ -317,13 +317,14 @@ class CwtchNotifier {
profileCN.getProfile(data["ProfileOnion"])?.contactList.resort(); profileCN.getProfile(data["ProfileOnion"])?.contactList.resort();
break; break;
case "SetGroupAttribute": case "SetGroupAttribute":
int identifier = int.parse(data["ConversationID"]);
if (data["Key"] == "local.name") { if (data["Key"] == "local.name") {
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"]) != null) { if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(identifier) != null) {
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.nickname = data["Data"]; profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(identifier)!.nickname = data["Data"];
} }
} else if (data["Key"] == "local.archived") { } else if (data["Key"] == "local.archived") {
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"]) != null) { if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(identifier) != null) {
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.isArchived = data["Data"] == "true"; profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(identifier)!.isArchived = data["Data"] == "true";
} }
} else { } else {
EnvironmentConfig.debugLog("unhandled set group attribute event: ${data['Key']}"); EnvironmentConfig.debugLog("unhandled set group attribute event: ${data['Key']}");

View File

@ -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();
} }

View File

@ -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,
), ),
); );