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);
|
List<dynamic> servers = jsonDecode(serversJson);
|
||||||
this._servers.replace(servers.map((server) {
|
this._servers.replace(servers.map((server) {
|
||||||
// TODO Keys...
|
// 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) {
|
this._contacts.contacts.forEach((contact) {
|
||||||
|
|
|
@ -67,11 +67,12 @@ class ProfileServerListState extends ChangeNotifier {
|
||||||
|
|
||||||
class RemoteServerInfoState extends ChangeNotifier {
|
class RemoteServerInfoState extends ChangeNotifier {
|
||||||
final String onion;
|
final String onion;
|
||||||
|
final int identifier;
|
||||||
String status;
|
String status;
|
||||||
String description;
|
String description;
|
||||||
List<ContactInfoState> _groups = [];
|
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) {
|
void updateDescription(String newDescription) {
|
||||||
this.description = 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
|
// 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), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
var profile = Provider.of<ProfileInfoState>(context);
|
var profile = Provider.of<ProfileInfoState>(context);
|
||||||
profile.serverList.getServer(serverHandle)?.updateDescription(serverDesc);
|
if (profile.serverList.getServer(serverHandle) != null) {
|
||||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetContactAttribute(profile.onion, serverHandle, "local.server.description", serverDesc);
|
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();
|
Navigator.of(context).pop();
|
||||||
});
|
});
|
||||||
|
|
|
@ -84,7 +84,7 @@ class _RemoteServerViewState extends State<RemoteServerView> {
|
||||||
labelText: AppLocalizations.of(context)!.fieldDescriptionLabel,
|
labelText: AppLocalizations.of(context)!.fieldDescriptionLabel,
|
||||||
icon: Icon(Icons.save),
|
icon: Icon(Icons.save),
|
||||||
onPressed: () {
|
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);
|
serverInfoState.updateDescription(ctrlrDesc.text);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue