Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add deb management links #1870

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/app_center/lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ const kSearchFieldIconConstraints = BoxConstraints(
);
const kSearchFieldContentPadding = EdgeInsets.all(12);
const kSearchFieldPrefixIcon = Icon(YaruIcons.search, size: 16);

// URLs
const localDebInfoUrl =
'https://ubuntu.com/server/docs/third-party-repository-usage';
const debManageDocsUrl =
'https://documentation.ubuntu.com/server/tutorial/managing-software/#installing-deb-packages';
16 changes: 13 additions & 3 deletions packages/app_center/lib/deb/deb_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class _Header extends StatelessWidget {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
return Column(
children: [
const SizedBox(height: kPagePadding),
Expand All @@ -259,9 +260,18 @@ class _Header extends StatelessWidget {
],
),
const SizedBox(height: kPagePadding),
Align(
alignment: AlignmentDirectional.centerStart,
child: _DebActionButtons(debModel: debModel),
Row(
children: [
_DebActionButtons(debModel: debModel),
const SizedBox(width: 32),
Html(
shrinkWrap: true,
data:
'<a href="$debManageDocsUrl">${l10n.debPageDocumentationLinkLabel} &gt;</a>',
style: {'body': Style(margin: Margins.zero)},
onLinkTap: (url, attributes, element) => launchUrlString(url!),
),
],
),
const SizedBox(height: 42),
const Divider(),
Expand Down
17 changes: 13 additions & 4 deletions packages/app_center/lib/deb/local_deb_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import 'package:ubuntu_widgets/ubuntu_widgets.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:yaru/yaru.dart';

const localDebInfoUrl =
'https://ubuntu.com/server/docs/third-party-repository-usage';

class LocalDebPage extends ConsumerWidget {
const LocalDebPage({required this.path, super.key});

Expand Down Expand Up @@ -221,7 +218,19 @@ class _Header extends StatelessWidget {
),
),
const SizedBox(height: kPagePadding),
_LocalDebActionButtons(debData: debData),
Row(
children: [
_LocalDebActionButtons(debData: debData),
const SizedBox(width: 32),
Html(
shrinkWrap: true,
data:
'<a href="$debManageDocsUrl">${l10n.debPageDocumentationLinkLabel} &gt;</a>',
style: {'body': Style(margin: Margins.zero)},
onLinkTap: (url, attributes, element) => launchUrlString(url!),
),
],
),
const SizedBox(height: kPagePadding),
const Divider(),
],
Expand Down
16 changes: 16 additions & 0 deletions packages/app_center/lib/manage/manage_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import 'package:app_center/manage/updates_model.dart';
import 'package:app_center/snapd/currently_installing_model.dart';
import 'package:app_center/snapd/snapd.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:ubuntu_widgets/ubuntu_widgets.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:yaru/yaru.dart';

class ManagePage extends ConsumerWidget {
Expand Down Expand Up @@ -62,6 +64,20 @@ class ManagePage extends ConsumerWidget {
l10n.managePageDebUpdatesMessage,
style: textTheme.titleMedium,
),
Html(
shrinkWrap: true,
data:
'<a href="$debManageDocsUrl">${l10n.managePageDocumentationLinkLabel}</a>',
style: {
'body': Style(
margin: Margins.zero,
fontSize: FontSize(textTheme.titleMedium!.fontSize!),
fontWeight: textTheme.titleMedium!.fontWeight,
lineHeight: LineHeight(textTheme.titleMedium!.height),
),
},
onLinkTap: (url, attributes, element) => launchUrlString(url!),
),
_SelfUpdateInfoBox(),
Builder(
builder: (context) {
Expand Down
2 changes: 2 additions & 0 deletions packages/app_center/lib/src/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
}
}
},
"managePageDocumentationLinkLabel": "Learn how to manage Debian packages in the documentation.",
"productivityPageLabel": "Productivity",
"developmentPageLabel": "Development",
"gamesPageLabel": "Games",
Expand Down Expand Up @@ -283,6 +284,7 @@
"snapReportPrivacyAgreementAndLabel": "and ",
"snapReportPrivacyAgreementPrivacyPolicy": "Privacy Policy",
"debPageErrorNoPackageInfo": "No package information found",
"debPageDocumentationLinkLabel": "Learn about managing Debian packages",
"externalResources": "Additional resources",
"externalResourcesButtonLabel": "Discover more",
"allGamesButtonLabel": "All games",
Expand Down
28 changes: 28 additions & 0 deletions packages/app_center/test/manage_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ void main() {

await tester.pumpAndSettle();
final testTile = find.snapTile('Test Snap');

// Use the top-level scrollbar to ensure the tiles are visible before testing them.
final scrollable = find.byType(Scrollable).first;

await tester.scrollUntilVisible(
testTile,
kMinInteractiveDimension / 2,
scrollable: scrollable,
);
expect(testTile, findsOneWidget);
expect(
find.descendant(of: testTile, matching: find.text('1.0')),
Expand All @@ -142,6 +151,11 @@ void main() {
);

final testTile2 = find.snapTile('Another Test Snap');
await tester.scrollUntilVisible(
testTile2,
kMinInteractiveDimension / 2,
scrollable: scrollable,
);
expect(testTile2, findsOneWidget);
expect(
find.descendant(of: testTile2, matching: find.text('1.5')),
Expand Down Expand Up @@ -195,8 +209,22 @@ void main() {
)
.hitTestable();

// Use the top-level scrollbar to ensure the buttons are visible before testing them.
final scrollable = find.byType(Scrollable).first;

await tester.scrollUntilVisible(
openButton,
kMinInteractiveDimension / 2,
scrollable: scrollable,
);
expect(openButton, findsOneWidget);
expect(openButton, isEnabled);

await tester.scrollUntilVisible(
openButton2,
kMinInteractiveDimension / 2,
scrollable: scrollable,
);
expect(openButton2, findsOneWidget);
expect(openButton2, isDisabled);

Expand Down