Merge branch 'main' into fix/save-album-sort
This commit is contained in:
@@ -169,7 +169,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
|
||||
album.activityEnabled = value;
|
||||
}
|
||||
},
|
||||
activeColor: activityEnabled.value ? context.primaryColor : context.themeData.disabledColor,
|
||||
activeThumbColor: activityEnabled.value ? context.primaryColor : context.themeData.disabledColor,
|
||||
dense: true,
|
||||
title: Text(
|
||||
"comments_and_likes",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -9,11 +11,13 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/extensions/theme_extensions.dart';
|
||||
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/backup/backup_toggle_button.widget.dart';
|
||||
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
||||
import 'package:immich_mobile/providers/background_sync.provider.dart';
|
||||
import 'package:immich_mobile/providers/backup/backup_album.provider.dart';
|
||||
import 'package:immich_mobile/providers/backup/drift_backup.provider.dart';
|
||||
import 'package:immich_mobile/providers/user.provider.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||
import 'package:immich_mobile/widgets/backup/backup_info_card.dart';
|
||||
|
||||
@RoutePage()
|
||||
@@ -25,6 +29,8 @@ class DriftBackupPage extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _DriftBackupPageState extends ConsumerState<DriftBackupPage> {
|
||||
Timer? _countPoller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -33,9 +39,42 @@ class _DriftBackupPageState extends ConsumerState<DriftBackupPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableBackup)) {
|
||||
_startCountPolling();
|
||||
}
|
||||
|
||||
ref.read(driftBackupProvider.notifier).getBackupStatus(currentUser.id);
|
||||
}
|
||||
|
||||
void _startCountPolling() {
|
||||
_countPoller?.cancel();
|
||||
_countPoller = Timer.periodic(const Duration(seconds: 5), (timer) async {
|
||||
if (!mounted) {
|
||||
timer.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
final currentUser = ref.read(currentUserProvider);
|
||||
if (currentUser == null) {
|
||||
timer.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
await ref.read(driftBackupProvider.notifier).getBackupStatus(currentUser.id);
|
||||
});
|
||||
}
|
||||
|
||||
void _stopCountPolling() {
|
||||
_countPoller?.cancel();
|
||||
_countPoller = null;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_stopCountPolling();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final selectedAlbum = ref
|
||||
@@ -55,10 +94,12 @@ class _DriftBackupPageState extends ConsumerState<DriftBackupPage> {
|
||||
await backgroundManager.syncRemote();
|
||||
await backupNotifier.getBackupStatus(currentUser.id);
|
||||
await backupNotifier.startBackup(currentUser.id);
|
||||
_startCountPolling();
|
||||
}
|
||||
|
||||
Future<void> stopBackup() async {
|
||||
await backupNotifier.cancel();
|
||||
_stopCountPolling();
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
|
||||
@@ -112,7 +112,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
|
||||
return SwitchListTile.adaptive(
|
||||
value: showMetadata.value,
|
||||
onChanged: newShareLink.value.isEmpty ? (value) => showMetadata.value = value : null,
|
||||
activeColor: colorScheme.primary,
|
||||
activeThumbColor: colorScheme.primary,
|
||||
dense: true,
|
||||
title: Text("show_metadata", style: themeData.textTheme.labelLarge?.copyWith(fontWeight: FontWeight.bold)).tr(),
|
||||
);
|
||||
@@ -122,7 +122,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
|
||||
return SwitchListTile.adaptive(
|
||||
value: allowDownload.value,
|
||||
onChanged: newShareLink.value.isEmpty ? (value) => allowDownload.value = value : null,
|
||||
activeColor: colorScheme.primary,
|
||||
activeThumbColor: colorScheme.primary,
|
||||
dense: true,
|
||||
title: Text(
|
||||
"allow_public_user_to_download",
|
||||
@@ -135,7 +135,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
|
||||
return SwitchListTile.adaptive(
|
||||
value: allowUpload.value,
|
||||
onChanged: newShareLink.value.isEmpty ? (value) => allowUpload.value = value : null,
|
||||
activeColor: colorScheme.primary,
|
||||
activeThumbColor: colorScheme.primary,
|
||||
dense: true,
|
||||
title: Text(
|
||||
"allow_public_user_to_upload",
|
||||
@@ -148,7 +148,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
|
||||
return SwitchListTile.adaptive(
|
||||
value: editExpiry.value,
|
||||
onChanged: newShareLink.value.isEmpty ? (value) => editExpiry.value = value : null,
|
||||
activeColor: colorScheme.primary,
|
||||
activeThumbColor: colorScheme.primary,
|
||||
dense: true,
|
||||
title: Text(
|
||||
"change_expiration_time",
|
||||
|
||||
@@ -208,7 +208,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget {
|
||||
activityEnabled.value = value;
|
||||
await ref.read(remoteAlbumProvider.notifier).setActivityStatus(album.id, value);
|
||||
},
|
||||
activeColor: activityEnabled.value ? context.primaryColor : context.themeData.disabledColor,
|
||||
activeThumbColor: activityEnabled.value ? context.primaryColor : context.themeData.disabledColor,
|
||||
dense: true,
|
||||
title: Text(
|
||||
"comments_and_likes",
|
||||
|
||||
@@ -96,7 +96,7 @@ mixin CancellableImageProviderMixin<T extends Object> on CancellableImageProvide
|
||||
|
||||
final operation = cachedOperation;
|
||||
if (operation != null) {
|
||||
this.cachedOperation = null;
|
||||
cachedOperation = null;
|
||||
operation.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import 'package:immich_mobile/infrastructure/repositories/backup.repository.dart
|
||||
import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
||||
import 'package:immich_mobile/providers/user.provider.dart';
|
||||
import 'package:immich_mobile/services/upload.service.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:immich_mobile/utils/debug_print.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class EnqueueStatus {
|
||||
final int enqueueCount;
|
||||
@@ -234,10 +234,6 @@ class DriftBackupNotifier extends StateNotifier<DriftBackupState> {
|
||||
|
||||
switch (update.status) {
|
||||
case TaskStatus.complete:
|
||||
if (update.task.group == kBackupGroup) {
|
||||
state = state.copyWith(backupCount: state.backupCount + 1, remainderCount: state.remainderCount - 1);
|
||||
}
|
||||
|
||||
// Remove the completed task from the upload items
|
||||
if (state.uploadItems.containsKey(taskId)) {
|
||||
Future.delayed(const Duration(milliseconds: 1000), () {
|
||||
|
||||
@@ -13,7 +13,7 @@ class MapSettingsListTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SwitchListTile.adaptive(
|
||||
activeColor: context.primaryColor,
|
||||
activeThumbColor: context.primaryColor,
|
||||
title: Text(title, style: context.textTheme.labelLarge?.copyWith(fontWeight: FontWeight.bold)).tr(),
|
||||
value: selected,
|
||||
onChanged: onChanged,
|
||||
|
||||
@@ -350,8 +350,8 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
final computedScale = useImageScale ? 1.0 : scale;
|
||||
|
||||
final matrix = Matrix4.identity()
|
||||
..translate(value.position.dx, value.position.dy)
|
||||
..scale(computedScale)
|
||||
..translateByDouble(value.position.dx, value.position.dy, 0, 1.0)
|
||||
..scaleByDouble(computedScale, computedScale, computedScale, 1.0)
|
||||
..rotateZ(value.rotation);
|
||||
|
||||
final Widget customChildLayout = CustomSingleChildLayout(
|
||||
|
||||
@@ -13,40 +13,19 @@ class MediaTypePicker extends HookWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final selectedMediaType = useState(filter ?? AssetType.other);
|
||||
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
RadioListTile(
|
||||
key: const Key("all"),
|
||||
title: const Text("all").tr(),
|
||||
value: AssetType.other,
|
||||
onChanged: (value) {
|
||||
selectedMediaType.value = value!;
|
||||
onSelect(value);
|
||||
},
|
||||
groupValue: selectedMediaType.value,
|
||||
),
|
||||
RadioListTile(
|
||||
key: const Key("image"),
|
||||
title: const Text("image").tr(),
|
||||
value: AssetType.image,
|
||||
onChanged: (value) {
|
||||
selectedMediaType.value = value!;
|
||||
onSelect(value);
|
||||
},
|
||||
groupValue: selectedMediaType.value,
|
||||
),
|
||||
RadioListTile(
|
||||
key: const Key("video"),
|
||||
title: const Text("video").tr(),
|
||||
value: AssetType.video,
|
||||
onChanged: (value) {
|
||||
selectedMediaType.value = value!;
|
||||
onSelect(value);
|
||||
},
|
||||
groupValue: selectedMediaType.value,
|
||||
),
|
||||
],
|
||||
return RadioGroup(
|
||||
onChanged: (value) {
|
||||
selectedMediaType.value = value!;
|
||||
onSelect(value);
|
||||
},
|
||||
groupValue: selectedMediaType.value,
|
||||
child: Column(
|
||||
children: [
|
||||
RadioListTile(key: const Key("all"), title: const Text("all").tr(), value: AssetType.other),
|
||||
RadioListTile(key: const Key("image"), title: const Text("image").tr(), value: AssetType.image),
|
||||
RadioListTile(key: const Key("video"), title: const Text("video").tr(), value: AssetType.video),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class BetaTimelineListTile extends ConsumerWidget {
|
||||
trailing: Switch.adaptive(
|
||||
value: betaTimelineValue,
|
||||
onChanged: onSwitchChanged,
|
||||
activeColor: context.primaryColor,
|
||||
activeThumbColor: context.primaryColor,
|
||||
),
|
||||
onTap: () => onSwitchChanged(!betaTimelineValue),
|
||||
),
|
||||
|
||||
@@ -115,7 +115,7 @@ class PrimaryColorSetting extends HookConsumerWidget {
|
||||
child: SwitchListTile.adaptive(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 6, horizontal: 20),
|
||||
dense: true,
|
||||
activeColor: context.primaryColor,
|
||||
activeThumbColor: context.primaryColor,
|
||||
tileColor: context.colorScheme.surfaceContainerHigh,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15))),
|
||||
title: Text(
|
||||
|
||||
@@ -9,7 +9,7 @@ class SettingsRadioGroup<T> {
|
||||
}
|
||||
|
||||
class SettingsRadioListTile<T> extends StatelessWidget {
|
||||
final List<SettingsRadioGroup> groups;
|
||||
final List<SettingsRadioGroup<T>> groups;
|
||||
final T groupBy;
|
||||
final void Function(T?) onRadioChanged;
|
||||
|
||||
@@ -17,21 +17,23 @@ class SettingsRadioListTile<T> extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: groups
|
||||
.map(
|
||||
(g) => RadioListTile<T>(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
dense: true,
|
||||
activeColor: context.primaryColor,
|
||||
title: Text(g.title, style: context.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w500)),
|
||||
value: g.value,
|
||||
groupValue: groupBy,
|
||||
onChanged: onRadioChanged,
|
||||
controlAffinity: ListTileControlAffinity.trailing,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
return RadioGroup(
|
||||
groupValue: groupBy,
|
||||
onChanged: onRadioChanged,
|
||||
child: Column(
|
||||
children: groups
|
||||
.map(
|
||||
(g) => RadioListTile<T>(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
dense: true,
|
||||
activeColor: context.primaryColor,
|
||||
title: Text(g.title, style: context.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w500)),
|
||||
value: g.value,
|
||||
controlAffinity: ListTileControlAffinity.trailing,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class SettingsSwitchListTile extends StatelessWidget {
|
||||
selectedTileColor: enabled ? null : context.themeData.disabledColor,
|
||||
value: valueNotifier.value,
|
||||
onChanged: onSwitchChanged,
|
||||
activeColor: enabled ? context.primaryColor : context.themeData.disabledColor,
|
||||
activeThumbColor: enabled ? context.primaryColor : context.themeData.disabledColor,
|
||||
dense: true,
|
||||
secondary: icon != null ? Icon(icon!, color: valueNotifier.value ? context.primaryColor : null) : null,
|
||||
title: Text(
|
||||
|
||||
Reference in New Issue
Block a user