mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-11 13:46:17 +00:00
refactor: update deprecated and minor code refactors (#710)
Improve code readability & additional refactoring Commits: chore: exclude generated from analyzer refactor: add SharedPreferences to locator refactor: access shared pref from locator, and code refactor refactor: remove unwanted `await` refactor: remove `const` from `CacheConfig`
This commit is contained in:
committed by
EvadeMaster
parent
3ae4d69110
commit
6829d3cdea
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/services/crowdin_api.dart';
|
||||
import 'package:revanced_manager/services/github_api.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
@@ -13,27 +12,25 @@ import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
||||
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
|
||||
import 'package:revanced_manager/utils/environment.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:stacked_themes/stacked_themes.dart';
|
||||
import 'package:timezone/data/latest.dart' as tz;
|
||||
|
||||
late SharedPreferences prefs;
|
||||
Future main() async {
|
||||
await ThemeManager.initialise();
|
||||
await setupLocator();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await locator<ManagerAPI>().initialize();
|
||||
final String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||
await locator<RevancedAPI>().initialize(apiUrl);
|
||||
await locator<CrowdinAPI>().initialize();
|
||||
final bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
||||
final String repoUrl = locator<ManagerAPI>().getRepoUrl();
|
||||
locator<GithubAPI>().initialize(repoUrl);
|
||||
await locator<PatcherAPI>().initialize();
|
||||
tz.initializeTimeZones();
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
await setupLocator();
|
||||
final manager = locator<ManagerAPI>();
|
||||
await manager.initialize();
|
||||
final String apiUrl = manager.getApiUrl();
|
||||
final bool isSentryEnabled = manager.isSentryEnabled();
|
||||
final String repoUrl = manager.getRepoUrl();
|
||||
|
||||
await SentryFlutter.init(
|
||||
await Future.wait([
|
||||
locator<RevancedAPI>().initialize(apiUrl),
|
||||
locator<PatcherAPI>().initialize(),
|
||||
]);
|
||||
locator<GithubAPI>().initialize(repoUrl);
|
||||
tz.initializeTimeZones();
|
||||
|
||||
return SentryFlutter.init(
|
||||
(options) {
|
||||
options
|
||||
..dsn = isSentryEnabled ? Environment.sentryDSN : ''
|
||||
@@ -51,11 +48,8 @@ Future main() async {
|
||||
}
|
||||
} as BeforeSendCallback?;
|
||||
},
|
||||
appRunner: () {
|
||||
runApp(const MyApp());
|
||||
},
|
||||
appRunner: () => runApp(const MyApp()),
|
||||
);
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
|
||||
Reference in New Issue
Block a user