port to new cwtch storage API
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
3f5428eff8
commit
6180b88172
|
@ -292,7 +292,7 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
List<dynamic> servers = jsonDecode(serversJson);
|
||||
this._servers.replace(servers.map((server) {
|
||||
// TODO Keys...
|
||||
return RemoteServerInfoState(onion: server["onion"], description: server["description"], status: server["status"]);
|
||||
return RemoteServerInfoState(onion: server["onion"], identifier: server["identifier"], description: server["description"], status: server["status"]);
|
||||
}));
|
||||
|
||||
this._contacts.contacts.forEach((contact) {
|
||||
|
|
|
@ -67,11 +67,12 @@ class ProfileServerListState extends ChangeNotifier {
|
|||
|
||||
class RemoteServerInfoState extends ChangeNotifier {
|
||||
final String onion;
|
||||
final int identifier;
|
||||
String status;
|
||||
String description;
|
||||
List<ContactInfoState> _groups = [];
|
||||
|
||||
RemoteServerInfoState({required this.onion, required this.description, required this.status});
|
||||
RemoteServerInfoState({required this.onion, required this.identifier, required this.description, required this.status});
|
||||
|
||||
void updateDescription(String newDescription) {
|
||||
this.description = newDescription;
|
||||
|
|
|
@ -118,8 +118,17 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
// Wait 500ms and hope the server is imported and add it's description in the UI and as an attribute
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
var profile = Provider.of<ProfileInfoState>(context);
|
||||
profile.serverList.getServer(serverHandle)?.updateDescription(serverDesc);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetContactAttribute(profile.onion, serverHandle, "local.server.description", serverDesc);
|
||||
if (profile.serverList.getServer(serverHandle) != null) {
|
||||
profile.serverList.getServer(serverHandle)?.updateDescription(
|
||||
serverDesc);
|
||||
|
||||
Provider
|
||||
.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.SetConversationAttribute(profile.onion, profile.serverList
|
||||
.getServer(serverHandle)
|
||||
!.identifier, "server.description", serverDesc);
|
||||
}
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
|
|
|
@ -84,7 +84,7 @@ class _RemoteServerViewState extends State<RemoteServerView> {
|
|||
labelText: AppLocalizations.of(context)!.fieldDescriptionLabel,
|
||||
icon: Icon(Icons.save),
|
||||
onPressed: () {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetContactAttribute(profile.onion, serverInfoState.onion, "local.server.description", ctrlrDesc.text);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetConversationAttribute(profile.onion, serverInfoState.identifier, "server.description", ctrlrDesc.text);
|
||||
serverInfoState.updateDescription(ctrlrDesc.text);
|
||||
},
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue