Merge pull request 'fix save history option saving in peer settings' (#293) from fixSaveHist into trunk
continuous-integration/drone/push Build is pending Details

Reviewed-on: #293
Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
Dan Ballard 2022-01-07 21:54:10 +00:00
commit ca95d7cff3
1 changed files with 8 additions and 17 deletions

View File

@ -137,26 +137,17 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
setState(() { setState(() {
// Set whether or not to dave the Contact History... // Set whether or not to dave the Contact History...
var profileOnion = Provider.of<ContactInfoState>(context, listen: false).profileOnion; var profileOnion = Provider.of<ContactInfoState>(context, listen: false).profileOnion;
var onion = Provider.of<ContactInfoState>(context, listen: false).onion; var identifier = Provider.of<ContactInfoState>(context, listen: false).identifier;
const SaveHistoryKey = "SavePeerHistory"; const SaveHistoryKey = "profile.SavePeerHistory";
const SaveHistory = "SaveHistory";
const DelHistory = "DeleteHistoryConfirmed";
if (newValue == AppLocalizations.of(context)!.savePeerHistory) { if (newValue == AppLocalizations.of(context)!.savePeerHistory) {
Provider.of<ContactInfoState>(context, listen: false).savePeerHistory = "SaveHistory"; Provider.of<ContactInfoState>(context, listen: false).savePeerHistory = SaveHistory;
final setPeerAttribute = { Provider.of<FlwtchState>(context, listen: false).cwtch.SetConversationAttribute(profileOnion, identifier, SaveHistoryKey, SaveHistory);
"EventType": "SetPeerAttribute",
"Data": {"RemotePeer": onion, "Key": SaveHistoryKey, "Data": "SaveHistory"},
};
final setPeerAttributeJson = jsonEncode(setPeerAttribute);
Provider.of<FlwtchState>(context, listen: false).cwtch.SendProfileEvent(profileOnion, setPeerAttributeJson);
} else { } else {
Provider.of<ContactInfoState>(context, listen: false).savePeerHistory = "DeleteHistoryConfirmed"; Provider.of<ContactInfoState>(context, listen: false).savePeerHistory = DelHistory;
final setPeerAttribute = { Provider.of<FlwtchState>(context, listen: false).cwtch.SetConversationAttribute(profileOnion, identifier, SaveHistoryKey, DelHistory);
"EventType": "SetPeerAttribute",
"Data": {"RemotePeer": onion, "Key": SaveHistoryKey, "Data": "DeleteHistoryConfirmed"},
};
final setPeerAttributeJson = jsonEncode(setPeerAttribute);
Provider.of<FlwtchState>(context, listen: false).cwtch.SendProfileEvent(profileOnion, setPeerAttributeJson);
} }
}); });
}, },