Fix interactions browser able to go to profiles never seen before

This commit is contained in:
Hank Grabowski 2023-03-22 09:24:14 -04:00
parent 0beac5b2c7
commit b9afe6f823
2 changed files with 20 additions and 4 deletions

View file

@ -11,6 +11,7 @@ import '../models/connection.dart';
import '../models/exec_error.dart'; import '../models/exec_error.dart';
import '../models/interaction_type_enum.dart'; import '../models/interaction_type_enum.dart';
import '../routes.dart'; import '../routes.dart';
import '../services/connections_manager.dart';
import '../services/interactions_manager.dart'; import '../services/interactions_manager.dart';
import '../services/network_status_service.dart'; import '../services/network_status_service.dart';
import '../utils/active_profile_selector.dart'; import '../utils/active_profile_selector.dart';
@ -66,9 +67,19 @@ class InteractionsViewerScreen extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final connection = connections[index]; final connection = connections[index];
return ListTile( return ListTile(
onTap: () { onTap: () async {
await getIt<ActiveProfileSelector<ConnectionsManager>>()
.activeEntry
.andThenSuccessAsync((cm) async {
final existingData = cm.getById(connection.id);
if (existingData.isFailure) {
await cm.fullRefresh(connection);
}
});
if (context.mounted) {
context.pushNamed(ScreenPaths.userProfile, context.pushNamed(ScreenPaths.userProfile,
params: {'id': connection.id}); params: {'id': connection.id});
}
}, },
leading: ImageControl( leading: ImageControl(
imageUrl: connection.avatarUrl.toString(), imageUrl: connection.avatarUrl.toString(),

View file

@ -303,7 +303,12 @@ class _SearchScreenState extends State<SearchScreen> {
onTap: () async { onTap: () async {
await getIt<ActiveProfileSelector<ConnectionsManager>>() await getIt<ActiveProfileSelector<ConnectionsManager>>()
.activeEntry .activeEntry
.andThenSuccessAsync((cm) async => cm.fullRefresh(connection)); .andThenSuccessAsync((cm) async {
final existingData = cm.getById(connection.id);
if (existingData.isFailure) {
await cm.fullRefresh(connection);
}
});
if (context.mounted) { if (context.mounted) {
context.pushNamed(ScreenPaths.userProfile, context.pushNamed(ScreenPaths.userProfile,
params: {'id': connection.id}); params: {'id': connection.id});