mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
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:
parent
23aa661324
commit
17bbcdf584
38 changed files with 168 additions and 153 deletions
|
|
@ -134,6 +134,13 @@ custom_lint:
|
||||||
|
|
||||||
dart_code_metrics:
|
dart_code_metrics:
|
||||||
rules:
|
rules:
|
||||||
|
- banned-usage:
|
||||||
|
entries:
|
||||||
|
- name: debugPrint
|
||||||
|
description: Use dPrint instead of debugPrint for proper tree-shaking in release builds.
|
||||||
|
exclude-paths:
|
||||||
|
- 'lib/utils/debug_print.dart'
|
||||||
|
severity: perf
|
||||||
# All rules from "recommended" preset
|
# All rules from "recommended" preset
|
||||||
# Show potential errors
|
# Show potential errors
|
||||||
# - avoid-cascade-after-if-null
|
# - avoid-cascade-after-if-null
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import 'package:immich_mobile/utils/http_ssl_options.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:worker_manager/worker_manager.dart';
|
import 'package:worker_manager/worker_manager.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class BackgroundWorkerFgService {
|
class BackgroundWorkerFgService {
|
||||||
final BackgroundWorkerFgHostApi _foregroundHostApi;
|
final BackgroundWorkerFgHostApi _foregroundHostApi;
|
||||||
|
|
@ -159,7 +160,7 @@ class BackgroundWorkerBgService extends BackgroundWorkerFlutterApi {
|
||||||
try {
|
try {
|
||||||
await _cleanup();
|
await _cleanup();
|
||||||
} catch (error, stack) {
|
} catch (error, stack) {
|
||||||
debugPrint('Failed to cleanup background worker: $error with stack: $stack');
|
dPrint(() => 'Failed to cleanup background worker: $error with stack: $stack');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +193,7 @@ class BackgroundWorkerBgService extends BackgroundWorkerFlutterApi {
|
||||||
await Future.wait(cleanupFutures);
|
await Future.wait(cleanupFutures);
|
||||||
_logger.info("Background worker resources cleaned up");
|
_logger.info("Background worker resources cleaned up");
|
||||||
} catch (error, stack) {
|
} catch (error, stack) {
|
||||||
debugPrint('Failed to cleanup background worker: $error with stack: $stack');
|
dPrint(() => 'Failed to cleanup background worker: $error with stack: $stack');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,7 +231,7 @@ class BackgroundWorkerBgService extends BackgroundWorkerFlutterApi {
|
||||||
.startBackupWithHttpClient(currentUser.id, networkCapabilities.hasWifi, _cancellationToken);
|
.startBackupWithHttpClient(currentUser.id, networkCapabilities.hasWifi, _cancellationToken);
|
||||||
},
|
},
|
||||||
(error, stack) {
|
(error, stack) {
|
||||||
debugPrint("Error in backup zone $error, $stack");
|
dPrint(() => "Error in backup zone $error, $stack");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:immich_mobile/constants/constants.dart';
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/log.model.dart';
|
import 'package:immich_mobile/domain/models/log.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/log.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/log.repository.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/store.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/store.repository.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
/// Service responsible for handling application logging.
|
/// Service responsible for handling application logging.
|
||||||
|
|
@ -66,13 +66,12 @@ class LogService {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleLogRecord(LogRecord r) {
|
void _handleLogRecord(LogRecord r) {
|
||||||
if (kDebugMode) {
|
dPrint(
|
||||||
debugPrint(
|
() =>
|
||||||
'[${r.level.name}] [${r.time}] [${r.loggerName}] ${r.message}'
|
'[${r.level.name}] [${r.time}] [${r.loggerName}] ${r.message}'
|
||||||
'${r.error == null ? '' : '\nError: ${r.error}'}'
|
'${r.error == null ? '' : '\nError: ${r.error}'}'
|
||||||
'${r.stackTrace == null ? '' : '\nStack: ${r.stackTrace}'}',
|
'${r.stackTrace == null ? '' : '\nStack: ${r.stackTrace}'}',
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
final record = LogMessage(
|
final record = LogMessage(
|
||||||
message: r.message,
|
message: r.message,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/partner.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/partner.repository.dart';
|
||||||
import 'package:immich_mobile/repositories/partner_api.repository.dart';
|
import 'package:immich_mobile/repositories/partner_api.repository.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class DriftPartnerService {
|
class DriftPartnerService {
|
||||||
final DriftPartnerRepository _driftPartnerRepository;
|
final DriftPartnerRepository _driftPartnerRepository;
|
||||||
|
|
@ -30,7 +30,7 @@ class DriftPartnerService {
|
||||||
Future<void> toggleShowInTimeline(String partnerId, String userId) async {
|
Future<void> toggleShowInTimeline(String partnerId, String userId) async {
|
||||||
final partner = await _driftPartnerRepository.getPartner(partnerId, userId);
|
final partner = await _driftPartnerRepository.getPartner(partnerId, userId);
|
||||||
if (partner == null) {
|
if (partner == null) {
|
||||||
debugPrint("Partner not found: $partnerId for user: $userId");
|
dPrint(() => "Partner not found: $partnerId for user: $userId");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
||||||
|
|
@ -6,6 +5,7 @@ import 'package:immich_mobile/infrastructure/repositories/remote_album.repositor
|
||||||
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
|
||||||
import 'package:immich_mobile/repositories/drift_album_api_repository.dart';
|
import 'package:immich_mobile/repositories/drift_album_api_repository.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final syncLinkedAlbumServiceProvider = Provider(
|
final syncLinkedAlbumServiceProvider = Provider(
|
||||||
(ref) => SyncLinkedAlbumService(
|
(ref) => SyncLinkedAlbumService(
|
||||||
|
|
@ -100,7 +100,7 @@ class SyncLinkedAlbumService {
|
||||||
|
|
||||||
/// Creates a new remote album and links it to the local album
|
/// Creates a new remote album and links it to the local album
|
||||||
Future<void> _createAndLinkNewRemoteAlbum(LocalAlbum localAlbum) async {
|
Future<void> _createAndLinkNewRemoteAlbum(LocalAlbum localAlbum) async {
|
||||||
debugPrint("Creating new remote album for local album: ${localAlbum.name}");
|
dPrint(() => "Creating new remote album for local album: ${localAlbum.name}");
|
||||||
final newRemoteAlbum = await _albumApiRepository.createDriftAlbum(localAlbum.name, assetIds: []);
|
final newRemoteAlbum = await _albumApiRepository.createDriftAlbum(localAlbum.name, assetIds: []);
|
||||||
await _remoteAlbumRepository.create(newRemoteAlbum, []);
|
await _remoteAlbumRepository.create(newRemoteAlbum, []);
|
||||||
return _localAlbumRepository.linkRemoteAlbum(localAlbum.id, newRemoteAlbum.id);
|
return _localAlbumRepository.linkRemoteAlbum(localAlbum.id, newRemoteAlbum.id);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:intl/message_format.dart';
|
import 'package:intl/message_format.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
extension StringTranslateExtension on String {
|
extension StringTranslateExtension on String {
|
||||||
String t({BuildContext? context, Map<String, Object>? args}) {
|
String t({BuildContext? context, Map<String, Object>? args}) {
|
||||||
|
|
@ -39,7 +40,7 @@ String _translateHelper(BuildContext? context, String key, [Map<String, Object>?
|
||||||
? MessageFormat(translatedMessage, locale: Intl.defaultLocale ?? 'en').format(args)
|
? MessageFormat(translatedMessage, locale: Intl.defaultLocale ?? 'en').format(args)
|
||||||
: translatedMessage;
|
: translatedMessage;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('Translation failed for key "$key". Error: $e');
|
dPrint(() => 'Translation failed for key "$key". Error: $e');
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import 'package:intl/date_symbol_data_local.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:timezone/data/latest.dart';
|
import 'package:timezone/data/latest.dart';
|
||||||
import 'package:worker_manager/worker_manager.dart';
|
import 'package:worker_manager/worker_manager.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
ImmichWidgetsBinding();
|
ImmichWidgetsBinding();
|
||||||
|
|
@ -69,9 +70,9 @@ Future<void> initApp() async {
|
||||||
if (kReleaseMode && Platform.isAndroid) {
|
if (kReleaseMode && Platform.isAndroid) {
|
||||||
try {
|
try {
|
||||||
await FlutterDisplayMode.setHighRefreshRate();
|
await FlutterDisplayMode.setHighRefreshRate();
|
||||||
debugPrint("Enabled high refresh mode");
|
dPrint(() => "Enabled high refresh mode");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error setting high refresh rate: $e");
|
dPrint(() => "Error setting high refresh rate: $e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,23 +127,23 @@ class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserve
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case AppLifecycleState.resumed:
|
case AppLifecycleState.resumed:
|
||||||
debugPrint("[APP STATE] resumed");
|
dPrint(() => "[APP STATE] resumed");
|
||||||
ref.read(appStateProvider.notifier).handleAppResume();
|
ref.read(appStateProvider.notifier).handleAppResume();
|
||||||
break;
|
break;
|
||||||
case AppLifecycleState.inactive:
|
case AppLifecycleState.inactive:
|
||||||
debugPrint("[APP STATE] inactive");
|
dPrint(() => "[APP STATE] inactive");
|
||||||
ref.read(appStateProvider.notifier).handleAppInactivity();
|
ref.read(appStateProvider.notifier).handleAppInactivity();
|
||||||
break;
|
break;
|
||||||
case AppLifecycleState.paused:
|
case AppLifecycleState.paused:
|
||||||
debugPrint("[APP STATE] paused");
|
dPrint(() => "[APP STATE] paused");
|
||||||
ref.read(appStateProvider.notifier).handleAppPause();
|
ref.read(appStateProvider.notifier).handleAppPause();
|
||||||
break;
|
break;
|
||||||
case AppLifecycleState.detached:
|
case AppLifecycleState.detached:
|
||||||
debugPrint("[APP STATE] detached");
|
dPrint(() => "[APP STATE] detached");
|
||||||
ref.read(appStateProvider.notifier).handleAppDetached();
|
ref.read(appStateProvider.notifier).handleAppDetached();
|
||||||
break;
|
break;
|
||||||
case AppLifecycleState.hidden:
|
case AppLifecycleState.hidden:
|
||||||
debugPrint("[APP STATE] hidden");
|
dPrint(() => "[APP STATE] hidden");
|
||||||
ref.read(appStateProvider.notifier).handleAppHidden();
|
ref.read(appStateProvider.notifier).handleAppHidden();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +201,7 @@ class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserve
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
initApp().then((_) => debugPrint("App Init Completed"));
|
initApp().then((_) => dPrint(() => "App Init Completed"));
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
// needs to be delayed so that EasyLocalization is working
|
// needs to be delayed so that EasyLocalization is working
|
||||||
if (Store.isBetaTimelineEnabled) {
|
if (Store.isBetaTimelineEnabled) {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import 'package:immich_mobile/providers/infrastructure/user.provider.dart';
|
||||||
import 'package:immich_mobile/providers/user.provider.dart';
|
import 'package:immich_mobile/providers/user.provider.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
import 'package:immich_mobile/widgets/common/mesmerizing_sliver_app_bar.dart';
|
import 'package:immich_mobile/widgets/common/mesmerizing_sliver_app_bar.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class DriftPartnerDetailPage extends StatelessWidget {
|
class DriftPartnerDetailPage extends StatelessWidget {
|
||||||
|
|
@ -68,7 +69,7 @@ class _InfoBoxState extends ConsumerState<_InfoBox> {
|
||||||
_inTimeline = !_inTimeline;
|
_inTimeline = !_inTimeline;
|
||||||
});
|
});
|
||||||
} catch (error, stack) {
|
} catch (error, stack) {
|
||||||
debugPrint("Failed to toggle in timeline: $error $stack");
|
dPrint(() => "Failed to toggle in timeline: $error $stack");
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
context: context,
|
context: context,
|
||||||
toastType: ToastType.error,
|
toastType: ToastType.error,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||||
import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
import 'package:scroll_date_picker/scroll_date_picker.dart';
|
import 'package:scroll_date_picker/scroll_date_picker.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class DriftPersonBirthdayEditForm extends ConsumerStatefulWidget {
|
class DriftPersonBirthdayEditForm extends ConsumerStatefulWidget {
|
||||||
final DriftPerson person;
|
final DriftPerson person;
|
||||||
|
|
@ -36,7 +37,7 @@ class _DriftPersonNameEditFormState extends ConsumerState<DriftPersonBirthdayEdi
|
||||||
context.pop<DateTime>(_selectedDate);
|
context.pop<DateTime>(_selectedDate);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint('Error updating birthday: $error');
|
dPrint(() => 'Error updating birthday: $error');
|
||||||
|
|
||||||
if (!context.mounted) {
|
if (!context.mounted) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||||
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||||
import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class DriftPersonNameEditForm extends ConsumerStatefulWidget {
|
class DriftPersonNameEditForm extends ConsumerStatefulWidget {
|
||||||
final DriftPerson person;
|
final DriftPerson person;
|
||||||
|
|
@ -34,7 +35,7 @@ class _DriftPersonNameEditFormState extends ConsumerState<DriftPersonNameEditFor
|
||||||
context.pop<String>(newName);
|
context.pop<String>(newName);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint('Error updating name: $error');
|
dPrint(() => 'Error updating name: $error');
|
||||||
|
|
||||||
if (!context.mounted) {
|
if (!context.mounted) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/enums.dart';
|
import 'package:immich_mobile/constants/enums.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
|
|
@ -13,6 +12,7 @@ import 'package:immich_mobile/services/etag.service.dart';
|
||||||
import 'package:immich_mobile/services/exif.service.dart';
|
import 'package:immich_mobile/services/exif.service.dart';
|
||||||
import 'package:immich_mobile/services/sync.service.dart';
|
import 'package:immich_mobile/services/sync.service.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final assetProvider = StateNotifierProvider<AssetNotifier, bool>((ref) {
|
final assetProvider = StateNotifierProvider<AssetNotifier, bool>((ref) {
|
||||||
return AssetNotifier(
|
return AssetNotifier(
|
||||||
|
|
@ -68,7 +68,7 @@ class AssetNotifier extends StateNotifier<bool> {
|
||||||
}
|
}
|
||||||
final bool newRemote = await _assetService.refreshRemoteAssets();
|
final bool newRemote = await _assetService.refreshRemoteAssets();
|
||||||
final bool newLocal = await _albumService.refreshDeviceAlbums();
|
final bool newLocal = await _albumService.refreshDeviceAlbums();
|
||||||
debugPrint("changedUsers: $changedUsers, newRemote: $newRemote, newLocal: $newLocal");
|
dPrint(() => "changedUsers: $changedUsers, newRemote: $newRemote, newLocal: $newLocal");
|
||||||
if (newRemote) {
|
if (newRemote) {
|
||||||
_ref.invalidate(memoryFutureProvider);
|
_ref.invalidate(memoryFutureProvider);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter_udid/flutter_udid.dart';
|
import 'package:flutter_udid/flutter_udid.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/constants.dart';
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
|
|
@ -18,6 +17,7 @@ import 'package:immich_mobile/services/widget.service.dart';
|
||||||
import 'package:immich_mobile/utils/hash.dart';
|
import 'package:immich_mobile/utils/hash.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final authProvider = StateNotifierProvider<AuthNotifier, AuthState>((ref) {
|
final authProvider = StateNotifierProvider<AuthNotifier, AuthState>((ref) {
|
||||||
return AuthNotifier(
|
return AuthNotifier(
|
||||||
|
|
@ -150,10 +150,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
||||||
_log.severe("Error getting user information from the server [API EXCEPTION]", stackTrace);
|
_log.severe("Error getting user information from the server [API EXCEPTION]", stackTrace);
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
_log.severe("Error getting user information from the server [CATCH ALL]", error, stackTrace);
|
_log.severe("Error getting user information from the server [CATCH ALL]", error, stackTrace);
|
||||||
|
dPrint(() => "Error getting user information from the server [CATCH ALL] $error $stackTrace");
|
||||||
if (kDebugMode) {
|
|
||||||
debugPrint("Error getting user information from the server [CATCH ALL] $error $stackTrace");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user is null, the login was not successful
|
// If the user is null, the login was not successful
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:cancellation_token_http/http.dart';
|
import 'package:cancellation_token_http/http.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/entities/album.entity.dart';
|
import 'package:immich_mobile/entities/album.entity.dart';
|
||||||
|
|
@ -33,6 +31,7 @@ import 'package:immich_mobile/utils/diff.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final backupProvider = StateNotifierProvider<BackupNotifier, BackUpState>((ref) {
|
final backupProvider = StateNotifierProvider<BackupNotifier, BackUpState>((ref) {
|
||||||
return BackupNotifier(
|
return BackupNotifier(
|
||||||
|
|
@ -286,7 +285,7 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
||||||
state = state.copyWith(selectedBackupAlbums: selectedAlbums, excludedBackupAlbums: excludedAlbums);
|
state = state.copyWith(selectedBackupAlbums: selectedAlbums, excludedBackupAlbums: excludedAlbums);
|
||||||
|
|
||||||
log.info("_getBackupAlbumsInfo: Found ${availableAlbums.length} available albums");
|
log.info("_getBackupAlbumsInfo: Found ${availableAlbums.length} available albums");
|
||||||
debugPrint("_getBackupAlbumsInfo takes ${stopwatch.elapsedMilliseconds}ms");
|
dPrint(() => "_getBackupAlbumsInfo takes ${stopwatch.elapsedMilliseconds}ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
@ -428,7 +427,7 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
||||||
|
|
||||||
/// Invoke backup process
|
/// Invoke backup process
|
||||||
Future<void> startBackupProcess() async {
|
Future<void> startBackupProcess() async {
|
||||||
debugPrint("Start backup process");
|
dPrint(() => "Start backup process");
|
||||||
assert(state.backupProgress == BackUpProgressEnum.idle);
|
assert(state.backupProgress == BackUpProgressEnum.idle);
|
||||||
state = state.copyWith(backupProgress: BackUpProgressEnum.inProgress);
|
state = state.copyWith(backupProgress: BackUpProgressEnum.inProgress);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:background_downloader/background_downloader.dart';
|
import 'package:background_downloader/background_downloader.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/constants.dart';
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||||
|
|
@ -14,6 +13,7 @@ import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
||||||
import 'package:immich_mobile/providers/user.provider.dart';
|
import 'package:immich_mobile/providers/user.provider.dart';
|
||||||
import 'package:immich_mobile/services/upload.service.dart';
|
import 'package:immich_mobile/services/upload.service.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class EnqueueStatus {
|
class EnqueueStatus {
|
||||||
final int enqueueCount;
|
final int enqueueCount;
|
||||||
|
|
@ -329,16 +329,16 @@ class DriftBackupNotifier extends StateNotifier<DriftBackupState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> cancel() async {
|
Future<void> cancel() async {
|
||||||
debugPrint("Canceling backup tasks...");
|
dPrint(() => "Canceling backup tasks...");
|
||||||
state = state.copyWith(enqueueCount: 0, enqueueTotalCount: 0, isCanceling: true);
|
state = state.copyWith(enqueueCount: 0, enqueueTotalCount: 0, isCanceling: true);
|
||||||
|
|
||||||
final activeTaskCount = await _uploadService.cancelBackup();
|
final activeTaskCount = await _uploadService.cancelBackup();
|
||||||
|
|
||||||
if (activeTaskCount > 0) {
|
if (activeTaskCount > 0) {
|
||||||
debugPrint("$activeTaskCount tasks left, continuing to cancel...");
|
dPrint(() => "$activeTaskCount tasks left, continuing to cancel...");
|
||||||
await cancel();
|
await cancel();
|
||||||
} else {
|
} else {
|
||||||
debugPrint("All tasks canceled successfully.");
|
dPrint(() => "All tasks canceled successfully.");
|
||||||
// Clear all upload items when cancellation is complete
|
// Clear all upload items when cancellation is complete
|
||||||
state = state.copyWith(isCanceling: false, uploadItems: {});
|
state = state.copyWith(isCanceling: false, uploadItems: {});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final manualUploadProvider = StateNotifierProvider<ManualUploadNotifier, ManualUploadState>((ref) {
|
final manualUploadProvider = StateNotifierProvider<ManualUploadNotifier, ManualUploadState>((ref) {
|
||||||
return ManualUploadNotifier(
|
return ManualUploadNotifier(
|
||||||
|
|
@ -216,7 +217,7 @@ class ManualUploadNotifier extends StateNotifier<ManualUploadState> {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (uploadAssets.isEmpty) {
|
if (uploadAssets.isEmpty) {
|
||||||
debugPrint("[_startUpload] No Assets to upload - Abort Process");
|
dPrint(() => "[_startUpload] No Assets to upload - Abort Process");
|
||||||
_backupProvider.updateBackupProgress(BackUpProgressEnum.idle);
|
_backupProvider.updateBackupProgress(BackUpProgressEnum.idle);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -294,10 +295,10 @@ class ManualUploadNotifier extends StateNotifier<ManualUploadState> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
openAppSettings();
|
openAppSettings();
|
||||||
debugPrint("[_startUpload] Do not have permission to the gallery");
|
dPrint(() => "[_startUpload] Do not have permission to the gallery");
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("ERROR _startUpload: ${e.toString()}");
|
dPrint(() => "ERROR _startUpload: ${e.toString()}");
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
} finally {
|
} finally {
|
||||||
_backupProvider.updateBackupProgress(BackUpProgressEnum.idle);
|
_backupProvider.updateBackupProgress(BackUpProgressEnum.idle);
|
||||||
|
|
@ -340,7 +341,7 @@ class ManualUploadNotifier extends StateNotifier<ManualUploadState> {
|
||||||
// waits until it has stopped to start the backup.
|
// waits until it has stopped to start the backup.
|
||||||
final bool hasLock = await ref.read(backgroundServiceProvider).acquireLock();
|
final bool hasLock = await ref.read(backgroundServiceProvider).acquireLock();
|
||||||
if (!hasLock) {
|
if (!hasLock) {
|
||||||
debugPrint("[uploadAssets] could not acquire lock, exiting");
|
dPrint(() => "[uploadAssets] could not acquire lock, exiting");
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
context: context,
|
context: context,
|
||||||
msg: "failed".tr(),
|
msg: "failed".tr(),
|
||||||
|
|
@ -355,18 +356,18 @@ class ManualUploadNotifier extends StateNotifier<ManualUploadState> {
|
||||||
|
|
||||||
// check if backup is already in process - then return
|
// check if backup is already in process - then return
|
||||||
if (_backupProvider.backupProgress == BackUpProgressEnum.manualInProgress) {
|
if (_backupProvider.backupProgress == BackUpProgressEnum.manualInProgress) {
|
||||||
debugPrint("[uploadAssets] Manual upload is already running - abort");
|
dPrint(() => "[uploadAssets] Manual upload is already running - abort");
|
||||||
showInProgress = true;
|
showInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_backupProvider.backupProgress == BackUpProgressEnum.inProgress) {
|
if (_backupProvider.backupProgress == BackUpProgressEnum.inProgress) {
|
||||||
debugPrint("[uploadAssets] Auto Backup is already in progress - abort");
|
dPrint(() => "[uploadAssets] Auto Backup is already in progress - abort");
|
||||||
showInProgress = true;
|
showInProgress = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_backupProvider.backupProgress == BackUpProgressEnum.inBackground) {
|
if (_backupProvider.backupProgress == BackUpProgressEnum.inBackground) {
|
||||||
debugPrint("[uploadAssets] Background backup is running - abort");
|
dPrint(() => "[uploadAssets] Background backup is running - abort");
|
||||||
showInProgress = true;
|
showInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,12 @@ import 'package:immich_mobile/theme/theme_data.dart';
|
||||||
import 'package:immich_mobile/theme/dynamic_theme.dart';
|
import 'package:immich_mobile/theme/dynamic_theme.dart';
|
||||||
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
||||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final immichThemeModeProvider = StateProvider<ThemeMode>((ref) {
|
final immichThemeModeProvider = StateProvider<ThemeMode>((ref) {
|
||||||
final themeMode = ref.watch(appSettingsServiceProvider).getSetting(AppSettingsEnum.themeMode);
|
final themeMode = ref.watch(appSettingsServiceProvider).getSetting(AppSettingsEnum.themeMode);
|
||||||
|
|
||||||
debugPrint("Current themeMode $themeMode");
|
dPrint(() => "Current themeMode $themeMode");
|
||||||
|
|
||||||
if (themeMode == ThemeMode.light.name) {
|
if (themeMode == ThemeMode.light.name) {
|
||||||
return ThemeMode.light;
|
return ThemeMode.light;
|
||||||
|
|
@ -26,12 +27,12 @@ final immichThemePresetProvider = StateProvider<ImmichColorPreset>((ref) {
|
||||||
final appSettingsProvider = ref.watch(appSettingsServiceProvider);
|
final appSettingsProvider = ref.watch(appSettingsServiceProvider);
|
||||||
final primaryColorPreset = appSettingsProvider.getSetting(AppSettingsEnum.primaryColor);
|
final primaryColorPreset = appSettingsProvider.getSetting(AppSettingsEnum.primaryColor);
|
||||||
|
|
||||||
debugPrint("Current theme preset $primaryColorPreset");
|
dPrint(() => "Current theme preset $primaryColorPreset");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return ImmichColorPreset.values.firstWhere((e) => e.name == primaryColorPreset);
|
return ImmichColorPreset.values.firstWhere((e) => e.name == primaryColorPreset);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Theme preset $primaryColorPreset not found. Applying default preset.");
|
dPrint(() => "Theme preset $primaryColorPreset not found. Applying default preset.");
|
||||||
appSettingsProvider.setSetting(AppSettingsEnum.primaryColor, defaultColorPresetName);
|
appSettingsProvider.setSetting(AppSettingsEnum.primaryColor, defaultColorPresetName);
|
||||||
return defaultColorPreset;
|
return defaultColorPreset;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:immich_mobile/domain/services/user.service.dart';
|
import 'package:immich_mobile/domain/services/user.service.dart';
|
||||||
import 'package:immich_mobile/providers/infrastructure/user.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/user.provider.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
enum UploadProfileStatus { idle, loading, success, failure }
|
enum UploadProfileStatus { idle, loading, success, failure }
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ class UploadProfileImageNotifier extends StateNotifier<UploadProfileImageState>
|
||||||
var profileImagePath = await _userService.createProfileImage(file.name, await file.readAsBytes());
|
var profileImagePath = await _userService.createProfileImage(file.name, await file.readAsBytes());
|
||||||
|
|
||||||
if (profileImagePath != null) {
|
if (profileImagePath != null) {
|
||||||
debugPrint("Successfully upload profile image");
|
dPrint(() => "Successfully upload profile image");
|
||||||
state = state.copyWith(status: UploadProfileStatus.success, profileImagePath: profileImagePath);
|
state = state.copyWith(status: UploadProfileStatus.success, profileImagePath: profileImagePath);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/entities/asset.entity.dart';
|
import 'package:immich_mobile/entities/asset.entity.dart';
|
||||||
|
|
@ -20,6 +18,7 @@ import 'package:immich_mobile/utils/debounce.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:socket_io_client/socket_io_client.dart';
|
import 'package:socket_io_client/socket_io_client.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
enum PendingAction { assetDelete, assetUploaded, assetHidden, assetTrash }
|
enum PendingAction { assetDelete, assetUploaded, assetHidden, assetTrash }
|
||||||
|
|
||||||
|
|
@ -105,7 +104,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||||
headers["Authorization"] = "Basic ${base64.encode(utf8.encode(endpoint.userInfo))}";
|
headers["Authorization"] = "Basic ${base64.encode(utf8.encode(endpoint.userInfo))}";
|
||||||
}
|
}
|
||||||
|
|
||||||
debugPrint("Attempting to connect to websocket");
|
dPrint(() => "Attempting to connect to websocket");
|
||||||
// Configure socket transports must be specified
|
// Configure socket transports must be specified
|
||||||
Socket socket = io(
|
Socket socket = io(
|
||||||
endpoint.origin,
|
endpoint.origin,
|
||||||
|
|
@ -121,12 +120,12 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||||
);
|
);
|
||||||
|
|
||||||
socket.onConnect((_) {
|
socket.onConnect((_) {
|
||||||
debugPrint("Established Websocket Connection");
|
dPrint(() => "Established Websocket Connection");
|
||||||
state = WebsocketState(isConnected: true, socket: socket, pendingChanges: state.pendingChanges);
|
state = WebsocketState(isConnected: true, socket: socket, pendingChanges: state.pendingChanges);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.onDisconnect((_) {
|
socket.onDisconnect((_) {
|
||||||
debugPrint("Disconnect to Websocket Connection");
|
dPrint(() => "Disconnect to Websocket Connection");
|
||||||
state = WebsocketState(isConnected: false, socket: null, pendingChanges: state.pendingChanges);
|
state = WebsocketState(isConnected: false, socket: null, pendingChanges: state.pendingChanges);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -150,13 +149,13 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||||
socket.on('on_config_update', _handleOnConfigUpdate);
|
socket.on('on_config_update', _handleOnConfigUpdate);
|
||||||
socket.on('on_new_release', _handleReleaseUpdates);
|
socket.on('on_new_release', _handleReleaseUpdates);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("[WEBSOCKET] Catch Websocket Error - ${e.toString()}");
|
dPrint(() => "[WEBSOCKET] Catch Websocket Error - ${e.toString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void disconnect() {
|
void disconnect() {
|
||||||
debugPrint("Attempting to disconnect from websocket");
|
dPrint(() => "Attempting to disconnect from websocket");
|
||||||
|
|
||||||
_batchedAssetUploadReady.clear();
|
_batchedAssetUploadReady.clear();
|
||||||
|
|
||||||
|
|
@ -200,7 +199,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void listenUploadEvent() {
|
void listenUploadEvent() {
|
||||||
debugPrint("Start listening to event on_upload_success");
|
dPrint(() => "Start listening to event on_upload_success");
|
||||||
state.socket?.on('on_upload_success', _handleOnUploadSuccess);
|
state.socket?.on('on_upload_success', _handleOnUploadSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:background_downloader/background_downloader.dart';
|
import 'package:background_downloader/background_downloader.dart';
|
||||||
import 'package:cancellation_token_http/http.dart';
|
import 'package:cancellation_token_http/http.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/constants.dart';
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/entities/store.entity.dart';
|
import 'package:immich_mobile/entities/store.entity.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class UploadTaskWithFile {
|
class UploadTaskWithFile {
|
||||||
final File file;
|
final File file;
|
||||||
|
|
@ -79,14 +79,17 @@ class UploadRepository {
|
||||||
FileDownloader().database.allRecordsWithStatus(TaskStatus.paused, group: kBackupGroup),
|
FileDownloader().database.allRecordsWithStatus(TaskStatus.paused, group: kBackupGroup),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
debugPrint("""
|
dPrint(
|
||||||
|
() =>
|
||||||
|
"""
|
||||||
Upload Info:
|
Upload Info:
|
||||||
Enqueued: ${enqueuedTasks.length}
|
Enqueued: ${enqueuedTasks.length}
|
||||||
Running: ${runningTasks.length}
|
Running: ${runningTasks.length}
|
||||||
Canceled: ${canceledTasks.length}
|
Canceled: ${canceledTasks.length}
|
||||||
Waiting: ${waitingTasks.length}
|
Waiting: ${waitingTasks.length}
|
||||||
Paused: ${pausedTasks.length}
|
Paused: ${pausedTasks.length}
|
||||||
""");
|
""",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> backupWithDartClient(Iterable<UploadTaskWithFile> tasks, CancellationToken cancelToken) async {
|
Future<void> backupWithDartClient(Iterable<UploadTaskWithFile> tasks, CancellationToken cancelToken) async {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
/// Guards against duplicate navigation to this route
|
/// Guards against duplicate navigation to this route
|
||||||
class DuplicateGuard extends AutoRouteGuard {
|
class DuplicateGuard extends AutoRouteGuard {
|
||||||
|
|
@ -8,7 +8,7 @@ class DuplicateGuard extends AutoRouteGuard {
|
||||||
void onNavigation(NavigationResolver resolver, StackRouter router) async {
|
void onNavigation(NavigationResolver resolver, StackRouter router) async {
|
||||||
// Duplicate navigation
|
// Duplicate navigation
|
||||||
if (resolver.route.name == router.current.name) {
|
if (resolver.route.name == router.current.name) {
|
||||||
debugPrint('DuplicateGuard: Preventing duplicate route navigation for ${resolver.route.name}');
|
dPrint(() => 'DuplicateGuard: Preventing duplicate route navigation for ${resolver.route.name}');
|
||||||
resolver.next(false);
|
resolver.next(false);
|
||||||
} else {
|
} else {
|
||||||
resolver.next(true);
|
resolver.next(true);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import 'dart:collection';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/enums.dart';
|
import 'package:immich_mobile/constants/enums.dart';
|
||||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
|
|
@ -24,6 +23,7 @@ import 'package:immich_mobile/services/entity.service.dart';
|
||||||
import 'package:immich_mobile/services/sync.service.dart';
|
import 'package:immich_mobile/services/sync.service.dart';
|
||||||
import 'package:immich_mobile/utils/hash.dart';
|
import 'package:immich_mobile/utils/hash.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final albumServiceProvider = Provider(
|
final albumServiceProvider = Provider(
|
||||||
(ref) => AlbumService(
|
(ref) => AlbumService(
|
||||||
|
|
@ -124,7 +124,7 @@ class AlbumService {
|
||||||
} finally {
|
} finally {
|
||||||
_localCompleter.complete(changes);
|
_localCompleter.complete(changes);
|
||||||
}
|
}
|
||||||
debugPrint("refreshDeviceAlbums took ${sw.elapsedMilliseconds}ms");
|
dPrint(() => "refreshDeviceAlbums took ${sw.elapsedMilliseconds}ms");
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ class AlbumService {
|
||||||
} finally {
|
} finally {
|
||||||
_remoteCompleter.complete(changes);
|
_remoteCompleter.complete(changes);
|
||||||
}
|
}
|
||||||
debugPrint("refreshRemoteAlbums took ${sw.elapsedMilliseconds}ms");
|
dPrint(() => "refreshRemoteAlbums took ${sw.elapsedMilliseconds}ms");
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ class AlbumService {
|
||||||
|
|
||||||
return AlbumAddAssetsResponse(alreadyInAlbum: result.duplicates, successfullyAdded: addedAssets.length);
|
return AlbumAddAssetsResponse(alreadyInAlbum: result.duplicates, successfullyAdded: addedAssets.length);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error addAssets ${e.toString()}");
|
dPrint(() => "Error addAssets ${e.toString()}");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -242,7 +242,7 @@ class AlbumService {
|
||||||
await _albumRepository.update(album);
|
await _albumRepository.update(album);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error setActivityEnabled ${e.toString()}");
|
dPrint(() => "Error setActivityEnabled ${e.toString()}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -271,7 +271,7 @@ class AlbumService {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error deleteAlbum ${e.toString()}");
|
dPrint(() => "Error deleteAlbum ${e.toString()}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +281,7 @@ class AlbumService {
|
||||||
await _albumApiRepository.removeUser(album.remoteId!, userId: "me");
|
await _albumApiRepository.removeUser(album.remoteId!, userId: "me");
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error leaveAlbum ${e.toString()}");
|
dPrint(() => "Error leaveAlbum ${e.toString()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,7 +293,7 @@ class AlbumService {
|
||||||
await _updateAssets(album.id, remove: toRemove.toList());
|
await _updateAssets(album.id, remove: toRemove.toList());
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error removeAssetFromAlbum ${e.toString()}");
|
dPrint(() => "Error removeAssetFromAlbum ${e.toString()}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -310,7 +310,7 @@ class AlbumService {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("Error removeUser ${error.toString()}");
|
dPrint(() => "Error removeUser ${error.toString()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -327,7 +327,7 @@ class AlbumService {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("Error addUsers ${error.toString()}");
|
dPrint(() => "Error addUsers ${error.toString()}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -340,7 +340,7 @@ class AlbumService {
|
||||||
await _albumRepository.update(album);
|
await _albumRepository.update(album);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error changeTitleAlbum ${e.toString()}");
|
dPrint(() => "Error changeTitleAlbum ${e.toString()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -353,7 +353,7 @@ class AlbumService {
|
||||||
await _albumRepository.update(album);
|
await _albumRepository.update(album);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error changeDescriptionAlbum ${e.toString()}");
|
dPrint(() => "Error changeDescriptionAlbum ${e.toString()}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/entities/store.entity.dart';
|
import 'package:immich_mobile/entities/store.entity.dart';
|
||||||
|
|
@ -11,6 +10,7 @@ import 'package:immich_mobile/utils/url_helper.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
import 'package:immich_mobile/utils/user_agent.dart';
|
import 'package:immich_mobile/utils/user_agent.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class ApiService implements Authentication {
|
class ApiService implements Authentication {
|
||||||
late ApiClient _apiClient;
|
late ApiClient _apiClient;
|
||||||
|
|
@ -155,7 +155,7 @@ class ApiService implements Authentication {
|
||||||
return endpoint;
|
return endpoint;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Could not locate /.well-known/immich at $baseUrl");
|
dPrint(() => "Could not locate /.well-known/immich at $baseUrl");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/enums.dart';
|
import 'package:immich_mobile/constants/enums.dart';
|
||||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
|
|
@ -26,6 +25,7 @@ import 'package:immich_mobile/services/sync.service.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final assetServiceProvider = Provider(
|
final assetServiceProvider = Provider(
|
||||||
(ref) => AssetService(
|
(ref) => AssetService(
|
||||||
|
|
@ -87,7 +87,7 @@ class AssetService {
|
||||||
getChangedAssets: _getRemoteAssetChanges,
|
getChangedAssets: _getRemoteAssetChanges,
|
||||||
loadAssets: _getRemoteAssets,
|
loadAssets: _getRemoteAssets,
|
||||||
);
|
);
|
||||||
debugPrint("refreshRemoteAssets full took ${sw.elapsedMilliseconds}ms");
|
dPrint(() => "refreshRemoteAssets full took ${sw.elapsedMilliseconds}ms");
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ class AssetService {
|
||||||
if (a.isInDb) {
|
if (a.isInDb) {
|
||||||
await _assetRepository.transaction(() => _assetRepository.update(a));
|
await _assetRepository.transaction(() => _assetRepository.update(a));
|
||||||
} else {
|
} else {
|
||||||
debugPrint("[loadExif] parameter Asset is not from DB!");
|
dPrint(() => "[loadExif] parameter Asset is not from DB!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import 'dart:ui' show DartPluginRegistrant, IsolateNameServer, PluginUtilities;
|
||||||
import 'package:cancellation_token_http/http.dart';
|
import 'package:cancellation_token_http/http.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.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:immich_mobile/utils/http_ssl_options.dart';
|
||||||
import 'package:path_provider_foundation/path_provider_foundation.dart';
|
import 'package:path_provider_foundation/path_provider_foundation.dart';
|
||||||
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final backgroundServiceProvider = Provider((ref) => BackgroundService());
|
final backgroundServiceProvider = Provider((ref) => BackgroundService());
|
||||||
|
|
||||||
|
|
@ -165,7 +165,7 @@ class BackgroundService {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[_updateNotification] failed to communicate with plugin");
|
dPrint(() => "[_updateNotification] failed to communicate with plugin");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -177,7 +177,7 @@ class BackgroundService {
|
||||||
return await _backgroundChannel.invokeMethod('showError', [title, content, individualTag]);
|
return await _backgroundChannel.invokeMethod('showError', [title, content, individualTag]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[_showErrorNotification] failed to communicate with plugin");
|
dPrint(() => "[_showErrorNotification] failed to communicate with plugin");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +188,7 @@ class BackgroundService {
|
||||||
return await _backgroundChannel.invokeMethod('clearErrorNotifications');
|
return await _backgroundChannel.invokeMethod('clearErrorNotifications');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[_clearErrorNotifications] failed to communicate with plugin");
|
dPrint(() => "[_clearErrorNotifications] failed to communicate with plugin");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +196,7 @@ class BackgroundService {
|
||||||
/// await to ensure this thread (foreground or background) has exclusive access
|
/// await to ensure this thread (foreground or background) has exclusive access
|
||||||
Future<bool> acquireLock() async {
|
Future<bool> acquireLock() async {
|
||||||
if (_hasLock) {
|
if (_hasLock) {
|
||||||
debugPrint("WARNING: [acquireLock] called more than once");
|
dPrint(() => "WARNING: [acquireLock] called more than once");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final int lockTime = Timeline.now;
|
final int lockTime = Timeline.now;
|
||||||
|
|
@ -302,19 +302,19 @@ class BackgroundService {
|
||||||
|
|
||||||
final bool hasAccess = await waitForLock;
|
final bool hasAccess = await waitForLock;
|
||||||
if (!hasAccess) {
|
if (!hasAccess) {
|
||||||
debugPrint("[_callHandler] could not acquire lock, exiting");
|
dPrint(() => "[_callHandler] could not acquire lock, exiting");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final translationsOk = await loadTranslations();
|
final translationsOk = await loadTranslations();
|
||||||
if (!translationsOk) {
|
if (!translationsOk) {
|
||||||
debugPrint("[_callHandler] could not load translations");
|
dPrint(() => "[_callHandler] could not load translations");
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool ok = await _onAssetsChanged();
|
final bool ok = await _onAssetsChanged();
|
||||||
return ok;
|
return ok;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint(error.toString());
|
dPrint(() => error.toString());
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
releaseLock();
|
releaseLock();
|
||||||
|
|
@ -324,7 +324,7 @@ class BackgroundService {
|
||||||
_cancellationToken?.cancel();
|
_cancellationToken?.cancel();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
debugPrint("Unknown method ${call.method}");
|
dPrint(() => "Unknown method ${call.method}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -344,9 +344,7 @@ class BackgroundService {
|
||||||
HttpSSLOptions.apply();
|
HttpSSLOptions.apply();
|
||||||
ref.read(apiServiceProvider).setAccessToken(Store.get(StoreKey.accessToken));
|
ref.read(apiServiceProvider).setAccessToken(Store.get(StoreKey.accessToken));
|
||||||
await ref.read(authServiceProvider).setOpenApiServiceEndpoint();
|
await ref.read(authServiceProvider).setOpenApiServiceEndpoint();
|
||||||
if (kDebugMode) {
|
dPrint(() => "[BG UPLOAD] Using endpoint: ${ref.read(apiServiceProvider).apiClient.basePath}");
|
||||||
debugPrint("[BG UPLOAD] Using endpoint: ${ref.read(apiServiceProvider).apiClient.basePath}");
|
|
||||||
}
|
|
||||||
|
|
||||||
final selectedAlbums = await ref.read(backupAlbumRepositoryProvider).getAllBySelection(BackupSelection.select);
|
final selectedAlbums = await ref.read(backupAlbumRepositoryProvider).getAllBySelection(BackupSelection.select);
|
||||||
final excludedAlbums = await ref.read(backupAlbumRepositoryProvider).getAllBySelection(BackupSelection.exclude);
|
final excludedAlbums = await ref.read(backupAlbumRepositoryProvider).getAllBySelection(BackupSelection.exclude);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:cancellation_token_http/http.dart' as http;
|
import 'package:cancellation_token_http/http.dart' as http;
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/entities/album.entity.dart';
|
import 'package:immich_mobile/entities/album.entity.dart';
|
||||||
|
|
@ -29,6 +28,7 @@ import 'package:openapi/api.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
import 'package:permission_handler/permission_handler.dart' as pm;
|
import 'package:permission_handler/permission_handler.dart' as pm;
|
||||||
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
import 'package:photo_manager/photo_manager.dart' show PMProgressHandler;
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final backupServiceProvider = Provider(
|
final backupServiceProvider = Provider(
|
||||||
(ref) => BackupService(
|
(ref) => BackupService(
|
||||||
|
|
@ -69,7 +69,7 @@ class BackupService {
|
||||||
try {
|
try {
|
||||||
return await _apiService.assetsApi.getAllUserAssetsByDeviceId(deviceId);
|
return await _apiService.assetsApi.getAllUserAssetsByDeviceId(deviceId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('Error [getDeviceBackupAsset] ${e.toString()}');
|
dPrint(() => 'Error [getDeviceBackupAsset] ${e.toString()}');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -356,8 +356,9 @@ class BackupService {
|
||||||
final error = responseBody;
|
final error = responseBody;
|
||||||
final errorMessage = error['message'] ?? error['error'];
|
final errorMessage = error['message'] ?? error['error'];
|
||||||
|
|
||||||
debugPrint(
|
dPrint(
|
||||||
"Error(${error['statusCode']}) uploading ${asset.localId} | $originalFileName | Created on ${asset.fileCreatedAt} | ${error['error']}",
|
() =>
|
||||||
|
"Error(${error['statusCode']}) uploading ${asset.localId} | $originalFileName | Created on ${asset.fileCreatedAt} | ${error['error']}",
|
||||||
);
|
);
|
||||||
|
|
||||||
onError(
|
onError(
|
||||||
|
|
@ -398,11 +399,11 @@ class BackupService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on http.CancelledException {
|
} on http.CancelledException {
|
||||||
debugPrint("Backup was cancelled by the user");
|
dPrint(() => "Backup was cancelled by the user");
|
||||||
anyErrors = true;
|
anyErrors = true;
|
||||||
break;
|
break;
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
debugPrint("Error backup asset: ${error.toString()}: $stackTrace");
|
dPrint(() => "Error backup asset: ${error.toString()}: $stackTrace");
|
||||||
anyErrors = true;
|
anyErrors = true;
|
||||||
continue;
|
continue;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -411,7 +412,7 @@ class BackupService {
|
||||||
await file?.delete();
|
await file?.delete();
|
||||||
await livePhotoFile?.delete();
|
await livePhotoFile?.delete();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("ERROR deleting file: ${e.toString()}");
|
dPrint(() => "ERROR deleting file: ${e.toString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -454,7 +455,9 @@ class BackupService {
|
||||||
if (![200, 201].contains(response.statusCode)) {
|
if (![200, 201].contains(response.statusCode)) {
|
||||||
var error = responseBody;
|
var error = responseBody;
|
||||||
|
|
||||||
debugPrint("Error(${error['statusCode']}) uploading livePhoto for assetId | $livePhotoTitle | ${error['error']}");
|
dPrint(
|
||||||
|
() => "Error(${error['statusCode']}) uploading livePhoto for assetId | $livePhotoTitle | ${error['error']}",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return responseBody.containsKey('id') ? responseBody['id'] : null;
|
return responseBody.containsKey('id') ? responseBody['id'] : null;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/providers/backup/manual_upload.provider.dart';
|
import 'package:immich_mobile/providers/backup/manual_upload.provider.dart';
|
||||||
import 'package:immich_mobile/providers/notification_permission.provider.dart';
|
import 'package:immich_mobile/providers/notification_permission.provider.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final localNotificationService = Provider(
|
final localNotificationService = Provider(
|
||||||
(ref) => LocalNotificationService(ref.watch(notificationPermissionProvider), ref),
|
(ref) => LocalNotificationService(ref.watch(notificationPermissionProvider), ref),
|
||||||
|
|
@ -110,7 +110,7 @@ class LocalNotificationService {
|
||||||
switch (notificationResponse.actionId) {
|
switch (notificationResponse.actionId) {
|
||||||
case cancelUploadActionID:
|
case cancelUploadActionID:
|
||||||
{
|
{
|
||||||
debugPrint("User cancelled manual upload operation");
|
dPrint(() => "User cancelled manual upload operation");
|
||||||
ref.read(manualUploadProvider.notifier).cancelBackup();
|
ref.read(manualUploadProvider.notifier).cancelBackup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
import 'package:easy_localization/src/easy_localization_controller.dart';
|
import 'package:easy_localization/src/easy_localization_controller.dart';
|
||||||
import 'package:easy_localization/src/localization.dart';
|
import 'package:easy_localization/src/localization.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:immich_mobile/constants/locales.dart';
|
import 'package:immich_mobile/constants/locales.dart';
|
||||||
import 'package:immich_mobile/generated/codegen_loader.g.dart';
|
import 'package:immich_mobile/generated/codegen_loader.g.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
/// Workaround to manually load translations in another Isolate
|
/// Workaround to manually load translations in another Isolate
|
||||||
Future<bool> loadTranslations() async {
|
Future<bool> loadTranslations() async {
|
||||||
|
|
@ -17,7 +17,7 @@ Future<bool> loadTranslations() async {
|
||||||
assetLoader: const CodegenLoader(),
|
assetLoader: const CodegenLoader(),
|
||||||
path: translationsPath,
|
path: translationsPath,
|
||||||
useOnlyLangCode: false,
|
useOnlyLangCode: false,
|
||||||
onLoadError: (e) => debugPrint(e.toString()),
|
onLoadError: (e) => dPrint(() => e.toString()),
|
||||||
fallbackLocale: locales.values.first,
|
fallbackLocale: locales.values.first,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/extensions/string_extensions.dart';
|
import 'package:immich_mobile/extensions/string_extensions.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/search_api.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/search_api.repository.dart';
|
||||||
|
|
@ -10,6 +9,7 @@ import 'package:immich_mobile/repositories/asset.repository.dart';
|
||||||
import 'package:immich_mobile/services/api.service.dart';
|
import 'package:immich_mobile/services/api.service.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final searchServiceProvider = Provider(
|
final searchServiceProvider = Provider(
|
||||||
(ref) => SearchService(
|
(ref) => SearchService(
|
||||||
|
|
@ -43,7 +43,7 @@ class SearchService {
|
||||||
model: model,
|
model: model,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("[ERROR] [getSearchSuggestions] ${e.toString()}");
|
dPrint(() => "[ERROR] [getSearchSuggestions] ${e.toString()}");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/models/server_info/server_config.model.dart';
|
import 'package:immich_mobile/models/server_info/server_config.model.dart';
|
||||||
import 'package:immich_mobile/models/server_info/server_disk_info.model.dart';
|
import 'package:immich_mobile/models/server_info/server_disk_info.model.dart';
|
||||||
|
|
@ -6,6 +5,7 @@ import 'package:immich_mobile/models/server_info/server_features.model.dart';
|
||||||
import 'package:immich_mobile/models/server_info/server_version.model.dart';
|
import 'package:immich_mobile/models/server_info/server_version.model.dart';
|
||||||
import 'package:immich_mobile/providers/api.provider.dart';
|
import 'package:immich_mobile/providers/api.provider.dart';
|
||||||
import 'package:immich_mobile/services/api.service.dart';
|
import 'package:immich_mobile/services/api.service.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final serverInfoServiceProvider = Provider((ref) => ServerInfoService(ref.watch(apiServiceProvider)));
|
final serverInfoServiceProvider = Provider((ref) => ServerInfoService(ref.watch(apiServiceProvider)));
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ class ServerInfoService {
|
||||||
return ServerDiskInfo.fromDto(dto);
|
return ServerDiskInfo.fromDto(dto);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error [getDiskInfo] ${e.toString()}");
|
dPrint(() => "Error [getDiskInfo] ${e.toString()}");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -42,7 +42,7 @@ class ServerInfoService {
|
||||||
return ServerVersion.fromDto(dto);
|
return ServerVersion.fromDto(dto);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error [getServerVersion] ${e.toString()}");
|
dPrint(() => "Error [getServerVersion] ${e.toString()}");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ class ServerInfoService {
|
||||||
return ServerFeatures.fromDto(dto);
|
return ServerFeatures.fromDto(dto);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error [getServerFeatures] ${e.toString()}");
|
dPrint(() => "Error [getServerFeatures] ${e.toString()}");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +66,7 @@ class ServerInfoService {
|
||||||
return ServerConfig.fromDto(dto);
|
return ServerConfig.fromDto(dto);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error [getServerConfig] ${e.toString()}");
|
dPrint(() => "Error [getServerConfig] ${e.toString()}");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/entities/asset.entity.dart';
|
import 'package:immich_mobile/entities/asset.entity.dart';
|
||||||
import 'package:immich_mobile/providers/api.provider.dart';
|
import 'package:immich_mobile/providers/api.provider.dart';
|
||||||
import 'package:immich_mobile/repositories/asset.repository.dart';
|
import 'package:immich_mobile/repositories/asset.repository.dart';
|
||||||
import 'package:immich_mobile/services/api.service.dart';
|
import 'package:immich_mobile/services/api.service.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class StackService {
|
class StackService {
|
||||||
const StackService(this._api, this._assetRepository);
|
const StackService(this._api, this._assetRepository);
|
||||||
|
|
@ -16,7 +16,7 @@ class StackService {
|
||||||
try {
|
try {
|
||||||
return _api.stacksApi.getStack(stackId);
|
return _api.stacksApi.getStack(stackId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("Error while fetching stack: $error");
|
dPrint(() => "Error while fetching stack: $error");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,7 @@ class StackService {
|
||||||
try {
|
try {
|
||||||
return _api.stacksApi.createStack(StackCreateDto(assetIds: assetIds));
|
return _api.stacksApi.createStack(StackCreateDto(assetIds: assetIds));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("Error while creating stack: $error");
|
dPrint(() => "Error while creating stack: $error");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -34,7 +34,7 @@ class StackService {
|
||||||
try {
|
try {
|
||||||
return await _api.stacksApi.updateStack(stackId, StackUpdateDto(primaryAssetId: primaryAssetId));
|
return await _api.stacksApi.updateStack(stackId, StackUpdateDto(primaryAssetId: primaryAssetId));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("Error while updating stack children: $error");
|
dPrint(() => "Error while updating stack children: $error");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ class StackService {
|
||||||
}
|
}
|
||||||
await _assetRepository.transaction(() => _assetRepository.updateAll(removeAssets));
|
await _assetRepository.transaction(() => _assetRepository.updateAll(removeAssets));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("Error while deleting stack: $error");
|
dPrint(() => "Error while deleting stack: $error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:background_downloader/background_downloader.dart';
|
import 'package:background_downloader/background_downloader.dart';
|
||||||
import 'package:cancellation_token_http/http.dart';
|
import 'package:cancellation_token_http/http.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/constants/constants.dart';
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||||
|
|
@ -22,6 +21,7 @@ import 'package:immich_mobile/services/api.service.dart';
|
||||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
final uploadServiceProvider = Provider((ref) {
|
final uploadServiceProvider = Provider((ref) {
|
||||||
final service = UploadService(
|
final service = UploadService(
|
||||||
|
|
@ -253,7 +253,7 @@ class UploadService {
|
||||||
|
|
||||||
enqueueTasks([uploadTask]);
|
enqueueTasks([uploadTask]);
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
debugPrint("Error handling live photo upload task: $error $stackTrace");
|
dPrint(() => "Error handling live photo upload task: $error $stackTrace");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
|
|
||||||
import 'package:immich_mobile/theme/theme_data.dart';
|
import 'package:immich_mobile/theme/theme_data.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
abstract final class DynamicTheme {
|
abstract final class DynamicTheme {
|
||||||
const DynamicTheme._();
|
const DynamicTheme._();
|
||||||
|
|
@ -13,7 +14,7 @@ abstract final class DynamicTheme {
|
||||||
final corePalette = await DynamicColorPlugin.getCorePalette();
|
final corePalette = await DynamicColorPlugin.getCorePalette();
|
||||||
if (corePalette != null) {
|
if (corePalette != null) {
|
||||||
final primaryColor = corePalette.toColorScheme().primary;
|
final primaryColor = corePalette.toColorScheme().primary;
|
||||||
debugPrint('dynamic_color: Core palette detected.');
|
dPrint(() => 'dynamic_color: Core palette detected.');
|
||||||
|
|
||||||
// Some palettes do not generate surface container colors accurately,
|
// Some palettes do not generate surface container colors accurately,
|
||||||
// so we regenerate all colors using the primary color
|
// so we regenerate all colors using the primary color
|
||||||
|
|
@ -23,7 +24,7 @@ abstract final class DynamicTheme {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint('dynamic_color: Failed to obtain core palette: $error');
|
dPrint(() => 'dynamic_color: Failed to obtain core palette: $error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
mobile/lib/utils/debug_print.dart
Normal file
8
mobile/lib/utils/debug_print.dart
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
void dPrint(String Function() message) {
|
||||||
|
if (kDebugMode) {
|
||||||
|
debugPrint(message());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/services/log.service.dart';
|
import 'package:immich_mobile/domain/services/log.service.dart';
|
||||||
|
|
@ -12,6 +11,7 @@ import 'package:immich_mobile/utils/bootstrap.dart';
|
||||||
import 'package:immich_mobile/utils/http_ssl_options.dart';
|
import 'package:immich_mobile/utils/http_ssl_options.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:worker_manager/worker_manager.dart';
|
import 'package:worker_manager/worker_manager.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class InvalidIsolateUsageException implements Exception {
|
class InvalidIsolateUsageException implements Exception {
|
||||||
const InvalidIsolateUsageException();
|
const InvalidIsolateUsageException();
|
||||||
|
|
@ -71,10 +71,10 @@ Cancelable<T?> runInIsolateGentle<T>({
|
||||||
await isar.close();
|
await isar.close();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Error closing Isar: $e");
|
dPrint(() => "Error closing Isar: $e");
|
||||||
}
|
}
|
||||||
} catch (error, stack) {
|
} catch (error, stack) {
|
||||||
debugPrint("Error closing resources in isolate: $error, $stack");
|
dPrint(() => "Error closing resources in isolate: $error, $stack");
|
||||||
} finally {
|
} finally {
|
||||||
ref.dispose();
|
ref.dispose();
|
||||||
// Delay to ensure all resources are released
|
// Delay to ensure all resources are released
|
||||||
|
|
@ -84,7 +84,7 @@ Cancelable<T?> runInIsolateGentle<T>({
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
(error, stack) {
|
(error, stack) {
|
||||||
debugPrint("Error in isolate zone: $error, $stack");
|
dPrint(() => "Error in isolate zone: $error, $stack");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/entities/album.entity.dart';
|
import 'package:immich_mobile/entities/album.entity.dart';
|
||||||
|
|
@ -26,6 +25,7 @@ import 'package:immich_mobile/utils/diff.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
// ignore: import_rule_photo_manager
|
// ignore: import_rule_photo_manager
|
||||||
import 'package:photo_manager/photo_manager.dart';
|
import 'package:photo_manager/photo_manager.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
const int targetVersion = 15;
|
const int targetVersion = 15;
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ Future<bool> _isNewInstallation(Isar db, Drift drift) async {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[MIGRATION] Error checking if new installation: $error");
|
dPrint(() => "[MIGRATION] Error checking if new installation: $error");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -143,10 +143,7 @@ Future<void> _migrateDeviceAsset(Isar db) async {
|
||||||
|
|
||||||
final PermissionState ps = await PhotoManager.requestPermissionExtend();
|
final PermissionState ps = await PhotoManager.requestPermissionExtend();
|
||||||
if (!ps.hasAccess) {
|
if (!ps.hasAccess) {
|
||||||
if (kDebugMode) {
|
dPrint(() => "[MIGRATION] Photo library permission not granted. Skipping device asset migration.");
|
||||||
debugPrint("[MIGRATION] Photo library permission not granted. Skipping device asset migration.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,8 +163,8 @@ Future<void> _migrateDeviceAsset(Isar db) async {
|
||||||
localAssets = allDeviceAssets.map((a) => _DeviceAsset(assetId: a.id, dateTime: a.modifiedDateTime)).toList();
|
localAssets = allDeviceAssets.map((a) => _DeviceAsset(assetId: a.id, dateTime: a.modifiedDateTime)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
debugPrint("[MIGRATION] Device Asset Ids length - ${ids.length}");
|
dPrint(() => "[MIGRATION] Device Asset Ids length - ${ids.length}");
|
||||||
debugPrint("[MIGRATION] Local Asset Ids length - ${localAssets.length}");
|
dPrint(() => "[MIGRATION] Local Asset Ids length - ${localAssets.length}");
|
||||||
ids.sort((a, b) => a.assetId.compareTo(b.assetId));
|
ids.sort((a, b) => a.assetId.compareTo(b.assetId));
|
||||||
localAssets.sort((a, b) => a.assetId.compareTo(b.assetId));
|
localAssets.sort((a, b) => a.assetId.compareTo(b.assetId));
|
||||||
final List<DeviceAssetEntity> toAdd = [];
|
final List<DeviceAssetEntity> toAdd = [];
|
||||||
|
|
@ -182,20 +179,14 @@ Future<void> _migrateDeviceAsset(Isar db) async {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
onlyFirst: (deviceAsset) {
|
onlyFirst: (deviceAsset) {
|
||||||
if (kDebugMode) {
|
dPrint(() => '[MIGRATION] Local asset not found in DeviceAsset: ${deviceAsset.assetId}');
|
||||||
debugPrint('[MIGRATION] Local asset not found in DeviceAsset: ${deviceAsset.assetId}');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onlySecond: (asset) {
|
onlySecond: (asset) {
|
||||||
if (kDebugMode) {
|
dPrint(() => '[MIGRATION] Local asset not found in DeviceAsset: ${asset.assetId}');
|
||||||
debugPrint('[MIGRATION] Local asset not found in DeviceAsset: ${asset.assetId}');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (kDebugMode) {
|
dPrint(() => "[MIGRATION] Total number of device assets migrated - ${toAdd.length}");
|
||||||
debugPrint("[MIGRATION] Total number of device assets migrated - ${toAdd.length}");
|
|
||||||
}
|
|
||||||
|
|
||||||
await db.writeTxn(() async {
|
await db.writeTxn(() async {
|
||||||
await db.deviceAssetEntitys.putAll(toAdd);
|
await db.deviceAssetEntitys.putAll(toAdd);
|
||||||
|
|
@ -215,7 +206,7 @@ Future<void> migrateDeviceAssetToSqlite(Isar db, Drift drift) async {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[MIGRATION] Error while migrating device assets to SQLite: $error");
|
dPrint(() => "[MIGRATION] Error while migrating device assets to SQLite: $error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,7 +254,7 @@ Future<void> migrateBackupAlbumsToSqlite(Isar db, Drift drift) async {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[MIGRATION] Error while migrating backup albums to SQLite: $error");
|
dPrint(() => "[MIGRATION] Error while migrating backup albums to SQLite: $error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -281,7 +272,7 @@ Future<void> migrateStoreToSqlite(Isar db, Drift drift) async {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[MIGRATION] Error while migrating store values to SQLite: $error");
|
dPrint(() => "[MIGRATION] Error while migrating store values to SQLite: $error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,7 +287,7 @@ Future<void> migrateStoreToIsar(Isar db, Drift drift) async {
|
||||||
await db.storeValues.putAll(driftStoreValues);
|
await db.storeValues.putAll(driftStoreValues);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint("[MIGRATION] Error while migrating store values to Isar: $error");
|
dPrint(() => "[MIGRATION] Error while migrating store values to Isar: $error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:immich_mobile/domain/models/exif.model.dart';
|
||||||
import 'package:immich_mobile/widgets/map/map_thumbnail.dart';
|
import 'package:immich_mobile/widgets/map/map_thumbnail.dart';
|
||||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class ExifMap extends StatelessWidget {
|
class ExifMap extends StatelessWidget {
|
||||||
final ExifInfo exifInfo;
|
final ExifInfo exifInfo;
|
||||||
|
|
@ -66,7 +67,7 @@ class ExifMap extends StatelessWidget {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugPrint('Opening Map Uri: $uri');
|
dPrint(() => 'Opening Map Uri: $uri');
|
||||||
launchUrl(uri);
|
launchUrl(uri);
|
||||||
},
|
},
|
||||||
onCreated: onMapCreated,
|
onCreated: onMapCreated,
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import 'package:immich_mobile/utils/url_helper.dart';
|
||||||
import 'package:immich_mobile/widgets/common/confirm_dialog.dart';
|
import 'package:immich_mobile/widgets/common/confirm_dialog.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
import 'package:immich_mobile/widgets/search/thumbnail_with_info.dart';
|
import 'package:immich_mobile/widgets/search/thumbnail_with_info.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class SharedLinkItem extends ConsumerWidget {
|
class SharedLinkItem extends ConsumerWidget {
|
||||||
final SharedLink sharedLink;
|
final SharedLink sharedLink;
|
||||||
|
|
@ -36,7 +37,7 @@ class SharedLinkItem extends ConsumerWidget {
|
||||||
return Text("expired", style: TextStyle(color: Colors.red[300])).tr();
|
return Text("expired", style: TextStyle(color: Colors.red[300])).tr();
|
||||||
}
|
}
|
||||||
final difference = sharedLink.expiresAt!.difference(DateTime.now());
|
final difference = sharedLink.expiresAt!.difference(DateTime.now());
|
||||||
debugPrint("Difference: $difference");
|
dPrint(() => "Difference: $difference");
|
||||||
if (difference.inDays > 0) {
|
if (difference.inDays > 0) {
|
||||||
var dayDifference = difference.inDays;
|
var dayDifference = difference.inDays;
|
||||||
if (difference.inHours % 24 > 12) {
|
if (difference.inHours % 24 > 12) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:immich_mobile/utils/throttle.dart';
|
import 'package:immich_mobile/utils/throttle.dart';
|
||||||
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
|
||||||
class _Counter {
|
class _Counter {
|
||||||
int _count = 0;
|
int _count = 0;
|
||||||
|
|
@ -8,7 +8,7 @@ class _Counter {
|
||||||
|
|
||||||
int get count => _count;
|
int get count => _count;
|
||||||
void increment() {
|
void increment() {
|
||||||
debugPrint("Counter inside increment: $count");
|
dPrint(() => "Counter inside increment: $count");
|
||||||
_count = _count + 1;
|
_count = _count + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue