Support for normal text changelogs (by Source)

This commit is contained in:
Imran Remtulla
2023-03-19 12:52:34 -04:00
parent 48d2532323
commit 6db31e2b24
2 changed files with 39 additions and 30 deletions

View File

@@ -231,8 +231,9 @@ class AppsPageState extends State<AppsPage> {
SliverList( SliverList(
delegate: SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
String? changesUrl = SourceProvider() AppSource appSource =
.getSource(listedApps[index].app.url) SourceProvider().getSource(listedApps[index].app.url);
String? changesUrl = appSource
.changeLogPageFromStandardUrl(listedApps[index].app.url); .changeLogPageFromStandardUrl(listedApps[index].app.url);
String? changeLog = listedApps[index].app.changeLog; String? changeLog = listedApps[index].app.changeLog;
var showChanges = (changeLog == null && changesUrl == null) var showChanges = (changeLog == null && changesUrl == null)
@@ -267,35 +268,42 @@ class AppsPageState extends State<AppsPage> {
height: 16, height: 16,
) )
: const SizedBox.shrink(), : const SizedBox.shrink(),
SizedBox( appSource.changeLogIfAnyIsMarkDown
width: MediaQuery.of(context).size.width, ? SizedBox(
height: width:
MediaQuery.of(context).size.height - MediaQuery.of(context).size.width,
height: MediaQuery.of(context)
.size
.height -
350, 350,
child: Markdown( child: Markdown(
data: changeLog, data: changeLog,
onTapLink: (text, href, title) { onTapLink: (text, href, title) {
if (href != null) { if (href != null) {
launchUrlString( launchUrlString(
href.startsWith('http://') || href.startsWith(
href.startsWith( 'http://') ||
'https://') href.startsWith(
? href 'https://')
: '${Uri.parse(listedApps[index].app.url).origin}/$href', ? href
mode: LaunchMode : '${Uri.parse(listedApps[index].app.url).origin}/$href',
.externalApplication); mode: LaunchMode
} .externalApplication);
}, }
extensionSet: md.ExtensionSet( },
md.ExtensionSet.gitHubFlavored extensionSet: md.ExtensionSet(
.blockSyntaxes, md.ExtensionSet.gitHubFlavored
[ .blockSyntaxes,
md.EmojiSyntax(), [
...md.ExtensionSet.gitHubFlavored md.EmojiSyntax(),
.inlineSyntaxes ...md
], .ExtensionSet
), .gitHubFlavored
)), .inlineSyntaxes
],
),
))
: Text(changeLog),
], ],
singleNullReturnButton: tr('ok'), singleNullReturnButton: tr('ok'),
); );

View File

@@ -228,6 +228,7 @@ class AppSource {
String? host; String? host;
late String name; late String name;
bool enforceTrackOnly = false; bool enforceTrackOnly = false;
bool changeLogIfAnyIsMarkDown = true;
AppSource() { AppSource() {
name = runtimeType.toString(); name = runtimeType.toString();