mirror of
https://github.com/immich-app/immich.git
synced 2025-11-20 08:42:35 +09:00
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker / pre-job (push) Waiting to run
Docker / Re-Tag ML () (push) Blocked by required conditions
Docker / Re-Tag ML (-armnn) (push) Blocked by required conditions
Docker / Re-Tag ML (-cuda) (push) Blocked by required conditions
Docker / Re-Tag ML (-openvino) (push) Blocked by required conditions
Docker / Re-Tag ML (-rknn) (push) Blocked by required conditions
Docker / Re-Tag ML (-rocm) (push) Blocked by required conditions
Docker / Re-Tag Server () (push) Blocked by required conditions
Docker / Build and Push ML (armnn, linux/arm64, -armnn) (push) Blocked by required conditions
Docker / Build and Push ML (cpu, ) (push) Blocked by required conditions
Docker / Build and Push ML (cuda, linux/amd64, -cuda) (push) Blocked by required conditions
Docker / Build and Push ML (openvino, linux/amd64, -openvino) (push) Blocked by required conditions
Docker / Build and Push ML (rknn, linux/arm64, -rknn) (push) Blocked by required conditions
Docker / Build and Push ML (rocm, linux/amd64, {"linux/amd64": "mich"}, -rocm) (push) Blocked by required conditions
Docker / Build and Push Server (push) Blocked by required conditions
Docker / Docker Build & Push Server Success (push) Blocked by required conditions
Docker / Docker Build & Push ML Success (push) Blocked by required conditions
Docs build / pre-job (push) Waiting to run
Docs build / Docs Build (push) Blocked by required conditions
Static Code Analysis / pre-job (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Blocked by required conditions
Static Code Analysis / zizmor (push) Waiting to run
Test / pre-job (push) Waiting to run
Test / Test & Lint Server (push) Blocked by required conditions
Test / Unit Test CLI (push) Blocked by required conditions
Test / Unit Test CLI (Windows) (push) Blocked by required conditions
Test / Lint Web (push) Blocked by required conditions
Test / Test Web (push) Blocked by required conditions
Test / Test i18n (push) Blocked by required conditions
Test / End-to-End Lint (push) Blocked by required conditions
Test / Medium Tests (Server) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests Success (push) Blocked by required conditions
Test / Unit Test Mobile (push) Blocked by required conditions
Test / Unit Test ML (push) Blocked by required conditions
Test / .github Files Formatting (push) Blocked by required conditions
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / SQL Schema Checks (push) Waiting to run
* feat: use drift for logging * fix: tests * feat: use the truncate limit from constants.ts as default * chore: move setupAll to top level and restructure * chore: code review changes * fix: inherits * feat: raise log line limit to 2000 * limit getAll to 250 lines * delete DLog and make LogRepository not a singleton * fix: drift build settings and `make migration` * fix: tests * remove sensitive log --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
173 lines
5.8 KiB
Dart
173 lines
5.8 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:drift/drift.dart' hide Column;
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
|
import 'package:immich_mobile/providers/background_sync.provider.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/platform.provider.dart';
|
|
import 'package:immich_mobile/providers/user.provider.dart';
|
|
import 'package:immich_mobile/routing/router.dart';
|
|
import 'package:logging/logging.dart';
|
|
|
|
final _features = [
|
|
_Feature(
|
|
name: 'Main Timeline',
|
|
icon: Icons.timeline_rounded,
|
|
onTap: (ctx, _) => ctx.pushRoute(const TabShellRoute()),
|
|
),
|
|
_Feature(
|
|
name: 'Selection Mode Timeline',
|
|
icon: Icons.developer_mode_rounded,
|
|
onTap: (ctx, ref) async {
|
|
final user = ref.watch(currentUserProvider);
|
|
if (user == null) {
|
|
return Future.value();
|
|
}
|
|
|
|
final assets = await ref.read(remoteAssetRepositoryProvider).getSome(user.id);
|
|
|
|
final selectedAssets = await ctx.pushRoute<Set<BaseAsset>>(
|
|
DriftAssetSelectionTimelineRoute(lockedSelectionAssets: assets.toSet()),
|
|
);
|
|
|
|
Logger("FeaturesInDevelopment").fine("Selected ${selectedAssets?.length ?? 0} assets");
|
|
|
|
return Future.value();
|
|
},
|
|
),
|
|
_Feature(name: '', icon: Icons.vertical_align_center_sharp, onTap: (_, __) => Future.value()),
|
|
_Feature(
|
|
name: 'Sync Local',
|
|
icon: Icons.photo_album_rounded,
|
|
onTap: (_, ref) => ref.read(backgroundSyncProvider).syncLocal(),
|
|
),
|
|
_Feature(
|
|
name: 'Sync Local Full (1)',
|
|
icon: Icons.photo_library_rounded,
|
|
onTap: (_, ref) => ref.read(backgroundSyncProvider).syncLocal(full: true),
|
|
),
|
|
_Feature(
|
|
name: 'Hash Local Assets (2)',
|
|
icon: Icons.numbers_outlined,
|
|
onTap: (_, ref) => ref.read(backgroundSyncProvider).hashAssets(),
|
|
),
|
|
_Feature(
|
|
name: 'Sync Remote (3)',
|
|
icon: Icons.refresh_rounded,
|
|
onTap: (_, ref) => ref.read(backgroundSyncProvider).syncRemote(),
|
|
),
|
|
_Feature(
|
|
name: 'WAL Checkpoint',
|
|
icon: Icons.save_rounded,
|
|
onTap: (_, ref) => ref.read(driftProvider).customStatement("pragma wal_checkpoint(truncate)"),
|
|
),
|
|
_Feature(name: '', icon: Icons.vertical_align_center_sharp, onTap: (_, __) => Future.value()),
|
|
_Feature(
|
|
name: 'Clear Delta Checkpoint',
|
|
icon: Icons.delete_rounded,
|
|
onTap: (_, ref) => ref.read(nativeSyncApiProvider).clearSyncCheckpoint(),
|
|
),
|
|
_Feature(
|
|
name: 'Clear Local Data',
|
|
style: const TextStyle(color: Colors.orange, fontWeight: FontWeight.bold),
|
|
icon: Icons.delete_forever_rounded,
|
|
onTap: (_, ref) async {
|
|
final db = ref.read(driftProvider);
|
|
await db.localAssetEntity.deleteAll();
|
|
await db.localAlbumEntity.deleteAll();
|
|
await db.localAlbumAssetEntity.deleteAll();
|
|
},
|
|
),
|
|
_Feature(
|
|
name: 'Clear Remote Data',
|
|
style: const TextStyle(color: Colors.orange, fontWeight: FontWeight.bold),
|
|
icon: Icons.delete_sweep_rounded,
|
|
onTap: (_, ref) async {
|
|
final db = ref.read(driftProvider);
|
|
await db.remoteAssetEntity.deleteAll();
|
|
await db.remoteExifEntity.deleteAll();
|
|
await db.remoteAlbumEntity.deleteAll();
|
|
await db.remoteAlbumUserEntity.deleteAll();
|
|
await db.remoteAlbumAssetEntity.deleteAll();
|
|
await db.memoryEntity.deleteAll();
|
|
await db.memoryAssetEntity.deleteAll();
|
|
await db.stackEntity.deleteAll();
|
|
await db.personEntity.deleteAll();
|
|
await db.assetFaceEntity.deleteAll();
|
|
},
|
|
),
|
|
_Feature(
|
|
name: 'Local Media Summary',
|
|
style: const TextStyle(color: Colors.indigo, fontWeight: FontWeight.bold),
|
|
icon: Icons.table_chart_rounded,
|
|
onTap: (ctx, _) => ctx.pushRoute(const LocalMediaSummaryRoute()),
|
|
),
|
|
_Feature(
|
|
name: 'Remote Media Summary',
|
|
style: const TextStyle(color: Colors.indigo, fontWeight: FontWeight.bold),
|
|
icon: Icons.summarize_rounded,
|
|
onTap: (ctx, _) => ctx.pushRoute(const RemoteMediaSummaryRoute()),
|
|
),
|
|
_Feature(
|
|
name: 'Reset Sqlite',
|
|
icon: Icons.table_view_rounded,
|
|
style: const TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
|
|
onTap: (_, ref) async {
|
|
final drift = ref.read(driftProvider);
|
|
// ignore: invalid_use_of_protected_member, invalid_use_of_visible_for_testing_member
|
|
final migrator = drift.createMigrator();
|
|
for (final entity in drift.allSchemaEntities) {
|
|
await migrator.drop(entity);
|
|
await migrator.create(entity);
|
|
}
|
|
},
|
|
),
|
|
];
|
|
|
|
@RoutePage()
|
|
class FeatInDevPage extends StatelessWidget {
|
|
const FeatInDevPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Features in Development'), centerTitle: true),
|
|
body: Column(
|
|
children: [
|
|
Flexible(
|
|
flex: 1,
|
|
child: ListView.builder(
|
|
itemBuilder: (_, index) {
|
|
final feat = _features[index];
|
|
return Consumer(
|
|
builder: (ctx, ref, _) => ListTile(
|
|
title: Text(feat.name, style: feat.style),
|
|
trailing: Icon(feat.icon),
|
|
visualDensity: VisualDensity.compact,
|
|
onTap: () => unawaited(feat.onTap(ctx, ref)),
|
|
),
|
|
);
|
|
},
|
|
itemCount: _features.length,
|
|
),
|
|
),
|
|
const Divider(height: 0),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _Feature {
|
|
const _Feature({required this.name, required this.icon, required this.onTap, this.style});
|
|
|
|
final String name;
|
|
final IconData icon;
|
|
final TextStyle? style;
|
|
final Future<void> Function(BuildContext, WidgetRef _) onTap;
|
|
}
|