- Introduced a new Flutter project for the cxyz Android manga/comic reader, including essential files such as pubspec.yaml, AndroidManifest.xml, and Gradle configuration. - Added .gitignore files to exclude unnecessary files and directories for both the main project and Android-specific files. - Implemented initial README.md with project description, features, setup instructions, and API details for ComicLand, MangaRead, and MangaTown. - Configured analysis options and dependencies in pubspec.yaml to support Flutter development. - Established a pnpm workspace and lockfile for dependency management. - Included various Android resources such as icons, styles, and launch backgrounds for a complete application setup.
38 lines
1.0 KiB
Dart
38 lines
1.0 KiB
Dart
import 'source.dart';
|
|
|
|
/// Compile-time source gate: `--dart-define=SOURCES=comicland,mangaread,mangatown`
|
|
/// or `--dart-define=SOURCES=all`.
|
|
///
|
|
/// Unset / invalid → ComicLand only. Default is **not** all sources.
|
|
const String kSourcesDefine = String.fromEnvironment(
|
|
'SOURCES',
|
|
defaultValue: 'comicland',
|
|
);
|
|
|
|
/// Parses [raw] into enabled [SourceId]s.
|
|
///
|
|
/// - Token `all` (case-insensitive) enables every [SourceId].
|
|
/// - Unknown tokens ignored.
|
|
/// - Empty result falls back to `{SourceId.comicland}`.
|
|
Set<SourceId> parseEnabledSourceIds([String raw = kSourcesDefine]) {
|
|
final parts = raw.split(',').map((p) => p.trim().toLowerCase()).where(
|
|
(p) => p.isNotEmpty,
|
|
);
|
|
for (final part in parts) {
|
|
if (part == 'all') {
|
|
return SourceId.values.toSet();
|
|
}
|
|
}
|
|
final out = <SourceId>{};
|
|
for (final part in parts) {
|
|
final id = SourceId.tryParse(part);
|
|
if (id != null) out.add(id);
|
|
}
|
|
if (out.isEmpty) {
|
|
return {SourceId.comicland};
|
|
}
|
|
return out;
|
|
}
|
|
|
|
Set<SourceId> enabledSourceIds() => parseEnabledSourceIds();
|