chore(mobile): add debugPrint lint rule (#21872)

* add lint rule

* update usages

* stragglers

* use dcm

* formatting

* test ci

* Revert "test ci"

This reverts commit 8f864c4e4d.

* revert whitespace change
This commit is contained in:
Mert
2025-09-12 18:56:00 -04:00
committed by GitHub
parent 23aa661324
commit 17bbcdf584
38 changed files with 168 additions and 153 deletions
+10 -12
View File
@@ -7,7 +7,6 @@ import 'dart:ui' show DartPluginRegistrant, IsolateNameServer, PluginUtilities;
import 'package:cancellation_token_http/http.dart';
import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@@ -33,6 +32,7 @@ import 'package:immich_mobile/utils/diff.dart';
import 'package:immich_mobile/utils/http_ssl_options.dart';
import 'package:path_provider_foundation/path_provider_foundation.dart';
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
import 'package:immich_mobile/utils/debug_print.dart';
final backgroundServiceProvider = Provider((ref) => BackgroundService());
@@ -165,7 +165,7 @@ class BackgroundService {
]);
}
} catch (error) {
debugPrint("[_updateNotification] failed to communicate with plugin");
dPrint(() => "[_updateNotification] failed to communicate with plugin");
}
return false;
}
@@ -177,7 +177,7 @@ class BackgroundService {
return await _backgroundChannel.invokeMethod('showError', [title, content, individualTag]);
}
} catch (error) {
debugPrint("[_showErrorNotification] failed to communicate with plugin");
dPrint(() => "[_showErrorNotification] failed to communicate with plugin");
}
return false;
}
@@ -188,7 +188,7 @@ class BackgroundService {
return await _backgroundChannel.invokeMethod('clearErrorNotifications');
}
} catch (error) {
debugPrint("[_clearErrorNotifications] failed to communicate with plugin");
dPrint(() => "[_clearErrorNotifications] failed to communicate with plugin");
}
return false;
}
@@ -196,7 +196,7 @@ class BackgroundService {
/// await to ensure this thread (foreground or background) has exclusive access
Future<bool> acquireLock() async {
if (_hasLock) {
debugPrint("WARNING: [acquireLock] called more than once");
dPrint(() => "WARNING: [acquireLock] called more than once");
return true;
}
final int lockTime = Timeline.now;
@@ -302,19 +302,19 @@ class BackgroundService {
final bool hasAccess = await waitForLock;
if (!hasAccess) {
debugPrint("[_callHandler] could not acquire lock, exiting");
dPrint(() => "[_callHandler] could not acquire lock, exiting");
return false;
}
final translationsOk = await loadTranslations();
if (!translationsOk) {
debugPrint("[_callHandler] could not load translations");
dPrint(() => "[_callHandler] could not load translations");
}
final bool ok = await _onAssetsChanged();
return ok;
} catch (error) {
debugPrint(error.toString());
dPrint(() => error.toString());
return false;
} finally {
releaseLock();
@@ -324,7 +324,7 @@ class BackgroundService {
_cancellationToken?.cancel();
return true;
default:
debugPrint("Unknown method ${call.method}");
dPrint(() => "Unknown method ${call.method}");
return false;
}
}
@@ -344,9 +344,7 @@ class BackgroundService {
HttpSSLOptions.apply();
ref.read(apiServiceProvider).setAccessToken(Store.get(StoreKey.accessToken));
await ref.read(authServiceProvider).setOpenApiServiceEndpoint();
if (kDebugMode) {
debugPrint("[BG UPLOAD] Using endpoint: ${ref.read(apiServiceProvider).apiClient.basePath}");
}
dPrint(() => "[BG UPLOAD] Using endpoint: ${ref.read(apiServiceProvider).apiClient.basePath}");
final selectedAlbums = await ref.read(backupAlbumRepositoryProvider).getAllBySelection(BackupSelection.select);
final excludedAlbums = await ref.read(backupAlbumRepositoryProvider).getAllBySelection(BackupSelection.exclude);