diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9262e7bb3a..7808c795d1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -70,7 +70,7 @@ body: Before creating a new bug report, please keep the following in mind: - - **Do not submit a duplicate bug report**: You can review existing bug reports [here](https://github.com/ReVanced/revanced-manager/labels/Bug%20report). + - **Do not submit a duplicate bug report**: Search for existing bug reports [here](https://github.com/ReVanced/revanced-manager/issues?q=label%3A%22Bug+report%22). - **Review the contribution guidelines**: Make sure your bug report adheres to it. You can find the guidelines [here](https://github.com/ReVanced/revanced-manager/blob/main/CONTRIBUTING.md). - **Do not use the issue page for support**: If you need help or have questions, check out other platforms on [revanced.app](https://revanced.app). - type: textarea @@ -99,14 +99,14 @@ body: - type: textarea attributes: label: ReVanced Manager logs - description: Export logs in ReVanced Manager settings. + description: Export logs from the ReVanced Manager settings. render: shell validations: required: true - type: textarea attributes: label: Patch logs - description: Export logs in "Patcher" screen. + description: Export logs from the "Patcher" screen. render: shell validations: required: false @@ -116,11 +116,11 @@ body: label: Acknowledgements description: Your bug report will be closed if you don't follow the checklist below. options: - - label: This issue is not a duplicate of an existing bug report. + - label: I have checked all open and closed bug reports and this is not a duplicate. required: true - label: I have chosen an appropriate title. required: true - label: All requested information has been provided properly. required: true - - label: The bug is only related to ReVanced Manager + - label: The bug is only related to ReVanced Manager. required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 73cc7976d2..f52fe568c8 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -70,7 +70,7 @@ body: Before creating a new feature request, please keep the following in mind: - - **Do not submit a duplicate feature request**: You can review existing feature requests [here](https://github.com/ReVanced/revanced-manager//labels/Feature%20request). + - **Do not submit a duplicate feature request**: Search for existing feature requests [here](https://github.com/ReVanced/revanced-manager/issues?q=label%3A%22Feature+request%22). - **Review the contribution guidelines**: Make sure your feature request adheres to it. You can find the guidelines [here](https://github.com/ReVanced/revanced-manager/blob/main/CONTRIBUTING.md). - **Do not use the issue page for support**: If you need help or have questions, check out other platforms on [revanced.app](https://revanced.app). - type: textarea @@ -79,7 +79,6 @@ body: description: | - Describe your feature in detail - Add images, videos, links, examples, references, etc. if possible - - Add the target application name in case you request a new patch - type: textarea attributes: label: Motivation @@ -98,9 +97,9 @@ body: label: Acknowledgements description: Your feature request will be closed if you don't follow the checklist below. options: - - label: This issue is not a duplicate of an existing feature request. + - label: I have checked all open and closed feature requests and this is not a duplicate. required: true - label: I have chosen an appropriate title. required: true - - label: The feature request is only related to ReVanced Manager + - label: The feature request is only related to ReVanced Manager. required: true diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index 2257e749a2..ad3020f391 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -61,6 +61,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: "stable" + flutter-version: 3.22.x cache: ${{ inputs.flutter-cache }} - name: Get dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d80328484a..0be07928fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,9 +36,10 @@ jobs: uses: subosito/flutter-action@v2 with: channel: "stable" + flutter-version: 3.22.x - name: Install dependencies - run: npm install + run: npm ci - name: Get dependencies run: flutter pub get diff --git a/.github/workflows/sync_crowdin.yml b/.github/workflows/sync_crowdin.yml index f750dd7ecc..43fa6c62ec 100644 --- a/.github/workflows/sync_crowdin.yml +++ b/.github/workflows/sync_crowdin.yml @@ -5,6 +5,7 @@ on: schedule: - cron: 00 12 * * 1 push: + branches: dev paths: - assets/i18n/*.json - assets/i18n/*.dart @@ -20,8 +21,11 @@ jobs: with: fetch-depth: 0 - - name: Setup Dart - uses: dart-lang/setup-dart@v1 + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: 3.22.x - name: Sync translations from Crowdin uses: crowdin/github-action@v1 @@ -43,17 +47,27 @@ jobs: CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - - name: Remove empty values from JSON + - name: Generate Translation Strings + run: | + dart pub get + dart run slang + flutter analyze lib/gen/strings.g.dart --no-fatal-infos --no-fatal-warnings + + - name: Remove empty values & Validation of Translation Strings run: | + dart run slang analyze + dart run slang clean + dart run slang normalize cd assets/i18n sudo chmod 777 *.json dart nuke.dart >> $GITHUB_STEP_SUMMARY + flutter analyze lib/gen/strings.g.dart --no-fatal-infos --no-fatal-warnings - name: Commit translations run: | git config user.name revanced-bot git config user.email github@revanced.app sudo chown -R $USER:$USER .git - git add assets/i18n/*.json - git commit -m "chore: Remove empty values from JSON" assets/i18n/*.json + git add assets/i18n/strings.*.json + git commit -m "chore: Remove empty values from JSON" assets/i18n/strings.*.json git push origin HEAD:feat/translations diff --git a/README.md b/README.md index 7d0ffb77c3..3b1b604fa9 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Some of the features ReVanced Manager provides are: ## 🔽 Download -You can download the most recent version of ReVanced Manager at [revanced.app/download](https://revanced.app/download) or from [GitHub releases](https://github.com/ReVanced/revanced-manager/releases). +You can download the most recent version of ReVanced Manager at [revanced.app/download](https://revanced.app/download) or from [GitHub releases](https://github.com/ReVanced/revanced-manager/releases/latest). Learn how to use ReVanced Manager by following the [documentation](/docs). ## 📚 Everything else @@ -98,10 +98,6 @@ To build a ReVanced Manager, you can follow the [documentation](/docs). You can find the documentation for ReVanced Manager [here](/docs). -### 👋 Contributing - -Thank you for considering contributing to ReVanced Manager. You can find the contribution guidelines [here](/CONTRIBUTING.md). - ## ⚖️ License ReVanced Manager is licensed under the GPLv3 license. Please see the [license file](LICENSE) for more information. diff --git a/android/app/build.gradle b/android/app/build.gradle index 7a34e02422..7e9a234171 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -23,10 +23,10 @@ if (flutterVersionName == null) { } android { - compileSdk flutter.compileSdkVersion - ndkVersion flutter.ndkVersion + compileSdk 34 compileOptions { + coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } @@ -113,6 +113,7 @@ flutter { } dependencies { + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4") // https://pub.dev/packages/flutter_local_notifications#gradle-setup implementation("app.revanced:revanced-patcher:19.3.1") implementation("app.revanced:revanced-library:2.2.1") } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b49b7e84c1..0f1c81cb13 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -26,7 +26,8 @@ android:name="${applicationName}" android:icon="@mipmap/ic_launcher" android:largeHeap="true" - android:requestLegacyExternalStorage="true"> + android:requestLegacyExternalStorage="true" + android:enableOnBackInvokedCallback="true"> json) => @@ -33,6 +35,8 @@ class PatchedApplication { bool isRooted; bool isFromStorage; List appliedPatches; + String patchedFilePath; + int fileSize; Map toJson() => _$PatchedApplicationToJson(this); diff --git a/lib/services/github_api.dart b/lib/services/github_api.dart index 0c0080b9e6..b4ab03a669 100644 --- a/lib/services/github_api.dart +++ b/lib/services/github_api.dart @@ -6,12 +6,14 @@ import 'package:injectable/injectable.dart'; import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/services/download_manager.dart'; import 'package:revanced_manager/services/manager_api.dart'; +import 'package:synchronized/synchronized.dart'; @lazySingleton class GithubAPI { late final Dio _dio; late final ManagerAPI _managerAPI = locator(); late final DownloadManager _downloadManager = locator(); + final Map _lockMap = {}; Future initialize(String repoUrl) async { _dio = _downloadManager.initDio(repoUrl); @@ -21,44 +23,21 @@ class GithubAPI { await _downloadManager.clearAllCache(); } - Future?> getLatestRelease( - String repoName, - ) async { - try { - final response = await _dio.get( - '/repos/$repoName/releases', - ); - return response.data[0]; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - } - - Future?> getPatchesRelease( - String repoName, - String version, - ) async { - try { - final response = await _dio.get( - '/repos/$repoName/releases/tags/$version', - ); - return response.data; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; + Future _dioGetSynchronously(String path) async { + // Create a new Lock for each path + if (!_lockMap.containsKey(path)) { + _lockMap[path] = Lock(); } + return _lockMap[path]!.synchronized(() async { + return await _dio.get(path); + }); } - Future?> getLatestPatchesRelease( + Future?> getLatestRelease( String repoName, ) async { try { - final response = await _dio.get( + final response = await _dioGetSynchronously( '/repos/$repoName/releases/latest', ); return response.data; @@ -70,36 +49,27 @@ class GithubAPI { } } - Future?> getLatestManagerRelease( - String repoName, - ) async { + Future getManagerChangelogs() async { try { - final response = await _dio.get( - '/repos/$repoName/releases', + final response = await _dioGetSynchronously( + '/repos/${_managerAPI.defaultManagerRepo}/releases?per_page=50', ); - final Map releases = response.data[0]; - int updates = 0; + final buffer = StringBuffer(); final String currentVersion = await _managerAPI.getCurrentManagerVersion(); - while (response.data[updates]['tag_name'] != currentVersion) { - updates++; - } - for (int i = 1; i < updates; i++) { - if (response.data[i]['prerelease']) { + for (final release in response.data) { + if (release['tag_name'] == currentVersion) { + if (buffer.isEmpty) { + buffer.writeln(release['body']); + } + break; + } + if (release['prerelease']) { continue; } - releases.update( - 'body', - (value) => - value + - '\n' + - '# ' + - response.data[i]['tag_name'] + - '\n' + - response.data[i]['body'], - ); + buffer.writeln(release['body']); } - return releases; + return buffer.toString(); } on Exception catch (e) { if (kDebugMode) { print(e); @@ -108,32 +78,7 @@ class GithubAPI { } } - Future getLatestReleaseFile( - String extension, - String repoName, - ) async { - try { - final Map? release = await getLatestRelease(repoName); - if (release != null) { - final Map? asset = - (release['assets'] as List).firstWhereOrNull( - (asset) => (asset['name'] as String).endsWith(extension), - ); - if (asset != null) { - return await _downloadManager.getSingleFile( - asset['browser_download_url'], - ); - } - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - return null; - } - - Future getPatchesReleaseFile( + Future getReleaseFile( String extension, String repoName, String version, @@ -145,8 +90,10 @@ class GithubAPI { url, ); } - final Map? release = - await getPatchesRelease(repoName, version); + final response = await _dioGetSynchronously( + '/repos/$repoName/releases/tags/$version', + ); + final Map? release = response.data; if (release != null) { final Map? asset = (release['assets'] as List).firstWhereOrNull( diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart index 8851858724..ce26bf96e8 100644 --- a/lib/services/manager_api.dart +++ b/lib/services/manager_api.dart @@ -31,7 +31,6 @@ class ManagerAPI { final String cliRepo = 'revanced-cli'; late SharedPreferences _prefs; List patches = []; - List