Skip to content

Commit b3af899

Browse files
committed
Allow users to override author name (#1792)
1 parent 9a58643 commit b3af899

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

lib/pages/app.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class _AppPageState extends State<AppPage> {
300300
? Theme.of(context).textTheme.displaySmall
301301
: Theme.of(context).textTheme.displayLarge,
302302
),
303-
Text(tr('byX', args: [app?.app.author ?? tr('unknown')]),
303+
Text(tr('byX', args: [app?.author ?? tr('unknown')]),
304304
textAlign: TextAlign.center,
305305
style: small
306306
? Theme.of(context).textTheme.headlineSmall

lib/pages/apps.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class AppsPageState extends State<AppsPage> {
216216
}
217217
}
218218
for (var t in authorTokens) {
219-
if (!app.app.author.toLowerCase().contains(t.toLowerCase())) {
219+
if (!app.author.toLowerCase().contains(t.toLowerCase())) {
220220
return false;
221221
}
222222
}
@@ -247,11 +247,11 @@ class AppsPageState extends State<AppsPage> {
247247
listedApps.sort((a, b) {
248248
int result = 0;
249249
if (settingsProvider.sortColumn == SortColumnSettings.authorName) {
250-
result = ((a.app.author + a.name).toLowerCase())
251-
.compareTo((b.app.author + b.name).toLowerCase());
250+
result = ((a.author + a.name).toLowerCase())
251+
.compareTo((b.author + b.name).toLowerCase());
252252
} else if (settingsProvider.sortColumn == SortColumnSettings.nameAuthor) {
253-
result = ((a.name + a.app.author).toLowerCase())
254-
.compareTo((b.name + b.app.author).toLowerCase());
253+
result = ((a.name + a.author).toLowerCase())
254+
.compareTo((b.name + b.author).toLowerCase());
255255
} else if (settingsProvider.sortColumn ==
256256
SortColumnSettings.releaseDate) {
257257
result = (a.app.releaseDate)?.compareTo(
@@ -570,7 +570,7 @@ class AppsPageState extends State<AppsPage> {
570570
: FontWeight.normal,
571571
),
572572
),
573-
subtitle: Text(tr('byX', args: [listedApps[index].app.author]),
573+
subtitle: Text(tr('byX', args: [listedApps[index].author]),
574574
maxLines: 1,
575575
style: TextStyle(
576576
overflow: TextOverflow.ellipsis,

lib/providers/apps_provider.dart

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class AppInMemory {
5353
AppInMemory(app.deepCopy(), downloadProgress, installedInfo, icon);
5454

5555
String get name => app.overrideName ?? app.finalName;
56+
String get author => app.overrideAuthor ?? app.finalAuthor;
5657
}
5758

5859
class DownloadedApk {

lib/providers/source_provider.dart

+10
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,15 @@ class App {
330330
return overrideName ?? name;
331331
}
332332

333+
String? get overrideAuthor =>
334+
additionalSettings['appAuthor']?.toString().trim().isNotEmpty == true
335+
? additionalSettings['appAuthor']
336+
: null;
337+
338+
String get finalAuthor {
339+
return overrideAuthor ?? author;
340+
}
341+
333342
App deepCopy() => App(
334343
id,
335344
url,
@@ -622,6 +631,7 @@ abstract class AppSource {
622631
label: tr('autoApkFilterByArch'), defaultValue: true)
623632
],
624633
[GeneratedFormTextField('appName', label: tr('appName'), required: false)],
634+
[GeneratedFormTextField('appAuthor', label: tr('author'), required: false)],
625635
[
626636
GeneratedFormSwitch('shizukuPretendToBeGooglePlay',
627637
label: tr('shizukuPretendToBeGooglePlay'), defaultValue: false)

0 commit comments

Comments
 (0)