diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index c59928e5..23835614 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -537,12 +537,12 @@ class CwtchFfi implements Cwtch { @override // ignore: non_constant_identifier_names void SetConversationAttribute(String profile, int contact, String key, String val) { - var setContactAttribute = library.lookup>("c_SetContactAttribute"); + var setContactAttribute = library.lookup>("c_SetConversationAttribute"); // ignore: non_constant_identifier_names final SetContactAttribute = setContactAttribute.asFunction(); final u1 = profile.toNativeUtf8(); final u3 = key.toNativeUtf8(); - final u4 = key.toNativeUtf8(); + final u4 = val.toNativeUtf8(); SetContactAttribute(u1, u1.length, contact, u3, u3.length, u4, u4.length); malloc.free(u1); malloc.free(u3); diff --git a/lib/views/groupsettingsview.dart b/lib/views/groupsettingsview.dart index 83e57d32..45dd0405 100644 --- a/lib/views/groupsettingsview.dart +++ b/lib/views/groupsettingsview.dart @@ -80,7 +80,7 @@ class _GroupSettingsViewState extends State { var profileOnion = Provider.of(context, listen: false).profileOnion; var handle = Provider.of(context, listen: false).identifier; Provider.of(context, listen: false).nickname = ctrlrNick.text; - Provider.of(context, listen: false).cwtch.SetConversationAttribute(profileOnion, handle, "local.name", ctrlrNick.text); + Provider.of(context, listen: false).cwtch.SetConversationAttribute(profileOnion, handle, "profile.name", ctrlrNick.text); // todo translations final snackBar = SnackBar(content: Text("Group Nickname changed successfully")); ScaffoldMessenger.of(context).showSnackBar(snackBar); diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index 235ca8ca..506c1706 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -69,14 +69,9 @@ class _PeerSettingsViewState extends State { readonly: false, onPressed: () { var profileOnion = Provider.of(context, listen: false).profileOnion; - var onion = Provider.of(context, listen: false).onion; + var conversation = Provider.of(context, listen: false).identifier; Provider.of(context, listen: false).nickname = ctrlrNick.text; - final setPeerAttribute = { - "EventType": "SetPeerAttribute", - "Data": {"RemotePeer": onion, "Key": "local.name", "Data": ctrlrNick.text}, - }; - final setPeerAttributeJson = jsonEncode(setPeerAttribute); - Provider.of(context, listen: false).cwtch.SendProfileEvent(profileOnion, setPeerAttributeJson); + Provider.of(context, listen: false).cwtch.SetConversationAttribute(profileOnion, conversation, "profile.name", ctrlrNick.text); final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.nickChangeSuccess)); ScaffoldMessenger.of(context).showSnackBar(snackBar); },