Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Add button to showLicensePage + add script that checks dependency lic…
Browse files Browse the repository at this point in the history
…enses
  • Loading branch information
Hjort committed Nov 23, 2023
1 parent 48d0c29 commit d91727a
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 0 deletions.
3 changes: 3 additions & 0 deletions assets/graphics/CCD.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions lib/screens/home/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:concordium_wallet/state/network.dart';
import 'package:concordium_wallet/state/terms_and_conditions.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:package_info_plus/package_info_plus.dart';

class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
Expand Down Expand Up @@ -79,6 +81,24 @@ class _HomeScreenState extends State<HomeScreen> {
],
),
),
ElevatedButton(
onPressed: () {
PackageInfo.fromPlatform().then((packageInfo) {
showAboutDialog(
context: context,
applicationName: packageInfo.appName,
applicationVersion: packageInfo.version,
applicationIcon: SvgPicture.asset(
'assets/graphics/CCD.svg',
semanticsLabel: 'CCD Logo',
),
);
});

},
child: const Text('Show About'),
),
const SizedBox(height: 8),
ElevatedButton(
onPressed: () => context.read<TermsAndConditionAcceptance>().testResetValidTime(),
child: const Text('Reset update time of valid T&C'),
Expand Down
112 changes: 112 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.11.0"
barbecue:
dependency: transitive
description:
name: barbecue
sha256: e3a0afaf9005e466887d6c87411a2ddd8d72fc46db3caabf278ee600f1e2f92c
url: "https://pub.dev"
source: hosted
version: "0.4.0"
bloc:
dependency: transitive
description:
Expand Down Expand Up @@ -137,6 +145,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7
url: "https://pub.dev"
source: hosted
version: "0.4.0"
clock:
dependency: transitive
description:
Expand All @@ -161,6 +177,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.17.2"
colorize:
dependency: transitive
description:
name: colorize
sha256: "584746cd6ba1cba0633b6720f494fe6f9601c4170f0666c1579d2aa2a61071ba"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
convert:
dependency: transitive
description:
Expand All @@ -185,6 +209,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.3"
csslib:
dependency: transitive
description:
name: csslib
sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -304,6 +336,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.1"
html:
dependency: transitive
description:
name: html
sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a"
url: "https://pub.dev"
source: hosted
version: "0.15.4"
http:
dependency: "direct main"
description:
Expand Down Expand Up @@ -360,6 +400,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.7.1"
license_checker:
dependency: "direct dev"
description:
name: license_checker
sha256: eea27638e42bc98fd91a6a8187eb57e5617e2c3c8b313a5d51b14bec7a8685e1
url: "https://pub.dev"
source: hosted
version: "1.6.0"
lints:
dependency: transitive
description:
Expand All @@ -376,6 +424,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
markdown:
dependency: transitive
description:
name: markdown
sha256: acf35edccc0463a9d7384e437c015a3535772e09714cf60e07eeef3a15870dcd
url: "https://pub.dev"
source: hosted
version: "7.1.1"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -440,6 +496,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
url: "https://pub.dev"
source: hosted
version: "4.2.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
pana:
dependency: transitive
description:
name: pana
sha256: "6f4372d5d2af5fe3fc6491c18f575601743bceb8433c7f179a6fffd162ee55f1"
url: "https://pub.dev"
source: hosted
version: "0.21.39"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -536,6 +616,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.3"
retry:
dependency: transitive
description:
name: retry
sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
safe_url_check:
dependency: transitive
description:
name: safe_url_check
sha256: b85685b48d74dcd9659e1f2228f900b9fb37cd3b4ba085ca4f593d06c00c36a6
url: "https://pub.dev"
source: hosted
version: "1.1.1"
shared_preferences:
dependency: "direct main"
description:
Expand Down Expand Up @@ -701,6 +797,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
string_validator:
dependency: transitive
description:
name: string_validator
sha256: "50dd8ecf91db6a732f4a851eeae81ee12406eedc62d0da72f2d91a04a2d10dd8"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
tar:
dependency: transitive
description:
name: tar
sha256: "451629b6ed9dd18be43688f4b42de34dd0ddd9e0a7da76a42b9e0b4ac7e9c68d"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
term_glyph:
dependency: transitive
description:
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies:
shared_preferences: ^2.2.1
http: ^1.1.0
flutter_bloc: ^8.1.3
package_info_plus: ^4.2.0

dev_dependencies:
flutter_test:
Expand All @@ -56,6 +57,7 @@ dev_dependencies:
json_serializable: ^6.7.1
mocktail: ^1.0.1
bloc_test: ^9.1.5
license_checker: ^1.6.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down Expand Up @@ -100,3 +102,4 @@ flutter:
# see https://flutter.dev/custom-fonts/#from-packages
assets:
- assets/graphics/

35 changes: 35 additions & 0 deletions scripts/check_license.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// ignore_for_file: avoid_print
import 'dart:io';
import 'package:license_checker/src/config.dart';
import 'package:license_checker/src/check_license.dart';
import 'package:license_checker/src/dependency_checker.dart';
import 'package:license_checker/src/package_checker.dart';

void main() async {
// Load the config file
Config config = Config.fromFile(File('./scripts/license.yaml'));

// Get the package configuration from the current directory
PackageChecker packageConfig = await PackageChecker.fromCurrentDirectory(config: config);

// Run the license check on all packages
List<LicenseDisplayWithPriority<String>> lic = await checkAllPackageLicenses<String>(
packageConfig: packageConfig,
showDirectDepsOnly: false,
filterApproved: true,
licenseDisplay: ({
required String licenseName,
required String packageName,
required LicenseStatus licenseStatus,
}) =>
'$packageName $licenseName ${licenseStatus.toString()}',
);

if (lic.isNotEmpty) {
print('Unapproved licenses used!');
for (final x in lic) {
print(x.display);
}
throw "Unapproved licenses used!";
}
}
14 changes: 14 additions & 0 deletions scripts/license.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
permittedLicenses:
- MIT
- BSD-3-Clause

rejectedLicenses:
- GPL
- GPL-1
- GPL-2
- GPL-3

omitDisclaimer:
- flutter_test
- flutter_web_plugins

0 comments on commit d91727a

Please sign in to comment.