Fixup Conversation Attribute Flow
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
c00bfbb48b
commit
b0f74ffb6d
|
@ -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<NativeFunction<void_from_string_int_string_string_function>>("c_SetContactAttribute");
|
||||
var setContactAttribute = library.lookup<NativeFunction<void_from_string_int_string_string_function>>("c_SetConversationAttribute");
|
||||
// ignore: non_constant_identifier_names
|
||||
final SetContactAttribute = setContactAttribute.asFunction<VoidFromStringIntStringStringFn>();
|
||||
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);
|
||||
|
|
|
@ -80,7 +80,7 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
|
|||
var profileOnion = Provider.of<ContactInfoState>(context, listen: false).profileOnion;
|
||||
var handle = Provider.of<ContactInfoState>(context, listen: false).identifier;
|
||||
Provider.of<ContactInfoState>(context, listen: false).nickname = ctrlrNick.text;
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetConversationAttribute(profileOnion, handle, "local.name", ctrlrNick.text);
|
||||
Provider.of<FlwtchState>(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);
|
||||
|
|
|
@ -69,14 +69,9 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
|
|||
readonly: false,
|
||||
onPressed: () {
|
||||
var profileOnion = Provider.of<ContactInfoState>(context, listen: false).profileOnion;
|
||||
var onion = Provider.of<ContactInfoState>(context, listen: false).onion;
|
||||
var conversation = Provider.of<ContactInfoState>(context, listen: false).identifier;
|
||||
Provider.of<ContactInfoState>(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<FlwtchState>(context, listen: false).cwtch.SendProfileEvent(profileOnion, setPeerAttributeJson);
|
||||
Provider.of<FlwtchState>(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);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue