Skip to content

Commit

Permalink
Merge pull request #739 from nextcloud/feature/source-code-issue-trac…
Browse files Browse the repository at this point in the history
…ker-links

feat(neon,app): Add links to the source code and issue tracker
  • Loading branch information
provokateurin authored Sep 8, 2023
2 parents e26118f + a37a7ec commit d383943
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/app/lib/branding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const branding = Branding(
'assets/logo.svg.vec',
),
),
sourceCodeURL: 'https://github.com/nextcloud/neon',
issueTrackerURL: 'https://github.com/nextcloud/neon/issues',
legalese: 'Copyright © 2023, provokateurin\nUnder GPLv3 license',
);

Expand Down
4 changes: 3 additions & 1 deletion packages/neon/neon/lib/l10n/en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,7 @@
},
"accountOptionsInitialApp": "App to show initially",
"accountOptionsAutomatic": "Automatic",
"licenses": "Licenses"
"licenses": "Licenses",
"sourceCode": "Source code",
"issueTracker": "Report a bug or request a feature"
}
12 changes: 12 additions & 0 deletions packages/neon/neon/lib/l10n/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,18 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Licenses'**
String get licenses;

/// No description provided for @sourceCode.
///
/// In en, this message translates to:
/// **'Source code'**
String get sourceCode;

/// No description provided for @issueTracker.
///
/// In en, this message translates to:
/// **'Report a bug or request a feature'**
String get issueTracker;
}

class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
Expand Down
6 changes: 6 additions & 0 deletions packages/neon/neon/lib/l10n/localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,10 @@ class AppLocalizationsEn extends AppLocalizations {

@override
String get licenses => 'Licenses';

@override
String get sourceCode => 'Source code';

@override
String get issueTracker => 'Report a bug or request a feature';
}
31 changes: 30 additions & 1 deletion packages/neon/neon/lib/src/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'package:neon/src/utils/save_file.dart';
import 'package:neon/src/widgets/exception.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher_string.dart';

enum SettingsCategories {
apps,
Expand Down Expand Up @@ -54,6 +55,7 @@ class _SettingsPageState extends State<SettingsPage> {
final globalOptions = Provider.of<GlobalOptions>(context);
final accountsBloc = Provider.of<AccountsBloc>(context, listen: false);
final appImplementations = Provider.of<Iterable<AppImplementation>>(context);
final branding = Branding.of(context);

final appBar = AppBar(
title: Text(AppLocalizations.of(context).settings),
Expand Down Expand Up @@ -220,14 +222,41 @@ class _SettingsPageState extends State<SettingsPage> {
title: Text(AppLocalizations.of(context).optionsCategoryOther),
key: ValueKey(SettingsCategories.other.name),
tiles: <SettingsTile>[
if (branding.sourceCodeURL != null)
CustomSettingsTile(
leading: Icon(
Icons.code,
color: Theme.of(context).colorScheme.primary,
),
title: Text(AppLocalizations.of(context).sourceCode),
onTap: () async {
await launchUrlString(
branding.sourceCodeURL!,
mode: LaunchMode.externalApplication,
);
},
),
if (branding.issueTrackerURL != null)
CustomSettingsTile(
leading: Icon(
MdiIcons.textBoxEditOutline,
color: Theme.of(context).colorScheme.primary,
),
title: Text(AppLocalizations.of(context).issueTracker),
onTap: () async {
await launchUrlString(
branding.issueTrackerURL!,
mode: LaunchMode.externalApplication,
);
},
),
CustomSettingsTile(
leading: Icon(
MdiIcons.scriptText,
color: Theme.of(context).colorScheme.primary,
),
title: Text(AppLocalizations.of(context).licenses),
onTap: () async {
final branding = Branding.of(context);
showLicensePage(
context: context,
applicationName: branding.name,
Expand Down
8 changes: 8 additions & 0 deletions packages/neon/neon/lib/src/theme/branding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Branding {
const Branding({
required this.name,
required this.logo,
this.sourceCodeURL,
this.issueTrackerURL,
this.legalese,
this.showLoginWithNextcloud = true,
});
Expand All @@ -22,6 +24,12 @@ class Branding {
/// Logo of the app shown on various places in the app.
final Widget logo;

/// The URL where the source code can be seen
final String? sourceCodeURL;

/// The URL where users can report bugs and request features
final String? issueTrackerURL;

/// A string to show in small print.
///
/// Typically this is a copyright notice shown as the [AboutDialog.applicationLegalese].
Expand Down

0 comments on commit d383943

Please sign in to comment.