kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix Adding/removing users from groups not working
rodzic
ce9b50b3a1
commit
b3fceec72f
|
@ -54,6 +54,7 @@ class MemoryGroupsRepo implements IGroupsRepo {
|
|||
@override
|
||||
void addConnectionToGroup(GroupData group, Connection connection) {
|
||||
_connectionsForGroup.putIfAbsent(group.id, () => {}).add(connection);
|
||||
_groupsForConnection[connection.id]?.add(group);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -155,30 +155,32 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
|
|||
return CheckboxListTile(
|
||||
title: Text(g.name),
|
||||
value: usersGroups.contains(g),
|
||||
onChanged: isUpdating
|
||||
? null
|
||||
: (bool? value) async {
|
||||
final isAdding = value == true;
|
||||
final confirm = await showYesNoDialog(
|
||||
context,
|
||||
isAdding
|
||||
? 'Add user to ${g.name}'
|
||||
: 'Remove user from ${g.name}');
|
||||
if (confirm != true) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
isUpdating = true;
|
||||
});
|
||||
if (isAdding) {
|
||||
await manager.addUserToGroup(g, profile);
|
||||
} else {
|
||||
await manager.removeUserFromGroup(g, profile);
|
||||
}
|
||||
setState(() {
|
||||
isUpdating = false;
|
||||
});
|
||||
},
|
||||
onChanged: (bool? value) async {
|
||||
if (isUpdating) {
|
||||
return;
|
||||
}
|
||||
|
||||
final isAdding = value == true;
|
||||
final confirm = await showYesNoDialog(
|
||||
context,
|
||||
isAdding
|
||||
? 'Add user to ${g.name}'
|
||||
: 'Remove user from ${g.name}');
|
||||
if (confirm != true) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
isUpdating = true;
|
||||
});
|
||||
if (isAdding) {
|
||||
await manager.addUserToGroup(g, profile);
|
||||
} else {
|
||||
await manager.removeUserFromGroup(g, profile);
|
||||
}
|
||||
setState(() {
|
||||
isUpdating = false;
|
||||
});
|
||||
},
|
||||
);
|
||||
}).toList();
|
||||
return Column(
|
||||
|
|
|
@ -318,6 +318,7 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
Result<List<GroupData>, ExecError> getGroupsForUser(String id) {
|
||||
final result = groupsRepo.getGroupsForUser(id);
|
||||
if (result.isSuccess) {
|
||||
print("Groups for user $id: $result");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -334,7 +335,7 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
_logger.finest('Adding ${connection.name} to group: ${group.name}');
|
||||
return await GroupsClient(profile)
|
||||
.addConnectionToGroup(group, connection)
|
||||
.withResultAsync((_) async => refreshGroupMemberships(group))
|
||||
.withResultAsync((_) async => await refreshGroupMemberships(group))
|
||||
.withResult((_) => notifyListeners())
|
||||
.mapError((error) {
|
||||
_logger
|
||||
|
@ -348,7 +349,7 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
_logger.finest('Removing ${connection.name} from group: ${group.name}');
|
||||
return GroupsClient(profile)
|
||||
.removeConnectionFromGroup(group, connection)
|
||||
.withResultAsync((_) async => refreshGroupMemberships(group))
|
||||
.withResultAsync((_) async => await refreshGroupMemberships(group))
|
||||
.withResult((_) => notifyListeners())
|
||||
.mapError(
|
||||
(error) {
|
||||
|
|
|
@ -19,7 +19,6 @@ import screen_brightness_macos
|
|||
import shared_preferences_foundation
|
||||
import sqflite
|
||||
import url_launcher_macos
|
||||
import video_player_avfoundation
|
||||
import wakelock_plus
|
||||
import window_to_front
|
||||
|
||||
|
@ -38,7 +37,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
|
||||
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
|
||||
WindowToFrontPlugin.register(with: registry.registrar(forPlugin: "WindowToFrontPlugin"))
|
||||
}
|
||||
|
|
60
pubspec.lock
60
pubspec.lock
|
@ -181,10 +181,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
|
||||
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.2"
|
||||
version: "1.17.1"
|
||||
color_blindness:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -221,10 +221,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: cryptography
|
||||
sha256: d146b76d33d94548cf035233fbc2f4338c1242fa119013bead807d033fc4ae05
|
||||
sha256: df156c5109286340817d21fa7b62f9140f17915077127dd70f8bd7a2a0997a35
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
version: "2.5.0"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -697,10 +697,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.1"
|
||||
version: "0.18.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -753,18 +753,18 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.16"
|
||||
version: "0.12.15"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
version: "0.2.0"
|
||||
media_kit:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1231,10 +1231,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
version: "1.9.1"
|
||||
sprintf:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1327,10 +1327,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
|
||||
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
version: "0.5.1"
|
||||
time_machine:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1375,10 +1375,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba
|
||||
sha256: "47e208a6711459d813ba18af120d9663c20bdf6985d6ad39fe165d2538378d27"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.1"
|
||||
version: "6.1.14"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1423,10 +1423,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2"
|
||||
sha256: ba140138558fcc3eead51a1c42e92a9fb074a1b1149ed3c73e66035b2ccd94f2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.0.19"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1495,10 +1495,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: video_player_avfoundation
|
||||
sha256: "6387c2de77763b45104256b3b00b660089be4f909ded8631457dc11bf635e38f"
|
||||
sha256: bf1a1322bf68bccd349982ba1f5a41314a3880861fb9a93d25d6d0a2345845f0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.4.11"
|
||||
video_player_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1511,10 +1511,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: video_player_web
|
||||
sha256: "2dd24f7ba46bfb5d070e9c795001db95e0ca5f2a3d025e98f287c10c9f0fd62f"
|
||||
sha256: "9c34a243785feca23148bfcd772dbb803d63c9304488177ec4f3f4463802fcb7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.0.17"
|
||||
volume_controller:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1547,14 +1547,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.4-beta"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1575,10 +1567,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: win32_registry
|
||||
sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a"
|
||||
sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "1.1.1"
|
||||
window_to_front:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1612,5 +1604,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.1.0 <4.0.0"
|
||||
flutter: ">=3.13.0"
|
||||
dart: ">=3.0.0 <4.0.0"
|
||||
flutter: ">=3.10.0"
|
||||
|
|
Ładowanie…
Reference in New Issue