feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import '../../settings/mcp_settings_value.dart';
|
||||
|
||||
import 'package:drift/drift.dart' hide JsonKey;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
import '../app_database.dart';
|
||||
|
||||
part 'mcp_settings_repository.g.dart';
|
||||
|
||||
abstract interface class McpSettingsRepository {
|
||||
Future<McpSettingsValue?> load();
|
||||
Future<void> save(McpSettingsValue configuration);
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
McpSettingsRepository mcpSettingsRepository(Ref ref) =>
|
||||
DriftMcpSettingsRepository(ref.watch(appDatabaseProvider));
|
||||
|
||||
class DriftMcpSettingsRepository implements McpSettingsRepository {
|
||||
DriftMcpSettingsRepository(this._database);
|
||||
|
||||
final AppDatabase _database;
|
||||
|
||||
@override
|
||||
Future<McpSettingsValue?> load() async {
|
||||
final row = await (_database.select(
|
||||
_database.mcpConfigurations,
|
||||
)..where((table) => table.id.equals(0))).getSingleOrNull();
|
||||
return row == null
|
||||
? null
|
||||
: McpSettingsValue(
|
||||
enabled: row.enabled,
|
||||
port: row.port,
|
||||
token: row.token,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> save(McpSettingsValue configuration) => _database
|
||||
.into(_database.mcpConfigurations)
|
||||
.insertOnConflictUpdate(
|
||||
McpConfigurationsCompanion.insert(
|
||||
id: const Value(0),
|
||||
enabled: configuration.enabled,
|
||||
port: configuration.port,
|
||||
token: configuration.token,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user