Fix interactions browser able to go to profiles never seen before

codemagic-setup
Hank Grabowski 2023-03-22 09:24:14 -04:00
rodzic 0beac5b2c7
commit b9afe6f823
2 zmienionych plików z 20 dodań i 4 usunięć

Wyświetl plik

@ -11,6 +11,7 @@ import '../models/connection.dart';
import '../models/exec_error.dart';
import '../models/interaction_type_enum.dart';
import '../routes.dart';
import '../services/connections_manager.dart';
import '../services/interactions_manager.dart';
import '../services/network_status_service.dart';
import '../utils/active_profile_selector.dart';
@ -66,9 +67,19 @@ class InteractionsViewerScreen extends StatelessWidget {
itemBuilder: (context, index) {
final connection = connections[index];
return ListTile(
onTap: () {
context.pushNamed(ScreenPaths.userProfile,
params: {'id': connection.id});
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,
params: {'id': connection.id});
}
},
leading: ImageControl(
imageUrl: connection.avatarUrl.toString(),

Wyświetl plik

@ -303,7 +303,12 @@ class _SearchScreenState extends State<SearchScreen> {
onTap: () async {
await getIt<ActiveProfileSelector<ConnectionsManager>>()
.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) {
context.pushNamed(ScreenPaths.userProfile,
params: {'id': connection.id});