From 4cadfa93750cc9b3f8fbe7b60f8161a77d2a12f6 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Fri, 9 Dec 2022 18:03:41 +0600 Subject: [PATCH] feat: new refined about page, update checker only check for same update channel --- README.md | 2 +- lib/collections/routes.dart | 9 + lib/hooks/use_update_checker.dart | 5 +- lib/pages/settings/about.dart | 237 +++++++++++++----- lib/pages/settings/settings.dart | 9 +- linux/flutter/generated_plugin_registrant.cc | 4 + linux/flutter/generated_plugins.cmake | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 2 + .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 10 files changed, 207 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index a35dc64ae..4384dd66e 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Following are the features that currently spotube offers: # Support this project -[!["Donate to out Collective"](https://opencollective.com/webpack/donate/button.png?color=blue)](https://opencollective.com/spotube) +[!["Donate to out Collective"](https://opencollective.com/spotube/donate/button.png?color=blue)](https://opencollective.com/spotube) [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/krtirtho) # Installation diff --git a/lib/collections/routes.dart b/lib/collections/routes.dart index 7f4efd567..c2e36333f 100644 --- a/lib/collections/routes.dart +++ b/lib/collections/routes.dart @@ -1,6 +1,7 @@ import 'package:flutter/widgets.dart'; import 'package:go_router/go_router.dart'; import 'package:spotify/spotify.dart' hide Search; +import 'package:spotube/pages/settings/about.dart'; import 'package:spotube/utils/platform.dart'; import 'package:spotube/components/shared/spotube_page_route.dart'; import 'package:spotube/pages/album/album.dart'; @@ -54,6 +55,14 @@ final router = GoRouter( pageBuilder: (context, state) => SpotubePage( child: const SettingsPage(), ), + routes: [ + GoRoute( + path: "about", + pageBuilder: (context, state) => SpotubePage( + child: const AboutSpotube(), + ), + ), + ], ), GoRoute( path: "/album/:id", diff --git a/lib/hooks/use_update_checker.dart b/lib/hooks/use_update_checker.dart index 844a0399c..294cea99a 100644 --- a/lib/hooks/use_update_checker.dart +++ b/lib/hooks/use_update_checker.dart @@ -51,7 +51,10 @@ void useUpdateChecker(WidgetRef ref) { checkUpdate().then((value) { final currentVersion = value.first; final latestVersion = value.last; - if (currentVersion == null || latestVersion == null) return; + if (currentVersion == null || + latestVersion == null || + (latestVersion.isPreRelease && !currentVersion.isPreRelease) || + (!latestVersion.isPreRelease && currentVersion.isPreRelease)) return; if (latestVersion <= currentVersion) return; showPlatformAlertDialog( context, diff --git a/lib/pages/settings/about.dart b/lib/pages/settings/about.dart index 3935f3082..eb5e6697a 100644 --- a/lib/pages/settings/about.dart +++ b/lib/pages/settings/about.dart @@ -1,85 +1,196 @@ import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:platform_ui/platform_ui.dart'; -import 'package:spotube/components/shared/links/hyper_link.dart'; +import 'package:spotube/components/shared/page_window_title_bar.dart'; import 'package:spotube/hooks/use_package_info.dart'; -const licenseText = """ -BSD-4-Clause License - -Copyright (c) 2022 Kingkor Roy Tirtho. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. 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. -3. All advertising materials mentioning features or use of this software must display the following acknowledgement: -This product includes software developed by Kingkor Roy Tirtho. -4. Neither the name of the Software 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 KINGKOR ROY TIRTHO 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 KINGKOR ROY TIRTHO AND 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. -"""; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher/url_launcher_string.dart'; -class About extends HookWidget { - const About({Key? key}) : super(key: key); +class AboutSpotube extends HookConsumerWidget { + const AboutSpotube({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { - final info = usePackageInfo( - appName: "Spotube", - packageName: "oss.krtirtho.Spotube", - version: "2.5.0", - ); + Widget build(BuildContext context, ref) { + final packageInfo = usePackageInfo(); - return PlatformListTile( - leading: const Icon(Icons.info_outline_rounded), - title: PlatformText( - "About Spotube", - style: PlatformTextTheme.of(context).body, + return PlatformScaffold( + appBar: PageWindowTitleBar( + leading: const PlatformBackButton(), + title: const PlatformText("About Wives"), ), - onTap: () { - showAboutDialog( - context: context, - applicationIcon: - CircleAvatar(child: Image.asset("assets/spotube-logo.png")), - applicationName: "Spotube", - applicationVersion: info.version, - applicationLegalese: licenseText, + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Column( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - PlatformText("Author: "), - Hyperlink( - "Kingkor Roy Tirtho", - "https://github.com/KRTirtho", - ), - ], + Image.asset( + "assets/spotube-logo.png", + height: 200, + width: 200, + ), + Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PlatformText.headline( + "Spotube, a light-weight, cross-platform, free-for-all spotify client", + ), + const SizedBox(height: 20), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + PlatformText.subheading( + "Founder: Kingkor Roy Tirtho", + ), + const SizedBox(width: 5), + CircleAvatar( + radius: 20, + child: ClipOval( + child: Image.network( + "https://avatars.githubusercontent.com/u/61944859?v=4", + ), + ), + ), + ], + ), + const SizedBox(height: 5), + PlatformText( + "Version: v${packageInfo.version}", + ), + const SizedBox(height: 5), + InkWell( + onTap: () { + launchUrlString( + "https://github.com/KRTirtho/spotube", + mode: LaunchMode.externalApplication, + ); + }, + child: const PlatformText( + "Repository: https://github.com/KRTirtho/spotube", + ), + ), + const SizedBox(height: 5), + InkWell( + onTap: () { + launchUrlString( + "https://raw.githubusercontent.com/KRTirtho/spotube/main/LICENSE", + mode: LaunchMode.externalApplication, + ); + }, + child: const PlatformText( + "License: BSD-4-Clause", + ), + ), + const SizedBox(height: 5), + InkWell( + onTap: () { + launchUrlString( + "https://github.com/KRTirtho/spotube/issues", + mode: LaunchMode.externalApplication, + ); + }, + child: const PlatformText( + "Bugs+Issues: https://github.com/KRTirtho/spotube/issues", + ), + ), + ], + ), ), const SizedBox(height: 20), Wrap( + runSpacing: 20, + spacing: 20, alignment: WrapAlignment.center, - children: const [ - Hyperlink( - "💚 Sponsor/Donate 💚", - "https://opencollective.com/spotube", + crossAxisAlignment: WrapCrossAlignment.center, + runAlignment: WrapAlignment.center, + children: [ + MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + onTap: () { + launchUrl( + Uri.parse("https://www.buymeacoffee.com/krtirtho"), + mode: LaunchMode.externalApplication, + ); + }, + child: SvgPicture.network( + "https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=krtirtho&button_colour=FF5F5F&font_colour=ffffff&font_family=Inter&outline_colour=000000&coffee_colour=FFDD00", + height: 45, + ), + ), ), - PlatformText(" • "), - Hyperlink( - "BSD-4-Clause LICENSE", - "https://github.com/KRTirtho/spotube/blob/master/LICENSE", + MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + onTap: () { + launchUrl( + Uri.parse( + "https://opencollective.com/spotube", + ), + mode: LaunchMode.externalApplication, + ); + }, + child: Image.network( + "https://opencollective.com/spotube/donate/button.png?color=blue", + height: 45, + ), + ), ), - PlatformText(" • "), - Hyperlink( - "Bug Report", - "https://github.com/KRTirtho/spotube/issues/new?assignees=&labels=bug&template=bug_report.md&title=", + MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + onTap: () { + launchUrl( + Uri.parse("https://patreon.com/krtirtho"), + mode: LaunchMode.externalApplication, + ); + }, + child: Image.network( + "https://user-images.githubusercontent.com/61944859/180249027-678b01b8-c336-451e-b147-6d84a5b9d0e7.png", + height: 45, + ), + ), ), ], ), - const SizedBox(height: 10), - const Center( - child: PlatformText("© Spotube 2022. All rights reserved")) - ]); - }, + const SizedBox(height: 20), + PlatformText.caption( + "Made with ❤️ in Bangladesh🇧🇩", + textAlign: TextAlign.center, + ), + PlatformText.caption( + "© 2021-${DateTime.now().year} Kingkor Roy Tirtho", + textAlign: TextAlign.center, + ), + const SizedBox(height: 20), + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 750), + child: PlatformText.caption( + licenseText, + textAlign: TextAlign.justify, + ), + ), + ], + ), + ), + ), ); } } + +const licenseText = """ +BSD-4-Clause License + +Copyright (c) 2022 Kingkor Roy Tirtho. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. 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. +3. All advertising materials mentioning features or use of this software must display the following acknowledgement: +This product includes software developed by Kingkor Roy Tirtho. +4. Neither the name of the Software 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 KINGKOR ROY TIRTHO 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 KINGKOR ROY TIRTHO AND 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. +"""; diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index 3c24fd0a6..76b70e4eb 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -535,7 +535,14 @@ class SettingsPage extends HookConsumerWidget { preferences.setCheckUpdate(checked), ), ), - const About() + PlatformListTile( + leading: const Icon(Icons.info_outline_rounded), + title: const PlatformText("About Spotube"), + trailing: const Icon(Icons.arrow_forward_ios_rounded), + onTap: () { + GoRouter.of(context).push("/settings/about"); + }, + ), ], ), ), diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index bf0cd78b6..b234ee20d 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -18,6 +19,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) bitsdojo_window_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "BitsdojoWindowPlugin"); bitsdojo_window_plugin_register_with_registrar(bitsdojo_window_linux_registrar); + g_autoptr(FlPluginRegistrar) flutter_acrylic_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterAcrylicPlugin"); + flutter_acrylic_plugin_register_with_registrar(flutter_acrylic_registrar); g_autoptr(FlPluginRegistrar) metadata_god_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "MetadataGodPlugin"); metadata_god_plugin_register_with_registrar(metadata_god_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 0de3bf803..3a6bc5001 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -5,6 +5,7 @@ list(APPEND FLUTTER_PLUGIN_LIST audioplayers_linux bitsdojo_window_linux + flutter_acrylic metadata_god url_launcher_linux ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 7beb29a87..e0226747c 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,6 +10,7 @@ import audio_session import audioplayers_darwin import bitsdojo_window_macos import connectivity_plus_macos +import flutter_acrylic import macos_ui import metadata_god import package_info_plus_macos @@ -24,6 +25,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin")) ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) + FlutterAcrylicPlugin.register(with: registry.registrar(forPlugin: "FlutterAcrylicPlugin")) MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin")) MetadataGodPlugin.register(with: registry.registrar(forPlugin: "MetadataGodPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index c40e4841a..802eee4f5 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("BitsdojoWindowPlugin")); ConnectivityPlusWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); + FlutterAcrylicPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FlutterAcrylicPlugin")); MetadataGodPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("MetadataGodPluginCApi")); PermissionHandlerWindowsPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 5dca4667d..8c87de867 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST audioplayers_windows bitsdojo_window_windows connectivity_plus_windows + flutter_acrylic metadata_god permission_handler_windows url_launcher_windows