mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: add always_put_control_body_on_new_line lint (#28352)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -65,7 +65,9 @@ class AppLifeCycleNotifier extends StateNotifier<AppLifeCycleEnum> {
|
||||
|
||||
Future<void> _performResume() async {
|
||||
// no need to resume because app was never really paused
|
||||
if (!_wasPaused) return;
|
||||
if (!_wasPaused) {
|
||||
return;
|
||||
}
|
||||
_wasPaused = false;
|
||||
|
||||
final isAuthenticated = _ref.read(authProvider).isAuthenticated;
|
||||
|
||||
@@ -45,8 +45,12 @@ class AssetViewerState {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other.runtimeType != runtimeType) return false;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
if (other.runtimeType != runtimeType) {
|
||||
return false;
|
||||
}
|
||||
return other is AssetViewerState &&
|
||||
other.backgroundOpacity == backgroundOpacity &&
|
||||
other.showingDetails == showingDetails &&
|
||||
@@ -83,7 +87,9 @@ class AssetViewerStateNotifier extends Notifier<AssetViewerState> {
|
||||
}
|
||||
|
||||
void setAsset(BaseAsset asset) {
|
||||
if (asset == state.currentAsset) return;
|
||||
if (asset == state.currentAsset) {
|
||||
return;
|
||||
}
|
||||
state = state.copyWith(currentAsset: asset, stackIndex: 0);
|
||||
}
|
||||
|
||||
@@ -138,6 +144,8 @@ final assetViewerProvider = NotifierProvider<AssetViewerStateNotifier, AssetView
|
||||
final _watchedCurrentAssetProvider = StreamProvider<BaseAsset?>((ref) {
|
||||
ref.watch(assetViewerProvider.select((s) => s.currentAsset?.heroTag));
|
||||
final asset = ref.read(assetViewerProvider).currentAsset;
|
||||
if (asset == null) return const Stream.empty();
|
||||
if (asset == null) {
|
||||
return const Stream.empty();
|
||||
}
|
||||
return ref.read(assetServiceProvider).watchAsset(asset);
|
||||
});
|
||||
|
||||
@@ -70,7 +70,9 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
}
|
||||
|
||||
Future<void> pause() async {
|
||||
if (_controller == null) return;
|
||||
if (_controller == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
_bufferingTimer?.cancel();
|
||||
|
||||
@@ -83,7 +85,9 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
}
|
||||
|
||||
Future<void> play() async {
|
||||
if (_controller == null) return;
|
||||
if (_controller == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await _flushSeek();
|
||||
@@ -97,18 +101,24 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
|
||||
Future<void> _flushSeek() async {
|
||||
final timer = _seekTimer;
|
||||
if (timer == null || !timer.isActive) return;
|
||||
if (timer == null || !timer.isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
timer.cancel();
|
||||
await _controller?.seekTo(state.position.inMilliseconds);
|
||||
}
|
||||
|
||||
void seekTo(Duration position) {
|
||||
if (_controller == null || state.position == position) return;
|
||||
if (_controller == null || state.position == position) {
|
||||
return;
|
||||
}
|
||||
|
||||
state = state.copyWith(position: position);
|
||||
|
||||
if (_seekTimer?.isActive ?? false) return;
|
||||
if (_seekTimer?.isActive ?? false) {
|
||||
return;
|
||||
}
|
||||
|
||||
_seekTimer = Timer(const Duration(milliseconds: 150), () {
|
||||
_controller?.seekTo(state.position.inMilliseconds);
|
||||
@@ -130,7 +140,9 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
|
||||
/// Pauses playback and preserves the current status for later restoration.
|
||||
void hold() {
|
||||
if (_holdStatus != null) return;
|
||||
if (_holdStatus != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
_holdStatus = state.status;
|
||||
pause();
|
||||
@@ -170,12 +182,16 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
}
|
||||
|
||||
void onNativePlaybackReady() {
|
||||
if (!mounted) return;
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
final playbackInfo = _controller?.playbackInfo;
|
||||
final videoInfo = _controller?.videoInfo;
|
||||
|
||||
if (playbackInfo == null || videoInfo == null) return;
|
||||
if (playbackInfo == null || videoInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
position: Duration(milliseconds: playbackInfo.position),
|
||||
@@ -185,15 +201,23 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
}
|
||||
|
||||
void onNativePositionChanged() {
|
||||
if (!mounted || (_seekTimer?.isActive ?? false)) return;
|
||||
if (!mounted || (_seekTimer?.isActive ?? false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final playbackInfo = _controller?.playbackInfo;
|
||||
if (playbackInfo == null) return;
|
||||
if (playbackInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final position = Duration(milliseconds: playbackInfo.position);
|
||||
if (state.position == position) return;
|
||||
if (state.position == position) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.status == VideoPlaybackStatus.playing) _startBufferingTimer();
|
||||
if (state.status == VideoPlaybackStatus.playing) {
|
||||
_startBufferingTimer();
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
position: position,
|
||||
@@ -202,10 +226,14 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
}
|
||||
|
||||
void onNativeStatusChanged() {
|
||||
if (!mounted) return;
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
final playbackInfo = _controller?.playbackInfo;
|
||||
if (playbackInfo == null) return;
|
||||
if (playbackInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final newStatus = _mapStatus(playbackInfo.status);
|
||||
switch (newStatus) {
|
||||
@@ -216,7 +244,9 @@ class VideoPlayerNotifier extends StateNotifier<VideoPlayerState> {
|
||||
onNativePlaybackEnded();
|
||||
}
|
||||
|
||||
if (state.status != newStatus) state = state.copyWith(status: newStatus);
|
||||
if (state.status != newStatus) {
|
||||
state = state.copyWith(status: newStatus);
|
||||
}
|
||||
}
|
||||
|
||||
void onNativePlaybackEnded() {
|
||||
|
||||
@@ -73,7 +73,9 @@ class DriftUploadStatus {
|
||||
|
||||
@override
|
||||
bool operator ==(covariant DriftUploadStatus other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return other.taskId == taskId &&
|
||||
other.filename == filename &&
|
||||
@@ -153,7 +155,9 @@ class DriftBackupState {
|
||||
|
||||
@override
|
||||
bool operator ==(covariant DriftBackupState other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
final mapEquals = const DeepCollectionEquality().equals;
|
||||
|
||||
return other.totalCount == totalCount &&
|
||||
|
||||
@@ -132,7 +132,9 @@ class CleanupNotifier extends StateNotifier<CleanupState> {
|
||||
|
||||
void applyDefaultAlbumSelections(List<(String id, String name)> albums) {
|
||||
final isInitialized = _metadataRepository.appConfig.cleanup.defaultsInitialized;
|
||||
if (isInitialized) return;
|
||||
if (isInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
final toKeep = _cleanupService.getDefaultKeepAlbumIds(albums);
|
||||
|
||||
|
||||
@@ -518,7 +518,9 @@ extension on Iterable<RemoteAsset> {
|
||||
Iterable<String> toIds() => map((e) => e.id);
|
||||
|
||||
Iterable<RemoteAsset> ownedAssets(String? ownerId) {
|
||||
if (ownerId == null) return const [];
|
||||
if (ownerId == null) {
|
||||
return const [];
|
||||
}
|
||||
return whereType<RemoteAsset>().where((a) => a.ownerId == ownerId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ class RemoteAlbumState {
|
||||
|
||||
@override
|
||||
bool operator ==(covariant RemoteAlbumState other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
final listEquals = const DeepCollectionEquality().equals;
|
||||
|
||||
return listEquals(other.albums, albums);
|
||||
|
||||
@@ -11,7 +11,9 @@ final userMetadataRepository = Provider<DriftUserMetadataRepository>(
|
||||
final userMetadataProvider = FutureProvider<List<UserMetadata>>((ref) async {
|
||||
final repository = ref.watch(userMetadataRepository);
|
||||
final user = ref.watch(currentUserProvider);
|
||||
if (user == null) return [];
|
||||
if (user == null) {
|
||||
return [];
|
||||
}
|
||||
return repository.getUserMetadata(user.id);
|
||||
});
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ class SearchSuggestionArgs {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return other is SearchSuggestionArgs &&
|
||||
other.type == type &&
|
||||
|
||||
@@ -56,7 +56,9 @@ class SyncStatusState {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
return other is SyncStatusState &&
|
||||
other.remoteSyncStatus == remoteSyncStatus &&
|
||||
other.localSyncStatus == localSyncStatus &&
|
||||
|
||||
@@ -48,7 +48,9 @@ class MultiSelectState {
|
||||
|
||||
@override
|
||||
bool operator ==(covariant MultiSelectState other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
final setEquals = const DeepCollectionEquality().equals;
|
||||
|
||||
return setEquals(other.selectedAssets, selectedAssets) &&
|
||||
@@ -124,7 +126,9 @@ class MultiSelectNotifier extends Notifier<MultiSelectState> {
|
||||
}
|
||||
|
||||
void toggleBucketSelectionByAssets(List<BaseAsset> bucketAssets) {
|
||||
if (bucketAssets.isEmpty) return;
|
||||
if (bucketAssets.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if all assets in this bucket are currently selected
|
||||
final allSelected = bucketAssets.every((asset) => state.selectedAssets.contains(asset));
|
||||
@@ -150,7 +154,9 @@ class MultiSelectNotifier extends Notifier<MultiSelectState> {
|
||||
final bucketSelectionProvider = Provider.family<bool, List<BaseAsset>>((ref, bucketAssets) {
|
||||
final selectedAssets = ref.watch(multiSelectProvider.select((s) => s.selectedAssets));
|
||||
|
||||
if (bucketAssets.isEmpty) return false;
|
||||
if (bucketAssets.isEmpty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if all assets in the bucket are selected
|
||||
return bucketAssets.every((asset) => selectedAssets.contains(asset));
|
||||
|
||||
@@ -46,7 +46,9 @@ class UploadProfileImageState {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return other is UploadProfileImageState && other.status == status && other.profileImagePath == profileImagePath;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ class WebsocketState {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return other is WebsocketState && other.socket == socket && other.isConnected == isConnected;
|
||||
}
|
||||
@@ -58,7 +60,9 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||
|
||||
/// Connects websocket to server unless already connected
|
||||
void connect() {
|
||||
if (state.isConnected) return;
|
||||
if (state.isConnected) {
|
||||
return;
|
||||
}
|
||||
final authenticationState = _ref.read(authProvider);
|
||||
|
||||
if (authenticationState.isAuthenticated) {
|
||||
|
||||
Reference in New Issue
Block a user