Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Revert "[locker] New translations (#9426)"

AmanRajSinghMouryab2ffdeb02702
diff --git a/.github/workflows/locker-crowdin-sync.yml b/.github/workflows/locker-crowdin-sync.yml
index bd5d42ce84..63a391f2fb 100644
--- a/.github/workflows/locker-crowdin-sync.yml
+++ b/.github/workflows/locker-crowdin-sync.yml
@@ -30,6 +30,7 @@ jobs:
download_translations: true
localization_branch_name: translations/locker
create_pull_request: true
+ skip_untranslated_strings: true
pull_request_title: "[locker] New translations"
pull_request_body: "New translations from [Crowdin](https://crowdin.com/project/ente-locker-app)"
pull_request_base_branch_name: "main"
diff --git a/mobile/apps/locker/fastlane/metadata/android/es/full_description.txt b/mobile/apps/locker/fastlane/metadata/android/es/full_description.txt
deleted file mode 100644
index 155f0d928e..0000000000
--- a/mobile/apps/locker/fastlane/metadata/android/es/full_description.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Ente Locker es una bóveda para proteger tus documentos más importantes y credenciales con cifrado de extremo a extremo.
-
-GUARDA LO QUE IMPORTA
-• Documentos personales y de identidad
-• Registros financieros y documentos importantes
-• Credenciales y datos de recuperación
-• Notas seguras
-
-COMPARTE DE FORMA PRIVADA
-Comparte elementos específicos con personas de confianza, según tus condiciones.
-
-TRANSFERENCIA DE EMERGENCIA
-Configura contactos de emergencia para que la información pertinente se comparta cuando más se necesita.
-
-PRIVACIDAD POR DISEÑO
-Tus datos están encriptados con tus claves antes de salir de tu dispositivo, por lo que solo tú puedes acceder a ellos. La arquitectura de Ente y el código fuente han sido auditados por Cure53.
diff --git a/mobile/apps/locker/fastlane/metadata/android/es/short_description.txt b/mobile/apps/locker/fastlane/metadata/android/es/short_description.txt
deleted file mode 100644
index f6a0f8c409..0000000000
--- a/mobile/apps/locker/fastlane/metadata/android/es/short_description.txt
+++ /dev/null
@@ -1 +0,0 @@
-Ente Locker: almacena documentos con cifrado de extremo a extremo
diff --git a/mobile/apps/locker/fastlane/metadata/android/es/title.txt b/mobile/apps/locker/fastlane/metadata/android/es/title.txt
deleted file mode 100644
index cdeae2d174..0000000000
--- a/mobile/apps/locker/fastlane/metadata/android/es/title.txt
+++ /dev/null
@@ -1 +0,0 @@
-Ente Locker
diff --git a/mobile/apps/locker/lib/l10n/app_es.arb b/mobile/apps/locker/lib/l10n/app_es.arb
index f2f7289c80..0417666dad 100644
--- a/mobile/apps/locker/lib/l10n/app_es.arb
+++ b/mobile/apps/locker/lib/l10n/app_es.arb
@@ -614,14 +614,6 @@
"@uploadStorageLimitErrorBody": {
"description": "Body shown when uploads fail due to running out of storage"
},
- "uploadSubscriptionExpiredErrorTitle": "Tu suscripción ha caducado",
- "@uploadSubscriptionExpiredErrorTitle": {
- "description": "Title shown when uploads fail because the Photos subscription is expired"
- },
- "uploadSubscriptionExpiredErrorBody": "Tu suscripción de Ente Photos ha caducado. Renueva tu suscripción para seguir subiendo archivos.",
- "@uploadSubscriptionExpiredErrorBody": {
- "description": "Body shown when uploads fail because the Photos subscription is expired"
- },
"uploadFileCountLimitErrorTitle": "Limite de archivos alcanzado",
"@uploadFileCountLimitErrorTitle": {
"description": "Title shown when uploads fail because the locker already has the maximum file count"
@@ -1031,7 +1023,5 @@
"usageFamily": "Familia",
"searchSettings": "Ajustes de búsqueda",
"suggestions": "Sugerencias",
- "noResultsFound": "No se han encontrado resultados",
- "viewActiveSessions": "Ver sesiones activas",
- "authToViewYourActiveSessions": "Por favor, autentícate para ver tus sesiones activas"
+ "noResultsFound": "No se han encontrado resultados"
}
\ No newline at end of file
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 1a89c5d3be..30c8fd35b9 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -2822,7 +2822,6 @@
"privateAndSecureBackupsDesc": "End-to-end encrypted, independently audited and fully open source",
"mlProgressBannerTitle": "Hang tight!",
"mlProgressBannerDescription": "Your photos are getting processed on device to detect faces, objects and more.",
- "mlProgressBannerPaused": "Paused",
"mlProgressBannerStatus": "{indexed} out of {total} photos processed",
"@mlProgressBannerStatus": {
"placeholders": {
diff --git a/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart b/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
index a32f841c3c..c3b2fb13bf 100644
--- a/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
@@ -136,7 +136,6 @@ class _MLProgressBannerState extends State<MLProgressBanner> {
final l10n = AppLocalizations.of(context);
final format = NumberFormat();
final progress = total > 0 ? status.indexedItems.toDouble() / total : 0.0;
- final showPausedPhase = _shouldShowPausedPhase(status);
final showModelDownloadPhase = _shouldShowModelDownloadPhase(status);
final titleStyle = textTheme.largeBold.copyWith(
@@ -200,42 +199,25 @@ class _MLProgressBannerState extends State<MLProgressBanner> {
const SizedBox(height: 24),
ClipRRect(
borderRadius: BorderRadius.circular(2.5),
- child: showPausedPhase
- ? LinearProgressIndicator(
- value: progress,
- minHeight: 5,
- backgroundColor: colorScheme.fillFaint,
- valueColor: AlwaysStoppedAnimation<Color>(
- colorScheme.greenBase,
- ),
- )
- : showModelDownloadPhase
- ? LinearProgressIndicator(
- value: 0.0,
- minHeight: 5,
- backgroundColor: colorScheme.fillFaint,
- valueColor: AlwaysStoppedAnimation<Color>(
- colorScheme.greenBase,
- ),
- )
- : _ShimmerProgressBar(
- progress: progress,
- backgroundColor: colorScheme.fillFaint,
- valueColor: colorScheme.greenBase,
- ),
+ child: LinearProgressIndicator(
+ value: showModelDownloadPhase ? 0.0 : progress,
+ minHeight: 5,
+ backgroundColor: colorScheme.fillFaint,
+ valueColor: AlwaysStoppedAnimation<Color>(
+ colorScheme.greenBase,
+ ),
+ ),
),
const SizedBox(height: 8),
Align(
alignment: Alignment.centerRight,
child: Text(
- showPausedPhase
- ? l10n.mlProgressBannerPaused
- : showModelDownloadPhase
- ? l10n.loadingModel
- : l10n.mlProgressBannerStatus(
- indexed: format.format(status.indexedItems),
- total: format.format(total),
- ),
+ showModelDownloadPhase
+ ? l10n.loadingModel
+ : l10n.mlProgressBannerStatus(
+ indexed: format.format(status.indexedItems),
+ total: format.format(total),
+ ),
style: textTheme.miniMuted,
),
),
@@ -248,17 +230,11 @@ class _MLProgressBannerState extends State<MLProgressBanner> {
bool _shouldShowModelDownloadPhase(IndexStatus status) {
if (!localSettings.isMLLocalIndexingEnabled) return false;
- if (_shouldShowPausedPhase(status)) return false;
if (status.indexedItems > 0) return false;
if (status.pendingItems <= 0) return false;
return !MLIndexingIsolate.instance.areModelsDownloaded;
}
- bool _shouldShowPausedPhase(IndexStatus status) {
- if (status.pendingItems <= 0) return false;
- return !computeController.isDeviceHealthy;
- }
-
void _onDismiss() {
setState(() {
_dismissed = true;
@@ -267,126 +243,3 @@ class _MLProgressBannerState extends State<MLProgressBanner> {
localSettings.setMLProgressBannerDismissed(true);
}
}
-
-class _ShimmerProgressBar extends StatefulWidget {
- final double progress;
- final Color backgroundColor;
- final Color valueColor;
-
- const _ShimmerProgressBar({
- required this.progress,
- required this.backgroundColor,
- required this.valueColor,
- });
-
- @override
- State<_ShimmerProgressBar> createState() => _ShimmerProgressBarState();
-}
-
-class _ShimmerProgressBarState extends State<_ShimmerProgressBar>
- with SingleTickerProviderStateMixin {
- late final AnimationController _controller;
-
- @override
- void initState() {
- super.initState();
- _controller = AnimationController(
- vsync: this,
- duration: const Duration(milliseconds: 1600),
- )..repeat();
- }
-
- @override
- void dispose() {
- _controller.dispose();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) {
- final clampedProgress = widget.progress.clamp(0.0, 1.0).toDouble();
- final displayProgress = clampedProgress > 0 ? clampedProgress : 0.08;
-
- return AnimatedBuilder(
- animation: _controller,
- builder: (context, _) {
- final phase = Curves.easeInOutCubic.transform(_controller.value);
- final pulseColor = Color.lerp(widget.valueColor, Colors.white, 0.55)!;
-
- return SizedBox(
- height: 5,
- child: DecoratedBox(
- decoration: BoxDecoration(
- color: widget.backgroundColor,
- borderRadius: BorderRadius.circular(2.5),
- ),
- child: Align(
- alignment: Alignment.centerLeft,
- child: FractionallySizedBox(
- widthFactor: displayProgress,
- heightFactor: 1,
- child: ClipRRect(
- borderRadius: BorderRadius.circular(2.5),
- child: LayoutBuilder(
- builder: (context, constraints) {
- final pulseWidth =
- (constraints.maxWidth * 0.3).clamp(20.0, 52.0);
- final travelDistance =
- constraints.maxWidth + (pulseWidth * 2);
- final left = (travelDistance * phase) - pulseWidth;
-
- return Stack(
- fit: StackFit.expand,
- children: [
- DecoratedBox(
- decoration: BoxDecoration(
- color: widget.valueColor,
- ),
- ),
- Positioned(
- left: left,
- top: 0,
- bottom: 0,
- width: pulseWidth,
- child: DecoratedBox(
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: [
- Colors.transparent,
- pulseColor.withValues(alpha: 0.18),
- pulseColor.withValues(alpha: 0.5),
- pulseColor.withValues(alpha: 0.18),
- Colors.transparent,
- ],
- stops: const [0.0, 0.24, 0.5, 0.76, 1.0],
- ),
- ),
- ),
- ),
- DecoratedBox(
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [
- Colors.white.withValues(alpha: 0.07),
- Colors.transparent,
- Colors.black.withValues(alpha: 0.03),
- ],
- stops: const [0.0, 0.56, 1.0],
- ),
- ),
- ),
- ],
- );
- },
- ),
- ),
- ),
- ),
- ),
- );
- },
- );
- }
-}
diff --git a/mobile/apps/photos/lib/ui/components/shimmer_loading.dart b/mobile/apps/photos/lib/ui/components/shimmer_loading.dart
deleted file mode 100644
index f886a5c953..0000000000
--- a/mobile/apps/photos/lib/ui/components/shimmer_loading.dart
+++ /dev/null
@@ -1,101 +0,0 @@
-import "package:flutter/material.dart";
-
-class ShimmerLoading extends StatefulWidget {
- final Widget child;
- final Color baseColor;
- final Color highlightColor;
- final Duration duration;
- final bool enabled;
- final double glowIntensity;
-
- const ShimmerLoading({
- super.key,
- required this.child,
- required this.baseColor,
- required this.highlightColor,
- this.duration = const Duration(milliseconds: 1150),
- this.enabled = true,
- this.glowIntensity = 1,
- });
-
- @override
- State<ShimmerLoading> createState() => _ShimmerLoadingState();
-}
-
-class _ShimmerLoadingState extends State<ShimmerLoading>
- with SingleTickerProviderStateMixin {
- late final AnimationController _controller;
-
- @override
- void initState() {
- super.initState();
- _controller = AnimationController(vsync: this, duration: widget.duration);
- if (widget.enabled) {
- _controller.repeat();
- }
- }
-
- @override
- void didUpdateWidget(covariant ShimmerLoading oldWidget) {
- super.didUpdateWidget(oldWidget);
- if (oldWidget.duration != widget.duration) {
- _controller.duration = widget.duration;
- }
- if (!widget.enabled && _controller.isAnimating) {
- _controller.stop();
- } else if (widget.enabled && !_controller.isAnimating) {
- _controller.repeat();
- }
- }
-
- @override
- void dispose() {
- _controller.dispose();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) {
- if (!widget.enabled) {
- return widget.child;
- }
-
- return AnimatedBuilder(
- animation: _controller,
- child: widget.child,
- builder: (context, child) {
- final gradient = _buildGlowPulseGradient();
-
- return ShaderMask(
- blendMode: BlendMode.srcIn,
- shaderCallback: (bounds) {
- return gradient.createShader(bounds);
- },
- child: child!,
- );
- },
- );
- }
-
- LinearGradient _buildGlowPulseGradient() {
- final phase = _controller.value;
- final pulse = phase <= 0.5 ? phase * 2 : (1 - phase) * 2;
- final easedPulse = Curves.easeInOut.transform(pulse);
- final intensity = widget.glowIntensity.clamp(0.0, 1.0).toDouble();
- const minGlow = 0.10;
- final maxGlow = (0.52 * intensity).clamp(minGlow, 0.9).toDouble();
- final glowStrength = minGlow + ((maxGlow - minGlow) * easedPulse);
- final pulseColor =
- Color.lerp(widget.baseColor, widget.highlightColor, glowStrength)!;
-
- return LinearGradient(
- colors: [
- pulseColor,
- pulseColor,
- ],
- stops: const [0.0, 1.0],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- );
- }
-}
diff --git a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
index 552ecd1fb7..5b1cbf673b 100644
--- a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
@@ -6,26 +6,19 @@ import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
import "package:photos/core/user_config.dart";
import 'package:photos/db/files_db.dart';
-import "package:photos/events/app_mode_changed_event.dart";
import 'package:photos/events/backup_folders_updated_event.dart';
-import "package:photos/events/collection_updated_event.dart";
import 'package:photos/events/files_updated_event.dart';
import 'package:photos/events/force_reload_home_gallery_event.dart';
import "package:photos/events/hide_shared_items_from_home_gallery_event.dart";
import 'package:photos/events/local_photos_updated_event.dart';
-import "package:photos/events/permission_granted_event.dart";
-import "package:photos/events/sync_status_update_event.dart";
import 'package:photos/models/file_load_result.dart';
import 'package:photos/models/gallery_type.dart';
import 'package:photos/models/selected_files.dart';
import "package:photos/service_locator.dart";
import 'package:photos/services/collections_service.dart';
import "package:photos/services/filter/db_filters.dart";
-import "package:photos/services/sync/sync_service.dart";
-import "package:photos/ui/home/start_backup_hook_widget.dart";
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import "package:photos/ui/viewer/gallery/component/group/type.dart";
-import "package:photos/ui/viewer/gallery/empty_state.dart";
import 'package:photos/ui/viewer/gallery/gallery.dart';
import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
@@ -139,7 +132,6 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
selectedFiles: widget.selectedFiles,
header: widget.header,
footer: widget.footer,
- emptyState: const HomeGalleryEmptyState(),
reloadDebounceTime: const Duration(seconds: 2),
reloadDebounceExecutionInterval: const Duration(seconds: 5),
priorityReloadDebounceTime: const Duration(milliseconds: 200),
@@ -166,95 +158,3 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
);
}
}
-
-class HomeGalleryEmptyState extends StatefulWidget {
- const HomeGalleryEmptyState({super.key});
-
- @override
- State<HomeGalleryEmptyState> createState() => _HomeGalleryEmptyStateState();
-}
-
-class _HomeGalleryEmptyStateState extends State<HomeGalleryEmptyState> {
- late final List<StreamSubscription<dynamic>> _stateSubscriptions;
- SyncStatusUpdate? _lastSyncStatusEvent;
-
- @override
- void initState() {
- super.initState();
- _lastSyncStatusEvent = SyncService.instance.getLastSyncStatusEvent();
- _stateSubscriptions = [
- Bus.instance.on<SyncStatusUpdate>().listen((event) {
- _lastSyncStatusEvent = event;
- _onStateChanged();
- }),
- Bus.instance
- .on<BackupFoldersUpdatedEvent>()
- .listen((_) => _onStateChanged()),
- Bus.instance
- .on<PermissionGrantedEvent>()
- .listen((_) => _onStateChanged()),
- Bus.instance.on<AppModeChangedEvent>().listen((_) => _onStateChanged()),
- Bus.instance
- .on<CollectionUpdatedEvent>()
- .listen((_) => _onStateChanged()),
- ];
- }
-
- @override
- void dispose() {
- for (final subscription in _stateSubscriptions) {
- subscription.cancel();
- }
- super.dispose();
- }
-
- void _onStateChanged() {
- if (!mounted) {
- return;
- }
- setState(() {});
- }
-
- @override
- Widget build(BuildContext context) {
- final shouldShowLoading = !isOfflineMode &&
- (_isSyncLikelyInProgress(_lastSyncStatusEvent) ||
- SyncService.instance.isSyncInProgress());
- if (shouldShowLoading) {
- return const StartBackupHookShimmer();
- }
- if (_shouldShowBackupHook()) {
- return const StartBackupHookBody();
- }
- return const EmptyState();
- }
-
- bool _shouldShowBackupHook() {
- if (isOfflineMode) {
- return false;
- }
- final bool noFoldersSelected =
- !backupPreferenceService.hasSelectedAnyBackupFolder;
- final bool hasLimitedPermission =
- permissionService.hasGrantedLimitedPermissions();
- final bool hasActiveCollections =
- CollectionsService.instance.getActiveCollections().isNotEmpty;
- return !hasActiveCollections && noFoldersSelected && !hasLimitedPermission;
- }
-
- bool _isSyncLikelyInProgress(SyncStatusUpdate? event) {
- if (event == null) return false;
- switch (event.status) {
- case SyncStatus.startedFirstGalleryImport:
- case SyncStatus.applyingRemoteDiff:
- case SyncStatus.preparingForUpload:
- case SyncStatus.inProgress:
- return true;
- case SyncStatus.completedFirstGalleryImport:
- case SyncStatus.completedBackup:
- case SyncStatus.paused:
- case SyncStatus.error:
- return false;
- }
- }
-}
diff --git a/mobile/apps/photos/lib/ui/home/memories/memories_widget.dart b/mobile/apps/photos/lib/ui/home/memories/memories_widget.dart
index 373638c784..52e9dd8a36 100644
--- a/mobile/apps/photos/lib/ui/home/memories/memories_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/memories_widget.dart
@@ -9,8 +9,7 @@ import "package:photos/events/memory_seen_event.dart";
import 'package:photos/models/memories/memory.dart';
import "package:photos/models/memories/smart_memory.dart";
import "package:photos/service_locator.dart";
-import "package:photos/theme/colors.dart";
-import "package:photos/ui/components/shimmer_loading.dart";
+import "package:photos/ui/common/loading_widget.dart";
import 'package:photos/ui/home/memories/memory_cover_widget.dart';
class MemoriesWidget extends StatefulWidget {
@@ -81,83 +80,27 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
future: memoriesCacheService.getMemories(),
builder: (context, snapshot) {
if (snapshot.hasError || !snapshot.hasData) {
- return _buildMemoriesLoadingShimmer();
- }
- if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) {
- return const SizedBox.shrink();
- }
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(
- height: 12,
- ),
- _buildMemories(snapshot.data!),
- const SizedBox(height: 10),
- ],
- ).animate().fadeIn(
- duration: const Duration(milliseconds: 250),
- curve: Curves.easeInOutCirc,
- );
- },
- );
- }
-
- Widget _buildMemoriesLoadingShimmer() {
- final isDark = Theme.of(context).brightness == Brightness.dark;
- final skeletonColor = isDark ? fillDarkestDark : fillDarkLight;
- final shimmerBaseColor = isDark ? fillDarkerDark : fillDarkLight;
- final highlightColor = isDark
- ? fillDarkestDark
- : contentLighterLight.withValues(
- alpha: 0.5,
+ return SizedBox(
+ height: _memoryheight + 12 + 10,
+ child: const EnteLoadingWidget(),
);
-
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- LayoutBuilder(
- builder: (context, constraints) {
- const itemCount = 4;
- const horizontalPadding = MemoryCoverWidget.horizontalPadding;
- final tileWidth =
- ((constraints.maxWidth / itemCount) - (horizontalPadding * 2))
- .clamp(0.0, double.infinity);
- final tileHeight = tileWidth / MemoryCoverWidget.aspectRatio;
-
- return ShimmerLoading(
- baseColor: shimmerBaseColor,
- highlightColor: highlightColor,
- duration: const Duration(milliseconds: 2000),
- glowIntensity: 0.9,
- child: SizedBox(
- height: tileHeight + (MemoryCoverWidget.outerStrokeWidth * 2),
- child: Row(
- children: List.generate(itemCount, (_) {
- return Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: horizontalPadding,
- ),
- child: SizedBox(
- width: tileWidth,
- height: tileHeight,
- child: DecoratedBox(
- decoration: BoxDecoration(
- color: skeletonColor,
- borderRadius: BorderRadius.circular(5),
- ),
- ),
- ),
- );
- }),
- ),
+ } else {
+ if (snapshot.data!.isEmpty) return const SizedBox.shrink();
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(
+ height: 12,
),
- );
- },
- ),
- const SizedBox(height: 10),
- ],
+ _buildMemories(snapshot.data!),
+ const SizedBox(height: 10),
+ ],
+ ).animate().fadeIn(
+ duration: const Duration(milliseconds: 250),
+ curve: Curves.easeInOutCirc,
+ );
+ }
+ },
);
}
diff --git a/mobile/apps/photos/lib/ui/home/start_backup_hook_widget.dart b/mobile/apps/photos/lib/ui/home/start_backup_hook_widget.dart
index f1bc852b20..0558982b11 100644
--- a/mobile/apps/photos/lib/ui/home/start_backup_hook_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/start_backup_hook_widget.dart
@@ -1,44 +1,12 @@
import 'package:flutter/material.dart';
import 'package:photos/generated/l10n.dart';
-import 'package:photos/service_locator.dart';
-import 'package:photos/theme/colors.dart';
import 'package:photos/ui/common/backup_flow_helper.dart';
import 'package:photos/ui/common/gradient_button.dart';
-import 'package:photos/ui/components/shimmer_loading.dart';
class StartBackupHookWidget extends StatelessWidget {
final Widget headerWidget;
- final bool showShimmer;
- const StartBackupHookWidget({
- super.key,
- required this.headerWidget,
- required this.showShimmer,
- });
-
- @override
- Widget build(BuildContext context) {
- if (showShimmer) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- headerWidget,
- const Expanded(child: StartBackupHookShimmer()),
- ],
- );
- }
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- headerWidget,
- const Expanded(child: StartBackupHookBody()),
- ],
- );
- }
-}
-
-class StartBackupHookBody extends StatelessWidget {
- const StartBackupHookBody({super.key});
+ const StartBackupHookWidget({super.key, required this.headerWidget});
@override
Widget build(BuildContext context) {
@@ -46,10 +14,13 @@ class StartBackupHookBody extends StatelessWidget {
builder: (context, constraints) {
return SingleChildScrollView(
child: ConstrainedBox(
- constraints: BoxConstraints(minHeight: constraints.maxHeight),
+ constraints: BoxConstraints(
+ minHeight: constraints.maxHeight,
+ ),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
+ headerWidget,
Padding(
padding: const EdgeInsets.only(top: 64),
child: Image.asset(
@@ -92,224 +63,3 @@ class StartBackupHookBody extends StatelessWidget {
);
}
}
-
-class StartBackupHookShimmer extends StatelessWidget {
- const StartBackupHookShimmer({super.key});
-
- @override
- Widget build(BuildContext context) {
- return const _ShimmerGallerySkeleton();
- }
-}
-
-class _ShimmerGallerySkeleton extends StatelessWidget {
- static const _headerSkeletonWidth = 86.0;
-
- const _ShimmerGallerySkeleton();
-
- @override
- Widget build(BuildContext context) {
- final isDark = Theme.of(context).brightness == Brightness.dark;
- final skeletonColor = isDark ? fillDarkestDark : fillDarkLight;
- final shimmerBaseColor = isDark ? fillDarkerDark : fillDarkLight;
- final highlightColor = isDark
- ? fillDarkestDark
- : contentLighterLight.withValues(
- alpha: 0.5,
- );
- const glowIntensity = 0.9;
-
- return LayoutBuilder(
- builder: (context, constraints) {
- final metrics = _SkeletonMetrics.fromConstraints(constraints);
-
- return ShimmerLoading(
- baseColor: shimmerBaseColor,
- highlightColor: highlightColor,
- duration: const Duration(milliseconds: 2000),
- glowIntensity: glowIntensity,
- child: SingleChildScrollView(
- child: ConstrainedBox(
- constraints: BoxConstraints(minHeight: constraints.maxHeight),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: _SkeletonMetrics.topPadding),
- if (metrics.firstSectionRows > 0) ...[
- _SectionHeaderSkeleton(
- color: skeletonColor,
- width: _headerSkeletonWidth,
- ),
- _PhotoGridSkeleton(
- rows: metrics.firstSectionRows,
- crossAxisCount: metrics.crossAxisCount,
- tileSize: metrics.tileSize,
- spacing: _SkeletonMetrics.spacing,
- color: skeletonColor,
- ),
- ],
- if (metrics.secondSectionRows > 0) ...[
- _SectionHeaderSkeleton(
- color: skeletonColor,
- width: _headerSkeletonWidth,
- ),
- _PhotoGridSkeleton(
- rows: metrics.secondSectionRows,
- crossAxisCount: metrics.crossAxisCount,
- tileSize: metrics.tileSize,
- spacing: _SkeletonMetrics.spacing,
- color: skeletonColor,
- ),
- ],
- ],
- ),
- ),
- ),
- );
- },
- );
- }
-}
-
-class _SkeletonMetrics {
- static const topPadding = 8.0;
- static const spacing = 2.0;
- static const _sectionHeaderTextHeight = 14.0;
- static const _firstSectionTargetRows = 4;
- static const _secondSectionTargetRows = 3;
-
- final int crossAxisCount;
- final double tileSize;
- final int firstSectionRows;
- final int secondSectionRows;
-
- const _SkeletonMetrics({
- required this.crossAxisCount,
- required this.tileSize,
- required this.firstSectionRows,
- required this.secondSectionRows,
- });
-
- factory _SkeletonMetrics.fromConstraints(BoxConstraints constraints) {
- final crossAxisCount = localSettings.getPhotoGridSize();
- final tileSize = (constraints.maxWidth - (crossAxisCount - 1) * spacing) /
- crossAxisCount;
-
- final sectionHeaderVerticalPadding = crossAxisCount < 5 ? 12.0 : 14.0;
- final sectionHeaderHeight =
- (sectionHeaderVerticalPadding * 2) + _sectionHeaderTextHeight;
-
- final availableGridHeight =
- constraints.maxHeight - topPadding - (sectionHeaderHeight * 2);
- final gridAreaHeight =
- availableGridHeight.isNegative ? 0.0 : availableGridHeight;
- final computedRows =
- ((gridAreaHeight + spacing) / (tileSize + spacing)).floor();
- const targetTotalRows = _firstSectionTargetRows + _secondSectionTargetRows;
- final totalRows = computedRows.clamp(0, targetTotalRows).toInt();
-
- final int firstSectionRows;
- final int secondSectionRows;
- if (totalRows <= 0) {
- firstSectionRows = 0;
- secondSectionRows = 0;
- } else {
- firstSectionRows = totalRows.clamp(0, _firstSectionTargetRows).toInt();
- secondSectionRows = (totalRows - firstSectionRows)
- .clamp(0, _secondSectionTargetRows)
- .toInt();
- }
-
- return _SkeletonMetrics(
- crossAxisCount: crossAxisCount,
- tileSize: tileSize,
- firstSectionRows: firstSectionRows,
- secondSectionRows: secondSectionRows,
- );
- }
-}
-
-class _SectionHeaderSkeleton extends StatelessWidget {
- final Color color;
- final double width;
-
- const _SectionHeaderSkeleton({
- required this.color,
- required this.width,
- });
-
- @override
- Widget build(BuildContext context) {
- final gridSize = localSettings.getPhotoGridSize();
- final horizontalPadding = gridSize < 5 ? 12.0 : 8.0;
- final verticalPadding = gridSize < 5 ? 12.0 : 14.0;
- final headerHeight = (verticalPadding * 2) + 14;
-
- return SizedBox(
- height: headerHeight,
- child: Padding(
- padding: EdgeInsets.symmetric(
- horizontal: horizontalPadding,
- vertical: verticalPadding,
- ),
- child: Align(
- alignment: Alignment.centerLeft,
- child: Container(
- width: width,
- height: 14,
- decoration: BoxDecoration(
- color: color,
- borderRadius: BorderRadius.circular(2),
- ),
- ),
- ),
- ),
- );
- }
-}
-
-class _PhotoGridSkeleton extends StatelessWidget {
- final int rows;
- final int crossAxisCount;
- final double tileSize;
- final double spacing;
- final Color color;
-
- const _PhotoGridSkeleton({
- required this.rows,
- required this.crossAxisCount,
- required this.tileSize,
- required this.spacing,
- required this.color,
- });
-
- @override
- Widget build(BuildContext context) {
- return Column(
- children: List.generate(rows, (rowIndex) {
- return Padding(
- padding: EdgeInsets.only(bottom: rowIndex == rows - 1 ? 0 : spacing),
- child: Row(
- children: List.generate(crossAxisCount, (colIndex) {
- return Padding(
- padding: EdgeInsets.only(
- right: colIndex == crossAxisCount - 1 ? 0 : spacing,
- ),
- child: SizedBox(
- width: tileSize,
- height: tileSize,
- child: DecoratedBox(
- decoration: BoxDecoration(
- color: color,
- borderRadius: BorderRadius.circular(1),
- ),
- ),
- ),
- );
- }),
- ),
- );
- }),
- );
- }
-}
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index 29fe1d704d..0d287b14c7 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -68,6 +68,7 @@ import "package:photos/ui/home/home_bottom_nav_bar.dart";
import "package:photos/ui/home/home_gallery_widget.dart";
import "package:photos/ui/home/landing_page_widget.dart";
import "package:photos/ui/home/loading_photos_widget.dart";
+import "package:photos/ui/home/start_backup_hook_widget.dart";
import "package:photos/ui/notification/update/change_log_page.dart";
import "package:photos/ui/rituals/ritual_camera_page.dart";
import "package:photos/ui/rituals/ritual_page.dart";
@@ -934,7 +935,11 @@ class _HomeWidgetState extends State<HomeWidget> {
? const NeverScrollableScrollPhysics()
: const BouncingScrollPhysics(),
children: [
- child!,
+ _showShowBackupHook
+ ? const StartBackupHookWidget(
+ headerWidget: HeaderWidget(),
+ )
+ : child!,
UserCollectionsTab(selectedAlbums: _selectedAlbums),
_sharedCollectionTab,
_searchTab,
@@ -1245,7 +1250,7 @@ class _HomeWidgetState extends State<HomeWidget> {
return;
}
_collectionsSyncTriggered = true;
- CollectionsService.instance.sync().whenComplete(() {
+ CollectionsService.instance.sync().then((_) {
if (mounted) {
setState(() {});
}