application adpted to Flutter 3.0

Got ready for F-Droid release
This commit is contained in:
Kingkor Roy Tirtho 2022-05-21 17:15:46 +06:00
parent 9b0c002684
commit 31551ac1dc
10 changed files with 205 additions and 61 deletions

View File

@ -3,6 +3,139 @@ import 'dart:io';
import 'package:path/path.dart' as path;
// blob metadata for de-stringifying
const randHash = [
49,
111,
98,
72,
78,
122,
98,
48,
112,
73,
81,
50,
112,
89,
90,
50,
116,
83,
84,
110,
99,
105,
76,
67,
74,
67,
89,
121,
48,
119,
77,
106,
69,
50,
86,
69,
53,
107,
77,
69,
86,
71,
101,
68,
66,
113,
78,
110,
66,
119
];
const sugarCarbonator = [
81,
119,
79,
71,
85,
53,
78,
50,
69,
52,
90,
68,
107,
120,
77,
87,
89,
52,
89,
84,
73
];
const randomSalt = [
70,
117,
67,
75,
117,
116,
72,
101,
105,
102,
65,
110,
68,
87,
72,
97,
84,
85,
82,
100,
79,
73,
110,
103,
83,
117,
75,
115
];
const algorithmicSugar = [
70,
117,
67,
75,
117,
116,
72,
101,
105,
102,
65,
78,
100,
102,
68,
114,
79,
105,
100,
115,
85,
99,
107,
83
];
void main(List<String> args) async {
List<String> val;
List<Map> val2;
@ -10,7 +143,7 @@ void main(List<String> args) async {
final cwd = Directory.current.path;
final binSafe = cwd.endsWith("/bin") ? ".." : "";
if (args.isEmpty) {
throw ArgumentError("Expected 1-2 arguments but passed none");
throw ArgumentError("Expected 1-3 arguments but passed none");
}
if (args.contains("--local")) {
final secretFilePath = path.join(cwd, binSafe, "secrets.json");
@ -19,11 +152,22 @@ void main(List<String> args) async {
final data = jsonDecode(await file.readAsString());
val = List.castFrom<dynamic, String>(data["LYRICS_SECRET"]);
val2 = List.castFrom<dynamic, Map>(data["SPOTIFY_SECRET"]);
} else if (args.contains("--fdroid")) {
final decodedLyricSecret = utf8.decode(base64Decode(
args[1].replaceAll(
String.fromCharCodes(randomSalt), String.fromCharCodes(randHash)),
));
final decodedSpotifySecret = utf8.decode(base64Decode(
args.last.replaceAll(String.fromCharCodes(algorithmicSugar),
String.fromCharCodes(sugarCarbonator)),
));
val = List.castFrom<dynamic, String>(jsonDecode(decodedLyricSecret));
val2 = List.castFrom<dynamic, Map>(jsonDecode(decodedSpotifySecret));
} else {
final decodedLyricSecret = utf8.decode(base64Decode(args.first));
final decodedSpotifySecrete = utf8.decode(base64Decode(args.last));
final decodedSpotifySecret = utf8.decode(base64Decode(args.last));
val = List.castFrom<dynamic, String>(jsonDecode(decodedLyricSecret));
val2 = List.castFrom<dynamic, Map>(jsonDecode(decodedSpotifySecrete));
val2 = List.castFrom<dynamic, Map>(jsonDecode(decodedSpotifySecret));
}
await File(path.join(cwd, binSafe, "lib/models/generated_secrets.dart"))

View File

@ -81,7 +81,7 @@ class Sidebar extends HookConsumerWidget {
trailing: FutureBuilder<User>(
future: spotify.me.get(),
builder: (context, snapshot) {
var avatarImg = imageToUrlString(snapshot.data?.images,
final avatarImg = imageToUrlString(snapshot.data?.images,
index: (snapshot.data?.images?.length ?? 1) - 1);
return extended.value
? Padding(

View File

@ -21,7 +21,7 @@ class _UserArtistsState extends ConsumerState<UserArtists> {
@override
void initState() {
super.initState();
WidgetsBinding.instance?.addPostFrameCallback((timestamp) {
WidgetsBinding.instance.addPostFrameCallback((timestamp) {
_pagingController.addPageRequestListener((pageKey) async {
try {
SpotifyApi spotifyApi = ref.read(spotifyProvider);

View File

@ -92,7 +92,7 @@ class Player extends HookConsumerWidget {
// I can't believe useEffect doesn't run Post Frame aka
// after rendering/painting the UI
// `My disappointment is immeasurable and my day is ruined` XD
WidgetsBinding.instance?.addPostFrameCallback((time) {
WidgetsBinding.instance.addPostFrameCallback((time) {
// clearing the overlay-entry as passing the already available
// entry will result in splashing while resizing the window
if (breakpoint.isLessThanOrEqualTo(Breakpoints.md) &&

View File

@ -29,7 +29,7 @@ class PlayerView extends HookConsumerWidget {
useEffect(() {
if (breakpoint.isMoreThan(Breakpoints.md)) {
WidgetsBinding.instance?.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
GoRouter.of(context).pop();
});
}

View File

@ -13,7 +13,7 @@ class RecordHotKeyDialog extends HookWidget {
@override
Widget build(BuildContext context) {
var _hotKey = useState(HotKey(null));
final _hotKey = useState<HotKey?>(null);
return AlertDialog(
content: SingleChildScrollView(
child: ListBody(
@ -72,10 +72,10 @@ class RecordHotKeyDialog extends HookWidget {
),
TextButton(
child: const Text('OK'),
onPressed: !_hotKey.value.isSetted
onPressed: _hotKey.value == null
? null
: () {
onHotKeyRecorded(_hotKey.value);
onHotKeyRecorded(_hotKey.value!);
GoRouter.of(context).pop();
},
),

View File

@ -30,7 +30,7 @@ Future<SpotubeTrack> toSpotubeTrack(
.replaceAll("\$FEATURED_ARTISTS", featuredArtists);
logger.v("[Youtube Search Term] $queryString");
SearchList videos = await youtube.search.getVideos(queryString);
VideoSearchList videos = await youtube.search.search(queryString);
List<Map> ratedRankedVideos = videos
.map((video) {

View File

@ -6,7 +6,7 @@ bool? useIsCurrentRoute([String matcher = "/"]) {
final isCurrentRoute = useState<bool?>(null);
final context = useContext();
useEffect(() {
WidgetsBinding.instance?.addPostFrameCallback((timer) {
WidgetsBinding.instance.addPostFrameCallback((timer) {
final isCurrent = GoRouter.of(context).location == matcher;
if (isCurrent != isCurrentRoute.value) {
isCurrentRoute.value = isCurrent;

View File

@ -9,7 +9,7 @@ PaletteColor usePaletteColor(BuildContext context, String imageUrl) {
final mounted = useIsMounted();
useEffect(() {
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) async {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
final palette = await PaletteGenerator.fromImageProvider(
CachedNetworkImageProvider(
imageUrl,

View File

@ -14,14 +14,14 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.1"
version: "3.3.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.1"
async:
dependency: transitive
description:
@ -105,7 +105,7 @@ packages:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
version: "3.2.1"
cached_network_image_platform_interface:
dependency: transitive
description:
@ -154,7 +154,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
csslib:
dependency: transitive
description:
@ -189,7 +189,7 @@ packages:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.2.1"
file:
dependency: transitive
description:
@ -208,7 +208,7 @@ packages:
name: flutter_blurhash
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
version: "0.7.0"
flutter_cache_manager:
dependency: transitive
description:
@ -222,7 +222,7 @@ packages:
name: flutter_hooks
url: "https://pub.dartlang.org"
source: hosted
version: "0.18.2+1"
version: "0.18.4"
flutter_launcher_icons:
dependency: "direct dev"
description:
@ -243,7 +243,7 @@ packages:
name: flutter_riverpod
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.4"
flutter_test:
dependency: "direct dev"
description: flutter
@ -267,21 +267,21 @@ packages:
name: go_router
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.4"
version: "3.1.0"
hooks_riverpod:
dependency: "direct main"
description:
name: hooks_riverpod
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.4"
hotkey_manager:
dependency: "direct main"
description:
name: hotkey_manager
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
version: "0.1.7"
html:
dependency: "direct main"
description:
@ -302,7 +302,7 @@ packages:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
image:
dependency: transitive
description:
@ -330,14 +330,14 @@ packages:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
version: "4.5.0"
just_audio:
dependency: "direct main"
description:
name: just_audio
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.20"
version: "0.9.21"
just_audio_background:
dependency: "direct main"
description:
@ -400,7 +400,7 @@ packages:
name: marquee
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
version: "2.2.2"
matcher:
dependency: transitive
description:
@ -442,7 +442,7 @@ packages:
name: octo_image
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
package_config:
dependency: transitive
description:
@ -512,49 +512,49 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
version: "2.0.10"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.14"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
version: "2.0.9"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
version: "2.1.6"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.0.6"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.4"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.0.6"
pedantic:
dependency: transitive
description:
@ -582,7 +582,7 @@ packages:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.3"
version: "9.0.4"
permission_handler_platform_interface:
dependency: transitive
description:
@ -603,7 +603,7 @@ packages:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
version: "5.0.0"
platform:
dependency: transitive
description:
@ -652,35 +652,35 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
version: "2.0.15"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.12"
shared_preferences_ios:
dependency: transitive
description:
name: shared_preferences_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.4"
shared_preferences_platform_interface:
dependency: transitive
description:
@ -694,14 +694,14 @@ packages:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.4"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
sky_engine:
dependency: transitive
description: flutter
@ -713,7 +713,7 @@ packages:
name: sliver_tools
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.6"
source_span:
dependency: transitive
description:
@ -736,14 +736,14 @@ packages:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.2+1"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.2.1+1"
stack_trace:
dependency: transitive
description:
@ -778,7 +778,7 @@ packages:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.0+2"
term_glyph:
dependency: transitive
description:
@ -799,42 +799,42 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.20"
version: "6.1.2"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
version: "6.0.17"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
version: "6.0.17"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
url_launcher_platform_interface:
dependency: transitive
description:
@ -848,14 +848,14 @@ packages:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.0.11"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
uuid:
dependency: transitive
description:
@ -890,21 +890,21 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.1"
version: "5.4.1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
version: "3.1.1"
youtube_explode_dart:
dependency: "direct main"
description:
name: youtube_explode_dart
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.9+1"
version: "1.11.0"
sdks:
dart: ">=2.17.0 <3.0.0"
flutter: ">=2.10.0"
flutter: ">=3.0.0"