diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index 8646a648..2c11bcb3 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -137,26 +137,17 @@ class _PeerSettingsViewState extends State { setState(() { // Set whether or not to dave the Contact History... var profileOnion = Provider.of(context, listen: false).profileOnion; - var onion = Provider.of(context, listen: false).onion; - const SaveHistoryKey = "SavePeerHistory"; + var identifier = Provider.of(context, listen: false).identifier; + const SaveHistoryKey = "profile.SavePeerHistory"; + const SaveHistory = "SaveHistory"; + const DelHistory = "DeleteHistoryConfirmed"; if (newValue == AppLocalizations.of(context)!.savePeerHistory) { - Provider.of(context, listen: false).savePeerHistory = "SaveHistory"; - final setPeerAttribute = { - "EventType": "SetPeerAttribute", - "Data": {"RemotePeer": onion, "Key": SaveHistoryKey, "Data": "SaveHistory"}, - }; - final setPeerAttributeJson = jsonEncode(setPeerAttribute); - Provider.of(context, listen: false).cwtch.SendProfileEvent(profileOnion, setPeerAttributeJson); + Provider.of(context, listen: false).savePeerHistory = SaveHistory; + Provider.of(context, listen: false).cwtch.SetConversationAttribute(profileOnion, identifier, SaveHistoryKey, SaveHistory); } else { - Provider.of(context, listen: false).savePeerHistory = "DeleteHistoryConfirmed"; - final setPeerAttribute = { - "EventType": "SetPeerAttribute", - "Data": {"RemotePeer": onion, "Key": SaveHistoryKey, "Data": "DeleteHistoryConfirmed"}, - }; - - final setPeerAttributeJson = jsonEncode(setPeerAttribute); - Provider.of(context, listen: false).cwtch.SendProfileEvent(profileOnion, setPeerAttributeJson); + Provider.of(context, listen: false).savePeerHistory = DelHistory; + Provider.of(context, listen: false).cwtch.SetConversationAttribute(profileOnion, identifier, SaveHistoryKey, DelHistory); } }); },