fix: save patched and installed apps on prefs, improve installer log, improve dashboard with real data (wip)

This commit is contained in:
Alberto Ponces
2022-08-15 18:42:09 +01:00
parent 384d593024
commit ce09a5264a
19 changed files with 180 additions and 365 deletions

View File

@ -5,6 +5,7 @@ import 'package:revanced_manager/services/root_api.dart';
import 'package:revanced_manager/ui/views/app_selector/app_selector_view.dart';
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
import 'package:revanced_manager/ui/views/contributors/contributors_view.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/views/installer/installer_view.dart';
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
@ -31,6 +32,7 @@ import 'package:stacked_themes/stacked_themes.dart';
LazySingleton(classType: PatcherAPI),
LazySingleton(classType: ManagerAPI),
LazySingleton(classType: RootAPI),
LazySingleton(classType: HomeViewModel),
LazySingleton(classType: PatcherViewModel),
LazySingleton(classType: AppSelectorViewModel),
LazySingleton(classType: PatchesSelectorViewModel),

View File

@ -1,39 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
// StackedLocatorGenerator
// **************************************************************************
// ignore_for_file: public_member_api_docs, depend_on_referenced_packages
import 'package:stacked_core/stacked_core.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:stacked_themes/stacked_themes.dart';
import '../services/manager_api.dart';
import '../services/patcher_api.dart';
import '../services/root_api.dart';
import '../ui/views/app_selector/app_selector_viewmodel.dart';
import '../ui/views/installer/installer_viewmodel.dart';
import '../ui/views/patcher/patcher_viewmodel.dart';
import '../ui/views/patches_selector/patches_selector_viewmodel.dart';
final locator = StackedLocator.instance;
Future<void> setupLocator(
{String? environment, EnvironmentFilter? environmentFilter}) async {
// Register environments
locator.registerEnvironment(
environment: environment, environmentFilter: environmentFilter);
// Register dependencies
locator.registerLazySingleton(() => NavigationService());
locator.registerLazySingleton(() => PatcherAPI());
locator.registerLazySingleton(() => ManagerAPI());
locator.registerLazySingleton(() => RootAPI());
locator.registerLazySingleton(() => PatcherViewModel());
locator.registerLazySingleton(() => AppSelectorViewModel());
locator.registerLazySingleton(() => PatchesSelectorViewModel());
locator.registerLazySingleton(() => InstallerViewModel());
locator.registerLazySingleton(() => ThemeService.getInstance());
}

View File

@ -1,231 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
// StackedRouterGenerator
// **************************************************************************
// ignore_for_file: public_member_api_docs, unused_import, non_constant_identifier_names
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import '../main.dart';
import '../ui/views/app_selector/app_selector_view.dart';
import '../ui/views/contributors/contributors_view.dart';
import '../ui/views/installer/installer_view.dart';
import '../ui/views/patches_selector/patches_selector_view.dart';
import '../ui/views/root_checker/root_checker_view.dart';
import '../ui/views/settings/settings_view.dart';
class Routes {
static const String navigation = '/Navigation';
static const String appSelectorView = '/app-selector-view';
static const String patchesSelectorView = '/patches-selector-view';
static const String installerView = '/installer-view';
static const String settingsView = '/settings-view';
static const String contributorsView = '/contributors-view';
static const String rootCheckerView = '/root-checker-view';
static const all = <String>{
navigation,
appSelectorView,
patchesSelectorView,
installerView,
settingsView,
contributorsView,
rootCheckerView,
};
}
class StackedRouter extends RouterBase {
@override
List<RouteDef> get routes => _routes;
final _routes = <RouteDef>[
RouteDef(Routes.navigation, page: Navigation),
RouteDef(Routes.appSelectorView, page: AppSelectorView),
RouteDef(Routes.patchesSelectorView, page: PatchesSelectorView),
RouteDef(Routes.installerView, page: InstallerView),
RouteDef(Routes.settingsView, page: SettingsView),
RouteDef(Routes.contributorsView, page: ContributorsView),
RouteDef(Routes.rootCheckerView, page: RootCheckerView),
];
@override
Map<Type, StackedRouteFactory> get pagesMap => _pagesMap;
final _pagesMap = <Type, StackedRouteFactory>{
Navigation: (data) {
return MaterialPageRoute<dynamic>(
builder: (context) => const Navigation(),
settings: data,
);
},
AppSelectorView: (data) {
return MaterialPageRoute<dynamic>(
builder: (context) => const AppSelectorView(),
settings: data,
);
},
PatchesSelectorView: (data) {
return MaterialPageRoute<dynamic>(
builder: (context) => const PatchesSelectorView(),
settings: data,
);
},
InstallerView: (data) {
var args = data.getArgs<InstallerViewArguments>(
orElse: () => InstallerViewArguments(),
);
return MaterialPageRoute<dynamic>(
builder: (context) => InstallerView(key: args.key),
settings: data,
);
},
SettingsView: (data) {
return MaterialPageRoute<dynamic>(
builder: (context) => const SettingsView(),
settings: data,
);
},
ContributorsView: (data) {
return MaterialPageRoute<dynamic>(
builder: (context) => const ContributorsView(),
settings: data,
);
},
RootCheckerView: (data) {
return MaterialPageRoute<dynamic>(
builder: (context) => const RootCheckerView(),
settings: data,
);
},
};
}
/// ************************************************************************
/// Arguments holder classes
/// *************************************************************************
/// InstallerView arguments holder class
class InstallerViewArguments {
final Key? key;
InstallerViewArguments({this.key});
}
/// ************************************************************************
/// Extension for strongly typed navigation
/// *************************************************************************
extension NavigatorStateExtension on NavigationService {
Future<dynamic> navigateToNavigation({
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo(
Routes.navigation,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition,
);
}
Future<dynamic> navigateToAppSelectorView({
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo(
Routes.appSelectorView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition,
);
}
Future<dynamic> navigateToPatchesSelectorView({
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo(
Routes.patchesSelectorView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition,
);
}
Future<dynamic> navigateToInstallerView({
Key? key,
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo(
Routes.installerView,
arguments: InstallerViewArguments(key: key),
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition,
);
}
Future<dynamic> navigateToSettingsView({
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo(
Routes.settingsView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition,
);
}
Future<dynamic> navigateToContributorsView({
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo(
Routes.contributorsView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition,
);
}
Future<dynamic> navigateToRootCheckerView({
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo(
Routes.rootCheckerView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition,
);
}
}