Merge pull request #2139 from ImranR98/dev

Allow users to override author name (#1792)
This commit is contained in:
Imran
2025-02-22 19:03:39 -06:00
committed by GitHub
4 changed files with 18 additions and 7 deletions

View File

@ -300,7 +300,7 @@ class _AppPageState extends State<AppPage> {
? Theme.of(context).textTheme.displaySmall ? Theme.of(context).textTheme.displaySmall
: Theme.of(context).textTheme.displayLarge, : Theme.of(context).textTheme.displayLarge,
), ),
Text(tr('byX', args: [app?.app.author ?? tr('unknown')]), Text(tr('byX', args: [app?.author ?? tr('unknown')]),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: small style: small
? Theme.of(context).textTheme.headlineSmall ? Theme.of(context).textTheme.headlineSmall

View File

@ -216,7 +216,7 @@ class AppsPageState extends State<AppsPage> {
} }
} }
for (var t in authorTokens) { for (var t in authorTokens) {
if (!app.app.author.toLowerCase().contains(t.toLowerCase())) { if (!app.author.toLowerCase().contains(t.toLowerCase())) {
return false; return false;
} }
} }
@ -247,11 +247,11 @@ class AppsPageState extends State<AppsPage> {
listedApps.sort((a, b) { listedApps.sort((a, b) {
int result = 0; int result = 0;
if (settingsProvider.sortColumn == SortColumnSettings.authorName) { if (settingsProvider.sortColumn == SortColumnSettings.authorName) {
result = ((a.app.author + a.name).toLowerCase()) result = ((a.author + a.name).toLowerCase())
.compareTo((b.app.author + b.name).toLowerCase()); .compareTo((b.author + b.name).toLowerCase());
} else if (settingsProvider.sortColumn == SortColumnSettings.nameAuthor) { } else if (settingsProvider.sortColumn == SortColumnSettings.nameAuthor) {
result = ((a.name + a.app.author).toLowerCase()) result = ((a.name + a.author).toLowerCase())
.compareTo((b.name + b.app.author).toLowerCase()); .compareTo((b.name + b.author).toLowerCase());
} else if (settingsProvider.sortColumn == } else if (settingsProvider.sortColumn ==
SortColumnSettings.releaseDate) { SortColumnSettings.releaseDate) {
result = (a.app.releaseDate)?.compareTo( result = (a.app.releaseDate)?.compareTo(
@ -570,7 +570,7 @@ class AppsPageState extends State<AppsPage> {
: FontWeight.normal, : FontWeight.normal,
), ),
), ),
subtitle: Text(tr('byX', args: [listedApps[index].app.author]), subtitle: Text(tr('byX', args: [listedApps[index].author]),
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

View File

@ -53,6 +53,7 @@ class AppInMemory {
AppInMemory(app.deepCopy(), downloadProgress, installedInfo, icon); AppInMemory(app.deepCopy(), downloadProgress, installedInfo, icon);
String get name => app.overrideName ?? app.finalName; String get name => app.overrideName ?? app.finalName;
String get author => app.overrideAuthor ?? app.finalAuthor;
} }
class DownloadedApk { class DownloadedApk {

View File

@ -330,6 +330,15 @@ class App {
return overrideName ?? name; return overrideName ?? name;
} }
String? get overrideAuthor =>
additionalSettings['appAuthor']?.toString().trim().isNotEmpty == true
? additionalSettings['appAuthor']
: null;
String get finalAuthor {
return overrideAuthor ?? author;
}
App deepCopy() => App( App deepCopy() => App(
id, id,
url, url,
@ -622,6 +631,7 @@ abstract class AppSource {
label: tr('autoApkFilterByArch'), defaultValue: true) label: tr('autoApkFilterByArch'), defaultValue: true)
], ],
[GeneratedFormTextField('appName', label: tr('appName'), required: false)], [GeneratedFormTextField('appName', label: tr('appName'), required: false)],
[GeneratedFormTextField('appAuthor', label: tr('author'), required: false)],
[ [
GeneratedFormSwitch('shizukuPretendToBeGooglePlay', GeneratedFormSwitch('shizukuPretendToBeGooglePlay',
label: tr('shizukuPretendToBeGooglePlay'), defaultValue: false) label: tr('shizukuPretendToBeGooglePlay'), defaultValue: false)