added extension notes/hints

This commit is contained in:
Schnitzel5 2025-04-23 23:33:18 +02:00
parent 4a555a1bfc
commit 7e9202ceeb
25 changed files with 354 additions and 32 deletions

View file

@ -45,6 +45,9 @@ class $MSource implements MSource, $Instance {
'additionalParams': BridgeFieldDef(
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.string)),
),
'notes': BridgeFieldDef(
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.string)),
),
},
wrap: true,
);
@ -84,6 +87,8 @@ class $MSource implements MSource, $Instance {
return $String($value.apiUrl!);
case 'additionalParams':
return $String($value.additionalParams!);
case 'notes':
return $String($value.notes!);
default:
return _superclass.$getProperty(runtime, identifier);
@ -116,6 +121,8 @@ class $MSource implements MSource, $Instance {
$value.apiUrl = value.$reified;
case 'additionalParams':
$value.additionalParams = value.$reified;
case 'notes':
$value.notes = value.$reified;
default:
_superclass.$setProperty(runtime, identifier, value);
}
@ -151,6 +158,9 @@ class $MSource implements MSource, $Instance {
@override
String? get additionalParams => $value.additionalParams;
@override
String? get notes => $value.notes;
@override
set apiUrl(String? apiUrl) {}
@ -181,6 +191,9 @@ class $MSource implements MSource, $Instance {
@override
set additionalParams(String? additionalParams) {}
@override
set notes(String? notes) {}
@override
Map<String, dynamic> toJson() => {
'apiUrl': apiUrl,
@ -193,5 +206,6 @@ class $MSource implements MSource, $Instance {
'lang': lang,
'name': name,
'additionalParams': additionalParams,
'notes': notes,
};
}

View file

@ -19,6 +19,8 @@ class MSource {
String? additionalParams;
String? notes;
MSource({
this.id,
this.name,
@ -30,6 +32,7 @@ class MSource {
this.dateFormatLocale,
this.apiUrl,
this.additionalParams,
this.notes,
});
Map<String, dynamic> toJson() => {
@ -43,5 +46,6 @@ class MSource {
'lang': lang,
'name': name,
'additionalParams': additionalParams,
'notes': notes,
};
}

View file

@ -463,5 +463,6 @@
"clear_all_sources": "Alle Quellen löschen",
"clear_all_sources_msg": "Dies wird alle Quellen der Anwendung vollständig löschen. Möchten Sie wirklich fortfahren?",
"sources_cleared": "Quellen gelöscht!",
"add_repo": "Repository hinzufügen?"
"add_repo": "Repository hinzufügen?",
"extension_notes": "Hinweis: {notes}"
}

View file

@ -460,5 +460,6 @@
"genre_search_library": "Search genre in library",
"genre_search_source": "Browse in source",
"source_not_added": "Source is not installed!",
"load_own_subtitles": "Load your own subtitles..."
"load_own_subtitles": "Load your own subtitles...",
"extension_notes": "Notes: {notes}"
}

View file

@ -2882,6 +2882,12 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Load your own subtitles...'**
String get load_own_subtitles;
/// No description provided for @extension_notes.
///
/// In en, this message translates to:
/// **'Notes: {notes}'**
String extension_notes(Object notes);
}
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsAr extends AppLocalizations {
@override
String get load_own_subtitles => 'تحميل الترجمة الخاصة بك...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get load_own_subtitles => 'Deine eigene Untertiteln laden...';
@override
String extension_notes(Object notes) {
return 'Hinweis: $notes';
}
}

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get load_own_subtitles => 'Load your own subtitles...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,6 +1438,11 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get load_own_subtitles => 'Cargar tus propios subtítulos...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}
/// The translations for Spanish Castilian, as used in Latin America and the Caribbean (`es_419`).

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get load_own_subtitles => 'Charger vos propres sous-titres...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsId extends AppLocalizations {
@override
String get load_own_subtitles => 'Muat subtitle Anda sendiri...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get load_own_subtitles => 'Carica i tuoi sottotitoli...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,6 +1438,11 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get load_own_subtitles => 'Carregar suas próprias legendas...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}
/// The translations for Portuguese, as used in Brazil (`pt_BR`).

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get load_own_subtitles => 'Загрузить свои собственные субтитры...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsTh extends AppLocalizations {
@override
String get load_own_subtitles => 'โหลดคำบรรยายของคุณเอง...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsTr extends AppLocalizations {
@override
String get load_own_subtitles => 'Kendi altyazılarınızı yükleyin...';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -1438,4 +1438,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get load_own_subtitles => '加载自定义字幕';
@override
String extension_notes(Object notes) {
return 'Notes: $notes';
}
}

View file

@ -65,6 +65,8 @@ class Source {
@enumerated
SourceCodeLanguage sourceCodeLanguage = SourceCodeLanguage.dart;
String? notes;
Repo? repo;
Source({
@ -95,6 +97,7 @@ class Source {
this.additionalParams = "",
this.isLocal = false,
this.isObsolete = false,
this.notes = '',
this.repo,
});
@ -128,6 +131,7 @@ class Source {
isLocal = json['isLocal'];
sourceCodeLanguage =
SourceCodeLanguage.values[json['sourceCodeLanguage'] ?? 0];
notes = json['notes'] ?? "";
repo = json['repo'] != null ? Repo.fromJson(json['repo']) : null;
}
@ -160,6 +164,7 @@ class Source {
'sourceCodeLanguage': sourceCodeLanguage.index,
'isObsolete': isObsolete,
'isLocal': isLocal,
'notes': notes,
'repo': repo?.toJson(),
};

View file

@ -128,40 +128,45 @@ const SourceSchema = CollectionSchema(
name: r'name',
type: IsarType.string,
),
r'repo': PropertySchema(
r'notes': PropertySchema(
id: 22,
name: r'notes',
type: IsarType.string,
),
r'repo': PropertySchema(
id: 23,
name: r'repo',
type: IsarType.object,
target: r'Repo',
),
r'sourceCode': PropertySchema(
id: 23,
id: 24,
name: r'sourceCode',
type: IsarType.string,
),
r'sourceCodeLanguage': PropertySchema(
id: 24,
id: 25,
name: r'sourceCodeLanguage',
type: IsarType.byte,
enumMap: _SourcesourceCodeLanguageEnumValueMap,
),
r'sourceCodeUrl': PropertySchema(
id: 25,
id: 26,
name: r'sourceCodeUrl',
type: IsarType.string,
),
r'typeSource': PropertySchema(
id: 26,
id: 27,
name: r'typeSource',
type: IsarType.string,
),
r'version': PropertySchema(
id: 27,
id: 28,
name: r'version',
type: IsarType.string,
),
r'versionLast': PropertySchema(
id: 28,
id: 29,
name: r'versionLast',
type: IsarType.string,
)
@ -246,6 +251,12 @@ int _sourceEstimateSize(
bytesCount += 3 + value.length * 3;
}
}
{
final value = object.notes;
if (value != null) {
bytesCount += 3 + value.length * 3;
}
}
{
final value = object.repo;
if (value != null) {
@ -314,18 +325,19 @@ void _sourceSerialize(
writer.writeString(offsets[19], object.lang);
writer.writeBool(offsets[20], object.lastUsed);
writer.writeString(offsets[21], object.name);
writer.writeString(offsets[22], object.notes);
writer.writeObject<Repo>(
offsets[22],
offsets[23],
allOffsets,
RepoSchema.serialize,
object.repo,
);
writer.writeString(offsets[23], object.sourceCode);
writer.writeByte(offsets[24], object.sourceCodeLanguage.index);
writer.writeString(offsets[25], object.sourceCodeUrl);
writer.writeString(offsets[26], object.typeSource);
writer.writeString(offsets[27], object.version);
writer.writeString(offsets[28], object.versionLast);
writer.writeString(offsets[24], object.sourceCode);
writer.writeByte(offsets[25], object.sourceCodeLanguage.index);
writer.writeString(offsets[26], object.sourceCodeUrl);
writer.writeString(offsets[27], object.typeSource);
writer.writeString(offsets[28], object.version);
writer.writeString(offsets[29], object.versionLast);
}
Source _sourceDeserialize(
@ -358,19 +370,20 @@ Source _sourceDeserialize(
lang: reader.readStringOrNull(offsets[19]),
lastUsed: reader.readBoolOrNull(offsets[20]),
name: reader.readStringOrNull(offsets[21]),
notes: reader.readStringOrNull(offsets[22]),
repo: reader.readObjectOrNull<Repo>(
offsets[22],
offsets[23],
RepoSchema.deserialize,
allOffsets,
),
sourceCode: reader.readStringOrNull(offsets[23]),
sourceCodeUrl: reader.readStringOrNull(offsets[25]),
typeSource: reader.readStringOrNull(offsets[26]),
version: reader.readStringOrNull(offsets[27]),
versionLast: reader.readStringOrNull(offsets[28]),
sourceCode: reader.readStringOrNull(offsets[24]),
sourceCodeUrl: reader.readStringOrNull(offsets[26]),
typeSource: reader.readStringOrNull(offsets[27]),
version: reader.readStringOrNull(offsets[28]),
versionLast: reader.readStringOrNull(offsets[29]),
);
object.sourceCodeLanguage = _SourcesourceCodeLanguageValueEnumMap[
reader.readByteOrNull(offsets[24])] ??
reader.readByteOrNull(offsets[25])] ??
SourceCodeLanguage.dart;
return object;
}
@ -428,25 +441,27 @@ P _sourceDeserializeProp<P>(
case 21:
return (reader.readStringOrNull(offset)) as P;
case 22:
return (reader.readStringOrNull(offset)) as P;
case 23:
return (reader.readObjectOrNull<Repo>(
offset,
RepoSchema.deserialize,
allOffsets,
)) as P;
case 23:
return (reader.readStringOrNull(offset)) as P;
case 24:
return (reader.readStringOrNull(offset)) as P;
case 25:
return (_SourcesourceCodeLanguageValueEnumMap[
reader.readByteOrNull(offset)] ??
SourceCodeLanguage.dart) as P;
case 25:
return (reader.readStringOrNull(offset)) as P;
case 26:
return (reader.readStringOrNull(offset)) as P;
case 27:
return (reader.readStringOrNull(offset)) as P;
case 28:
return (reader.readStringOrNull(offset)) as P;
case 29:
return (reader.readStringOrNull(offset)) as P;
default:
throw IsarError('Unknown property with id $propertyId');
}
@ -2418,6 +2433,152 @@ extension SourceQueryFilter on QueryBuilder<Source, Source, QFilterCondition> {
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNull(
property: r'notes',
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesIsNotNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNotNull(
property: r'notes',
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo(
property: r'notes',
value: value,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesGreaterThan(
String? value, {
bool include = false,
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.greaterThan(
include: include,
property: r'notes',
value: value,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesLessThan(
String? value, {
bool include = false,
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.lessThan(
include: include,
property: r'notes',
value: value,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesBetween(
String? lower,
String? upper, {
bool includeLower = true,
bool includeUpper = true,
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.between(
property: r'notes',
lower: lower,
includeLower: includeLower,
upper: upper,
includeUpper: includeUpper,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesStartsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.startsWith(
property: r'notes',
value: value,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesEndsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.endsWith(
property: r'notes',
value: value,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesContains(
String value,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.contains(
property: r'notes',
value: value,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesMatches(
String pattern,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.matches(
property: r'notes',
wildcard: pattern,
caseSensitive: caseSensitive,
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesIsEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo(
property: r'notes',
value: '',
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> notesIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.greaterThan(
property: r'notes',
value: '',
));
});
}
QueryBuilder<Source, Source, QAfterFilterCondition> repoIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNull(
@ -3497,6 +3658,18 @@ extension SourceQuerySortBy on QueryBuilder<Source, Source, QSortBy> {
});
}
QueryBuilder<Source, Source, QAfterSortBy> sortByNotes() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'notes', Sort.asc);
});
}
QueryBuilder<Source, Source, QAfterSortBy> sortByNotesDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'notes', Sort.desc);
});
}
QueryBuilder<Source, Source, QAfterSortBy> sortBySourceCode() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'sourceCode', Sort.asc);
@ -3847,6 +4020,18 @@ extension SourceQuerySortThenBy on QueryBuilder<Source, Source, QSortThenBy> {
});
}
QueryBuilder<Source, Source, QAfterSortBy> thenByNotes() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'notes', Sort.asc);
});
}
QueryBuilder<Source, Source, QAfterSortBy> thenByNotesDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'notes', Sort.desc);
});
}
QueryBuilder<Source, Source, QAfterSortBy> thenBySourceCode() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'sourceCode', Sort.asc);
@ -4065,6 +4250,13 @@ extension SourceQueryWhereDistinct on QueryBuilder<Source, Source, QDistinct> {
});
}
QueryBuilder<Source, Source, QDistinct> distinctByNotes(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'notes', caseSensitive: caseSensitive);
});
}
QueryBuilder<Source, Source, QDistinct> distinctBySourceCode(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
@ -4247,6 +4439,12 @@ extension SourceQueryProperty on QueryBuilder<Source, Source, QQueryProperty> {
});
}
QueryBuilder<Source, String?, QQueryOperations> notesProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'notes');
});
}
QueryBuilder<Source, Repo?, QQueryOperations> repoProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'repo');

View file

@ -22,6 +22,7 @@ class _CreateExtensionState extends State<CreateExtension> {
String _baseUrl = "";
String _apiUrl = "";
String _iconUrl = "";
String _notes = "";
int _sourceTypeIndex = 0;
int _itemTypeIndex = 0;
int _languageIndex = 0;
@ -111,6 +112,11 @@ class _CreateExtensionState extends State<CreateExtension> {
_iconUrl = v;
});
}),
_textEditing("notes", context, "ex: this extension requires login", (v) {
setState(() {
_notes = v;
});
}),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 17),
child: Row(
@ -217,6 +223,7 @@ class _CreateExtensionState extends State<CreateExtension> {
isActive: true,
version: "0.0.1",
isNsfw: false,
notes: _notes,
)..sourceCodeLanguage = _sourceCodeLanguage;
source =
source
@ -378,7 +385,8 @@ const mangayomiSources = [{
"typeSource": "${source.typeSource}",
"itemType": ${source.itemType.index},
"version": "${source.version}",
"pkgPath": ""
"pkgPath": "",
"notes": ""
}];
class DefaultExtension extends MProvider {

View file

@ -6,7 +6,7 @@ part of 'track_state_providers.dart';
// RiverpodGenerator
// **************************************************************************
String _$trackStateHash() => r'f8d5a962cfbff41400945c0e7140071c76fa80fd';
String _$trackStateHash() => r'1aecb0459141daa3e44fe3bbf6b49c0992b5f8bc';
/// Copied from Dart SDK
class _SystemHash {

View file

@ -6,7 +6,7 @@ part of 'download_provider.dart';
// RiverpodGenerator
// **************************************************************************
String _$downloadChapterHash() => r'bf43fddf83fce382ff794c688288153477f9a3aa';
String _$downloadChapterHash() => r'd729e45de171814dada724bf6004aeca7ea85a0a';
/// Copied from Dart SDK
class _SystemHash {

View file

@ -25,6 +25,7 @@ import 'package:mangayomi/modules/manga/home/widget/mangas_card_selector.dart';
import 'package:mangayomi/modules/widgets/gridview_widget.dart';
import 'package:mangayomi/modules/widgets/manga_image_card_widget.dart';
import 'package:mangayomi/utils/global_style.dart';
import 'package:marquee/marquee.dart';
import 'package:super_sliver_list/super_sliver_list.dart';
class MangaHomeScreen extends ConsumerStatefulWidget {
@ -149,7 +150,29 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
};
return Scaffold(
appBar: AppBar(
title: _isSearch ? null : Text('${source.name}'),
title:
_isSearch
? null
: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("${source.name}"),
source.notes != null && source.notes!.isNotEmpty
? SizedBox(
height: 20,
child: Marquee(
text: l10n.extension_notes(source.notes!),
style: const TextStyle(fontSize: 12),
blankSpace: 40.0,
velocity: 30.0,
pauseAfterRound: const Duration(seconds: 1),
startPadding: 10.0,
),
)
: Container(),
],
),
leading: !_isSearch ? null : Container(),
actions: [
_isSearch

View file

@ -106,6 +106,7 @@ Future<void> _updateSource(
..sourceCodeLanguage = source.sourceCodeLanguage
..additionalParams = source.additionalParams ?? ""
..isObsolete = false
..notes = source.notes
..repo = repo;
isar.writeTxnSync(() {
@ -144,6 +145,7 @@ void _addNewSource(Source source, Ref ref, Repo? repo, ItemType itemType) {
..isFullData = source.isFullData ?? false
..appMinVerReq = source.appMinVerReq
..isObsolete = false
..notes = source.notes
..repo = repo;
isar.sources.putSync(newSource);
ref

View file

@ -6,7 +6,7 @@ part of 'kitsu.dart';
// RiverpodGenerator
// **************************************************************************
String _$kitsuHash() => r'9a123ca11d2b9e01d7d78b75d408a9f7a7b9b4e6';
String _$kitsuHash() => r'09e9b9599bd536b94ca24bc087c8e9310d2b9ef9';
/// Copied from Dart SDK
class _SystemHash {