Skip to content

Commit

Permalink
feat: new refined about page, update checker only check for same upda…
Browse files Browse the repository at this point in the history
…te channel
  • Loading branch information
KRTirtho committed Dec 9, 2022
1 parent 90c1200 commit 4cadfa9
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 66 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Following are the features that currently spotube offers:
# Support this project

<a href="https://patreon.com/krtirtho"><img src="https://user-images.githubusercontent.com/61944859/180249027-678b01b8-c336-451e-b147-6d84a5b9d0e7.png" width="250"/></a>
[!["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
Expand Down
9 changes: 9 additions & 0 deletions lib/collections/routes.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion lib/hooks/use_update_checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
237 changes: 174 additions & 63 deletions lib/pages/settings/about.dart
Original file line number Diff line number Diff line change
@@ -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.
""";
9 changes: 8 additions & 1 deletion lib/pages/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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");
},
),
],
),
),
Expand Down
4 changes: 4 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <audioplayers_linux/audioplayers_linux_plugin.h>
#include <bitsdojo_window_linux/bitsdojo_window_plugin.h>
#include <flutter_acrylic/flutter_acrylic_plugin.h>
#include <metadata_god/metadata_god_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_linux
bitsdojo_window_linux
flutter_acrylic
metadata_god
url_launcher_linux
)
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <audioplayers_windows/audioplayers_windows_plugin.h>
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
#include <connectivity_plus_windows/connectivity_plus_windows_plugin.h>
#include <flutter_acrylic/flutter_acrylic_plugin.h>
#include <metadata_god/metadata_god_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4cadfa9

Please sign in to comment.