mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-24 16:04:43 +01:00
Fix people browser showing error when server app not installed
This commit is contained in:
parent
ffa82a1f31
commit
194b1b8836
1 changed files with 10 additions and 1 deletions
|
@ -12,6 +12,7 @@ import 'package:nc_photos/app_localizations.dart';
|
||||||
import 'package:nc_photos/bloc/list_person.dart';
|
import 'package:nc_photos/bloc/list_person.dart';
|
||||||
import 'package:nc_photos/cache_manager_util.dart';
|
import 'package:nc_photos/cache_manager_util.dart';
|
||||||
import 'package:nc_photos/entity/person.dart';
|
import 'package:nc_photos/entity/person.dart';
|
||||||
|
import 'package:nc_photos/exception.dart';
|
||||||
import 'package:nc_photos/exception_util.dart' as exception_util;
|
import 'package:nc_photos/exception_util.dart' as exception_util;
|
||||||
import 'package:nc_photos/help_utils.dart' as help_utils;
|
import 'package:nc_photos/help_utils.dart' as help_utils;
|
||||||
import 'package:nc_photos/iterable_extension.dart';
|
import 'package:nc_photos/iterable_extension.dart';
|
||||||
|
@ -82,7 +83,8 @@ class _PeopleBrowserState extends State<PeopleBrowser> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildContent(BuildContext context, ListPersonBlocState state) {
|
Widget _buildContent(BuildContext context, ListPersonBlocState state) {
|
||||||
if (state is ListPersonBlocSuccess && _items.isEmpty) {
|
if ((state is ListPersonBlocSuccess || state is ListPersonBlocFailure) &&
|
||||||
|
_items.isEmpty) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
AppBar(
|
AppBar(
|
||||||
|
@ -180,6 +182,13 @@ class _PeopleBrowserState extends State<PeopleBrowser> {
|
||||||
_transformItems(state.items);
|
_transformItems(state.items);
|
||||||
} else if (state is ListPersonBlocFailure) {
|
} else if (state is ListPersonBlocFailure) {
|
||||||
_transformItems(state.items);
|
_transformItems(state.items);
|
||||||
|
try {
|
||||||
|
final e = state.exception as ApiException;
|
||||||
|
if (e.response.statusCode == 404) {
|
||||||
|
// face recognition app probably not installed, ignore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
content: Text(exception_util.toUserString(state.exception)),
|
content: Text(exception_util.toUserString(state.exception)),
|
||||||
duration: k.snackBarDurationNormal,
|
duration: k.snackBarDurationNormal,
|
||||||
|
|
Loading…
Add table
Reference in a new issue