diff --git a/android/app/build.gradle b/android/app/build.gradle index 98cd7fd..ad51d9d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -52,7 +52,7 @@ android { applicationId "dev.abmgrt.shlink_app" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion 18 //flutter.minSdkVersion + minSdkVersion 19 //flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/lib/SettingsView.dart b/lib/SettingsView.dart index 9466ba5..8703e06 100644 --- a/lib/SettingsView.dart +++ b/lib/SettingsView.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import 'package:shlink_app/API/ServerManager.dart'; import 'package:shlink_app/LoginView.dart'; import 'package:shlink_app/OpenSourceLicensesView.dart'; @@ -22,6 +23,7 @@ class _SettingsViewState extends State { var _server_version = "---"; ServerStatus _server_status = ServerStatus.connecting; + var packageInfo = null; @override void initState() { @@ -32,6 +34,10 @@ class _SettingsViewState extends State { } void getServerHealth() async { + var _packageInfo = await PackageInfo.fromPlatform(); + setState(() { + packageInfo = _packageInfo; + }); final response = await globals.serverManager.getServerHealth(); response.fold((l) { setState(() { @@ -191,7 +197,45 @@ class _SettingsViewState extends State { ), ), ), - ) + ), + SizedBox(height: 16), + GestureDetector( + onTap: () async { + var url = Uri.parse("https://abmgrt.dev/shlink-manager/privacy"); + if (await canLaunchUrl(url)) { + launchUrl(url, mode: LaunchMode.externalApplication); + } + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Theme.of(context).brightness == Brightness.light ? Colors.grey[100] : Colors.grey[900], + ), + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12, top: 20, bottom: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Icon(Icons.lock), + SizedBox(width: 8), + Text("Privacy Policy", style: TextStyle(fontWeight: FontWeight.w500)), + ], + ), + Icon(Icons.chevron_right) + ] + ), + ), + ), + ), + SizedBox(height: 16), + if (packageInfo != null) + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text("${packageInfo.appName}, v${packageInfo.version} (${packageInfo.buildNumber})", style: TextStyle(color: Colors.grey),),], + ) ], ) ), diff --git a/lib/util/license.dart b/lib/util/license.dart index 4364677..42d8635 100644 --- a/lib/util/license.dart +++ b/lib/util/license.dart @@ -576,6 +576,40 @@ SOFTWARE. homepage: r'https://github.com/icapps/flutter-icapps-license', repository: null, ), + License( + name: r'package_info_plus', + license: r'''Copyright 2017 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +''', + version: r'^4.0.2', + homepage: r'https://plus.fluttercommunity.dev/', + repository: r'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/', + ), License( name: r'qr_flutter', license: r'''BSD 3-Clause License diff --git a/pubspec.lock b/pubspec.lock index 19baa90..d6ec8f5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -121,6 +121,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + url: "https://pub.dev" + source: hosted + version: "2.0.2" flutter: dependency: "direct main" description: flutter @@ -297,6 +305,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.0" + package_info_plus: + dependency: "direct main" + description: + name: package_info_plus + sha256: ceb027f6bc6a60674a233b4a90a7658af1aebdea833da0b5b53c1e9821a78c7b + url: "https://pub.dev" + source: hosted + version: "4.0.2" + 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" path: dependency: transitive description: @@ -486,6 +510,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + win32: + dependency: transitive + description: + name: win32 + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + url: "https://pub.dev" + source: hosted + version: "4.1.4" xml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b49b227..e012e2b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.9.0+3 +version: 0.9.0+4 environment: sdk: ^2.19.0 @@ -40,6 +40,7 @@ dependencies: intl: ^0.18.1 dynamic_color: ^1.6.6 url_launcher: 6.1.9 + package_info_plus: ^4.0.2 dev_dependencies: flutter_test: