[mob][photos] Initial settings screen for face recognition

This commit is contained in:
laurenspriem 2024-05-16 14:30:45 +05:30
parent ccec166fa0
commit e414128f18
27 changed files with 153 additions and 16 deletions

@ -1 +1 @@
Subproject commit 8a3731352af133a02223a6c7b1f37c4abb096af0
Subproject commit 8e7701d6a40462733043f54b3849faf35af70a83

View file

@ -46,6 +46,10 @@ class MessageLookup extends MessageLookupByLibrary {
"Edits to location will only be seen within Ente"),
"enterPersonName":
MessageLookupByLibrary.simpleMessage("Enter person name"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"fileTypes": MessageLookupByLibrary.simpleMessage("File types"),
"joinDiscord": MessageLookupByLibrary.simpleMessage("Join Discord"),
"locations": MessageLookupByLibrary.simpleMessage("Locations"),

View file

@ -702,6 +702,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Protokolle exportieren"),
"exportYourData":
MessageLookupByLibrary.simpleMessage("Daten exportieren"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"faces": MessageLookupByLibrary.simpleMessage("Gesichter"),
"failedToApplyCode": MessageLookupByLibrary.simpleMessage(
"Der Code konnte nicht aktiviert werden"),

View file

@ -700,6 +700,10 @@ class MessageLookup extends MessageLookupByLibrary {
"exportLogs": MessageLookupByLibrary.simpleMessage("Export logs"),
"exportYourData":
MessageLookupByLibrary.simpleMessage("Export your data"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"faces": MessageLookupByLibrary.simpleMessage("Faces"),
"failedToApplyCode":
MessageLookupByLibrary.simpleMessage("Failed to apply code"),

View file

@ -611,6 +611,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Exportar registros"),
"exportYourData":
MessageLookupByLibrary.simpleMessage("Exportar tus datos"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"failedToApplyCode":
MessageLookupByLibrary.simpleMessage("Error al aplicar el código"),
"failedToCancel":

View file

@ -690,6 +690,10 @@ class MessageLookup extends MessageLookupByLibrary {
"exportLogs": MessageLookupByLibrary.simpleMessage("Exporter les logs"),
"exportYourData":
MessageLookupByLibrary.simpleMessage("Exportez vos données"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"faces": MessageLookupByLibrary.simpleMessage("Visages"),
"failedToApplyCode": MessageLookupByLibrary.simpleMessage(
"Impossible d\'appliquer le code"),

View file

@ -667,6 +667,10 @@ class MessageLookup extends MessageLookupByLibrary {
"Questo link è scaduto. Si prega di selezionare un nuovo orario di scadenza o disabilitare la scadenza del link."),
"exportLogs": MessageLookupByLibrary.simpleMessage("Esporta log"),
"exportYourData": MessageLookupByLibrary.simpleMessage("Esporta dati"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"failedToApplyCode": MessageLookupByLibrary.simpleMessage(
"Impossibile applicare il codice"),
"failedToCancel":

View file

@ -46,6 +46,10 @@ class MessageLookup extends MessageLookupByLibrary {
"Edits to location will only be seen within Ente"),
"enterPersonName":
MessageLookupByLibrary.simpleMessage("Enter person name"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"fileTypes": MessageLookupByLibrary.simpleMessage("File types"),
"joinDiscord": MessageLookupByLibrary.simpleMessage("Join Discord"),
"locations": MessageLookupByLibrary.simpleMessage("Locations"),

View file

@ -723,6 +723,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Logboek exporteren"),
"exportYourData":
MessageLookupByLibrary.simpleMessage("Exporteer je gegevens"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"faces": MessageLookupByLibrary.simpleMessage("Gezichten"),
"failedToApplyCode":
MessageLookupByLibrary.simpleMessage("Code toepassen mislukt"),

View file

@ -63,6 +63,10 @@ class MessageLookup extends MessageLookupByLibrary {
"Vennligst skriv inn en gyldig e-postadresse."),
"enterYourEmailAddress": MessageLookupByLibrary.simpleMessage(
"Skriv inn e-postadressen din"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"feedback": MessageLookupByLibrary.simpleMessage("Tilbakemelding"),
"fileTypes": MessageLookupByLibrary.simpleMessage("File types"),
"invalidEmailAddress":

View file

@ -111,6 +111,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Wprowadź hasło"),
"enterYourRecoveryKey": MessageLookupByLibrary.simpleMessage(
"Wprowadź swój klucz odzyskiwania"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"feedback": MessageLookupByLibrary.simpleMessage("Informacja zwrotna"),
"fileTypes": MessageLookupByLibrary.simpleMessage("File types"),
"forgotPassword":

View file

@ -713,6 +713,10 @@ class MessageLookup extends MessageLookupByLibrary {
"exportLogs": MessageLookupByLibrary.simpleMessage("Exportar logs"),
"exportYourData":
MessageLookupByLibrary.simpleMessage("Exportar seus dados"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"faces": MessageLookupByLibrary.simpleMessage("Rostos"),
"failedToApplyCode":
MessageLookupByLibrary.simpleMessage("Falha ao aplicar o código"),

View file

@ -592,6 +592,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("此链接已过期。请选择新的过期时间或禁用链接有效期。"),
"exportLogs": MessageLookupByLibrary.simpleMessage("导出日志"),
"exportYourData": MessageLookupByLibrary.simpleMessage("导出您的数据"),
"faceRecognition":
MessageLookupByLibrary.simpleMessage("Face recognition"),
"faceRecognitionIndexingDescription": MessageLookupByLibrary.simpleMessage(
"Please note that this will result in a higher bandwidth and battery usage until all items are indexed."),
"faces": MessageLookupByLibrary.simpleMessage("人脸"),
"failedToApplyCode": MessageLookupByLibrary.simpleMessage("无法使用此代码"),
"failedToCancel": MessageLookupByLibrary.simpleMessage("取消失败"),

View file

@ -8753,6 +8753,26 @@ class S {
args: [],
);
}
/// `Face recognition`
String get faceRecognition {
return Intl.message(
'Face recognition',
name: 'faceRecognition',
desc: '',
args: [],
);
}
/// `Please note that this will result in a higher bandwidth and battery usage until all items are indexed.`
String get faceRecognitionIndexingDescription {
return Intl.message(
'Please note that this will result in a higher bandwidth and battery usage until all items are indexed.',
name: 'faceRecognitionIndexingDescription',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View file

@ -20,5 +20,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -1208,5 +1208,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -1231,5 +1231,7 @@
"castIPMismatchBody": "Please make sure you are on the same network as the TV.",
"pairingComplete": "Pairing complete",
"autoPair": "Auto pair",
"pairWithPin": "Pair with PIN"
"pairWithPin": "Pair with PIN",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -982,5 +982,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -1163,5 +1163,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -1125,5 +1125,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -20,5 +20,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -1226,5 +1226,7 @@
"stopCastingBody": "Wil je stoppen met casten?",
"castIPMismatchTitle": "Album casten mislukt",
"castIPMismatchBody": "Zorg ervoor dat je op hetzelfde netwerk zit als de tv.",
"pairingComplete": "Koppeling voltooid"
"pairingComplete": "Koppeling voltooid",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -34,5 +34,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -121,5 +121,7 @@
"createCollaborativeLink": "Create collaborative link",
"search": "Search",
"enterPersonName": "Enter person name",
"removePersonLabel": "Remove person label"
"removePersonLabel": "Remove person label",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -1226,5 +1226,7 @@
"stopCastingBody": "Você quer parar a transmissão?",
"castIPMismatchTitle": "Falha ao transmitir álbum",
"castIPMismatchBody": "Certifique-se de estar na mesma rede que a TV.",
"pairingComplete": "Pareamento concluído"
"pairingComplete": "Pareamento concluído",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -1226,5 +1226,7 @@
"stopCastingBody": "您想停止投放吗?",
"castIPMismatchTitle": "投放相册失败",
"castIPMismatchBody": "请确保您的设备与电视处于同一网络。",
"pairingComplete": "配对完成"
"pairingComplete": "配对完成",
"faceRecognition": "Face recognition",
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed."
}

View file

@ -6,6 +6,7 @@ import "package:photos/core/event_bus.dart";
import 'package:photos/events/embedding_updated_event.dart';
import "package:photos/generated/l10n.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/machine_learning/face_ml/face_ml_service.dart";
import 'package:photos/services/machine_learning/semantic_search/frameworks/ml_framework.dart';
import 'package:photos/services/machine_learning/semantic_search/semantic_search_service.dart';
import "package:photos/theme/ente_theme.dart";
@ -89,6 +90,8 @@ class _MachineLearningSettingsPageState
mainAxisSize: MainAxisSize.min,
children: [
_getMagicSearchSettings(context),
const SizedBox(height: 12),
_getFacesSearchSettings(context),
],
),
),
@ -147,7 +150,7 @@ class _MachineLearningSettingsPageState
children: [
_state == InitializationState.initialized
? const MagicSearchIndexStatsWidget()
: ModelLoadingState(_state),
: MagicSearchModelLoadingState(_state),
const SizedBox(
height: 12,
),
@ -174,12 +177,54 @@ class _MachineLearningSettingsPageState
],
);
}
Widget _getFacesSearchSettings(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final hasEnabled = LocalSettings.instance.isFaceIndexingEnabled;
return Column(
children: [
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: S.of(context).faceRecognition,
),
menuItemColor: colorScheme.fillFaint,
trailingWidget: ToggleSwitchWidget(
value: () => LocalSettings.instance.isFaceIndexingEnabled,
onChanged: () async {
final isEnabled =
await LocalSettings.instance.toggleFaceIndexing();
if (isEnabled) {
unawaited(FaceMlService.instance.ensureInitialized());
} else {
FaceMlService.instance.pauseIndexing();
}
if (mounted) {
setState(() {});
}
},
),
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
isGestureDetectorDisabled: true,
),
const SizedBox(
height: 4,
),
MenuSectionDescriptionWidget(
content: S.of(context).faceRecognitionIndexingDescription,
),
const SizedBox(
height: 12,
),
],
);
}
}
class ModelLoadingState extends StatelessWidget {
class MagicSearchModelLoadingState extends StatelessWidget {
final InitializationState state;
const ModelLoadingState(
const MagicSearchModelLoadingState(
this.state, {
Key? key,
}) : super(key: key);