mirror of
https://github.com/immich-app/immich.git
synced 2025-10-20 05:20:37 -04:00
* feat(mobile): Add Kid (Readonly) Mode toggle This commit introduces a "Kid (Readonly) Mode" feature. - Adds a `KidModeProvider` to manage the state of Kid Mode. - Implements a `KidModeCheckbox` widget in the app bar dialog to toggle Kid Mode. - When Kid Mode is enabled, - Disables selecting the multigrid & the bottom bar - Removes the top bar from view Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Reverts the changes to devtools_options.yaml file Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> refactor: replace Kid Mode with Readonly Mode This commit replaces the "Kid Mode" feature with a more generic "Readonly Mode". - Renamed `KidModeProvider` to `ReadonlyModeProvider`. - Readonly Mode state is now persisted in app settings. - Added a new app setting `allowUserAvatarOverride` to toggle read-only mode. - Updated translations. - Added a message in the app bar dialog indicating when read-only mode is active. Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Address comments - - Removes the `allowUserAvatarOverride` setting. - Hides the bottom gallery bar when read-only mode is enabled. - Adds an icon on the main app bar when read-only mode is enabled with a snackbar. Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Update to snackbar - When toggling readonly mode from either the settings or the app bar, a snackbar notification will now appear. - The readonly mode message in the profile drawer has been restyled. - The upload button in the app bar is now hidden when readonly mode is enabled. Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Removes clearing of snackbar Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Address Comments - Consolidated snackbar messages for enabling/disabling readonly mode. - Ensured the "Select All" icon in asset group titles is hidden in readonly mode. Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Adds in the missing translation keys for readonly_mode Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Fix translation Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Fix check failure for BorderRadius Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Changes: - Adjusted AppBar background color in readonly mode. - Removes cross-out pencil icon button in favor of above. - Hides the "Edit" icon next to date/time, disable description and onTap for people and location when readonly mode is enabled. Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> Address comments from Alex - Moved readonly mode check to `GalleryAppBar` to hide the entire `TopControlAppBar` when readonly mode is enabled. - Changed `toggleReadonlyMode` in `ImmichAppBar` to directly toggle the state. Signed-off-by: Sudheer Puthana <Sud-Puth@users.noreply.github.com> migrate readonly mode to new beta timeline remove readonly mode from legacy UI only show readonly functionality when on beta timeline simplify selection icon update generated provider chore: more formatting * fix: bad merge * chore: use Notifier for readonlyModeProvider * fix: drag select now honors readonly mode * fix: disable asset bottom sheet in readonly * fix: disable editing user icon when in readonly * chore: remove generated file * fix: disable tabs instead entire tab bar This solves the issues with the scrubber * chore: remove unneeded import * chore: lint * remove unused condition in bottomsheet --------- Co-authored-by: Brandon Wees <brandonwees@gmail.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
72 lines
3.7 KiB
Dart
72 lines
3.7 KiB
Dart
import 'package:immich_mobile/constants/colors.dart';
|
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
|
import 'package:immich_mobile/entities/store.entity.dart';
|
|
|
|
enum AppSettingsEnum<T> {
|
|
loadPreview<bool>(StoreKey.loadPreview, "loadPreview", true),
|
|
loadOriginal<bool>(StoreKey.loadOriginal, "loadOriginal", false),
|
|
themeMode<String>(StoreKey.themeMode, "themeMode", "system"), // "light","dark","system"
|
|
primaryColor<String>(StoreKey.primaryColor, "primaryColor", defaultColorPresetName),
|
|
dynamicTheme<bool>(StoreKey.dynamicTheme, "dynamicTheme", false),
|
|
colorfulInterface<bool>(StoreKey.colorfulInterface, "colorfulInterface", true),
|
|
tilesPerRow<int>(StoreKey.tilesPerRow, "tilesPerRow", 4),
|
|
dynamicLayout<bool>(StoreKey.dynamicLayout, "dynamicLayout", false),
|
|
groupAssetsBy<int>(StoreKey.groupAssetsBy, "groupBy", 0),
|
|
uploadErrorNotificationGracePeriod<int>(
|
|
StoreKey.uploadErrorNotificationGracePeriod,
|
|
"uploadErrorNotificationGracePeriod",
|
|
2,
|
|
),
|
|
backgroundBackupTotalProgress<bool>(StoreKey.backgroundBackupTotalProgress, "backgroundBackupTotalProgress", true),
|
|
backgroundBackupSingleProgress<bool>(
|
|
StoreKey.backgroundBackupSingleProgress,
|
|
"backgroundBackupSingleProgress",
|
|
false,
|
|
),
|
|
storageIndicator<bool>(StoreKey.storageIndicator, "storageIndicator", true),
|
|
thumbnailCacheSize<int>(StoreKey.thumbnailCacheSize, "thumbnailCacheSize", 10000),
|
|
imageCacheSize<int>(StoreKey.imageCacheSize, "imageCacheSize", 350),
|
|
albumThumbnailCacheSize<int>(StoreKey.albumThumbnailCacheSize, "albumThumbnailCacheSize", 200),
|
|
selectedAlbumSortOrder<int>(StoreKey.selectedAlbumSortOrder, "selectedAlbumSortOrder", 0),
|
|
advancedTroubleshooting<bool>(StoreKey.advancedTroubleshooting, null, false),
|
|
manageLocalMediaAndroid<bool>(StoreKey.manageLocalMediaAndroid, null, false),
|
|
logLevel<int>(StoreKey.logLevel, null, 5), // Level.INFO = 5
|
|
preferRemoteImage<bool>(StoreKey.preferRemoteImage, null, false),
|
|
loopVideo<bool>(StoreKey.loopVideo, "loopVideo", true),
|
|
loadOriginalVideo<bool>(StoreKey.loadOriginalVideo, "loadOriginalVideo", false),
|
|
mapThemeMode<int>(StoreKey.mapThemeMode, null, 0),
|
|
mapShowFavoriteOnly<bool>(StoreKey.mapShowFavoriteOnly, null, false),
|
|
mapIncludeArchived<bool>(StoreKey.mapIncludeArchived, null, false),
|
|
mapwithPartners<bool>(StoreKey.mapwithPartners, null, false),
|
|
mapRelativeDate<int>(StoreKey.mapRelativeDate, null, 0),
|
|
allowSelfSignedSSLCert<bool>(StoreKey.selfSignedCert, null, false),
|
|
ignoreIcloudAssets<bool>(StoreKey.ignoreIcloudAssets, null, false),
|
|
selectedAlbumSortReverse<bool>(StoreKey.selectedAlbumSortReverse, null, false),
|
|
enableHapticFeedback<bool>(StoreKey.enableHapticFeedback, null, true),
|
|
syncAlbums<bool>(StoreKey.syncAlbums, null, false),
|
|
autoEndpointSwitching<bool>(StoreKey.autoEndpointSwitching, null, false),
|
|
photoManagerCustomFilter<bool>(StoreKey.photoManagerCustomFilter, null, true),
|
|
betaTimeline<bool>(StoreKey.betaTimeline, null, false),
|
|
enableBackup<bool>(StoreKey.enableBackup, null, false),
|
|
useCellularForUploadVideos<bool>(StoreKey.useWifiForUploadVideos, null, false),
|
|
useCellularForUploadPhotos<bool>(StoreKey.useWifiForUploadPhotos, null, false),
|
|
readonlyModeEnabled<bool>(StoreKey.readonlyModeEnabled, "readonlyModeEnabled", false);
|
|
|
|
const AppSettingsEnum(this.storeKey, this.hiveKey, this.defaultValue);
|
|
|
|
final StoreKey<T> storeKey;
|
|
final String? hiveKey;
|
|
final T defaultValue;
|
|
}
|
|
|
|
class AppSettingsService {
|
|
const AppSettingsService();
|
|
T getSetting<T>(AppSettingsEnum<T> setting) {
|
|
return Store.get(setting.storeKey, setting.defaultValue);
|
|
}
|
|
|
|
Future<void> setSetting<T>(AppSettingsEnum<T> setting, T value) {
|
|
return Store.put(setting.storeKey, value);
|
|
}
|
|
}
|