mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
fix: add some minor improvements and fix release builds
This commit is contained in:
parent
70a50c7177
commit
2cd9f99aa3
13 changed files with 169 additions and 146 deletions
|
@ -52,6 +52,8 @@ android {
|
|||
|
||||
buildTypes {
|
||||
release {
|
||||
shrinkResources false
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class MainActivity : FlutterActivity() {
|
|||
path,
|
||||
DexClassLoader(
|
||||
path,
|
||||
context.cacheDir.path,
|
||||
applicationContext.cacheDir.path,
|
||||
null,
|
||||
javaClass.classLoader
|
||||
)
|
||||
|
@ -180,7 +180,7 @@ class MainActivity : FlutterActivity() {
|
|||
|
||||
fun createPatcher(inputFilePath: String, cacheDirPath: String): Boolean {
|
||||
val inputFile = File(inputFilePath)
|
||||
val aaptPath = Aapt.binary(context).absolutePath
|
||||
val aaptPath = Aapt.binary(applicationContext).absolutePath
|
||||
patcher = Patcher(PatcherOptions(inputFile, cacheDirPath, true, aaptPath, cacheDirPath))
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
// StackedLocatorGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: public_member_api_docs, depend_on_referenced_packages, implementation_imports
|
||||
// ignore_for_file: public_member_api_docs, depend_on_referenced_packages
|
||||
|
||||
import 'package:stacked_core/stacked_core.dart';
|
||||
import 'package:stacked_services/src/navigation/navigation_service.dart';
|
||||
import 'package:stacked_themes/src/theme_service.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:stacked_themes/stacked_themes.dart';
|
||||
|
||||
import '../services/patcher_api.dart';
|
||||
import '../ui/views/app_selector/app_selector_viewmodel.dart';
|
||||
|
|
|
@ -4,165 +4,176 @@
|
|||
// StackedRouterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes, implementation_imports
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/foundation/key.dart' as _i7;
|
||||
import 'package:stacked/stacked.dart' as _i1;
|
||||
import 'package:stacked_services/stacked_services.dart' as _i8;
|
||||
// ignore_for_file: public_member_api_docs, unused_import, non_constant_identifier_names
|
||||
|
||||
import '../ui/views/app_selector/app_selector_view.dart' as _i2;
|
||||
import '../ui/views/contributors/contributors_view.dart' as _i6;
|
||||
import '../ui/views/installer/installer_view.dart' as _i4;
|
||||
import '../ui/views/patches_selector/patches_selector_view.dart' as _i3;
|
||||
import '../ui/views/settings/settings_view.dart' as _i5;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.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/settings/settings_view.dart';
|
||||
|
||||
class Routes {
|
||||
static const appSelectorView = '/app-selector-view';
|
||||
|
||||
static const patchesSelectorView = '/patches-selector-view';
|
||||
|
||||
static const installerView = '/installer-view';
|
||||
|
||||
static const settingsView = '/settings-view';
|
||||
|
||||
static const contributorsView = '/contributors-view';
|
||||
|
||||
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 all = <String>{
|
||||
appSelectorView,
|
||||
patchesSelectorView,
|
||||
installerView,
|
||||
settingsView,
|
||||
contributorsView
|
||||
contributorsView,
|
||||
};
|
||||
}
|
||||
|
||||
class StackedRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(Routes.appSelectorView, page: _i2.AppSelectorView),
|
||||
_i1.RouteDef(Routes.patchesSelectorView, page: _i3.PatchesSelectorView),
|
||||
_i1.RouteDef(Routes.installerView, page: _i4.InstallerView),
|
||||
_i1.RouteDef(Routes.settingsView, page: _i5.SettingsView),
|
||||
_i1.RouteDef(Routes.contributorsView, page: _i6.ContributorsView)
|
||||
class StackedRouter extends RouterBase {
|
||||
@override
|
||||
List<RouteDef> get routes => _routes;
|
||||
final _routes = <RouteDef>[
|
||||
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),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i2.AppSelectorView: (data) {
|
||||
@override
|
||||
Map<Type, StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
final _pagesMap = <Type, StackedRouteFactory>{
|
||||
AppSelectorView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i2.AppSelectorView(),
|
||||
builder: (context) => const AppSelectorView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i3.PatchesSelectorView: (data) {
|
||||
PatchesSelectorView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i3.PatchesSelectorView(),
|
||||
builder: (context) => const PatchesSelectorView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i4.InstallerView: (data) {
|
||||
final args = data.getArgs<InstallerViewArguments>(
|
||||
orElse: () => const InstallerViewArguments(),
|
||||
InstallerView: (data) {
|
||||
var args = data.getArgs<InstallerViewArguments>(
|
||||
orElse: () => InstallerViewArguments(),
|
||||
);
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => _i4.InstallerView(key: args.key),
|
||||
builder: (context) => InstallerView(key: args.key),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i5.SettingsView: (data) {
|
||||
SettingsView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i5.SettingsView(),
|
||||
builder: (context) => const SettingsView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i6.ContributorsView: (data) {
|
||||
ContributorsView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i6.ContributorsView(),
|
||||
builder: (context) => const ContributorsView(),
|
||||
settings: data,
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
/// ************************************************************************
|
||||
/// Arguments holder classes
|
||||
/// *************************************************************************
|
||||
|
||||
/// InstallerView arguments holder class
|
||||
class InstallerViewArguments {
|
||||
const InstallerViewArguments({this.key});
|
||||
|
||||
final _i7.Key? key;
|
||||
final Key? key;
|
||||
InstallerViewArguments({this.key});
|
||||
}
|
||||
|
||||
extension NavigatorStateExtension on _i8.NavigationService {
|
||||
Future<dynamic> navigateToAppSelectorView(
|
||||
[int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(
|
||||
BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition]) async {
|
||||
navigateTo(Routes.appSelectorView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
/// ************************************************************************
|
||||
/// Extension for strongly typed navigation
|
||||
/// *************************************************************************
|
||||
|
||||
extension NavigatorStateExtension on NavigationService {
|
||||
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 {
|
||||
navigateTo(Routes.patchesSelectorView,
|
||||
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(
|
||||
{_i7.Key? key,
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(
|
||||
BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition}) async {
|
||||
navigateTo(Routes.installerView,
|
||||
arguments: InstallerViewArguments(key: key),
|
||||
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 {
|
||||
navigateTo(Routes.settingsView,
|
||||
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 {
|
||||
navigateTo(Routes.contributorsView,
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,16 +44,16 @@ class PatcherAPI {
|
|||
String? dexFileUrl =
|
||||
await githubAPI.latestRelease('revanced', 'revanced-patches');
|
||||
if (dexFileUrl != null && dexFileUrl.isNotEmpty) {
|
||||
_patchBundleFile =
|
||||
await DefaultCacheManager().getSingleFile(dexFileUrl);
|
||||
try {
|
||||
_patchBundleFile =
|
||||
await DefaultCacheManager().getSingleFile(dexFileUrl);
|
||||
return await platform.invokeMethod<bool>(
|
||||
'loadPatches',
|
||||
{
|
||||
'pathBundlesPaths': <String>[_patchBundleFile!.absolute.path],
|
||||
},
|
||||
);
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
_patchBundleFile = null;
|
||||
return false;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class PatcherAPI {
|
|||
}
|
||||
}
|
||||
}
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
_filteredPackages.clear();
|
||||
return List.empty();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class PatcherAPI {
|
|||
}
|
||||
}
|
||||
}
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
_filteredPatches[selectedApp.packageName]!.clear();
|
||||
return List.empty();
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ class PatcherAPI {
|
|||
'inputFilePath': _inputFile!.path,
|
||||
},
|
||||
);
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class PatcherAPI {
|
|||
'cacheDirPath': _cacheDir!.path,
|
||||
},
|
||||
);
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ class PatcherAPI {
|
|||
'integrationsPath': _integrations!.path,
|
||||
},
|
||||
);
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class PatcherAPI {
|
|||
'selectedPatches': selectedPatches.map((e) => e.name).toList(),
|
||||
},
|
||||
);
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ class PatcherAPI {
|
|||
'patchedFilePath': _patchedFile!.path,
|
||||
},
|
||||
);
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ class PatcherAPI {
|
|||
'outFilePath': _outFile!.path,
|
||||
},
|
||||
);
|
||||
} on PlatformException {
|
||||
} on Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -277,9 +277,11 @@ class PatcherAPI {
|
|||
}
|
||||
}
|
||||
|
||||
bool sharePatchedFile(String packageName) {
|
||||
bool sharePatchedFile(String appName, String version) {
|
||||
if (_outFile != null) {
|
||||
String sharePath = '${_outFile!.parent.path}/$packageName.revanced.apk';
|
||||
String path = _outFile!.parent.path;
|
||||
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
||||
String sharePath = '$path/$prefix-revanced_v$version.apk';
|
||||
File share = _outFile!.copySync(sharePath);
|
||||
ShareExtend.share(share.path, "file");
|
||||
return true;
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'package:revanced_manager/app/app.locator.dart';
|
|||
import 'package:revanced_manager/models/application_info.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class AppSelectorViewModel extends BaseViewModel {
|
||||
|
@ -34,6 +35,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||
apkFilePath: application.apkFilePath,
|
||||
);
|
||||
locator<AppSelectorViewModel>().selectedApp = app;
|
||||
locator<PatchesSelectorViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().dimPatchCard = false;
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
|
@ -55,6 +57,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||
apkFilePath: result.files.single.path!,
|
||||
);
|
||||
locator<AppSelectorViewModel>().selectedApp = app;
|
||||
locator<PatchesSelectorViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().dimPatchCard = false;
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
|
|
|
@ -23,15 +23,6 @@ class HomeView extends StatelessWidget {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: IconButton(
|
||||
onPressed: () => {},
|
||||
icon: const Icon(
|
||||
Icons.more_vert,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
I18nText(
|
||||
'homeView.widgetTitle',
|
||||
|
|
|
@ -75,7 +75,10 @@ class InstallerView extends StatelessWidget {
|
|||
child: SelectableText(
|
||||
model.logs,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'monospace', fontSize: 15),
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
|
@ -133,6 +136,7 @@ class InstallerView extends StatelessWidget {
|
|||
),
|
||||
onWillPop: () async {
|
||||
if (!model.isPatching) {
|
||||
model.cleanWorkplace();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:revanced_manager/models/application_info.dart';
|
|||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
|
@ -43,7 +44,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||
List<Patch> selectedPatches =
|
||||
locator<PatchesSelectorViewModel>().selectedPatches;
|
||||
if (selectedPatches.isNotEmpty) {
|
||||
addLog('Initializing patcher...');
|
||||
addLog('Initializing installer...');
|
||||
bool? isSuccess = await locator<PatcherAPI>().initPatcher();
|
||||
if (isSuccess != null && isSuccess) {
|
||||
addLog('Done');
|
||||
|
@ -108,7 +109,17 @@ class InstallerViewModel extends BaseViewModel {
|
|||
void shareResult() {
|
||||
ApplicationInfo? selectedApp = locator<AppSelectorViewModel>().selectedApp;
|
||||
if (selectedApp != null) {
|
||||
locator<PatcherAPI>().sharePatchedFile(selectedApp.packageName);
|
||||
locator<PatcherAPI>().sharePatchedFile(
|
||||
selectedApp.name,
|
||||
selectedApp.version,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void cleanWorkplace() {
|
||||
locator<PatcherAPI>().cleanPatcher();
|
||||
locator<AppSelectorViewModel>().selectedApp = null;
|
||||
locator<PatchesSelectorViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class AppSelectorCard extends StatelessWidget {
|
|||
const SizedBox(height: 10),
|
||||
locator<AppSelectorViewModel>().selectedApp != null
|
||||
? Text(
|
||||
locator<AppSelectorViewModel>().selectedApp!.packageName,
|
||||
locator<AppSelectorViewModel>().selectedApp!.name,
|
||||
style: robotoTextStyle,
|
||||
)
|
||||
: I18nText(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:github/github.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/constants.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ContributorsCard extends StatefulWidget {
|
||||
|
|
Loading…
Reference in a new issue