mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
refactor: migrate to catcher to catcher_2
This commit is contained in:
parent
b2b5445799
commit
931664e6b6
@ -1,4 +1,4 @@
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@ -27,7 +27,7 @@ import 'package:spotube/pages/mobile_login/mobile_login.dart';
|
||||
|
||||
import '../pages/library/playlist_generate/playlist_generate_result.dart';
|
||||
|
||||
final rootNavigatorKey = Catcher.navigatorKey;
|
||||
final rootNavigatorKey = Catcher2.navigatorKey;
|
||||
final shellRouteNavigatorKey = GlobalKey<NavigatorState>();
|
||||
final router = GoRouter(
|
||||
navigatorKey: rootNavigatorKey,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -99,7 +99,7 @@ final localTracksProvider = FutureProvider<List<LocalTrack>>((ref) async {
|
||||
if (e is FfiException) {
|
||||
return {"file": f};
|
||||
}
|
||||
Catcher.reportCheckedError(e, stack);
|
||||
Catcher2.reportCheckedError(e, stack);
|
||||
return {};
|
||||
}
|
||||
},
|
||||
@ -123,7 +123,7 @@ final localTracksProvider = FutureProvider<List<LocalTrack>>((ref) async {
|
||||
|
||||
return tracks;
|
||||
} catch (e, stack) {
|
||||
Catcher.reportCheckedError(e, stack);
|
||||
Catcher2.reportCheckedError(e, stack);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:device_preview/device_preview.dart';
|
||||
import 'package:fl_query/fl_query.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
@ -90,9 +90,9 @@ Future<void> main(List<String> rawArgs) async {
|
||||
path: hiveCacheDir,
|
||||
);
|
||||
|
||||
Catcher(
|
||||
Catcher2(
|
||||
enableLogger: arguments["verbose"],
|
||||
debugConfig: CatcherOptions(
|
||||
debugConfig: Catcher2Options(
|
||||
SilentReportMode(),
|
||||
[
|
||||
ConsoleHandler(
|
||||
@ -102,7 +102,7 @@ Future<void> main(List<String> rawArgs) async {
|
||||
if (!kIsWeb) FileHandler(await getLogsPath(), printLogs: false),
|
||||
],
|
||||
),
|
||||
releaseConfig: CatcherOptions(
|
||||
releaseConfig: Catcher2Options(
|
||||
SilentReportMode(),
|
||||
[
|
||||
if (arguments["verbose"] ?? false) ConsoleHandler(),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
@ -129,7 +129,7 @@ class DownloadManagerProvider extends ChangeNotifier {
|
||||
|
||||
return Uint8List.fromList(bytes);
|
||||
} catch (e, stackTrace) {
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -209,7 +209,7 @@ class DownloadManagerProvider extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
Catcher.reportCheckedError(e, StackTrace.current);
|
||||
Catcher2.reportCheckedError(e, StackTrace.current);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
@ -98,7 +98,7 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
|
||||
|
||||
updatePalette();
|
||||
} catch (e, stackTrace) {
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
}
|
||||
});
|
||||
|
||||
@ -117,7 +117,7 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
|
||||
active: newActiveIndex,
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
}
|
||||
});
|
||||
|
||||
@ -153,7 +153,7 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
|
||||
mapSourcesToTracks([audioPlayer.nextSource!]).firstOrNull;
|
||||
await removeTrack(oldTrack!.id!);
|
||||
}
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
} finally {
|
||||
isPreSearching.value = false;
|
||||
}
|
||||
@ -210,7 +210,7 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
|
||||
}
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
}
|
||||
});
|
||||
}();
|
||||
@ -602,7 +602,7 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
|
||||
return List.castFrom<dynamic, SkipSegment>(segments);
|
||||
} catch (e, stack) {
|
||||
await SkipSegment.box.put(id, []);
|
||||
Catcher.reportCheckedError(e, stack);
|
||||
Catcher2.reportCheckedError(e, stack);
|
||||
return List.castFrom<dynamic, SkipSegment>([]);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:scrobblenaut/scrobblenaut.dart';
|
||||
import 'package:spotify/spotify.dart';
|
||||
@ -52,7 +52,7 @@ class ScrobblerNotifier extends PersistedStateNotifier<ScrobblerState?> {
|
||||
trackNumber: track.trackNumber,
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:spotube/services/audio_player/mk_state_player.dart';
|
||||
// import 'package:just_audio/just_audio.dart' as ja;
|
||||
import 'dart:async';
|
||||
@ -25,7 +25,7 @@ abstract class AudioPlayerInterface {
|
||||
// _justAudio = !_mkSupportedPlatform ? ja.AudioPlayer() : null
|
||||
{
|
||||
_mkPlayer.stream.error.listen((event) {
|
||||
Catcher.reportCheckedError(event, StackTrace.current);
|
||||
Catcher2.reportCheckedError(event, StackTrace.current);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
// ignore: implementation_imports
|
||||
@ -53,7 +53,7 @@ class MkPlayerWithState extends Player {
|
||||
await Future.delayed(const Duration(milliseconds: 250), play);
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
}
|
||||
}),
|
||||
stream.playlist.listen((event) {
|
||||
@ -62,7 +62,7 @@ class MkPlayerWithState extends Player {
|
||||
}
|
||||
}),
|
||||
stream.error.listen((event) {
|
||||
Catcher.reportCheckedError('[MediaKitError] \n$event', null);
|
||||
Catcher2.reportCheckedError('[MediaKitError] \n$event', null);
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:io';
|
||||
import 'package:catcher/core/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
@ -130,7 +130,7 @@ class DownloadManager {
|
||||
}
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
Catcher.reportCheckedError(e, stackTrace);
|
||||
Catcher2.reportCheckedError(e, stackTrace);
|
||||
|
||||
var task = getDownload(url)!;
|
||||
if (task.status.value != DownloadStatus.canceled &&
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:fl_query/fl_query.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:spotify/spotify.dart';
|
||||
@ -71,7 +71,7 @@ class AlbumQueries {
|
||||
|
||||
return albums;
|
||||
} catch (e, stack) {
|
||||
Catcher.reportCheckedError(e, stack);
|
||||
Catcher2.reportCheckedError(e, stack);
|
||||
rethrow;
|
||||
}
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import 'package:fl_query/fl_query.dart';
|
||||
import 'package:fl_query_hooks/fl_query_hooks.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@ -221,7 +221,7 @@ class PlaylistQueries {
|
||||
await spotify.playlists.featured.getPage(5, pageParam);
|
||||
return playlists;
|
||||
} catch (e, stack) {
|
||||
Catcher.reportCheckedError(e, stack);
|
||||
Catcher2.reportCheckedError(e, stack);
|
||||
rethrow;
|
||||
}
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:catcher/catcher.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
|
||||
/// Parses duration string formatted by Duration.toString() to [Duration].
|
||||
/// The string should be of form hours:minutes:seconds.microseconds
|
||||
@ -53,7 +53,7 @@ Duration? tryParseDuration(String input) {
|
||||
try {
|
||||
return parseDuration(input);
|
||||
} catch (e, stack) {
|
||||
Catcher.reportCheckedError(e, stack);
|
||||
Catcher2.reportCheckedError(e, stack);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <catcher/catcher_plugin.h>
|
||||
#include <file_selector_linux/file_selector_plugin.h>
|
||||
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
||||
#include <local_notifier/local_notifier_plugin.h>
|
||||
@ -19,9 +18,6 @@
|
||||
#include <window_size/window_size_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) catcher_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "CatcherPlugin");
|
||||
catcher_plugin_register_with_registrar(catcher_registrar);
|
||||
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
||||
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
||||
|
@ -3,7 +3,6 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
catcher
|
||||
file_selector_linux
|
||||
flutter_secure_storage_linux
|
||||
local_notifier
|
||||
|
@ -7,7 +7,6 @@ import Foundation
|
||||
|
||||
import audio_service
|
||||
import audio_session
|
||||
import catcher
|
||||
import device_info_plus
|
||||
import file_selector_macos
|
||||
import flutter_secure_storage_macos
|
||||
@ -27,7 +26,6 @@ import window_size
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AudioServicePlugin.register(with: registry.registrar(forPlugin: "AudioServicePlugin"))
|
||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||
CatcherPlugin.register(with: registry.registrar(forPlugin: "CatcherPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||
|
13
pubspec.lock
13
pubspec.lock
@ -257,15 +257,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
catcher:
|
||||
catcher_2:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: "354108cbfe75299e8dd25be521946b32c41f621d"
|
||||
url: "https://github.com/ThexXTURBOXx/catcher"
|
||||
source: git
|
||||
version: "0.8.0"
|
||||
name: catcher_2
|
||||
sha256: "8a33bfa845de8aa4306e607d8c76a52b0f111576089f9f329270d56023900ad2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0-alpha.1"
|
||||
change_case:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -20,9 +20,7 @@ dependencies:
|
||||
auto_size_text: ^3.0.0
|
||||
buttons_tabbar: ^1.3.6
|
||||
cached_network_image: ^3.2.2
|
||||
catcher:
|
||||
git:
|
||||
url: https://github.com/ThexXTURBOXx/catcher
|
||||
catcher_2: 1.0.0-alpha.1
|
||||
collection: ^1.15.0
|
||||
cupertino_icons: ^1.0.5
|
||||
curved_navigation_bar: ^1.0.3
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <catcher/catcher_plugin.h>
|
||||
#include <file_selector_windows/file_selector_windows.h>
|
||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||
#include <local_notifier/local_notifier_plugin.h>
|
||||
@ -20,8 +19,6 @@
|
||||
#include <window_size/window_size_plugin.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
CatcherPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("CatcherPlugin"));
|
||||
FileSelectorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||
|
@ -3,7 +3,6 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
catcher
|
||||
file_selector_windows
|
||||
flutter_secure_storage_windows
|
||||
local_notifier
|
||||
|
Loading…
Reference in New Issue
Block a user