chore: merge dev to main (#1545)

This commit is contained in:
Benjamin 2023-12-11 18:23:08 -08:00 committed by GitHub
commit ca9ef544ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 123 additions and 87 deletions

View File

@ -59,7 +59,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: Setup JDK - name: Setup JDK
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: '17' java-version: '17'
distribution: 'zulu' distribution: 'zulu'

View File

@ -13,7 +13,7 @@ jobs:
- name: Set env - name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK - name: Set up JDK
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: "17" java-version: "17"
distribution: "zulu" distribution: "zulu"

View File

@ -12,7 +12,10 @@
</picture> </picture>
<br> <br>
<a href="https://revanced.app/"> <a href="https://revanced.app/">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="assets/revanced-logo/revanced-logo-round.svg" />
<img height="24px" src="assets/revanced-logo/revanced-logo-round.svg" /> <img height="24px" src="assets/revanced-logo/revanced-logo-round.svg" />
</picture>
</a>&nbsp;&nbsp;&nbsp; </a>&nbsp;&nbsp;&nbsp;
<a href="https://github.com/ReVanced"> <a href="https://github.com/ReVanced">
<picture> <picture>
@ -21,13 +24,22 @@
</picture> </picture>
</a>&nbsp;&nbsp;&nbsp; </a>&nbsp;&nbsp;&nbsp;
<a href="http://revanced.app/discord"> <a href="http://revanced.app/discord">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" /> <img height="24px" src="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp; </a>&nbsp;&nbsp;&nbsp;
<a href="https://reddit.com/r/revancedapp"> <a href="https://reddit.com/r/revancedapp">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" /> <img height="24px" src="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp; </a>&nbsp;&nbsp;&nbsp;
<a href="https://t.me/app_revanced"> <a href="https://t.me/app_revanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" /> <img height="24px" src="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp; </a>&nbsp;&nbsp;&nbsp;
<a href="https://x.com/revancedapp"> <a href="https://x.com/revancedapp">
<picture> <picture>
@ -36,7 +48,10 @@
</picture> </picture>
</a>&nbsp;&nbsp;&nbsp; </a>&nbsp;&nbsp;&nbsp;
<a href="https://www.youtube.com/@ReVanced"> <a href="https://www.youtube.com/@ReVanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" /> <img height="24px" src="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
</picture>
</a> </a>
<br> <br>
<br> <br>
@ -69,7 +84,7 @@ If you encounter a bug while using the ReVanced Manager app, open an issue using
## 📝 How to contribute ## 📝 How to contribute
> [!NOTE] > [!TIP]
> We recommend that you discuss your changes with > We recommend that you discuss your changes with
> the maintainers of ReVanced Manager before contributing. > the maintainers of ReVanced Manager before contributing.
> This will help you determine whether your change is acceptable. > This will help you determine whether your change is acceptable.

View File

@ -2,29 +2,31 @@
This page will guide you through building ReVanced Manager from source. This page will guide you through building ReVanced Manager from source.
1. Setup the Flutter environment for your [platform](https://docs.flutter.dev/get-started/install) 1\. Setup the Flutter environment for your [platform](https://docs.flutter.dev/get-started/install)
2. Clone the repository 2\. Clone the repository
```sh ```sh
git clone https://github.com/revanced/revanced-manager.git && cd revanced-manager git clone https://github.com/revanced/revanced-manager.git && cd revanced-manager
``` ```
3. Get dependencies 3\. Get dependencies
```sh ```sh
flutter pub get flutter pub get
``` ```
4. Delete conflicting outputs 4\. Delete conflicting outputs
> [!TIP]
> Must be run every time you sync your local repository with the remote repository.
```sh ```sh
dart run build_runner build --delete-conflicting-outputs dart run build_runner build --delete-conflicting-outputs
``` ```
> [!Note]
> Must be run every time you sync your local repository with the remote repository.
5. Build the APK
5\. Build the APK
```sh ```sh
flutter build apk flutter build apk

View File

@ -582,8 +582,8 @@ class ManagerAPI {
return showDialog( return showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: (context) => PopScope( builder: (context) => WillPopScope(
canPop: false, onWillPop: () async => false,
child: AlertDialog( child: AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer, backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'), title: I18nText('warning'),

View File

@ -269,8 +269,9 @@ void sharePatchedFile(String appName, String version) {
} }
String _getFileName(String appName, String version) { String _getFileName(String appName, String version) {
final String patchVersion = _managerAPI.patchesVersion!;
final String prefix = appName.toLowerCase().replaceAll(' ', '-'); final String prefix = appName.toLowerCase().replaceAll(' ', '-');
final String newName = '$prefix-revanced_v$version.apk'; final String newName = '$prefix-revanced_v$version-patches_$patchVersion.apk';
return newName; return newName;
} }

View File

@ -15,8 +15,7 @@ class InstallerView extends StatelessWidget {
return ViewModelBuilder<InstallerViewModel>.reactive( return ViewModelBuilder<InstallerViewModel>.reactive(
onViewModelReady: (model) => model.initialize(context), onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => InstallerViewModel(), viewModelBuilder: () => InstallerViewModel(),
builder: (context, model, child) => PopScope( builder: (context, model, child) => WillPopScope(
onPopInvoked: (bool didPop) => model.onPopInvoked(context, didPop),
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: model.isPatching, bottom: model.isPatching,
@ -84,7 +83,7 @@ class InstallerView extends StatelessWidget {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
onBackButtonPressed: () => model.onBackButtonInvoked(context), onBackButtonPressed: () => model.onWillPop(context),
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: const Size(double.infinity, 1.0), preferredSize: const Size(double.infinity, 1.0),
child: GradientProgressIndicator(progress: model.progress), child: GradientProgressIndicator(progress: model.progress),
@ -112,6 +111,7 @@ class InstallerView extends StatelessWidget {
), ),
), ),
), ),
onWillPop: () => model.onWillPop(context),
), ),
); );
} }

View File

@ -183,13 +183,15 @@ class InstallerViewModel extends BaseViewModel {
final lineCount = logLines.where((line) => line.endsWith(keyword)).length; final lineCount = logLines.where((line) => line.endsWith(keyword)).length;
final index = logLines.indexWhere((line) => line.endsWith(keyword)); final index = logLines.indexWhere((line) => line.endsWith(keyword));
if (newString != null && lineCount > 0) { if (newString != null && lineCount > 0) {
logLines.insert(index, newString.replaceAll('{lineCount}', lineCount.toString())); logLines.insert(
index, newString.replaceAll('{lineCount}', lineCount.toString()));
} }
logLines.removeWhere((lines) => lines.endsWith(keyword)); logLines.removeWhere((lines) => lines.endsWith(keyword));
} }
dynamic _getPatchOptionValue(String patchName, Option option) { dynamic _getPatchOptionValue(String patchName, Option option) {
final Option? savedOption = _managerAPI.getPatchOption(_app.packageName, patchName, option.key); final Option? savedOption =
_managerAPI.getPatchOption(_app.packageName, patchName, option.key);
if (savedOption != null) { if (savedOption != null) {
return savedOption.value; return savedOption.value;
} else { } else {
@ -201,7 +203,24 @@ class InstallerViewModel extends BaseViewModel {
if (patches.isEmpty) { if (patches.isEmpty) {
return 'None'; return 'None';
} }
return patches.map((p) => p.name + (p.options.isEmpty ? '' : ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]')).toList().join(', '); return patches
.map((p) =>
p.name +
(p.options.isEmpty
? ''
: ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]'))
.toList()
.join(', ');
}
String _getSuggestedVersion(String packageName) {
String suggestedVersion = _patcherAPI.getSuggestedVersion(_app.packageName);
if (suggestedVersion.isEmpty) {
suggestedVersion = 'Any';
} else {
suggestedVersion = 'v$suggestedVersion';
}
return suggestedVersion;
} }
Future<void> copyLogs() async { Future<void> copyLogs() async {
@ -213,12 +232,21 @@ class InstallerViewModel extends BaseViewModel {
_trimLogs(logsTrimmed, '.dex', 'Compiled {lineCount} dex files'); _trimLogs(logsTrimmed, '.dex', 'Compiled {lineCount} dex files');
// Get patches added / removed // Get patches added / removed
final defaultPatches = _patcherAPI.getFilteredPatches(_app.packageName).where((p) => !p.excluded).toList(); final defaultPatches = _patcherAPI
final patchesAdded = _patches.where((p) => !defaultPatches.contains(p)).toList(); .getFilteredPatches(_app.packageName)
final patchesRemoved = defaultPatches.where((p) => !_patches.contains(p)).toList(); .where((p) => !p.excluded)
.toList();
final patchesAdded =
_patches.where((p) => !defaultPatches.contains(p)).toList();
final patchesRemoved =
defaultPatches.where((p) => !_patches.contains(p)).toList();
// Options changed // Options changed
final patchesChanged = defaultPatches.where((p) => _patches.contains(p) && p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value)).toList(); final patchesChanged = defaultPatches
.where((p) =>
_patches.contains(p) &&
p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value))
.toList();
// Add Info // Add Info
final formattedLogs = [ final formattedLogs = [
@ -228,21 +256,21 @@ class InstallerViewModel extends BaseViewModel {
'Model: ${info['model']}', 'Model: ${info['model']}',
'Android version: ${info['androidVersion']}', 'Android version: ${info['androidVersion']}',
'Supported architectures: ${info['supportedArch'].join(", ")}', 'Supported architectures: ${info['supportedArch'].join(", ")}',
'Root permissions: ${isRooted ? 'Yes' : 'No'}', 'Root permissions: ${isRooted ? 'Yes' : 'No'}', //
'\n- Patch Info', '\n- Patch Info',
'App: ${_app.packageName} v${_app.version}', 'App: ${_app.packageName} v${_app.version} (Suggested: ${_getSuggestedVersion(_app.packageName)})',
'Patches version: ${_managerAPI.patchesVersion}', 'Patches version: ${_managerAPI.patchesVersion}',
'Patches added: ${_formatPatches(patchesAdded)}', 'Patches added: ${_formatPatches(patchesAdded)}',
'Patches removed: ${_formatPatches(patchesRemoved)}', 'Patches removed: ${_formatPatches(patchesRemoved)}',
'Options changed: ${_formatPatches(patchesChanged)}', 'Options changed: ${_formatPatches(patchesChanged)}', //
'\n- Settings', '\n- Settings',
'Allow changing patch selection: ${_managerAPI.isPatchesChangeEnabled()}', 'Allow changing patch selection: ${_managerAPI.isPatchesChangeEnabled()}',
'Version compatibility check: ${_managerAPI.isVersionCompatibilityCheckEnabled()}', 'Version compatibility check: ${_managerAPI.isVersionCompatibilityCheckEnabled()}',
'Show universal patches: ${_managerAPI.areUniversalPatchesEnabled()}', 'Show universal patches: ${_managerAPI.areUniversalPatchesEnabled()}',
'Patches source: ${_managerAPI.getPatchesRepo()}', 'Patches source: ${_managerAPI.getPatchesRepo()}',
'Integration source: ${_managerAPI.getIntegrationsRepo()}', 'Integration source: ${_managerAPI.getIntegrationsRepo()}', //
'\n- Logs', '\n- Logs',
logsTrimmed.join('\n'), logsTrimmed.join('\n'),
@ -461,28 +489,7 @@ class InstallerViewModel extends BaseViewModel {
} }
} }
bool canPop() { Future<bool> onWillPop(BuildContext context) async {
return !isPatching;
}
void onBackButtonInvoked(BuildContext context) {
if (canPop()) {
onPopInvoked(context, true);
} else {
onPopInvoked(context, false);
}
}
Future<void> onPopInvoked(BuildContext context, bool didPop) async {
if (didPop) {
if (!cancel) {
cleanPatcher();
} else {
_patcherAPI.cleanPatcher();
}
screenshotCallback.dispose();
Navigator.of(context).pop();
} else {
if (isPatching) { if (isPatching) {
if (!cancel) { if (!cancel) {
cancel = true; cancel = true;
@ -492,7 +499,15 @@ class InstallerViewModel extends BaseViewModel {
} else { } else {
_toast.showBottom('installerView.noExit'); _toast.showBottom('installerView.noExit');
} }
} return false;
} }
if (!cancel) {
cleanPatcher();
} else {
_patcherAPI.cleanPatcher();
}
screenshotCallback.dispose();
Navigator.of(context).pop();
return true;
} }
} }

View File

@ -13,11 +13,13 @@ class NavigationView extends StatelessWidget {
return ViewModelBuilder<NavigationViewModel>.reactive( return ViewModelBuilder<NavigationViewModel>.reactive(
onViewModelReady: (model) => model.initialize(context), onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => locator<NavigationViewModel>(), viewModelBuilder: () => locator<NavigationViewModel>(),
builder: (context, model, child) => PopScope( builder: (context, model, child) => WillPopScope(
canPop: model.currentIndex == 0, onWillPop: () async {
onPopInvoked: (bool didPop) { if (model.currentIndex == 0) {
if (!didPop) { return true;
} else {
model.setIndex(0); model.setIndex(0);
return false;
} }
}, },
child: Scaffold( child: Scaffold(

View File

@ -25,6 +25,9 @@ class PatchesSelectorViewModel extends BaseViewModel {
locator<PatcherViewModel>().selectedPatches; locator<PatcherViewModel>().selectedPatches;
PatchedApplication? selectedApp = locator<PatcherViewModel>().selectedApp; PatchedApplication? selectedApp = locator<PatcherViewModel>().selectedApp;
String? patchesVersion = ''; String? patchesVersion = '';
Set<String> savedPatchNames = {};
bool isDefaultPatchesRepo() { bool isDefaultPatchesRepo() {
return _managerAPI.getPatchesRepo() == 'revanced/revanced-patches'; return _managerAPI.getPatchesRepo() == 'revanced/revanced-patches';
} }
@ -48,13 +51,17 @@ class PatchesSelectorViewModel extends BaseViewModel {
}); });
currentSelection.clear(); currentSelection.clear();
currentSelection.addAll(selectedPatches); currentSelection.addAll(selectedPatches);
savedPatchNames = _managerAPI.getSavedPatches(selectedApp!.packageName).map((p) => p.name).toSet();
notifyListeners(); notifyListeners();
} }
bool isSelected(Patch patch) { bool isSelected(Patch patch) {
return selectedPatches.any( return selectedPatches.any(
(element) => element.name == patch.name, (element) => element.name == patch.name,
); ) ||
(isPatchNew(patch) && !patch.excluded);
} }
void navigateToPatchOptions(List<Option> setOptions, Patch patch) { void navigateToPatchOptions(List<Option> setOptions, Patch patch) {
@ -281,13 +288,10 @@ class PatchesSelectorViewModel extends BaseViewModel {
} }
bool isPatchNew(Patch patch) { bool isPatchNew(Patch patch) {
final List<Patch> savedPatches = if (savedPatchNames.isEmpty) {
_managerAPI.getSavedPatches(selectedApp!.packageName);
if (savedPatches.isEmpty) {
return false; return false;
} else { } else {
return !savedPatches return !savedPatchNames.contains(patch.name);
.any((p) => p.getSimpleName() == patch.getSimpleName());
} }
} }

View File

@ -1,6 +1,6 @@
name: revanced_manager name: revanced_manager
description: Patch your favorite apps, right on your device. description: Patch your favorite apps, right on your device.
homepage: https://github.com/revanced/revanced-manager homepage: https://github.com/ReVanced/revanced-manager
publish_to: 'none' publish_to: 'none'
@ -15,7 +15,7 @@ dependencies:
device_apps: device_apps:
git: # switch back to ponces fork once https://github.com/ponces/flutter_plugin_device_apps/pull/1 is merged git: # switch back to ponces fork once https://github.com/ponces/flutter_plugin_device_apps/pull/1 is merged
url: https://github.com/BenjaminHalko/flutter_plugin_device_apps url: https://github.com/BenjaminHalko/flutter_plugin_device_apps
ref: revanced-manager ref: 0efbeba41657158a66bbc92c55d1226df56d0f1b # Branch: revanced-manager
device_info_plus: ^9.1.0 device_info_plus: ^9.1.0
dynamic_color: ^1.6.3 dynamic_color: ^1.6.3
dio: ^5.0.0 dio: ^5.0.0
@ -27,17 +27,14 @@ dependencies:
flutter_background: flutter_background:
git: # remove once https://github.com/JulianAssmann/flutter_background/pull/79 is merged git: # remove once https://github.com/JulianAssmann/flutter_background/pull/79 is merged
url: https://github.com/BenjaminHalko/flutter_background url: https://github.com/BenjaminHalko/flutter_background
ref: specify-namespace ref: 560d21c4148b53933313573e7eafca0b0eb9aadf # Branch: specify-namespace
flutter_cache_manager: ^3.3.0 flutter_cache_manager: ^3.3.0
flutter_i18n: ^0.34.0 flutter_i18n: ^0.34.0
flutter_local_notifications: ^16.1.0 flutter_local_notifications: ^16.1.0
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter
flutter_svg: ^2.0.4 flutter_svg: ^2.0.4
fluttertoast: fluttertoast: ^8.2.4
git: # remove once the next fluttertoast version is release (> 8.2.2)
url: https://github.com/ponnamkarthik/FlutterToast
ref: f4e7b4e1afc8c760eb5bac80f6a2e299906d83ca
font_awesome_flutter: ^10.4.0 font_awesome_flutter: ^10.4.0
get_it: ^7.6.4 get_it: ^7.6.4
google_fonts: ^6.1.0 google_fonts: ^6.1.0
@ -48,7 +45,7 @@ dependencies:
logcat: logcat:
git: git:
url: https://github.com/BenjaminHalko/logcat url: https://github.com/BenjaminHalko/logcat
ref: master ref: 4a6d5e0e22292c8eb160cfb9365b9ea29735fd43 # Branch: master
package_info_plus: ^4.2.0 package_info_plus: ^4.2.0
path_provider: ^2.0.14 path_provider: ^2.0.14
permission_handler: ^11.0.1 permission_handler: ^11.0.1
@ -56,7 +53,7 @@ dependencies:
root: root:
git: git:
url: https://github.com/validcube/root url: https://github.com/validcube/root
ref: 68e5678a535a2a3344828a14a39017fa74b9098c ref: 68e5678a535a2a3344828a14a39017fa74b9098c # Branch: libsu-521
shared_preferences: ^2.1.0 shared_preferences: ^2.1.0
skeletons: ^0.0.3 skeletons: ^0.0.3
stacked: ^3.2.0 stacked: ^3.2.0
@ -71,11 +68,11 @@ dependencies:
install_plugin: install_plugin:
git: # remove once https://github.com/hui-z/flutter_install_plugin/pull/67 is merged git: # remove once https://github.com/hui-z/flutter_install_plugin/pull/67 is merged
url: https://github.com/BenjaminHalko/flutter_install_plugin url: https://github.com/BenjaminHalko/flutter_install_plugin
ref: master ref: 5f9b1a8c956fc3355ae655eefcbcadb457bd10f7 # Branch: master
screenshot_callback: screenshot_callback:
git: # remove once https://github.com/flutter-moum/flutter_screenshot_callback/pull/81 is merged git: # remove once https://github.com/flutter-moum/flutter_screenshot_callback/pull/81 is merged
url: https://github.com/BenjaminHalko/flutter_screenshot_callback url: https://github.com/BenjaminHalko/flutter_screenshot_callback
ref: master ref: 1a1616ac91e16cd1f3dd170a81febf27ffce3587 # Branch: master
synchronized: ^3.1.0 synchronized: ^3.1.0
connectivity_plus: ^5.0.1 connectivity_plus: ^5.0.1
flutter_file_dialog: ^3.0.2 flutter_file_dialog: ^3.0.2