mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
f82c439b26
Co-authored-by: validcube <pun.butrach@gmail.com>
52 lines
1.8 KiB
Dart
52 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
|
import 'package:revanced_manager/gen/strings.g.dart';
|
|
import 'package:revanced_manager/services/download_manager.dart';
|
|
import 'package:revanced_manager/services/github_api.dart';
|
|
import 'package:revanced_manager/services/manager_api.dart';
|
|
import 'package:revanced_manager/services/revanced_api.dart';
|
|
import 'package:revanced_manager/services/root_api.dart';
|
|
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
|
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:timezone/data/latest.dart' as tz;
|
|
|
|
late SharedPreferences prefs;
|
|
Future main() async {
|
|
await setupLocator();
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await locator<ManagerAPI>().initialize();
|
|
|
|
await locator<DownloadManager>().initialize();
|
|
final String apiUrl = locator<ManagerAPI>().getApiUrl();
|
|
await locator<RevancedAPI>().initialize(apiUrl);
|
|
final String repoUrl = locator<ManagerAPI>().getRepoUrl();
|
|
locator<GithubAPI>().initialize(repoUrl);
|
|
tz.initializeTimeZones();
|
|
|
|
// TODO(aAbed): remove in the future, keep it for now during migration.
|
|
final rootAPI = RootAPI();
|
|
if (await rootAPI.hasRootPermissions()) {
|
|
await rootAPI.removeOrphanedFiles();
|
|
}
|
|
|
|
prefs = await SharedPreferences.getInstance();
|
|
|
|
final managerAPI = locator<ManagerAPI>();
|
|
final locale = managerAPI.getLocale();
|
|
LocaleSettings.setLocaleRaw(locale);
|
|
|
|
runApp(TranslationProvider(child: const MyApp()));
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const DynamicThemeBuilder(
|
|
title: 'ReVanced Manager',
|
|
home: NavigationView(),
|
|
);
|
|
}
|
|
}
|