Skip to content

Commit b19f9c4

Browse files
committed
wip
1 parent 2b66722 commit b19f9c4

12 files changed

+1109
-201
lines changed

mobile/lib/domain/models/store.model.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ enum StoreKey<T> {
6868
manageLocalMediaAndroid<bool>._(137),
6969

7070
// Experimental stuff
71-
photoManagerCustomFilter<bool>._(1000);
71+
photoManagerCustomFilter<bool>._(1000),
72+
newUpload<bool>._(1001);
7273

7374
const StoreKey._(this.id);
7475
final int id;

mobile/lib/pages/backup/backup_album_selection.page.dart

Lines changed: 117 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ import 'package:easy_localization/easy_localization.dart';
33
import 'package:flutter/material.dart';
44
import 'package:flutter_hooks/flutter_hooks.dart';
55
import 'package:hooks_riverpod/hooks_riverpod.dart';
6-
import 'package:immich_mobile/domain/models/local_album.model.dart';
76
import 'package:immich_mobile/extensions/build_context_extensions.dart';
87
import 'package:immich_mobile/providers/album/album.provider.dart';
98
import 'package:immich_mobile/providers/backup/backup.provider.dart';
10-
import 'package:immich_mobile/providers/backup/backup_album.provider.dart';
119
import 'package:immich_mobile/services/app_settings.service.dart';
1210
import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';
1311
import 'package:immich_mobile/widgets/backup/album_info_card.dart';
@@ -19,17 +17,12 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
1917
const BackupAlbumSelectionPage({super.key});
2018
@override
2119
Widget build(BuildContext context, WidgetRef ref) {
22-
final albums = ref.watch(backupAlbumProvider);
23-
24-
final selectedBackupAlbums = albums
25-
.where((album) => album.backupSelection == BackupSelection.selected)
26-
.toList();
27-
final excludedBackupAlbums = albums
28-
.where((album) => album.backupSelection == BackupSelection.excluded)
29-
.toList();
20+
final selectedBackupAlbums = ref.watch(backupProvider).selectedBackupAlbums;
21+
final excludedBackupAlbums = ref.watch(backupProvider).excludedBackupAlbums;
3022
final enableSyncUploadAlbum =
3123
useAppSettingsState(AppSettingsEnum.syncAlbums);
3224
final isDarkTheme = context.isDarkTheme;
25+
final albums = ref.watch(backupProvider).availableAlbums;
3326

3427
useEffect(
3528
() {
@@ -92,9 +85,8 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
9285

9386
buildSelectedAlbumNameChip() {
9487
return selectedBackupAlbums.map((album) {
95-
void removeSelection() {
96-
ref.read(backupAlbumProvider.notifier).deselectAlbum(album);
97-
}
88+
void removeSelection() =>
89+
ref.read(backupProvider.notifier).removeAlbumForBackup(album);
9890

9991
return Padding(
10092
padding: const EdgeInsets.only(right: 8.0),
@@ -125,7 +117,9 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
125117
buildExcludedAlbumNameChip() {
126118
return excludedBackupAlbums.map((album) {
127119
void removeSelection() {
128-
ref.read(backupAlbumProvider.notifier).deselectAlbum(album);
120+
ref
121+
.watch(backupProvider.notifier)
122+
.removeExcludedAlbumForBackup(album);
129123
}
130124

131125
return GestureDetector(
@@ -174,131 +168,129 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
174168
).tr(),
175169
elevation: 0,
176170
),
177-
body: SafeArea(
178-
child: CustomScrollView(
179-
physics: const ClampingScrollPhysics(),
180-
slivers: [
181-
SliverToBoxAdapter(
182-
child: Column(
183-
crossAxisAlignment: CrossAxisAlignment.start,
184-
children: [
185-
Padding(
186-
padding: const EdgeInsets.symmetric(
187-
vertical: 8.0,
188-
horizontal: 16.0,
189-
),
190-
child: Text(
191-
"backup_album_selection_page_selection_info",
192-
style: context.textTheme.titleSmall,
193-
).tr(),
171+
body: CustomScrollView(
172+
physics: const ClampingScrollPhysics(),
173+
slivers: [
174+
SliverToBoxAdapter(
175+
child: Column(
176+
crossAxisAlignment: CrossAxisAlignment.start,
177+
children: [
178+
Padding(
179+
padding: const EdgeInsets.symmetric(
180+
vertical: 8.0,
181+
horizontal: 16.0,
194182
),
195-
// Selected Album Chips
183+
child: Text(
184+
"backup_album_selection_page_selection_info",
185+
style: context.textTheme.titleSmall,
186+
).tr(),
187+
),
188+
// Selected Album Chips
196189

197-
Padding(
198-
padding: const EdgeInsets.symmetric(horizontal: 16.0),
199-
child: Wrap(
200-
children: [
201-
...buildSelectedAlbumNameChip(),
202-
...buildExcludedAlbumNameChip(),
203-
],
204-
),
190+
Padding(
191+
padding: const EdgeInsets.symmetric(horizontal: 16.0),
192+
child: Wrap(
193+
children: [
194+
...buildSelectedAlbumNameChip(),
195+
...buildExcludedAlbumNameChip(),
196+
],
205197
),
198+
),
206199

207-
SettingsSwitchListTile(
208-
valueNotifier: enableSyncUploadAlbum,
209-
title: "sync_albums".tr(),
210-
subtitle: "sync_upload_album_setting_subtitle".tr(),
211-
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
212-
titleStyle: context.textTheme.bodyLarge?.copyWith(
213-
fontWeight: FontWeight.bold,
214-
),
215-
subtitleStyle: context.textTheme.labelLarge?.copyWith(
216-
color: context.colorScheme.primary,
217-
),
218-
onChanged: handleSyncAlbumToggle,
200+
SettingsSwitchListTile(
201+
valueNotifier: enableSyncUploadAlbum,
202+
title: "sync_albums".tr(),
203+
subtitle: "sync_upload_album_setting_subtitle".tr(),
204+
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
205+
titleStyle: context.textTheme.bodyLarge?.copyWith(
206+
fontWeight: FontWeight.bold,
207+
),
208+
subtitleStyle: context.textTheme.labelLarge?.copyWith(
209+
color: context.colorScheme.primary,
219210
),
211+
onChanged: handleSyncAlbumToggle,
212+
),
220213

221-
ListTile(
222-
title: Text(
223-
"backup_album_selection_page_albums_device".tr(
224-
namedArgs: {
225-
'count': ref
226-
.watch(backupProvider)
227-
.availableAlbums
228-
.length
229-
.toString(),
230-
},
231-
),
232-
style: context.textTheme.titleSmall,
233-
),
234-
subtitle: Padding(
235-
padding: const EdgeInsets.symmetric(vertical: 8.0),
236-
child: Text(
237-
"backup_album_selection_page_albums_tap",
238-
style: context.textTheme.labelLarge?.copyWith(
239-
color: context.primaryColor,
240-
),
241-
).tr(),
214+
ListTile(
215+
title: Text(
216+
"backup_album_selection_page_albums_device".tr(
217+
namedArgs: {
218+
'count': ref
219+
.watch(backupProvider)
220+
.availableAlbums
221+
.length
222+
.toString(),
223+
},
242224
),
243-
trailing: IconButton(
244-
splashRadius: 16,
245-
icon: Icon(
246-
Icons.info,
247-
size: 20,
225+
style: context.textTheme.titleSmall,
226+
),
227+
subtitle: Padding(
228+
padding: const EdgeInsets.symmetric(vertical: 8.0),
229+
child: Text(
230+
"backup_album_selection_page_albums_tap",
231+
style: context.textTheme.labelLarge?.copyWith(
248232
color: context.primaryColor,
249233
),
250-
onPressed: () {
251-
// show the dialog
252-
showDialog(
253-
context: context,
254-
builder: (BuildContext context) {
255-
return AlertDialog(
256-
shape: RoundedRectangleBorder(
257-
borderRadius: BorderRadius.circular(10),
234+
).tr(),
235+
),
236+
trailing: IconButton(
237+
splashRadius: 16,
238+
icon: Icon(
239+
Icons.info,
240+
size: 20,
241+
color: context.primaryColor,
242+
),
243+
onPressed: () {
244+
// show the dialog
245+
showDialog(
246+
context: context,
247+
builder: (BuildContext context) {
248+
return AlertDialog(
249+
shape: RoundedRectangleBorder(
250+
borderRadius: BorderRadius.circular(10),
251+
),
252+
elevation: 5,
253+
title: Text(
254+
'backup_album_selection_page_selection_info',
255+
style: TextStyle(
256+
fontSize: 16,
257+
fontWeight: FontWeight.bold,
258+
color: context.primaryColor,
258259
),
259-
elevation: 5,
260-
title: Text(
261-
'backup_album_selection_page_selection_info',
262-
style: TextStyle(
263-
fontSize: 16,
264-
fontWeight: FontWeight.bold,
265-
color: context.primaryColor,
266-
),
267-
).tr(),
268-
content: SingleChildScrollView(
269-
child: ListBody(
270-
children: [
271-
const Text(
272-
'backup_album_selection_page_assets_scatter',
273-
style: TextStyle(
274-
fontSize: 14,
275-
),
276-
).tr(),
277-
],
278-
),
260+
).tr(),
261+
content: SingleChildScrollView(
262+
child: ListBody(
263+
children: [
264+
const Text(
265+
'backup_album_selection_page_assets_scatter',
266+
style: TextStyle(
267+
fontSize: 14,
268+
),
269+
).tr(),
270+
],
279271
),
280-
);
281-
},
282-
);
283-
},
284-
),
272+
),
273+
);
274+
},
275+
);
276+
},
285277
),
278+
),
286279

287-
// buildSearchBar(),
288-
],
289-
),
290-
),
291-
SliverLayoutBuilder(
292-
builder: (context, constraints) {
293-
if (constraints.crossAxisExtent > 600) {
294-
return buildAlbumSelectionGrid();
295-
} else {
296-
return buildAlbumSelectionList();
297-
}
298-
},
280+
// buildSearchBar(),
281+
],
299282
),
300-
],
301-
),
283+
),
284+
SliverLayoutBuilder(
285+
builder: (context, constraints) {
286+
if (constraints.crossAxisExtent > 600) {
287+
return buildAlbumSelectionGrid();
288+
} else {
289+
return buildAlbumSelectionList();
290+
}
291+
},
292+
),
293+
],
302294
),
303295
);
304296
}

0 commit comments

Comments
 (0)