diff --git a/.github/ISSUE_TEMPLATE/bug-issue.yml b/.github/ISSUE_TEMPLATE/bug-issue.yml deleted file mode 100644 index 87c8e4fb67..0000000000 --- a/.github/ISSUE_TEMPLATE/bug-issue.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: 🐞 Bug report -description: Report a very clearly broken issue. -title: 'bug: ' -labels: [bug] -body: - - type: markdown - attributes: - value: | - # ReVanced Manager bug report - - Important to note that your issue may have already been reported before. Please check for existing issues [here](https://github.com/revanced/revanced-manager/labels/bug). - - - type: dropdown - attributes: - label: Type - options: - - Error while running the manager - - Error at runtime - - Cosmetic - - Other - validations: - required: true - - type: textarea - attributes: - label: Bug description - description: How did you find the bug? Any additional details that might help? - validations: - required: true - - type: textarea - attributes: - label: Steps to reproduce - description: Add the steps to reproduce this bug, including your environment. - placeholder: Step 1. Download some files. Step 2. ... - validations: - required: true - - type: textarea - attributes: - label: Android version - description: Android version used. - validations: - required: true - - type: textarea - attributes: - label: Manager version - description: Manager version used. - validations: - required: true - - type: textarea - attributes: - label: Target package name - description: App you tried to patch. - validations: - required: true - - type: textarea - attributes: - label: Target package version. - description: Version of the app you tried to patch. - validations: - required: true - - type: dropdown - attributes: - label: Installation type - options: - - Non-root - - Root - validations: - required: true - - type: textarea - attributes: - label: Patches selected. - description: Patches you selected for the app. - validations: - required: true - - type: textarea - attributes: - label: Device logs (exported using Manager settings). - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so there is no need for backticks. - render: shell - validations: - required: true - - type: textarea - attributes: - label: Installer logs (exported using Installer menu option) [unneeded if the issue is not during patching]. - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so there is no need for backticks. - render: shell - validations: - required: false - - type: textarea - attributes: - label: Screenshots or video - description: Add screenshots or videos that show the bug here. - placeholder: Drag and drop the screenshots/videos into this box. - validations: - required: false - - type: textarea - attributes: - label: Solution - description: If applicable, add a possible solution. - validations: - required: false - - type: textarea - attributes: - label: Additional context - description: Add additional context here. - validations: - required: false - - type: checkboxes - id: acknowledgments - attributes: - label: Acknowledgments - description: Your issue will be closed if you haven't done these steps. - options: - - label: I have searched the existing issues; this is new and no duplicate or related to another open issue. - required: true - - label: I have written a short but informative title. - required: true - - label: I properly filled out all of the requested information in this issue. - required: true - - label: The issue is solely related to ReVanced Manager and not caused by patches. - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index ec4bb386bc..0000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-issue.yml b/.github/ISSUE_TEMPLATE/feature-issue.yml deleted file mode 100644 index 8df4eab2d7..0000000000 --- a/.github/ISSUE_TEMPLATE/feature-issue.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: ⭐ Feature request -description: Create a detailed feature request. -title: 'feat: <title>' -labels: [feature-request] -body: - - type: dropdown - attributes: - label: Type - options: - - Functionality - - Cosmetic - - Other - validations: - required: true - - type: textarea - attributes: - label: Issue - description: What is the current problem. Why does it require a feature request? - validations: - required: true - - type: textarea - attributes: - label: Feature - description: Describe your feature in detail. How does it solve the issue? - validations: - required: true - - type: textarea - attributes: - label: Motivation - description: Why should your feature should be considered? - validations: - required: true - - type: textarea - attributes: - label: Additional context - description: Add additional context here. - validations: - required: false - - type: checkboxes - id: acknowledgements - attributes: - label: Acknowledgements - description: Your issue will be closed if you haven't done these steps. - options: - - label: I have searched the existing issues and this is a new and no duplicate or related to another open issue. - required: true - - label: I have written a short but informative title. - required: true - - label: I filled out all of the requested information in this issue properly. - required: true - - label: The issue is related solely to the ReVanced Manager - required: true diff --git a/.github/config.yaml b/.github/config.yaml deleted file mode 100644 index 650941e517..0000000000 --- a/.github/config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -firstPRMergeComment: > - Thank you for contributing to ReVanced. Join us on [Discord](https://revanced.app/discord) if you want to receive a contributor role. \ No newline at end of file diff --git a/.github/crowdin.yml b/.github/crowdin.yml new file mode 100644 index 0000000000..db76da5e90 --- /dev/null +++ b/.github/crowdin.yml @@ -0,0 +1,19 @@ +project_id_env: CROWDIN_PROJECT_ID +api_token_env: CROWDIN_PERSONAL_TOKEN + +preserve_hierarchy: true + +pull_request_title: 'chore(translation): sync translation with Crowdin' +commit_message: 'chore(translation): sync translation with Crowdin' +pull_request_labels: 'translation' + +files: [ + { + source: 'app/src/res/values/strings.xml', + translation: 'app/src/res/values-%android_code%/strings.xml' + } + { + source: 'app/src/res/values/plurals.xml', + translation: 'app/src/res/values-%android_code%/plurals.xml' + } +] diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml deleted file mode 100644 index e3f0f0638b..0000000000 --- a/.github/workflows/analyze.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Analyze Code - -on: - push: - branches: [ "dev" ] - paths: - - "**.dart" - - ".github/workflows/analyze.yml" - pull_request: - branches: [ "main", "dev" ] - types: - - opened - - reopened - - synchronize - - ready_for_review - paths: - - "**.dart" - - ".github/workflows/analyze.yml" - -jobs: - build: - name: "Static analysis & format check" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - cache: true - - name: Install Flutter dependencies - run: flutter pub get - - name: Generate files with Builder - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Analyze code - uses: ValentinVignal/action-dart-analyze@v0.15 - with: - fail-on: warning diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml new file mode 100644 index 0000000000..4cd68b3141 --- /dev/null +++ b/.github/workflows/crowdin.yml @@ -0,0 +1,34 @@ +name: Crowdin + +on: + push: + branches: [ dev ] + paths: + - "app/src/res/values/strings.xml" + - ".github/workflows/crowdin.yml" + schedule: + - cron: "0 0 * * 1" + workflow_dispatch: + + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Crowdin action + uses: crowdin/github-action@v2 + with: + config: ".github/crowdin.yml" + upload_sources: true + upload_translations: false + download_translations: true + create_pull_request: true + localization_branch_name: "crowdin_translations" + pull_request_base_branch_name: "dev" + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml deleted file mode 100644 index 0bb9bdb11f..0000000000 --- a/.github/workflows/pr-build.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: PR Build - -on: - pull_request: - paths: - - ".github/workflows/pr-build.yml" - - "android/**" - - "assets/**" - - "lib/**" - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - # Make sure the release step uses its own credentials: - # https://github.com/cycjimmy/semantic-release-action#private-packages - persist-credentials: false - fetch-depth: 0 - - name: Setup JDK - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'zulu' - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - cache: true - - name: Install Flutter dependencies - run: flutter pub get - - name: Generate files with Builder - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Build with Flutter - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: flutter build apk --debug - - name: Upload build - uses: actions/upload-artifact@v3 - with: - name: revanced-manager - path: build/app/outputs/flutter-apk/app-debug.apk diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml deleted file mode 100644 index 4b414eb7ef..0000000000 --- a/.github/workflows/release-build.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Release Build" - -on: - push: - tags: - - "v*" - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: "11" - distribution: "zulu" - - uses: subosito/flutter-action@v2 - with: - channel: "stable" - - name: Set up Flutter - run: flutter pub get - - name: Generate files with Builder - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - name: Build with Flutter - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} - SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }} - run: flutter build apk - - name: Sign APK - id: sign_apk - uses: ilharp/sign-android-release@v1 - with: - releaseDir: build/app/outputs/apk/release - signingKey: ${{ secrets.SIGNING_KEYSTORE }} - keyStorePassword: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }} - keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }} - keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} - - name: Add version to APK - run: mv ${{steps.sign_apk.outputs.signedFile}} revanced-manager-${{ env.RELEASE_VERSION }}.apk - - name: Publish release APK - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - files: revanced-manager-${{ env.RELEASE_VERSION }}.apk \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..642933c845 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Android Release + +on: + push: + branches: + - dev + pull_request: + branches: + - dev + +jobs: + build: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Build with Gradle + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew assembleRelease --no-daemon + + - name: Sign APK + id: sign_apk + uses: r0adkll/sign-android-release@v1 + with: + releaseDirectory: ./app/build/outputs/apk/release/ + signingKeyBase64: ${{ secrets.TEMP_SIGNING_KEYSTORE }} + keyStorePassword: ${{ secrets.TEMP_SIGNING_KEYSTORE_PASSWORD }} + alias: ${{ vars.TEMP_SIGNING_KEY_ALIAS }} + keyPassword: ${{ secrets.TEMP_SIGNING_KEY_PASSWORD }} + + - name: Upload APK + uses: actions/upload-artifact@v3 + with: + name: manager + path: ${{steps.sign_apk.outputs.signedReleaseFile}} diff --git a/.github/workflows/update-documentation.yml b/.github/workflows/update-documentation.yml deleted file mode 100644 index 77097e2fe6..0000000000 --- a/.github/workflows/update-documentation.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Update documentation - -on: - push: - paths: - - docs/** - -jobs: - trigger: - runs-on: ubuntu-latest - name: Dispatch event to documentation repository - if: github.ref == 'refs/heads/main' - steps: - - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.DOCUMENTATION_REPO_ACCESS_TOKEN }} - repository: revanced/revanced-documentation - event-type: update-documentation - client-payload: '{"repo": "${{ github.event.repository.name }}", "ref": "${{ github.ref }}"}' diff --git a/.gitignore b/.gitignore index 2f30200232..154ff109d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,144 +1,19 @@ -# Miscellaneous -*.class -*.lock -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related *.iml -*.ipr -*.iws -.idea/ - -# Visual Studio Code related -.classpath -.project -.settings/ - -# Flutter repo-specific -/bin/cache/ -/bin/mingit/ -/dev/benchmarks/mega_gallery/ -/dev/bots/.recipe_deps -/dev/bots/android_tools/ -/dev/docs/doc/ -/dev/docs/flutter.docs.zip -/dev/docs/lib/ -/dev/docs/pubspec.yaml -/dev/integration_tests/**/xcuserdata -/dev/integration_tests/**/Pods -/packages/flutter/coverage/ -version - -# packages file containing multi-root paths -.packages.generated - -# Flutter/Dart/Pub related -**/doc/api/ -**/*.g.dart -**/*.locator.dart -**/*.router.dart -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -**/generated_plugin_registrant.dart -.packages -.pub-cache/ -.pub/ -build/ -flutter_*.png -linked_*.ds -unlinked.ds -unlinked_spec.ds - -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java -**/android/key.properties -*.jks - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/.last_build_id -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Flutter.podspec -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* - -# macOS related -**/macos/Flutter/GeneratedPluginRegistrant.swift -**/macos/Flutter/Flutter-Debug.xcconfig -**/macos/Flutter/Flutter-Release.xcconfig -**/macos/Flutter/Flutter-Profile.xcconfig - -# Windows related -**/windows/flutter/ephemeral/ -**/windows/**/*.suo -**/windows/**/*.user -**/windows/**/*.userosscache -**/windows/**/*.sln.docstates -**/windows/x64/ -**/windows/x86/ -**/windows/**/*.[Cc]ache -**/windows/**/!*.[Cc]ache/ - -# Web related -lib/generated_plugin_registrant.dart - -# Coverage -coverage/ - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages -!/dev/ci/**/Gemfile.lock - -# Firebase related -.firebase - -# Dependency directories -node_modules/ +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +/.idea/deploymentTargetDropDown.xml +/.idea/misc.xml +/.idea/gradle.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties -# FVM -.fvm \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000..26d33521af --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/fastlane/metadata/android/en-US/title.txt b/.idea/.name similarity index 100% rename from fastlane/metadata/android/en-US/title.txt rename to .idea/.name diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000000..b589d56e9f --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <bytecodeTargetLevel target="17" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000000..d8e9561668 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="DiscordProjectSettings"> + <option name="show" value="PROJECT_FILES" /> + <option name="description" value="" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000000..01940c92e0 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="GradleMigrationSettings" migrationVersion="1" /> + <component name="GradleSettings"> + <option name="linkedExternalProjectsSettings"> + <GradleProjectSettings> + <option name="testRunner" value="GRADLE" /> + <option name="distributionType" value="DEFAULT_WRAPPED" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="gradleJvm" value="zulu-17" /> + <option name="modules"> + <set> + <option value="$PROJECT_DIR$" /> + <option value="$PROJECT_DIR$/app" /> + </set> + </option> + <option name="resolveExternalAnnotations" value="false" /> + </GradleProjectSettings> + </option> + </component> +</project> \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000..ed76bea38e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,37 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + <inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + <inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + <inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + <inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + <inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + <inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + <inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true"> + <option name="composableFile" value="true" /> + <option name="previewFile" value="true" /> + </inspection_tool> + </profile> +</component> \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000000..217e5c51fb --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="KotlinJpsPluginSettings"> + <option name="version" value="1.8.21" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..d673ade909 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ExternalStorageConfigurationManager" enabled="true" /> + <component name="ProjectRootManager" version="2" languageLevel="JDK_17_PREVIEW" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/build/classes" /> + </component> + <component name="ProjectType"> + <option name="id" value="Android" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..94a25f7f4c --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/.metadata b/.metadata deleted file mode 100644 index e7c1001054..0000000000 --- a/.metadata +++ /dev/null @@ -1,45 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled. - -version: - revision: 85684f9300908116a78138ea4c6036c35c9a1236 - channel: stable - -project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - platform: android - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - platform: ios - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - platform: linux - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - platform: macos - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - platform: web - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - platform: windows - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/.releaserc b/.releaserc deleted file mode 100644 index a10173d648..0000000000 --- a/.releaserc +++ /dev/null @@ -1,75 +0,0 @@ -{ - "branches": [ - "main", - { - "name": "dev", - "prerelease": true - } - ], - "plugins": [ - "semantic-release-export-data", - "@semantic-release/commit-analyzer", - [ - "@semantic-release/release-notes-generator", - { - "presetConfig": { - "types": [ - { - "type": "build", - "section": "Dependency Updates" - }, - { - "type": "chore", - "section": "Other Changes", - "hidden": false - }, - { - "type": "perf", - "section": "Performance Improvements", - "hidden": false - }, - { - "type": "refactor", - "section": "Code Improvements", - "hidden": false - } - ] - } - } - ], - "@semantic-release/changelog", - "semantic-release-flutter-plugin", - [ - "@semantic-release/git", - { - "assets": [ - "CHANGELOG.md", - "pubspec.yaml" - ] - } - ], - [ - "@semantic-release/github", - { - "assets": [ - { - "path": "build/app/outputs/apk/release/revanced-manager-*.apk" - } - ], - "successComment": false - } - ], - [ - "@saithodev/semantic-release-backmerge", - { - "backmergeBranches": [ - { - "from": "main", - "to": "dev" - } - ], - "clearWorkspace": true - } - ] - ] -} diff --git a/.run/main.dart.run.xml b/.run/main.dart.run.xml deleted file mode 100644 index 4767aff814..0000000000 --- a/.run/main.dart.run.xml +++ /dev/null @@ -1,6 +0,0 @@ -<component name="ProjectRunConfigurationManager"> - <configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter"> - <option name="filePath" value="$PROJECT_DIR$/lib/main.dart" /> - <method v="2" /> - </configuration> -</component> \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index a09c28f5e6..0000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "Generate (Builder)", - "type": "shell", - "command": "flutter packages pub run build_runner build --delete-conflicting-outputs", - "problemMatcher": [] - }, - { - "label": "Build (Android)", - "type": "shell", - "command": "flutter build apk", - "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } - }, - { - "label": "Install (Android)", - "type": "shell", - "command": "adb install build\\app\\outputs\\flutter-apk\\app-release.apk", - "problemMatcher": [] - }, - { - "label": "Clean (Flutter)", - "type": "shell", - "command": "flutter clean && flutter pub get", - "problemMatcher": [] - }, - { - "label": "Clean (Builder)", - "type": "shell", - "command": "flutter packages pub run build_runner clean", - "problemMatcher": [] - }, - { - "label": "Build all (Android)", - "dependsOrder": "sequence", - "dependsOn": [ - "Generate (Builder)", - "Build (Android)" - ], - "problemMatcher": [] - }, - { - "label": "Clean all", - "dependsOrder": "sequence", - "dependsOn": [ - "Clean (Flutter)", - "Clean (Builder)" - ], - "problemMatcher": [] - }, - { - "label": "Clean all & Build all (Android)", - "dependsOrder": "sequence", - "dependsOn": [ - "Clean all", - "Build all (Android)" - ], - "problemMatcher": [] - }, - { - "label": "Clean all & Install (Android)", - "dependsOrder": "sequence", - "dependsOn": [ - "Clean all", - "Build all (Android)", - "Install (Android)", - ], - "problemMatcher": [] - }, - { - "label": "Build & Install (Android)", - "dependsOrder": "sequence", - "dependsOn": [ - "Build (Android)", - "Install (Android)" - ], - "problemMatcher": [] - }, - { - "label": "Validate translations", - "type": "shell", - "command": "flutter pub run flutter_i18n diff en.json pt.json", - "problemMatcher": [] - } - ] -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 8b13789179..0000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f288702d2f..0000000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<https://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/README.md b/README.md index 07ed4a791f..366b55a3e7 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,34 @@ -# 💊 ReVanced Manager +# ReVanced Manager (Compose Rewrite) -The official ReVanced Manager based on Flutter. +[![GitHub license](https://img.shields.io/github/license/revanced/revanced-manager-compose)](/LICENSE) +[![GitHub last commit](https://img.shields.io/github/last-commit/revanced/revanced-manager-compose)](https://github.com/ReVanced/revanced-manager-compose/commits) +[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/revanced/revanced-manager-compose)](https://github.com/ReVanced/revanced-manager-compose/commits) -## 🔽 Download -To download latest Manager, go [here](https://github.com/revanced/revanced-manager/releases/latest) and install the provided APK file. +_(Yet another)_ rewrite of the ReVanced Manager using Kotlin and Jetpack Compose. -## 📝 Prerequisites -1. Android 8 or higher -2. Does not work on some armv7 devices +## Design system -## 🔴 Issues -For suggestions and bug reports, open an issue [here](https://github.com/revanced/revanced-manager/issues/new/choose). +In this rewrite, we are adopting the latest Material Design principles and guidelines by using Material 3 and Material You. -## 💭 Discussion -If you wish to discuss the Manager, a thread has been made under the [#development](https://discord.com/channels/952946952348270622/1002922226443632761) channel in the Discord server, please note that this thread may be temporary and may be removed in the future. +Material Design is a design system developed by Google that provides a unified visual language for building beautiful and consistent user interfaces across all platforms and devices. Material You is an extension of Material Design that provides even more customization options for users, making it possible for them to personalize their device and create a unique look and feel. +### Why Material 3? -## 🌐 Translation -[![Crowdin](https://badges.crowdin.net/revanced/localized.svg)](https://crowdin.com/project/revanced) +* **Consistent design language** +* **Improved accessibility** +* **Better user experience** -If you wish to translate ReVanced Manager, we're accepting translations on [Crowdin](https://translate.revanced.app) +By using Material 3 and Material You, we are ensuring that the app's user interface is consistent, customizable, accessible, and engaging for our users. This will help to improve the overall user experience and increase user satisfaction with the the manager. + +## Technology stack + +* Kotlin: Kotlin is a modern and concise programming language that is fully interoperable with Java and provides improved safety, readability, and maintainability compared to Java. +* Jetpack Compose: Jetpack Compose is a modern UI toolkit for Android development that allows developers to build beautiful and performant user interfaces using declarative programming. It provides a unified and efficient way of building UI that is well-integrated with the Android framework. + +## Why Kotlin and Compose? + +* **Improved safety:** Kotlin provides improved safety compared to Java, which reduces the likelihood of common programming mistakes that can cause security vulnerabilities or crashes. +* **Concise and readable code:** Kotlin's concise syntax and expressive type system make the code more readable, which makes it easier for developers to understand and maintain the codebase. +* **Better performance:** Jetpack Compose uses the power of the Android framework to provide smooth and fast performance, which enhances the user experience. +* **Modern and efficient UI development:** Jetpack Compose provides a modern and efficient way of building UI, which makes it easier for developers to create beautiful and performant user interfaces. -## 🛠️ Building Manager from source -1. Setup flutter environment for your [platform](https://docs.flutter.dev/get-started/install) -2. Clone the repository locally -3. Add your github token in gradle.properties like [this](/docs/4_building.md) -4. Open the project in terminal -5. Run `flutter pub get` in terminal -6. Then `flutter packages pub run build_runner build --delete-conflicting-outputs` (Must be done on each git pull) -7. To build release apk run `flutter build apk` diff --git a/analysis_options.yaml b/analysis_options.yaml deleted file mode 100644 index 1c02c24c3a..0000000000 --- a/analysis_options.yaml +++ /dev/null @@ -1,163 +0,0 @@ -# This file configures the analyzer, which statically analyzes Dart code to -# check for errors, warnings, and lints. -# -# The issues identified by the analyzer are surfaced in the UI of Dart-enabled -# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be -# invoked from the command line by running `flutter analyze`. - -# The following line activates a set of recommended lints for Flutter apps, -# packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml - -analyzer: - exclude: - - lib/app/app.locator.dart - - lib/app/app.router.dart - - lib/models/patch.g.dart - - lib/models/patched_application.g.dart - -linter: - rules: - - always_declare_return_types - - require_trailing_commas - - always_put_control_body_on_new_line - - always_require_non_null_named_parameters - - always_use_package_imports # we do this commonly - - annotate_overrides - - avoid_bool_literals_in_conditional_expressions - - avoid_double_and_int_checks - - avoid_empty_else - - avoid_equals_and_hash_code_on_mutable_classes - - avoid_escaping_inner_quotes - - avoid_field_initializers_in_const_classes - - avoid_function_literals_in_foreach_calls - - avoid_implementing_value_types - - avoid_init_to_null - - avoid_js_rounded_ints - - avoid_null_checks_in_equality_operators - - avoid_print - - avoid_redundant_argument_values - - avoid_relative_lib_imports - - avoid_renaming_method_parameters - - avoid_return_types_on_setters - - avoid_returning_null - - avoid_returning_null_for_future - - avoid_returning_null_for_void - - avoid_setters_without_getters - - avoid_shadowing_type_parameters - - avoid_single_cascade_in_expression_statements - - avoid_type_to_string - - avoid_types_as_parameter_names - - avoid_unnecessary_containers - - avoid_void_async - - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere - - await_only_futures - - camel_case_extensions - - camel_case_types - - cancel_subscriptions - - cast_nullable_to_non_nullable - - close_sinks # not reliable enough - - control_flow_in_finally - - curly_braces_in_flow_control_structures - - depend_on_referenced_packages - - deprecated_consistency - - directives_ordering - - empty_catches - - empty_constructor_bodies - - empty_statements - - eol_at_end_of_file - - exhaustive_cases - - file_names - - flutter_style_todos - - hash_and_equals - - implementation_imports - - collection_methods_unrelated_type - - leading_newlines_in_multiline_strings - - library_names - - library_prefixes - - library_private_types_in_public_api - - missing_whitespace_between_adjacent_strings - - no_adjacent_strings_in_list - - no_duplicate_case_values - - no_logic_in_create_state - - non_constant_identifier_names - - noop_primitive_operations - - null_check_on_nullable_type_parameter - - null_closures - - overridden_fields - - package_api_docs - - package_names - - package_prefixed_library_names - - prefer_adjacent_string_concatenation - - prefer_asserts_in_initializer_lists - - prefer_collection_literals - - prefer_conditional_assignment - - prefer_const_constructors - - prefer_const_constructors_in_immutables - - prefer_const_declarations - - prefer_const_literals_to_create_immutables - - prefer_contains - - prefer_final_fields - - prefer_final_in_for_each - - prefer_final_locals - - prefer_for_elements_to_map_fromIterable - - prefer_foreach - - prefer_function_declarations_over_variables - - prefer_generic_function_type_aliases - - prefer_if_elements_to_conditional_expressions - - prefer_if_null_operators - - prefer_initializing_formals - - prefer_inlined_adds - - prefer_interpolation_to_compose_strings - - prefer_is_empty - - prefer_is_not_empty - - prefer_is_not_operator - - prefer_iterable_whereType - - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018 - - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere - - prefer_null_aware_operators - - prefer_single_quotes - - prefer_spread_collections - - prefer_typing_uninitialized_variables - - prefer_void_to_null - - provide_deprecation_message - - recursive_getters - - sized_box_for_whitespace - - slash_for_doc_comments - - sort_child_properties_last - - sort_constructors_first - - sort_unnamed_constructors_first - - test_types_in_equals - - throw_in_finally - - tighten_type_of_initializing_formals - - type_init_formals - - unnecessary_brace_in_string_interps - - unnecessary_const - - unnecessary_getters_setters - - unnecessary_new - - unnecessary_null_aware_assignments - - unnecessary_null_checks - - unnecessary_null_in_if_null_operators - - unnecessary_nullable_for_final_variable_declarations - - unnecessary_overrides - - unnecessary_parenthesis - - unnecessary_statements - - unnecessary_string_escapes - - unnecessary_string_interpolations - - unnecessary_this - - unrelated_type_equality_checks - - unsafe_html - - use_build_context_synchronously - - use_full_hex_values_for_flutter_colors - - use_function_type_syntax_for_parameters - - use_if_null_to_convert_nulls_to_bools - - use_is_even_rather_than_modulo - - use_key_in_widget_constructors - - use_late_for_private_fields_and_variables - - use_named_constants - - use_raw_strings - - use_rethrow_when_possible - - use_setters_to_change_properties - - use_test_throws_matchers - - valid_regexps - - void_checks diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index 6f568019d3..0000000000 --- a/android/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java - -# Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app -key.properties -**/*.keystore -**/*.jks diff --git a/android/Gemfile b/android/Gemfile deleted file mode 100644 index 7a118b49be..0000000000 --- a/android/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source "https://rubygems.org" - -gem "fastlane" diff --git a/android/app/build.gradle b/android/app/build.gradle deleted file mode 100644 index 8663736a80..0000000000 --- a/android/app/build.gradle +++ /dev/null @@ -1,92 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - - kotlinOptions { - jvmTarget = '11' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - applicationId "app.revanced.manager.flutter" - minSdkVersion 26 - targetSdkVersion 33 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - resValue "string", "app_name", "ReVanced Manager" - signingConfig signingConfigs.debug - ndk { - abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64' - } - } - debug { - shrinkResources false - minifyEnabled false - resValue "string", "app_name", "ReVanced Manager Debug" - applicationIdSuffix ".debug" - signingConfig signingConfigs.debug - ndk { - abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64' - } - } - } - - packagingOptions { - exclude '/prebuilt/**' - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - - // ReVanced - implementation "app.revanced:revanced-patcher:11.0.4" - - // Signing & aligning - implementation("org.bouncycastle:bcpkix-jdk15on:1.70") - implementation("com.android.tools.build:apksig:7.2.2") - -} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index 2abfc8e943..0000000000 --- a/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="app.revanced.manager.flutter"> - <uses-permission android:name="android.permission.INTERNET"/> -</manifest> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 8548324123..0000000000 --- a/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,59 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="app.revanced.manager.flutter"> - <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> - <uses-permission android:name="android.permission.INTERNET" /> - - <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> - <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> - <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" /> - - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" - android:maxSdkVersion="32" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" - android:maxSdkVersion="32" /> - <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> - - <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> - <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> - <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" /> - <uses-permission android:name="android.permission.WAKE_LOCK" /> - - <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> - <application - android:label="@string/app_name" - android:name="${applicationName}" - android:icon="@mipmap/ic_launcher" - android:largeHeap="true" - android:requestLegacyExternalStorage="true" - android:extractNativeLibs="true" - android:enableOnBackInvokedCallback="true"> - <activity - android:name=".MainActivity" - android:exported="true" - android:launchMode="singleTop" - android:theme="@style/LaunchTheme" - android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" - android:hardwareAccelerated="true" - android:windowSoftInputMode="adjustResize"> - <meta-data - android:name="io.flutter.embedding.android.NormalTheme" - android:resource="@style/NormalTheme"/> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - <meta-data - android:name="flutterEmbedding" - android:value="2" /> - <provider - android:name="androidx.core.content.FileProvider" - android:authorities="${applicationId}.fileProvider" - android:exported="false" - android:grantUriPermissions="true"> - <meta-data - android:name="android.support.FILE_PROVIDER_PATHS" - android:resource="@xml/file_paths" /> - </provider> - </application> -</manifest> diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt b/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt deleted file mode 100644 index 2c8d77169e..0000000000 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt +++ /dev/null @@ -1,385 +0,0 @@ -package app.revanced.manager.flutter - -import android.os.Build -import android.os.Handler -import android.os.Looper -import androidx.annotation.NonNull -import app.revanced.manager.flutter.utils.Aapt -import app.revanced.manager.flutter.utils.aligning.ZipAligner -import app.revanced.manager.flutter.utils.signing.Signer -import app.revanced.manager.flutter.utils.zip.ZipFile -import app.revanced.manager.flutter.utils.zip.structures.ZipEntry -import app.revanced.patcher.Patcher -import app.revanced.patcher.PatcherOptions -import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages -import app.revanced.patcher.extensions.PatchExtensions.patchName -import app.revanced.patcher.logging.Logger -import app.revanced.patcher.util.patch.PatchBundle -import dalvik.system.DexClassLoader -import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugin.common.MethodChannel -import java.io.File - -private const val PATCHER_CHANNEL = "app.revanced.manager.flutter/patcher" -private const val INSTALLER_CHANNEL = "app.revanced.manager.flutter/installer" - -class MainActivity : FlutterActivity() { - private val handler = Handler(Looper.getMainLooper()) - private lateinit var installerChannel: MethodChannel - private var cancel: Boolean = false - private var stopResult: MethodChannel.Result? = null - - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - super.configureFlutterEngine(flutterEngine) - val mainChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, PATCHER_CHANNEL) - installerChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL) - mainChannel.setMethodCallHandler { call, result -> - when (call.method) { - "runPatcher" -> { - val patchBundleFilePath = call.argument<String>("patchBundleFilePath") - val originalFilePath = call.argument<String>("originalFilePath") - val inputFilePath = call.argument<String>("inputFilePath") - val patchedFilePath = call.argument<String>("patchedFilePath") - val outFilePath = call.argument<String>("outFilePath") - val integrationsPath = call.argument<String>("integrationsPath") - val selectedPatches = call.argument<List<String>>("selectedPatches") - val cacheDirPath = call.argument<String>("cacheDirPath") - val keyStoreFilePath = call.argument<String>("keyStoreFilePath") - val keystorePassword = call.argument<String>("keystorePassword") - - if (patchBundleFilePath != null && - originalFilePath != null && - inputFilePath != null && - patchedFilePath != null && - outFilePath != null && - integrationsPath != null && - selectedPatches != null && - cacheDirPath != null && - keyStoreFilePath != null && - keystorePassword != null - ) { - cancel = false - runPatcher( - result, - patchBundleFilePath, - originalFilePath, - inputFilePath, - patchedFilePath, - outFilePath, - integrationsPath, - selectedPatches, - cacheDirPath, - keyStoreFilePath, - keystorePassword - ) - } else { - result.notImplemented() - } - } - "stopPatcher" -> { - cancel = true - stopResult = result - } - else -> result.notImplemented() - } - } - } - - private fun runPatcher( - result: MethodChannel.Result, - patchBundleFilePath: String, - originalFilePath: String, - inputFilePath: String, - patchedFilePath: String, - outFilePath: String, - integrationsPath: String, - selectedPatches: List<String>, - cacheDirPath: String, - keyStoreFilePath: String, - keystorePassword: String - ) { - val originalFile = File(originalFilePath) - val inputFile = File(inputFilePath) - val patchedFile = File(patchedFilePath) - val outFile = File(outFilePath) - val integrations = File(integrationsPath) - val keyStoreFile = File(keyStoreFilePath) - - Thread { - try { - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.1, - "header" to "", - "log" to "Copying original apk" - ) - ) - } - - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - - originalFile.copyTo(inputFile, true) - - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.2, - "header" to "Unpacking apk...", - "log" to "Unpacking input apk" - ) - ) - } - - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - - val patcher = - Patcher( - PatcherOptions( - inputFile, - cacheDirPath, - Aapt.binary(applicationContext).absolutePath, - cacheDirPath, - logger = ManagerLogger() - ) - ) - - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - - handler.post { - installerChannel.invokeMethod( - "update", - mapOf("progress" to 0.3, "header" to "", "log" to "") - ) - } - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.4, - "header" to "Merging integrations...", - "log" to "Merging integrations" - ) - ) - } - - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - - patcher.addIntegrations(listOf(integrations)) {} - - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.5, - "header" to "Applying patches...", - "log" to "" - ) - ) - } - - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - - val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) { - PatchBundle.Dex( - patchBundleFilePath, - DexClassLoader( - patchBundleFilePath, - cacheDirPath, - null, - javaClass.classLoader - ) - ).loadPatches().filter { patch -> - (patch.compatiblePackages?.any { it.name == patcher.context.packageMetadata.packageName } == true || patch.compatiblePackages.isNullOrEmpty()) && - selectedPatches.any { it == patch.patchName } - } - } else { - TODO("VERSION.SDK_INT < CUPCAKE") - } - - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - - patcher.addPatches(patches) - patcher.executePatches().forEach { (patch, res) -> - if (res.isSuccess) { - val msg = "Applied $patch" - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.5, - "header" to "", - "log" to msg - ) - ) - } - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - return@forEach - } - val msg = - "Failed to apply $patch: " + "${res.exceptionOrNull()!!.message ?: res.exceptionOrNull()!!.cause!!::class.simpleName}" - handler.post { - installerChannel.invokeMethod( - "update", - mapOf("progress" to 0.5, "header" to "", "log" to msg) - ) - } - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - } - - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.7, - "header" to "Repacking apk...", - "log" to "Repacking patched apk" - ) - ) - } - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - val res = patcher.save() - ZipFile(patchedFile).use { file -> - res.dexFiles.forEach { - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - file.addEntryCompressData( - ZipEntry.createWithName(it.name), - it.stream.readBytes() - ) - } - res.resourceFile?.let { - file.copyEntriesFromFileAligned( - ZipFile(it), - ZipAligner::getEntryAlignment - ) - } - file.copyEntriesFromFileAligned( - ZipFile(inputFile), - ZipAligner::getEntryAlignment - ) - } - if(cancel) { - handler.post { stopResult!!.success(null) } - return@Thread - } - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 0.9, - "header" to "Signing apk...", - "log" to "" - ) - ) - } - - try { - Signer("ReVanced", keystorePassword).signApk( - patchedFile, - outFile, - keyStoreFile - ) - } catch (e: Exception) { - //log to console - print("Error signing apk: ${e.message}") - e.printStackTrace() - } - - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to 1.0, - "header" to "Finished!", - "log" to "Finished!" - ) - ) - } - } catch (ex: Throwable) { - val stack = ex.stackTraceToString() - handler.post { - installerChannel.invokeMethod( - "update", - mapOf( - "progress" to -100.0, - "header" to "Aborted...", - "log" to "An error occurred! Aborted\nError:\n$stack" - ) - ) - } - } - handler.post { result.success(null) } - }.start() - } - - inner class ManagerLogger : Logger { - override fun error(msg: String) { - handler.post { - installerChannel - .invokeMethod( - "update", - mapOf("progress" to -1.0, "header" to "", "log" to msg) - ) - } - } - - override fun warn(msg: String) { - handler.post { - installerChannel.invokeMethod( - "update", - mapOf("progress" to -1.0, "header" to "", "log" to msg) - ) - } - } - - override fun info(msg: String) { - handler.post { - installerChannel.invokeMethod( - "update", - mapOf("progress" to -1.0, "header" to "", "log" to msg) - ) - } - } - - override fun trace(_msg: String) { /* unused */ - } - } -} diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/Aapt.kt b/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/Aapt.kt deleted file mode 100644 index 72198e58fa..0000000000 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/Aapt.kt +++ /dev/null @@ -1,12 +0,0 @@ -package app.revanced.manager.flutter.utils - -import android.content.Context -import java.io.File - -object Aapt { - fun binary(context: Context): File { - return File(context.applicationInfo.nativeLibraryDir).resolveAapt() - } -} - -private fun File.resolveAapt() = resolve(list { _, f -> !File(f).isDirectory && f.contains("aapt") }!!.first()) \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml deleted file mode 100644 index f74085f3f6..0000000000 --- a/android/app/src/main/res/drawable-v21/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Modify this file to customize your launch splash screen --> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="?android:colorBackground" /> - - <!-- You can insert your own image assets here --> - <!-- <item> - <bitmap - android:gravity="center" - android:src="@mipmap/launch_image" /> - </item> --> -</layer-list> diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f884..0000000000 --- a/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Modify this file to customize your launch splash screen --> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@android:color/white" /> - - <!-- You can insert your own image assets here --> - <!-- <item> - <bitmap - android:gravity="center" - android:src="@mipmap/launch_image" /> - </item> --> -</layer-list> diff --git a/android/app/src/main/res/values-night-v31/styles.xml b/android/app/src/main/res/values-night-v31/styles.xml deleted file mode 100644 index 581c5fca71..0000000000 --- a/android/app/src/main/res/values-night-v31/styles.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> - <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> - <!-- Show a splash screen on the activity. Automatically removed when - the Flutter engine draws its first frame --> - <item name="android:windowBackground">@drawable/launch_background</item> - <item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_round</item> - </style> - <!-- Theme applied to the Android Window as soon as the process has started. - This theme determines the color of the Android Window while your - Flutter UI initializes, as well as behind your Flutter UI while its - running. - - This Theme is only used starting with V2 of Flutter's Android embedding. --> - <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> - <item name="android:windowBackground">?android:colorBackground</item> - </style> -</resources> diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml deleted file mode 100644 index 06952be745..0000000000 --- a/android/app/src/main/res/values-night/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> - <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> - <!-- Show a splash screen on the activity. Automatically removed when - the Flutter engine draws its first frame --> - <item name="android:windowBackground">@drawable/launch_background</item> - </style> - <!-- Theme applied to the Android Window as soon as the process has started. - This theme determines the color of the Android Window while your - Flutter UI initializes, as well as behind your Flutter UI while its - running. - - This Theme is only used starting with V2 of Flutter's Android embedding. --> - <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> - <item name="android:windowBackground">?android:colorBackground</item> - </style> -</resources> diff --git a/android/app/src/main/res/values-v31/styles.xml b/android/app/src/main/res/values-v31/styles.xml deleted file mode 100644 index 41f95cf120..0000000000 --- a/android/app/src/main/res/values-v31/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> - <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> - <!-- Show a splash screen on the activity. Automatically removed when - the Flutter engine draws its first frame --> - <item name="android:windowBackground">@drawable/launch_background</item> - <item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_round</item> - </style> - <!-- Theme applied to the Android Window as soon as the process has started. - This theme determines the color of the Android Window while your - Flutter UI initializes, as well as behind your Flutter UI while its - running. - - This Theme is only used starting with V2 of Flutter's Android embedding. --> - <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> - <item name="android:windowBackground">?android:colorBackground</item> - </style> -</resources> - diff --git a/android/app/src/main/res/values/ic_launcher_background.xml b/android/app/src/main/res/values/ic_launcher_background.xml deleted file mode 100644 index 74008be87f..0000000000 --- a/android/app/src/main/res/values/ic_launcher_background.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <color name="ic_launcher_background">#1B1B1B</color> -</resources> \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml deleted file mode 100644 index cb1ef88056..0000000000 --- a/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> - <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> - <!-- Show a splash screen on the activity. Automatically removed when - the Flutter engine draws its first frame --> - <item name="android:windowBackground">@drawable/launch_background</item> - </style> - <!-- Theme applied to the Android Window as soon as the process has started. - This theme determines the color of the Android Window while your - Flutter UI initializes, as well as behind your Flutter UI while its - running. - - This Theme is only used starting with V2 of Flutter's Android embedding. --> - <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> - <item name="android:windowBackground">?android:colorBackground</item> - </style> -</resources> diff --git a/android/app/src/main/res/xml/file_paths.xml b/android/app/src/main/res/xml/file_paths.xml deleted file mode 100644 index d2e2c8deaf..0000000000 --- a/android/app/src/main/res/xml/file_paths.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<paths> - <cache-path name="cache" path="." /> -</paths> diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index 2abfc8e943..0000000000 --- a/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="app.revanced.manager.flutter"> - <uses-permission android:name="android.permission.INTERNET"/> -</manifest> diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 88ac491ced..0000000000 --- a/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - maven { - url = uri("https://maven.pkg.github.com/revanced/revanced-patcher") - credentials { - username = (project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")) as String - password = (project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")) as String - } - } - mavenLocal() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/android/gradle.properties b/android/gradle.properties deleted file mode 100644 index 4b11638cfe..0000000000 --- a/android/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -XX:+UseParallelGC -org.gradle.parallel=true -org.gradle.daemon=true -org.gradle.caching=true -android.useAndroidX=true -android.enableJetifier=true diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index 44e62bcf06..0000000000 --- a/android/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':app' - -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() - -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } - -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000000..981023fbe2 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,147 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.devtools) + alias(libs.plugins.about.libraries) + id("kotlin-parcelize") + kotlin("plugin.serialization") version "1.8.22" +} + +android { + namespace = "app.revanced.manager" + compileSdk = 33 + buildToolsVersion = "33.0.2" + + defaultConfig { + applicationId = "app.revanced.manager" + minSdk = 26 + targetSdk = 33 + versionCode = 1 + versionName = "0.0.1" + resourceConfigurations.addAll(listOf( + "en", + )) + + vectorDrawables.useSupportLibrary = true + } + + buildTypes { + release { + isMinifyEnabled = true + isShrinkResources = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + dependenciesInfo { + includeInApk = false + includeInBundle = false + } + packaging { + resources.excludes.addAll(listOf( + "/prebuilt/**", + "META-INF/DEPENDENCIES", + "META-INF/**.version", + "DebugProbesKt.bin", + "kotlin-tooling-metadata.json", + "org/bouncycastle/pqc/**.properties", + "org/bouncycastle/x509/**.properties", + )) + jniLibs { + useLegacyPackaging = true + } + } + + ksp { + arg("room.schemaLocation", "$projectDir/schemas") + } + + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures.compose = true + + composeOptions.kotlinCompilerExtensionVersion = "1.5.1" +} + +kotlin { + jvmToolchain(17) +} + +dependencies { + + // AndroidX Core + implementation(libs.androidx.ktx) + implementation(libs.runtime.ktx) + implementation(libs.runtime.compose) + implementation(libs.splash.screen) + implementation(libs.compose.activity) + implementation(libs.paging.common.ktx) + implementation(libs.work.runtime.ktx) + implementation(libs.preferences.datastore) + + // Compose + implementation(platform(libs.compose.bom)) + implementation(libs.compose.ui) + implementation(libs.compose.ui.preview) + implementation(libs.compose.livedata) + implementation(libs.compose.material.icons.extended) + implementation(libs.compose.material3) + + // Accompanist + implementation(libs.accompanist.drawablepainter) + implementation(libs.accompanist.webview) + implementation(libs.accompanist.placeholder) + + // HTML Scraper + implementation(libs.skrapeit.dsl) + implementation(libs.skrapeit.parser) + + // Coil (async image loading, network image) + implementation(libs.coil.compose) + implementation(libs.coil.appiconloader) + + // KotlinX + implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlinx.collection.immutable) + + // Room + implementation(libs.room.runtime) + implementation(libs.room.ktx) + annotationProcessor(libs.room.compiler) + ksp(libs.room.compiler) + + // ReVanced + implementation(libs.patcher) + + // Signing + implementation(libs.apksign) + implementation(libs.bcpkix.jdk18on) + + // Koin + implementation(libs.koin.android) + implementation(libs.koin.compose) + implementation(libs.koin.workmanager) + + // Compose Navigation + implementation(libs.reimagined.navigation) + + // Licenses + implementation(libs.about.libraries) + + // Ktor + implementation(libs.ktor.core) + implementation(libs.ktor.logging) + implementation(libs.ktor.okhttp) + implementation(libs.ktor.content.negotiation) + implementation(libs.ktor.serialization) + + // Markdown to HTML + implementation(libs.markdown) +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000000..5300a12057 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,53 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle.kts.kts. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +-dontobfuscate + +# Required for serialization to work properly +-if @kotlinx.serialization.Serializable class ** +-keepclassmembers class <1> { + static <1>$Companion Companion; +} +-if @kotlinx.serialization.Serializable class ** { + static **$* *; +} +-keepclassmembers class <2>$<3> { + kotlinx.serialization.KSerializer serializer(...); +} +-if @kotlinx.serialization.Serializable class ** { + public static ** INSTANCE; +} +-keepclassmembers class <1> { + public static <1> INSTANCE; + kotlinx.serialization.KSerializer serializer(...); +} + +# Required for the patcher to function correctly +-keep class app.revanced.patcher.** { + *; +} +-keep class brut.** { + *; +} +-keep class org.xmlpull.** { + *; +} +-keep class kotlin.** { + *; +} +-keep class org.jf.** { + *; +} +-keep class com.android.** { + *; +} +-dontwarn java.awt.** +-dontwarn javax.** +-dontwarn org.slf4j.** +-dontwarn it.skrape.fetcher.* + +-keepattributes RuntimeVisibleAnnotations,AnnotationDefault \ No newline at end of file diff --git a/app/schemas/app.revanced.manager.data.room.AppDatabase/1.json b/app/schemas/app.revanced.manager.data.room.AppDatabase/1.json new file mode 100644 index 0000000000..543d7a70ad --- /dev/null +++ b/app/schemas/app.revanced.manager.data.room.AppDatabase/1.json @@ -0,0 +1,306 @@ +{ + "formatVersion": 1, + "database": { + "version": 1, + "identityHash": "5515d164bc8f713201506d42a02d337f", + "entities": [ + { + "tableName": "patch_bundles", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uid` INTEGER NOT NULL, `name` TEXT NOT NULL, `source` TEXT NOT NULL, `auto_update` INTEGER NOT NULL, `version` TEXT, `integrations_version` TEXT, PRIMARY KEY(`uid`))", + "fields": [ + { + "fieldPath": "uid", + "columnName": "uid", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "source", + "columnName": "source", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "autoUpdate", + "columnName": "auto_update", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "versionInfo.patches", + "columnName": "version", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "versionInfo.integrations", + "columnName": "integrations_version", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uid" + ] + }, + "indices": [ + { + "name": "index_patch_bundles_name", + "unique": true, + "columnNames": [ + "name" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_patch_bundles_name` ON `${TABLE_NAME}` (`name`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "patch_selections", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uid` INTEGER NOT NULL, `patch_bundle` INTEGER NOT NULL, `package_name` TEXT NOT NULL, PRIMARY KEY(`uid`), FOREIGN KEY(`patch_bundle`) REFERENCES `patch_bundles`(`uid`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "uid", + "columnName": "uid", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "patchBundle", + "columnName": "patch_bundle", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "packageName", + "columnName": "package_name", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "uid" + ] + }, + "indices": [ + { + "name": "index_patch_selections_patch_bundle_package_name", + "unique": true, + "columnNames": [ + "patch_bundle", + "package_name" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_patch_selections_patch_bundle_package_name` ON `${TABLE_NAME}` (`patch_bundle`, `package_name`)" + } + ], + "foreignKeys": [ + { + "table": "patch_bundles", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "patch_bundle" + ], + "referencedColumns": [ + "uid" + ] + } + ] + }, + { + "tableName": "selected_patches", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`selection` INTEGER NOT NULL, `patch_name` TEXT NOT NULL, PRIMARY KEY(`selection`, `patch_name`), FOREIGN KEY(`selection`) REFERENCES `patch_selections`(`uid`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "selection", + "columnName": "selection", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "patchName", + "columnName": "patch_name", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "selection", + "patch_name" + ] + }, + "indices": [], + "foreignKeys": [ + { + "table": "patch_selections", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "selection" + ], + "referencedColumns": [ + "uid" + ] + } + ] + }, + { + "tableName": "downloaded_app", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`package_name` TEXT NOT NULL, `version` TEXT NOT NULL, `file` TEXT NOT NULL, PRIMARY KEY(`package_name`, `version`))", + "fields": [ + { + "fieldPath": "packageName", + "columnName": "package_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "version", + "columnName": "version", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "file", + "columnName": "file", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "package_name", + "version" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "installed_app", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`current_package_name` TEXT NOT NULL, `original_package_name` TEXT NOT NULL, `version` TEXT NOT NULL, `install_type` TEXT NOT NULL, PRIMARY KEY(`current_package_name`))", + "fields": [ + { + "fieldPath": "currentPackageName", + "columnName": "current_package_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "originalPackageName", + "columnName": "original_package_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "version", + "columnName": "version", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "installType", + "columnName": "install_type", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "current_package_name" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "applied_patch", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`package_name` TEXT NOT NULL, `bundle` INTEGER NOT NULL, `patch_name` TEXT NOT NULL, PRIMARY KEY(`package_name`, `bundle`, `patch_name`), FOREIGN KEY(`package_name`) REFERENCES `installed_app`(`current_package_name`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`bundle`) REFERENCES `patch_bundles`(`uid`) ON UPDATE NO ACTION ON DELETE NO ACTION )", + "fields": [ + { + "fieldPath": "packageName", + "columnName": "package_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "bundle", + "columnName": "bundle", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "patchName", + "columnName": "patch_name", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "package_name", + "bundle", + "patch_name" + ] + }, + "indices": [ + { + "name": "index_applied_patch_bundle", + "unique": false, + "columnNames": [ + "bundle" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_applied_patch_bundle` ON `${TABLE_NAME}` (`bundle`)" + } + ], + "foreignKeys": [ + { + "table": "installed_app", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "package_name" + ], + "referencedColumns": [ + "current_package_name" + ] + }, + { + "table": "patch_bundles", + "onDelete": "NO ACTION", + "onUpdate": "NO ACTION", + "columns": [ + "bundle" + ], + "referencedColumns": [ + "uid" + ] + } + ] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5515d164bc8f713201506d42a02d337f')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..452c968a8d --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> + + <permission android:name="android.permission.QUERY_ALL_PACKAGES" + tools:ignore="ReservedSystemPermission" /> + + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> + <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" /> + <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> + <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="29" /> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" + tools:ignore="ScopedStorage" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + + <queries> + <intent> + <action android:name="android.intent.action.MAIN" /> + </intent> + </queries> + + <application + android:name=".ManagerApplication" + android:allowBackup="true" + android:dataExtractionRules="@xml/data_extraction_rules" + android:largeHeap="true" + android:fullBackupContent="@xml/backup_rules" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:supportsRtl="true" + android:theme="@style/Theme.ReVancedManager" + android:enableOnBackInvokedCallback="true" + tools:targetApi="33"> + + <activity + android:name=".MainActivity" + android:exported="true" + android:theme="@style/Theme.ReVancedManager"> + + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + <service android:name=".service.InstallService" /> + <service android:name=".service.UninstallService" /> + + <provider + android:name="androidx.startup.InitializationProvider" + android:authorities="${applicationId}.androidx-startup" + android:exported="false" + tools:node="merge"> + <meta-data + android:name="androidx.work.WorkManagerInitializer" + android:value="androidx.startup" + tools:node="remove" /> + </provider> + </application> +</manifest> \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/MainActivity.kt b/app/src/main/java/app/revanced/manager/MainActivity.kt new file mode 100644 index 0000000000..8fba9f6d8a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/MainActivity.kt @@ -0,0 +1,123 @@ +package app.revanced.manager + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.animation.ExperimentalAnimationApi +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.getValue +import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen +import app.revanced.manager.ui.component.AutoUpdatesDialog +import app.revanced.manager.ui.destination.Destination +import app.revanced.manager.ui.screen.AppInfoScreen +import app.revanced.manager.ui.screen.VersionSelectorScreen +import app.revanced.manager.ui.screen.AppSelectorScreen +import app.revanced.manager.ui.screen.DashboardScreen +import app.revanced.manager.ui.screen.InstallerScreen +import app.revanced.manager.ui.screen.PatchesSelectorScreen +import app.revanced.manager.ui.screen.SettingsScreen +import app.revanced.manager.ui.theme.ReVancedManagerTheme +import app.revanced.manager.ui.theme.Theme +import app.revanced.manager.ui.viewmodel.MainViewModel +import dev.olshevski.navigation.reimagined.AnimatedNavHost +import dev.olshevski.navigation.reimagined.NavBackHandler +import dev.olshevski.navigation.reimagined.navigate +import dev.olshevski.navigation.reimagined.pop +import dev.olshevski.navigation.reimagined.popUpTo +import dev.olshevski.navigation.reimagined.rememberNavController +import org.koin.androidx.compose.getViewModel +import org.koin.core.parameter.parametersOf +import org.koin.androidx.viewmodel.ext.android.getViewModel as getActivityViewModel + +class MainActivity : ComponentActivity() { + @ExperimentalAnimationApi + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + val vm: MainViewModel = getActivityViewModel() + + installSplashScreen() + + setContent { + val theme by vm.prefs.theme.getAsState() + val dynamicColor by vm.prefs.dynamicColor.getAsState() + + ReVancedManagerTheme( + darkTheme = theme == Theme.SYSTEM && isSystemInDarkTheme() || theme == Theme.DARK, + dynamicColor = dynamicColor + ) { + val navController = + rememberNavController<Destination>(startDestination = Destination.Dashboard) + + NavBackHandler(navController) + + val showAutoUpdatesDialog by vm.prefs.showAutoUpdatesDialog.getAsState() + if (showAutoUpdatesDialog) { + AutoUpdatesDialog(vm::applyAutoUpdatePrefs) + } + + AnimatedNavHost( + controller = navController + ) { destination -> + when (destination) { + is Destination.Dashboard -> DashboardScreen( + onSettingsClick = { navController.navigate(Destination.Settings) }, + onAppSelectorClick = { navController.navigate(Destination.AppSelector) }, + onAppClick = { installedApp -> navController.navigate(Destination.ApplicationInfo(installedApp)) } + ) + + is Destination.ApplicationInfo -> AppInfoScreen( + onPatchClick = { packageName, patchesSelection -> + navController.navigate(Destination.VersionSelector(packageName, patchesSelection)) + }, + onBackClick = { navController.pop() }, + viewModel = getViewModel { parametersOf(destination.installedApp) } + ) + + is Destination.Settings -> SettingsScreen( + onBackClick = { navController.pop() } + ) + + is Destination.AppSelector -> AppSelectorScreen( + onAppClick = { navController.navigate(Destination.VersionSelector(it)) }, + onStorageClick = { navController.navigate(Destination.PatchesSelector(it)) }, + onBackClick = { navController.pop() } + ) + + is Destination.VersionSelector -> VersionSelectorScreen( + onBackClick = { navController.pop() }, + onAppClick = { selectedApp -> + navController.navigate( + Destination.PatchesSelector( + selectedApp, + destination.patchesSelection + ) + ) + }, + viewModel = getViewModel { parametersOf(destination.packageName, destination.patchesSelection) } + ) + + is Destination.PatchesSelector -> PatchesSelectorScreen( + onBackClick = { navController.pop() }, + onPatchClick = { patches, options -> + navController.navigate( + Destination.Installer( + destination.selectedApp, + patches, + options + ) + ) + }, + vm = getViewModel { parametersOf(destination) } + ) + + is Destination.Installer -> InstallerScreen( + onBackClick = { navController.popUpTo { it is Destination.Dashboard } }, + vm = getViewModel { parametersOf(destination) } + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ManagerApplication.kt b/app/src/main/java/app/revanced/manager/ManagerApplication.kt new file mode 100644 index 0000000000..8f9393d670 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ManagerApplication.kt @@ -0,0 +1,63 @@ +package app.revanced.manager + +import android.app.Application +import app.revanced.manager.di.* +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.domain.repository.PatchBundleRepository +import kotlinx.coroutines.Dispatchers +import coil.Coil +import coil.ImageLoader +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.launch +import me.zhanghai.android.appiconloader.coil.AppIconFetcher +import me.zhanghai.android.appiconloader.coil.AppIconKeyer +import org.koin.android.ext.android.inject +import org.koin.android.ext.koin.androidContext +import org.koin.android.ext.koin.androidLogger +import org.koin.androidx.workmanager.koin.workManagerFactory +import org.koin.core.context.startKoin + +class ManagerApplication : Application() { + private val scope = MainScope() + private val prefs: PreferencesManager by inject() + private val patchBundleRepository: PatchBundleRepository by inject() + override fun onCreate() { + super.onCreate() + + startKoin { + androidContext(this@ManagerApplication) + androidLogger() + workManagerFactory() + modules( + httpModule, + preferencesModule, + repositoryModule, + serviceModule, + managerModule, + workerModule, + viewModelModule, + databaseModule, + ) + } + + val pixels = 512 + Coil.setImageLoader( + ImageLoader.Builder(this) + .components { + add(AppIconKeyer()) + add(AppIconFetcher.Factory(pixels, true, this@ManagerApplication)) + } + .build() + ) + + scope.launch { + prefs.preload() + } + scope.launch(Dispatchers.Default) { + with(patchBundleRepository) { + reload() + updateCheck() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/platform/FileSystem.kt b/app/src/main/java/app/revanced/manager/data/platform/FileSystem.kt new file mode 100644 index 0000000000..f037e8a6e6 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/platform/FileSystem.kt @@ -0,0 +1,27 @@ +package app.revanced.manager.data.platform + +import android.app.Application +import android.os.Build +import android.os.Environment +import android.Manifest +import android.content.pm.PackageManager +import androidx.activity.result.contract.ActivityResultContract +import androidx.activity.result.contract.ActivityResultContracts +import app.revanced.manager.util.RequestManageStorageContract + +class FileSystem(private val app: Application) { + val contentResolver = app.contentResolver // TODO: move Content Resolver operations to here. + + fun externalFilesDir() = Environment.getExternalStorageDirectory().toPath() + + private fun usesManagePermission() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R + + private val storagePermissionName = if (usesManagePermission()) Manifest.permission.MANAGE_EXTERNAL_STORAGE else Manifest.permission.READ_EXTERNAL_STORAGE + + fun permissionContract(): Pair<ActivityResultContract<String, Boolean>, String> { + val contract = if (usesManagePermission()) RequestManageStorageContract() else ActivityResultContracts.RequestPermission() + return contract to storagePermissionName + } + + fun hasStoragePermission() = if (usesManagePermission()) Environment.isExternalStorageManager() else app.checkSelfPermission(storagePermissionName) == PackageManager.PERMISSION_GRANTED +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/platform/NetworkInfo.kt b/app/src/main/java/app/revanced/manager/data/platform/NetworkInfo.kt new file mode 100644 index 0000000000..f5d3dd89bb --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/platform/NetworkInfo.kt @@ -0,0 +1,19 @@ +package app.revanced.manager.data.platform + +import android.app.Application +import android.net.ConnectivityManager +import android.net.NetworkCapabilities +import androidx.core.content.getSystemService + +class NetworkInfo(app: Application) { + private val connectivityManager = app.getSystemService<ConnectivityManager>()!! + + private fun getCapabilities() = connectivityManager.activeNetwork?.let { connectivityManager.getNetworkCapabilities(it) } + fun isConnected() = connectivityManager.activeNetwork != null + fun isUnmetered() = getCapabilities()?.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED) ?: true + + /** + * Returns true if it is safe to download large files. + */ + fun isSafe() = isConnected() && isUnmetered() +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/AppDatabase.kt b/app/src/main/java/app/revanced/manager/data/room/AppDatabase.kt new file mode 100644 index 0000000000..e1a0f81bd5 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/AppDatabase.kt @@ -0,0 +1,29 @@ +package app.revanced.manager.data.room + +import androidx.room.Database +import androidx.room.RoomDatabase +import androidx.room.TypeConverters +import app.revanced.manager.data.room.apps.downloaded.DownloadedAppDao +import app.revanced.manager.data.room.apps.downloaded.DownloadedApp +import app.revanced.manager.data.room.apps.installed.AppliedPatch +import app.revanced.manager.data.room.apps.installed.InstalledApp +import app.revanced.manager.data.room.apps.installed.InstalledAppDao +import app.revanced.manager.data.room.selection.PatchSelection +import app.revanced.manager.data.room.selection.SelectedPatch +import app.revanced.manager.data.room.selection.SelectionDao +import app.revanced.manager.data.room.bundles.PatchBundleDao +import app.revanced.manager.data.room.bundles.PatchBundleEntity +import kotlin.random.Random + +@Database(entities = [PatchBundleEntity::class, PatchSelection::class, SelectedPatch::class, DownloadedApp::class, InstalledApp::class, AppliedPatch::class], version = 1) +@TypeConverters(Converters::class) +abstract class AppDatabase : RoomDatabase() { + abstract fun patchBundleDao(): PatchBundleDao + abstract fun selectionDao(): SelectionDao + abstract fun downloadedAppDao(): DownloadedAppDao + abstract fun installedAppDao(): InstalledAppDao + + companion object { + fun generateUid() = Random.Default.nextInt() + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/Converters.kt b/app/src/main/java/app/revanced/manager/data/room/Converters.kt new file mode 100644 index 0000000000..f8aa073d73 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/Converters.kt @@ -0,0 +1,20 @@ +package app.revanced.manager.data.room + +import androidx.room.TypeConverter +import app.revanced.manager.data.room.bundles.Source +import io.ktor.http.* +import java.io.File + +class Converters { + @TypeConverter + fun sourceFromString(value: String) = Source.from(value) + + @TypeConverter + fun sourceToString(value: Source) = value.toString() + + @TypeConverter + fun fileFromString(value: String) = File(value) + + @TypeConverter + fun fileToString(file: File): String = file.absolutePath +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/apps/downloaded/DownloadedApp.kt b/app/src/main/java/app/revanced/manager/data/room/apps/downloaded/DownloadedApp.kt new file mode 100644 index 0000000000..a30063ffa4 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/apps/downloaded/DownloadedApp.kt @@ -0,0 +1,15 @@ +package app.revanced.manager.data.room.apps.downloaded + +import androidx.room.ColumnInfo +import androidx.room.Entity +import java.io.File + +@Entity( + tableName = "downloaded_app", + primaryKeys = ["package_name", "version"] +) +data class DownloadedApp( + @ColumnInfo(name = "package_name") val packageName: String, + @ColumnInfo(name = "version") val version: String, + @ColumnInfo(name = "file") val file: File, +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/apps/downloaded/DownloadedAppDao.kt b/app/src/main/java/app/revanced/manager/data/room/apps/downloaded/DownloadedAppDao.kt new file mode 100644 index 0000000000..4f4d96237a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/apps/downloaded/DownloadedAppDao.kt @@ -0,0 +1,22 @@ +package app.revanced.manager.data.room.apps.downloaded + +import androidx.room.Dao +import androidx.room.Delete +import androidx.room.Insert +import androidx.room.Query +import kotlinx.coroutines.flow.Flow + +@Dao +interface DownloadedAppDao { + @Query("SELECT * FROM downloaded_app") + fun getAllApps(): Flow<List<DownloadedApp>> + + @Query("SELECT * FROM downloaded_app WHERE package_name = :packageName AND version = :version") + suspend fun get(packageName: String, version: String): DownloadedApp? + + @Insert + suspend fun insert(downloadedApp: DownloadedApp) + + @Delete + suspend fun delete(downloadedApps: Collection<DownloadedApp>) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/apps/installed/AppliedPatch.kt b/app/src/main/java/app/revanced/manager/data/room/apps/installed/AppliedPatch.kt new file mode 100644 index 0000000000..6feb04ed49 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/apps/installed/AppliedPatch.kt @@ -0,0 +1,34 @@ +package app.revanced.manager.data.room.apps.installed + +import android.os.Parcelable +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.ForeignKey +import androidx.room.Index +import app.revanced.manager.data.room.bundles.PatchBundleEntity +import kotlinx.parcelize.Parcelize + +@Parcelize +@Entity( + tableName = "applied_patch", + primaryKeys = ["package_name", "bundle", "patch_name"], + foreignKeys = [ + ForeignKey( + InstalledApp::class, + parentColumns = ["current_package_name"], + childColumns = ["package_name"], + onDelete = ForeignKey.CASCADE + ), + ForeignKey( + PatchBundleEntity::class, + parentColumns = ["uid"], + childColumns = ["bundle"] + ) + ], + indices = [Index(value = ["bundle"], unique = false)] +) +data class AppliedPatch( + @ColumnInfo(name = "package_name") val packageName: String, + @ColumnInfo(name = "bundle") val bundle: Int, + @ColumnInfo(name = "patch_name") val patchName: String +) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledApp.kt b/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledApp.kt new file mode 100644 index 0000000000..ad7033ddfe --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledApp.kt @@ -0,0 +1,23 @@ +package app.revanced.manager.data.room.apps.installed + +import android.os.Parcelable +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.PrimaryKey +import app.revanced.manager.R +import kotlinx.parcelize.Parcelize + +enum class InstallType(val stringResource: Int) { + DEFAULT(R.string.default_install), + ROOT(R.string.root_install) +} + +@Parcelize +@Entity(tableName = "installed_app") +data class InstalledApp( + @PrimaryKey + @ColumnInfo(name = "current_package_name") val currentPackageName: String, + @ColumnInfo(name = "original_package_name") val originalPackageName: String, + @ColumnInfo(name = "version") val version: String, + @ColumnInfo(name = "install_type") val installType: InstallType +) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledAppDao.kt b/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledAppDao.kt new file mode 100644 index 0000000000..7117249323 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledAppDao.kt @@ -0,0 +1,40 @@ +package app.revanced.manager.data.room.apps.installed + +import androidx.room.Dao +import androidx.room.Delete +import androidx.room.Insert +import androidx.room.MapInfo +import androidx.room.Query +import androidx.room.Transaction +import kotlinx.coroutines.flow.Flow + +@Dao +interface InstalledAppDao { + @Query("SELECT * FROM installed_app") + fun getAll(): Flow<List<InstalledApp>> + + @Query("SELECT * FROM installed_app WHERE current_package_name = :packageName") + suspend fun get(packageName: String): InstalledApp? + + @MapInfo(keyColumn = "bundle", valueColumn = "patch_name") + @Query( + "SELECT bundle, patch_name FROM applied_patch" + + " WHERE package_name = :packageName" + ) + suspend fun getPatchesSelection(packageName: String): Map<Int, List<String>> + + @Transaction + suspend fun insertApp(installedApp: InstalledApp, appliedPatches: List<AppliedPatch>) { + insertApp(installedApp) + insertAppliedPatches(appliedPatches) + } + + @Insert + suspend fun insertApp(installedApp: InstalledApp) + + @Insert + suspend fun insertAppliedPatches(appliedPatches: List<AppliedPatch>) + + @Delete + suspend fun delete(installedApp: InstalledApp) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/bundles/PatchBundleDao.kt b/app/src/main/java/app/revanced/manager/data/room/bundles/PatchBundleDao.kt new file mode 100644 index 0000000000..28f54e5c07 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/bundles/PatchBundleDao.kt @@ -0,0 +1,34 @@ +package app.revanced.manager.data.room.bundles + +import androidx.room.* +import kotlinx.coroutines.flow.Flow + +@Dao +interface PatchBundleDao { + @Query("SELECT * FROM patch_bundles") + suspend fun all(): List<PatchBundleEntity> + + @Query("SELECT version, integrations_version, auto_update FROM patch_bundles WHERE uid = :uid") + fun getPropsById(uid: Int): Flow<BundleProperties> + + @Query("UPDATE patch_bundles SET version = :patches, integrations_version = :integrations WHERE uid = :uid") + suspend fun updateVersion(uid: Int, patches: String?, integrations: String?) + + @Query("UPDATE patch_bundles SET auto_update = :value WHERE uid = :uid") + suspend fun setAutoUpdate(uid: Int, value: Boolean) + + @Query("DELETE FROM patch_bundles WHERE uid != 0") + suspend fun purgeCustomBundles() + + @Transaction + suspend fun reset() { + purgeCustomBundles() + updateVersion(0, null, null) // Reset the main source + } + + @Query("DELETE FROM patch_bundles WHERE uid = :uid") + suspend fun remove(uid: Int) + + @Insert + suspend fun add(source: PatchBundleEntity) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/bundles/PatchBundleEntity.kt b/app/src/main/java/app/revanced/manager/data/room/bundles/PatchBundleEntity.kt new file mode 100644 index 0000000000..e9869de9f4 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/bundles/PatchBundleEntity.kt @@ -0,0 +1,49 @@ +package app.revanced.manager.data.room.bundles + +import androidx.room.* +import io.ktor.http.* + +sealed class Source { + object Local : Source() { + const val SENTINEL = "local" + + override fun toString() = SENTINEL + } + + object API : Source() { + const val SENTINEL = "api" + + override fun toString() = SENTINEL + } + + data class Remote(val url: Url) : Source() { + override fun toString() = url.toString() + } + + companion object { + fun from(value: String) = when(value) { + Local.SENTINEL -> Local + API.SENTINEL -> API + else -> Remote(Url(value)) + } + } +} + +data class VersionInfo( + @ColumnInfo(name = "version") val patches: String? = null, + @ColumnInfo(name = "integrations_version") val integrations: String? = null, +) + +@Entity(tableName = "patch_bundles", indices = [Index(value = ["name"], unique = true)]) +data class PatchBundleEntity( + @PrimaryKey val uid: Int, + @ColumnInfo(name = "name") val name: String, + @Embedded val versionInfo: VersionInfo, + @ColumnInfo(name = "source") val source: Source, + @ColumnInfo(name = "auto_update") val autoUpdate: Boolean +) + +data class BundleProperties( + @Embedded val versionInfo: VersionInfo, + @ColumnInfo(name = "auto_update") val autoUpdate: Boolean +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/selection/PatchSelection.kt b/app/src/main/java/app/revanced/manager/data/room/selection/PatchSelection.kt new file mode 100644 index 0000000000..02f5ab94d3 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/selection/PatchSelection.kt @@ -0,0 +1,24 @@ +package app.revanced.manager.data.room.selection + +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.ForeignKey +import androidx.room.Index +import androidx.room.PrimaryKey +import app.revanced.manager.data.room.bundles.PatchBundleEntity + +@Entity( + tableName = "patch_selections", + foreignKeys = [ForeignKey( + PatchBundleEntity::class, + parentColumns = ["uid"], + childColumns = ["patch_bundle"], + onDelete = ForeignKey.CASCADE + )], + indices = [Index(value = ["patch_bundle", "package_name"], unique = true)] +) +data class PatchSelection( + @PrimaryKey val uid: Int, + @ColumnInfo(name = "patch_bundle") val patchBundle: Int, + @ColumnInfo(name = "package_name") val packageName: String +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/selection/SelectedPatch.kt b/app/src/main/java/app/revanced/manager/data/room/selection/SelectedPatch.kt new file mode 100644 index 0000000000..c190364cf5 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/selection/SelectedPatch.kt @@ -0,0 +1,20 @@ +package app.revanced.manager.data.room.selection + +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.ForeignKey + +@Entity( + tableName = "selected_patches", + primaryKeys = ["selection", "patch_name"], + foreignKeys = [ForeignKey( + PatchSelection::class, + parentColumns = ["uid"], + childColumns = ["selection"], + onDelete = ForeignKey.CASCADE + )] +) +data class SelectedPatch( + @ColumnInfo(name = "selection") val selection: Int, + @ColumnInfo(name = "patch_name") val patchName: String +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/data/room/selection/SelectionDao.kt b/app/src/main/java/app/revanced/manager/data/room/selection/SelectionDao.kt new file mode 100644 index 0000000000..2e288d9793 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/data/room/selection/SelectionDao.kt @@ -0,0 +1,53 @@ +package app.revanced.manager.data.room.selection + +import androidx.room.Dao +import androidx.room.Insert +import androidx.room.MapInfo +import androidx.room.Query +import androidx.room.Transaction + +@Dao +abstract class SelectionDao { + @Transaction + @MapInfo(keyColumn = "patch_bundle", valueColumn = "patch_name") + @Query( + "SELECT patch_bundle, patch_name FROM patch_selections" + + " LEFT JOIN selected_patches ON uid = selected_patches.selection" + + " WHERE package_name = :packageName" + ) + abstract suspend fun getSelectedPatches(packageName: String): Map<Int, List<String>> + + @Transaction + @MapInfo(keyColumn = "package_name", valueColumn = "patch_name") + @Query( + "SELECT package_name, patch_name FROM patch_selections" + + " LEFT JOIN selected_patches ON uid = selected_patches.selection" + + " WHERE patch_bundle = :bundleUid" + ) + abstract suspend fun exportSelection(bundleUid: Int): Map<String, List<String>> + + @Query("SELECT uid FROM patch_selections WHERE patch_bundle = :bundleUid AND package_name = :packageName") + abstract suspend fun getSelectionId(bundleUid: Int, packageName: String): Int? + + @Insert + abstract suspend fun createSelection(selection: PatchSelection) + + @Query("DELETE FROM patch_selections WHERE patch_bundle = :uid") + abstract suspend fun clearForPatchBundle(uid: Int) + + @Query("DELETE FROM patch_selections") + abstract suspend fun reset() + + @Insert + protected abstract suspend fun selectPatches(patches: List<SelectedPatch>) + + @Query("DELETE FROM selected_patches WHERE selection = :selectionId") + protected abstract suspend fun clearSelection(selectionId: Int) + + @Transaction + open suspend fun updateSelections(selections: Map<Int, Set<String>>) = + selections.map { (selectionUid, patches) -> + clearSelection(selectionUid) + selectPatches(patches.map { SelectedPatch(selectionUid, it) }) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/di/DatabaseModule.kt b/app/src/main/java/app/revanced/manager/di/DatabaseModule.kt new file mode 100644 index 0000000000..37d8c05dd6 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/DatabaseModule.kt @@ -0,0 +1,15 @@ +package app.revanced.manager.di + +import android.content.Context +import androidx.room.Room +import app.revanced.manager.data.room.AppDatabase +import org.koin.android.ext.koin.androidContext +import org.koin.dsl.module + +val databaseModule = module { + fun provideAppDatabase(context: Context) = Room.databaseBuilder(context, AppDatabase::class.java, "manager").build() + + single { + provideAppDatabase(androidContext()) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/di/HttpModule.kt b/app/src/main/java/app/revanced/manager/di/HttpModule.kt new file mode 100644 index 0000000000..38621b0c43 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/HttpModule.kt @@ -0,0 +1,55 @@ +package app.revanced.manager.di + +import android.content.Context +import io.ktor.client.* +import io.ktor.client.engine.okhttp.* +import io.ktor.client.plugins.HttpTimeout +import io.ktor.client.plugins.contentnegotiation.* +import io.ktor.serialization.kotlinx.json.* +import kotlinx.serialization.json.Json +import okhttp3.Cache +import okhttp3.Dns +import org.koin.android.ext.koin.androidContext +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.module +import java.net.Inet4Address +import java.net.InetAddress + +val httpModule = module { + fun provideHttpClient(context: Context, json: Json) = HttpClient(OkHttp) { + engine { + config { + dns(object : Dns { + override fun lookup(hostname: String): List<InetAddress> { + val addresses = Dns.SYSTEM.lookup(hostname) + return if (hostname == "raw.githubusercontent.com") { + addresses.filterIsInstance<Inet4Address>() + } else { + addresses + } + } + }) + cache(Cache(context.cacheDir.resolve("cache").also { it.mkdirs() }, 1024 * 1024 * 100)) + followRedirects(true) + followSslRedirects(true) + } + } + install(ContentNegotiation) { + json(json) + } + install(HttpTimeout) { + socketTimeoutMillis = 10000 + } + } + + fun provideJson() = Json { + encodeDefaults = true + isLenient = true + ignoreUnknownKeys = true + } + + single { + provideHttpClient(androidContext(), get()) + } + singleOf(::provideJson) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/di/ManagerModule.kt b/app/src/main/java/app/revanced/manager/di/ManagerModule.kt new file mode 100644 index 0000000000..0aae1cd67f --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/ManagerModule.kt @@ -0,0 +1,11 @@ +package app.revanced.manager.di + +import app.revanced.manager.domain.manager.KeystoreManager +import app.revanced.manager.util.PM +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.module + +val managerModule = module { + singleOf(::KeystoreManager) + singleOf(::PM) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/di/PreferencesModule.kt b/app/src/main/java/app/revanced/manager/di/PreferencesModule.kt new file mode 100644 index 0000000000..029ef4ed0a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/PreferencesModule.kt @@ -0,0 +1,9 @@ +package app.revanced.manager.di + +import app.revanced.manager.domain.manager.PreferencesManager +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.module + +val preferencesModule = module { + singleOf(::PreferencesManager) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/di/RepositoryModule.kt b/app/src/main/java/app/revanced/manager/di/RepositoryModule.kt new file mode 100644 index 0000000000..37c152e54c --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/RepositoryModule.kt @@ -0,0 +1,22 @@ +package app.revanced.manager.di + +import app.revanced.manager.data.platform.FileSystem +import app.revanced.manager.data.platform.NetworkInfo +import app.revanced.manager.domain.repository.* +import app.revanced.manager.domain.worker.WorkerRepository +import app.revanced.manager.network.api.ReVancedAPI +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.module + +val repositoryModule = module { + singleOf(::ReVancedAPI) + singleOf(::GithubRepository) + singleOf(::FileSystem) + singleOf(::NetworkInfo) + singleOf(::PatchBundlePersistenceRepository) + singleOf(::PatchSelectionRepository) + singleOf(::PatchBundleRepository) + singleOf(::WorkerRepository) + singleOf(::DownloadedAppRepository) + singleOf(::InstalledAppRepository) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/di/ServiceModule.kt b/app/src/main/java/app/revanced/manager/di/ServiceModule.kt new file mode 100644 index 0000000000..78b99c2725 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/ServiceModule.kt @@ -0,0 +1,21 @@ +package app.revanced.manager.di + +import app.revanced.manager.network.service.GithubService +import app.revanced.manager.network.service.HttpService +import app.revanced.manager.network.service.ReVancedService +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.module + +val serviceModule = module { + fun provideReVancedService( + client: HttpService, + ): ReVancedService { + return ReVancedService( + client = client, + ) + } + + single { provideReVancedService(get()) } + singleOf(::HttpService) + singleOf(::GithubService) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/di/ViewModelModule.kt b/app/src/main/java/app/revanced/manager/di/ViewModelModule.kt new file mode 100644 index 0000000000..00ba56cffe --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/ViewModelModule.kt @@ -0,0 +1,24 @@ +package app.revanced.manager.di + +import app.revanced.manager.ui.viewmodel.* +import org.koin.androidx.viewmodel.dsl.viewModelOf +import org.koin.dsl.module + +val viewModelModule = module { + viewModelOf(::MainViewModel) + viewModelOf(::DashboardViewModel) + viewModelOf(::PatchesSelectorViewModel) + viewModelOf(::SettingsViewModel) + viewModelOf(::AdvancedSettingsViewModel) + viewModelOf(::AppSelectorViewModel) + viewModelOf(::VersionSelectorViewModel) + viewModelOf(::BundlesViewModel) + viewModelOf(::InstallerViewModel) + viewModelOf(::UpdateProgressViewModel) + viewModelOf(::ManagerUpdateChangelogViewModel) + viewModelOf(::ImportExportViewModel) + viewModelOf(::ContributorViewModel) + viewModelOf(::DownloadsViewModel) + viewModelOf(::InstalledAppsViewModel) + viewModelOf(::AppInfoViewModel) +} diff --git a/app/src/main/java/app/revanced/manager/di/WorkerModule.kt b/app/src/main/java/app/revanced/manager/di/WorkerModule.kt new file mode 100644 index 0000000000..d5d9112e9b --- /dev/null +++ b/app/src/main/java/app/revanced/manager/di/WorkerModule.kt @@ -0,0 +1,9 @@ +package app.revanced.manager.di + +import app.revanced.manager.patcher.worker.PatcherWorker +import org.koin.androidx.workmanager.dsl.workerOf +import org.koin.dsl.module + +val workerModule = module { + workerOf(::PatcherWorker) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/bundles/LocalPatchBundle.kt b/app/src/main/java/app/revanced/manager/domain/bundles/LocalPatchBundle.kt new file mode 100644 index 0000000000..43f86e723a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/bundles/LocalPatchBundle.kt @@ -0,0 +1,23 @@ +package app.revanced.manager.domain.bundles + +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import java.io.File +import java.io.InputStream +import java.nio.file.Files +import java.nio.file.StandardCopyOption + +class LocalPatchBundle(name: String, id: Int, directory: File) : PatchBundleSource(name, id, directory) { + suspend fun replace(patches: InputStream? = null, integrations: InputStream? = null) { + withContext(Dispatchers.IO) { + patches?.let { + Files.copy(it, patchesFile.toPath(), StandardCopyOption.REPLACE_EXISTING) + } + integrations?.let { + Files.copy(it, this@LocalPatchBundle.integrationsFile.toPath(), StandardCopyOption.REPLACE_EXISTING) + } + } + + reload() + } +} diff --git a/app/src/main/java/app/revanced/manager/domain/bundles/PatchBundleSource.kt b/app/src/main/java/app/revanced/manager/domain/bundles/PatchBundleSource.kt new file mode 100644 index 0000000000..f8b8e74c78 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/bundles/PatchBundleSource.kt @@ -0,0 +1,55 @@ +package app.revanced.manager.domain.bundles + +import androidx.compose.runtime.Stable +import app.revanced.manager.patcher.patch.PatchBundle +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.flowOf +import java.io.File + +/** + * A [PatchBundle] source. + */ +@Stable +sealed class PatchBundleSource(val name: String, val uid: Int, directory: File) { + protected val patchesFile = directory.resolve("patches.jar") + protected val integrationsFile = directory.resolve("integrations.apk") + + private val _state = MutableStateFlow(load()) + val state = _state.asStateFlow() + + /** + * Returns true if the bundle has been downloaded to local storage. + */ + fun hasInstalled() = patchesFile.exists() + + private fun load(): State { + if (!hasInstalled()) return State.Missing + + return try { + State.Loaded(PatchBundle(patchesFile, integrationsFile.takeIf(File::exists))) + } catch (t: Throwable) { + State.Failed(t) + } + } + + fun reload() { + _state.value = load() + } + + sealed interface State { + fun patchBundleOrNull(): PatchBundle? = null + + object Missing : State + data class Failed(val throwable: Throwable) : State + data class Loaded(val bundle: PatchBundle) : State { + override fun patchBundleOrNull() = bundle + } + } + + companion object { + val PatchBundleSource.isDefault get() = uid == 0 + val PatchBundleSource.asRemoteOrNull get() = this as? RemotePatchBundle + fun PatchBundleSource.propsOrNullFlow() = asRemoteOrNull?.propsFlow() ?: flowOf(null) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/bundles/RemotePatchBundle.kt b/app/src/main/java/app/revanced/manager/domain/bundles/RemotePatchBundle.kt new file mode 100644 index 0000000000..93c945a88a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/bundles/RemotePatchBundle.kt @@ -0,0 +1,119 @@ +package app.revanced.manager.domain.bundles + +import androidx.compose.runtime.Stable +import app.revanced.manager.data.room.bundles.VersionInfo +import app.revanced.manager.domain.repository.PatchBundlePersistenceRepository +import app.revanced.manager.network.api.ReVancedAPI +import app.revanced.manager.network.api.ReVancedAPI.Extensions.findAssetByType +import app.revanced.manager.network.dto.BundleAsset +import app.revanced.manager.network.dto.BundleInfo +import app.revanced.manager.network.service.HttpService +import app.revanced.manager.network.utils.getOrThrow +import app.revanced.manager.util.APK_MIMETYPE +import app.revanced.manager.util.JAR_MIMETYPE +import io.ktor.client.request.url +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject +import java.io.File + +@Stable +sealed class RemotePatchBundle(name: String, id: Int, directory: File, val endpoint: String) : + PatchBundleSource(name, id, directory), KoinComponent { + private val configRepository: PatchBundlePersistenceRepository by inject() + protected val http: HttpService by inject() + + protected abstract suspend fun getLatestInfo(): BundleInfo + + private suspend fun download(info: BundleInfo) = withContext(Dispatchers.IO) { + val (patches, integrations) = info + coroutineScope { + mapOf( + patches.url to patchesFile, + integrations.url to integrationsFile + ).forEach { (asset, file) -> + launch { + http.download(file) { + url(asset) + } + } + } + } + + saveVersion(patches.version, integrations.version) + reload() + } + + suspend fun downloadLatest() { + download(getLatestInfo()) + } + + suspend fun update(): Boolean = withContext(Dispatchers.IO) { + val info = getLatestInfo() + if (hasInstalled() && VersionInfo( + info.patches.version, + info.integrations.version + ) == currentVersion() + ) { + return@withContext false + } + + download(info) + true + } + + private suspend fun currentVersion() = configRepository.getProps(uid).first().versionInfo + private suspend fun saveVersion(patches: String, integrations: String) = + configRepository.updateVersion(uid, patches, integrations) + + suspend fun deleteLocalFiles() = withContext(Dispatchers.Default) { + arrayOf(patchesFile, integrationsFile).forEach(File::delete) + reload() + } + + fun propsFlow() = configRepository.getProps(uid) + + suspend fun setAutoUpdate(value: Boolean) = configRepository.setAutoUpdate(uid, value) + + companion object { + const val updateFailMsg = "Failed to update patch bundle(s)" + } +} + +class JsonPatchBundle(name: String, id: Int, directory: File, endpoint: String) : + RemotePatchBundle(name, id, directory, endpoint) { + override suspend fun getLatestInfo() = withContext(Dispatchers.IO) { + http.request<BundleInfo> { + url(endpoint) + }.getOrThrow() + } +} + +class APIPatchBundle(name: String, id: Int, directory: File, endpoint: String) : + RemotePatchBundle(name, id, directory, endpoint) { + private val api: ReVancedAPI by inject() + + override suspend fun getLatestInfo() = coroutineScope { + fun getAssetAsync(repo: String, mime: String) = async(Dispatchers.IO) { + api + .getRelease(repo) + .getOrThrow() + .let { + BundleAsset(it.metadata.tag, it.findAssetByType(mime).downloadUrl) + } + } + + val patches = getAssetAsync("revanced-patches", JAR_MIMETYPE) + val integrations = getAssetAsync("revanced-integrations", APK_MIMETYPE) + + BundleInfo( + patches.await(), + integrations.await() + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/manager/KeystoreManager.kt b/app/src/main/java/app/revanced/manager/domain/manager/KeystoreManager.kt new file mode 100644 index 0000000000..4362caa523 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/manager/KeystoreManager.kt @@ -0,0 +1,69 @@ +package app.revanced.manager.domain.manager + +import android.app.Application +import android.content.Context +import app.revanced.manager.util.signing.Signer +import app.revanced.manager.util.signing.SigningOptions +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import java.io.File +import java.io.OutputStream +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardCopyOption +import kotlin.io.path.exists + +class KeystoreManager(app: Application, private val prefs: PreferencesManager) { + companion object { + /** + * Default alias and password for the keystore. + */ + const val DEFAULT = "ReVanced" + } + + private val keystorePath = + app.getDir("signing", Context.MODE_PRIVATE).resolve("manager.keystore").toPath() + + private suspend fun updatePrefs(cn: String, pass: String) = prefs.edit { + prefs.keystoreCommonName.value = cn + prefs.keystorePass.value = pass + } + + suspend fun sign(input: File, output: File) = withContext(Dispatchers.Default) { + Signer( + SigningOptions( + prefs.keystoreCommonName.get(), + prefs.keystorePass.get(), + keystorePath + ) + ).signApk( + input, + output + ) + } + + suspend fun regenerate() = withContext(Dispatchers.Default) { + Signer(SigningOptions(DEFAULT, DEFAULT, keystorePath)).regenerateKeystore() + updatePrefs(DEFAULT, DEFAULT) + } + + suspend fun import(cn: String, pass: String, keystore: Path): Boolean { + if (!Signer(SigningOptions(cn, pass, keystore)).canUnlock()) { + return false + } + withContext(Dispatchers.IO) { + Files.copy(keystore, keystorePath, StandardCopyOption.REPLACE_EXISTING) + } + + updatePrefs(cn, pass) + return true + } + + fun hasKeystore() = keystorePath.exists() + + suspend fun export(target: OutputStream) { + withContext(Dispatchers.IO) { + Files.copy(keystorePath, target) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/manager/PreferencesManager.kt b/app/src/main/java/app/revanced/manager/domain/manager/PreferencesManager.kt new file mode 100644 index 0000000000..34d7af60e0 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/manager/PreferencesManager.kt @@ -0,0 +1,24 @@ +package app.revanced.manager.domain.manager + +import android.content.Context +import app.revanced.manager.domain.manager.base.BasePreferencesManager +import app.revanced.manager.ui.theme.Theme + +class PreferencesManager( + context: Context +) : BasePreferencesManager(context, "settings") { + val dynamicColor = booleanPreference("dynamic_color", true) + val theme = enumPreference("theme", Theme.SYSTEM) + + val api = stringPreference("api_url", "https://api.revanced.app") + + val allowExperimental = booleanPreference("allow_experimental", false) + + val keystoreCommonName = stringPreference("keystore_cn", KeystoreManager.DEFAULT) + val keystorePass = stringPreference("keystore_pass", KeystoreManager.DEFAULT) + + val preferSplits = booleanPreference("prefer_splits", false) + + val showAutoUpdatesDialog = booleanPreference("show_auto_updates_dialog", true) + val managerAutoUpdates = booleanPreference("manager_auto_updates", false) +} diff --git a/app/src/main/java/app/revanced/manager/domain/manager/base/BasePreferencesManager.kt b/app/src/main/java/app/revanced/manager/domain/manager/base/BasePreferencesManager.kt new file mode 100644 index 0000000000..57810a05e4 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/manager/base/BasePreferencesManager.kt @@ -0,0 +1,133 @@ +package app.revanced.manager.domain.manager.base + +import android.content.Context +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.datastore.core.DataStore +import androidx.datastore.preferences.core.* +import androidx.datastore.preferences.preferencesDataStore +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.domain.manager.base.BasePreferencesManager.Companion.editor +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.runBlocking + +abstract class BasePreferencesManager(private val context: Context, name: String) { + private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = name) + protected val dataStore get() = context.dataStore + + suspend fun preload() { + dataStore.data.first() + } + + suspend fun edit(block: EditorContext.() -> Unit) = dataStore.editor(block) + + protected fun stringPreference(key: String, default: String) = + StringPreference(dataStore, key, default) + + protected fun booleanPreference(key: String, default: Boolean) = + BooleanPreference(dataStore, key, default) + + protected fun intPreference(key: String, default: Int) = IntPreference(dataStore, key, default) + + protected fun floatPreference(key: String, default: Float) = + FloatPreference(dataStore, key, default) + + protected inline fun <reified E : Enum<E>> enumPreference( + key: String, + default: E + ) = EnumPreference(dataStore, key, default, enumValues()) + + companion object { + suspend inline fun DataStore<Preferences>.editor(crossinline block: EditorContext.() -> Unit) { + edit { + EditorContext(it).run(block) + } + } + } +} + +class EditorContext(private val prefs: MutablePreferences) { + var <T> Preference<T>.value + get() = prefs.run { read() } + set(value) = prefs.run { write(value) } +} + +abstract class Preference<T>( + private val dataStore: DataStore<Preferences>, + protected val default: T +) { + internal abstract fun Preferences.read(): T + internal abstract fun MutablePreferences.write(value: T) + + val flow = dataStore.data.map { with(it) { read() } ?: default }.distinctUntilChanged() + + suspend fun get() = flow.first() + fun getBlocking() = runBlocking { get() } + @Composable + fun getAsState() = flow.collectAsStateWithLifecycle(initialValue = remember { + getBlocking() + }) + suspend fun update(value: T) = dataStore.editor { + this@Preference.value = value + } +} + +class EnumPreference<E : Enum<E>>( + dataStore: DataStore<Preferences>, + key: String, + default: E, + private val enumValues: Array<E> +) : Preference<E>(dataStore, default) { + private val key = stringPreferencesKey(key) + override fun Preferences.read() = + this[key]?.let { name -> + enumValues.find { it.name == name } + } ?: default + + override fun MutablePreferences.write(value: E) { + this[key] = value.name + } +} + +abstract class BasePreference<T>(dataStore: DataStore<Preferences>, default: T) : + Preference<T>(dataStore, default) { + protected abstract val key: Preferences.Key<T> + override fun Preferences.read() = this[key] ?: default + override fun MutablePreferences.write(value: T) { + this[key] = value + } +} + +class StringPreference( + dataStore: DataStore<Preferences>, + key: String, + default: String +) : BasePreference<String>(dataStore, default) { + override val key = stringPreferencesKey(key) +} + +class BooleanPreference( + dataStore: DataStore<Preferences>, + key: String, + default: Boolean +) : BasePreference<Boolean>(dataStore, default) { + override val key = booleanPreferencesKey(key) +} + +class IntPreference( + dataStore: DataStore<Preferences>, + key: String, + default: Int +) : BasePreference<Int>(dataStore, default) { + override val key = intPreferencesKey(key) +} + +class FloatPreference( + dataStore: DataStore<Preferences>, + key: String, + default: Float +) : BasePreference<Float>(dataStore, default) { + override val key = floatPreferencesKey(key) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/repository/DownloadedAppRepository.kt b/app/src/main/java/app/revanced/manager/domain/repository/DownloadedAppRepository.kt new file mode 100644 index 0000000000..7035c6c4ba --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/repository/DownloadedAppRepository.kt @@ -0,0 +1,36 @@ +package app.revanced.manager.domain.repository + +import app.revanced.manager.data.room.AppDatabase +import app.revanced.manager.data.room.apps.downloaded.DownloadedApp +import kotlinx.coroutines.flow.distinctUntilChanged +import java.io.File + +class DownloadedAppRepository( + db: AppDatabase +) { + private val dao = db.downloadedAppDao() + + fun getAll() = dao.getAllApps().distinctUntilChanged() + + suspend fun get(packageName: String, version: String) = dao.get(packageName, version) + + suspend fun add( + packageName: String, + version: String, + file: File + ) = dao.insert( + DownloadedApp( + packageName = packageName, + version = version, + file = file + ) + ) + + suspend fun delete(downloadedApps: Collection<DownloadedApp>) { + downloadedApps.forEach { + it.file.deleteRecursively() + } + + dao.delete(downloadedApps) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/repository/GithubRepository.kt b/app/src/main/java/app/revanced/manager/domain/repository/GithubRepository.kt new file mode 100644 index 0000000000..79587dfca4 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/repository/GithubRepository.kt @@ -0,0 +1,8 @@ +package app.revanced.manager.domain.repository + +import app.revanced.manager.network.service.GithubService + +// TODO: delete this when the revanced api adds download count. +class GithubRepository(private val service: GithubService) { + suspend fun getChangelog(repo: String) = service.getChangelog(repo) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/repository/InstalledAppRepository.kt b/app/src/main/java/app/revanced/manager/domain/repository/InstalledAppRepository.kt new file mode 100644 index 0000000000..99a37ed957 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/repository/InstalledAppRepository.kt @@ -0,0 +1,51 @@ +package app.revanced.manager.domain.repository + +import app.revanced.manager.data.room.AppDatabase +import app.revanced.manager.data.room.apps.installed.AppliedPatch +import app.revanced.manager.data.room.apps.installed.InstallType +import app.revanced.manager.data.room.apps.installed.InstalledApp +import app.revanced.manager.util.PatchesSelection +import kotlinx.coroutines.flow.distinctUntilChanged + +class InstalledAppRepository( + db: AppDatabase +) { + private val dao = db.installedAppDao() + + fun getAll() = dao.getAll().distinctUntilChanged() + + suspend fun get(packageName: String) = dao.get(packageName) + + suspend fun getAppliedPatches(packageName: String): PatchesSelection = + dao.getPatchesSelection(packageName).mapValues { (_, patches) -> patches.toSet() } + + suspend fun add( + currentPackageName: String, + originalPackageName: String, + version: String, + installType: InstallType, + patchesSelection: PatchesSelection + ) { + dao.insertApp( + InstalledApp( + currentPackageName = currentPackageName, + originalPackageName = originalPackageName, + version = version, + installType = installType + ), + patchesSelection.flatMap { (uid, patches) -> + patches.map { patch -> + AppliedPatch( + packageName = currentPackageName, + bundle = uid, + patchName = patch + ) + } + } + ) + } + + suspend fun delete(installedApp: InstalledApp) { + dao.delete(installedApp) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/repository/PatchBundlePersistenceRepository.kt b/app/src/main/java/app/revanced/manager/domain/repository/PatchBundlePersistenceRepository.kt new file mode 100644 index 0000000000..8ea5733ddb --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/repository/PatchBundlePersistenceRepository.kt @@ -0,0 +1,56 @@ +package app.revanced.manager.domain.repository + +import app.revanced.manager.data.room.AppDatabase +import app.revanced.manager.data.room.AppDatabase.Companion.generateUid +import app.revanced.manager.data.room.bundles.PatchBundleEntity +import app.revanced.manager.data.room.bundles.Source +import app.revanced.manager.data.room.bundles.VersionInfo +import io.ktor.http.* +import kotlinx.coroutines.flow.distinctUntilChanged + +class PatchBundlePersistenceRepository(db: AppDatabase) { + private val dao = db.patchBundleDao() + + suspend fun loadConfiguration(): List<PatchBundleEntity> { + val all = dao.all() + if (all.isEmpty()) { + dao.add(defaultSource) + return listOf(defaultSource) + } + + return all + } + + suspend fun reset() = dao.reset() + + + suspend fun create(name: String, source: Source, autoUpdate: Boolean = false) = + PatchBundleEntity( + uid = generateUid(), + name = name, + versionInfo = VersionInfo(), + source = source, + autoUpdate = autoUpdate + ).also { + dao.add(it) + } + + suspend fun delete(uid: Int) = dao.remove(uid) + + suspend fun updateVersion(uid: Int, patches: String, integrations: String) = + dao.updateVersion(uid, patches, integrations) + + suspend fun setAutoUpdate(uid: Int, value: Boolean) = dao.setAutoUpdate(uid, value) + + fun getProps(id: Int) = dao.getPropsById(id).distinctUntilChanged() + + private companion object { + val defaultSource = PatchBundleEntity( + uid = 0, + name = "Main", + versionInfo = VersionInfo(), + source = Source.API, + autoUpdate = false + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/repository/PatchBundleRepository.kt b/app/src/main/java/app/revanced/manager/domain/repository/PatchBundleRepository.kt new file mode 100644 index 0000000000..ffdf7d1314 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/repository/PatchBundleRepository.kt @@ -0,0 +1,143 @@ +package app.revanced.manager.domain.repository + +import android.app.Application +import android.content.Context +import android.util.Log +import app.revanced.manager.data.platform.NetworkInfo +import app.revanced.manager.data.room.bundles.PatchBundleEntity +import app.revanced.manager.domain.bundles.APIPatchBundle +import app.revanced.manager.domain.bundles.JsonPatchBundle +import app.revanced.manager.data.room.bundles.Source as SourceInfo +import app.revanced.manager.domain.bundles.LocalPatchBundle +import app.revanced.manager.domain.bundles.RemotePatchBundle +import app.revanced.manager.domain.bundles.PatchBundleSource +import app.revanced.manager.util.flatMapLatestAndCombine +import app.revanced.manager.util.tag +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch +import kotlinx.coroutines.supervisorScope +import kotlinx.coroutines.withContext +import java.io.InputStream + +class PatchBundleRepository( + app: Application, + private val persistenceRepo: PatchBundlePersistenceRepository, + private val networkInfo: NetworkInfo, +) { + private val bundlesDir = app.getDir("patch_bundles", Context.MODE_PRIVATE) + + private val _sources: MutableStateFlow<Map<Int, PatchBundleSource>> = + MutableStateFlow(emptyMap()) + val sources = _sources.map { it.values.toList() } + + val bundles = sources.flatMapLatestAndCombine( + combiner = { + it.mapNotNull { (uid, state) -> + val bundle = state.patchBundleOrNull() ?: return@mapNotNull null + uid to bundle + }.toMap() + } + ) { + it.state.map { state -> it.uid to state } + } + + /** + * Get the directory of the [PatchBundleSource] with the specified [uid], creating it if needed. + */ + private fun directoryOf(uid: Int) = bundlesDir.resolve(uid.toString()).also { it.mkdirs() } + + private fun PatchBundleEntity.load(): PatchBundleSource { + val dir = directoryOf(uid) + + return when (source) { + is SourceInfo.Local -> LocalPatchBundle(name, uid, dir) + is SourceInfo.API -> APIPatchBundle(name, uid, dir, SourceInfo.API.SENTINEL) + is SourceInfo.Remote -> JsonPatchBundle( + name, + uid, + dir, + source.url.toString() + ) + } + } + + suspend fun reload() = withContext(Dispatchers.Default) { + val entities = persistenceRepo.loadConfiguration().onEach { + Log.d(tag, "Bundle: $it") + } + + _sources.value = entities.associate { + it.uid to it.load() + } + } + + suspend fun reset() = withContext(Dispatchers.Default) { + persistenceRepo.reset() + _sources.value = emptyMap() + bundlesDir.apply { + deleteRecursively() + mkdirs() + } + + reload() + } + + suspend fun remove(bundle: PatchBundleSource) = withContext(Dispatchers.Default) { + persistenceRepo.delete(bundle.uid) + directoryOf(bundle.uid).deleteRecursively() + + _sources.update { + it.filterKeys { key -> + key != bundle.uid + } + } + } + + private fun addBundle(patchBundle: PatchBundleSource) = + _sources.update { it.toMutableMap().apply { put(patchBundle.uid, patchBundle) } } + + suspend fun createLocal(name: String, patches: InputStream, integrations: InputStream?) { + val id = persistenceRepo.create(name, SourceInfo.Local).uid + val bundle = LocalPatchBundle(name, id, directoryOf(id)) + + bundle.replace(patches, integrations) + addBundle(bundle) + } + + suspend fun createRemote(name: String, url: String, autoUpdate: Boolean) { + val entity = persistenceRepo.create(name, SourceInfo.from(url), autoUpdate) + addBundle(entity.load()) + } + + private suspend inline fun <reified T> getBundlesByType() = + sources.first().filterIsInstance<T>() + + suspend fun reloadApiBundles() { + getBundlesByType<APIPatchBundle>().forEach { + it.deleteLocalFiles() + } + + reload() + } + + suspend fun redownloadRemoteBundles() = getBundlesByType<RemotePatchBundle>().forEach { it.downloadLatest() } + + suspend fun updateCheck() = supervisorScope { + if (!networkInfo.isSafe()) { + Log.d(tag, "Skipping update check because the network is down or metered.") + return@supervisorScope + } + + getBundlesByType<RemotePatchBundle>().forEach { + launch { + if (!it.propsFlow().first().autoUpdate) return@launch + Log.d(tag, "Updating patch bundle: ${it.name}") + it.update() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/repository/PatchSelectionRepository.kt b/app/src/main/java/app/revanced/manager/domain/repository/PatchSelectionRepository.kt new file mode 100644 index 0000000000..cade429164 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/repository/PatchSelectionRepository.kt @@ -0,0 +1,43 @@ +package app.revanced.manager.domain.repository + +import app.revanced.manager.data.room.AppDatabase +import app.revanced.manager.data.room.AppDatabase.Companion.generateUid +import app.revanced.manager.data.room.selection.PatchSelection + +class PatchSelectionRepository(db: AppDatabase) { + private val dao = db.selectionDao() + + private suspend fun getOrCreateSelection(bundleUid: Int, packageName: String) = + dao.getSelectionId(bundleUid, packageName) ?: PatchSelection( + uid = generateUid(), + patchBundle = bundleUid, + packageName = packageName + ).also { dao.createSelection(it) }.uid + + suspend fun getSelection(packageName: String): Map<Int, Set<String>> = + dao.getSelectedPatches(packageName).mapValues { it.value.toSet() } + + suspend fun updateSelection(packageName: String, selection: Map<Int, Set<String>>) = + dao.updateSelections(selection.mapKeys { (sourceUid, _) -> + getOrCreateSelection( + sourceUid, + packageName + ) + }) + + suspend fun reset() = dao.reset() + + suspend fun export(bundleUid: Int): SerializedSelection = dao.exportSelection(bundleUid) + + suspend fun import(bundleUid: Int, selection: SerializedSelection) { + dao.clearForPatchBundle(bundleUid) + dao.updateSelections(selection.entries.associate { (packageName, patches) -> + getOrCreateSelection(bundleUid, packageName) to patches.toSet() + }) + } +} + +/** + * A [Map] of package name -> selected patches. + */ +typealias SerializedSelection = Map<String, List<String>> \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/worker/Worker.kt b/app/src/main/java/app/revanced/manager/domain/worker/Worker.kt new file mode 100644 index 0000000000..85dc3df355 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/worker/Worker.kt @@ -0,0 +1,7 @@ +package app.revanced.manager.domain.worker + +import android.content.Context +import androidx.work.CoroutineWorker +import androidx.work.WorkerParameters + +abstract class Worker<ARGS>(context: Context, parameters: WorkerParameters) : CoroutineWorker(context, parameters) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/domain/worker/WorkerRepository.kt b/app/src/main/java/app/revanced/manager/domain/worker/WorkerRepository.kt new file mode 100644 index 0000000000..222a31c48b --- /dev/null +++ b/app/src/main/java/app/revanced/manager/domain/worker/WorkerRepository.kt @@ -0,0 +1,36 @@ +package app.revanced.manager.domain.worker + +import android.app.Application +import androidx.work.ExistingWorkPolicy +import androidx.work.OneTimeWorkRequest +import androidx.work.OutOfQuotaPolicy +import androidx.work.WorkManager +import java.util.UUID + +class WorkerRepository(app: Application) { + val workManager = WorkManager.getInstance(app) + + /** + * The standard WorkManager communication APIs use [androidx.work.Data], which has too many limitations. + * We can get around those limits by passing inputs using global variables instead. + */ + val workerInputs = mutableMapOf<UUID, Any>() + + @Suppress("UNCHECKED_CAST") + fun <A : Any, W : Worker<A>> claimInput(worker: W): A { + val data = workerInputs[worker.id] ?: throw IllegalStateException("Worker was not launched via WorkerRepository") + workerInputs.remove(worker.id) + + return data as A + } + + inline fun <reified W : Worker<A>, A : Any> launchExpedited(name: String, input: A): UUID { + val request = + OneTimeWorkRequest.Builder(W::class.java) // create Worker + .setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST) + .build() + workerInputs[request.id] = input + workManager.enqueueUniqueWork(name, ExistingWorkPolicy.REPLACE, request) + return request.id + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/api/ReVancedAPI.kt b/app/src/main/java/app/revanced/manager/network/api/ReVancedAPI.kt new file mode 100644 index 0000000000..3367bcf257 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/api/ReVancedAPI.kt @@ -0,0 +1,26 @@ +package app.revanced.manager.network.api + +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.network.dto.Asset +import app.revanced.manager.network.dto.ReVancedLatestRelease +import app.revanced.manager.network.dto.ReVancedRelease +import app.revanced.manager.network.service.ReVancedService +import app.revanced.manager.network.utils.getOrThrow +import app.revanced.manager.network.utils.transform + +class ReVancedAPI( + private val service: ReVancedService, + private val prefs: PreferencesManager +) { + private suspend fun apiUrl() = prefs.api.get() + + suspend fun getContributors() = service.getContributors(apiUrl()).transform { it.repositories } + + suspend fun getRelease(name: String) = service.getRelease(apiUrl(), name).transform { it.release } + + companion object Extensions { + fun ReVancedRelease.findAssetByType(mime: String) = assets.singleOrNull { it.contentType == mime } ?: throw MissingAssetException(mime) + } +} + +class MissingAssetException(type: String) : Exception("No asset with type $type") \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/downloader/APKMirror.kt b/app/src/main/java/app/revanced/manager/network/downloader/APKMirror.kt new file mode 100644 index 0000000000..3a055ef576 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/downloader/APKMirror.kt @@ -0,0 +1,289 @@ +package app.revanced.manager.network.downloader + +import android.os.Build.SUPPORTED_ABIS +import app.revanced.manager.network.service.HttpService +import io.ktor.client.plugins.onDownload +import io.ktor.client.request.parameter +import io.ktor.client.request.url +import it.skrape.selects.html5.a +import it.skrape.selects.html5.div +import it.skrape.selects.html5.form +import it.skrape.selects.html5.h5 +import it.skrape.selects.html5.input +import it.skrape.selects.html5.p +import it.skrape.selects.html5.span +import kotlinx.coroutines.flow.flow +import kotlinx.parcelize.IgnoredOnParcel +import kotlinx.parcelize.Parcelize +import org.koin.core.component.KoinComponent +import org.koin.core.component.get +import org.koin.core.component.inject +import java.io.File + +class APKMirror : AppDownloader, KoinComponent { + private val httpClient: HttpService = get() + + enum class APKType { + APK, + BUNDLE + } + + data class Variant( + val apkType: APKType, + val arch: String, + val link: String + ) + + private suspend fun getAppLink(packageName: String): String { + val searchResults = httpClient.getHtml { url("$apkMirror/?post_type=app_release&searchtype=app&s=$packageName") } + .div { + withId = "content" + findFirst { + div { + withClass = "listWidget" + findAll { + + find { + it.children.first().text.contains(packageName) + }!!.children.mapNotNull { + if (it.classNames.isEmpty()) { + it.h5 { + withClass = "appRowTitle" + findFirst { + a { + findFirst { + attribute("href") + } + } + } + } + } else null + } + + } + } + } + } + + return searchResults.find { url -> + httpClient.getHtml { url(apkMirror + url) } + .div { + withId = "primary" + findFirst { + div { + withClass = "tab-buttons" + findFirst { + div { + withClass = "tab-button-positioning" + findFirst { + children.any { + it.attribute("href") == "https://play.google.com/store/apps/details?id=$packageName" + } + } + } + } + } + } + } + } ?: throw Exception("App isn't available for download") + } + + override fun getAvailableVersions(packageName: String, versionFilter: Set<String>) = flow<AppDownloader.App> { + + // Vanced music uses the same package name so we have to hardcode... + val appCategory = if (packageName == "com.google.android.apps.youtube.music") + "youtube-music" + else + getAppLink(packageName).split("/")[3] + + var page = 1 + + val versions = mutableListOf<String>() + + while ( + if (versionFilter.isNotEmpty()) + versions.size < versionFilter.size && page <= 7 + else + page <= 1 + ) { + httpClient.getHtml { + url("$apkMirror/uploads/page/$page/") + parameter("appcategory", appCategory) + }.div { + withClass = "widget_appmanager_recentpostswidget" + findFirst { + div { + withClass = "listWidget" + findFirst { + children.mapNotNull { element -> + if (element.className.isEmpty()) { + + APKMirrorApp( + packageName = packageName, + version = element.div { + withClass = "infoSlide" + findFirst { + p { + findFirst { + span { + withClass = "infoSlide-value" + findFirst { + text + } + } + } + } + } + }.also { + if (it in versionFilter) + versions.add(it) + }, + downloadLink = element.findFirst { + a { + withClass = "downloadLink" + findFirst { + attribute("href") + } + } + } + ) + + } else null + } + } + } + } + }.onEach { version -> emit(version) } + + page++ + } + } + + @Parcelize + private class APKMirrorApp( + override val packageName: String, + override val version: String, + private val downloadLink: String, + ) : AppDownloader.App, KoinComponent { + @IgnoredOnParcel private val httpClient: HttpService by inject() + + override suspend fun download( + saveDirectory: File, + preferSplit: Boolean, + onDownload: suspend (downloadProgress: Pair<Float, Float>?) -> Unit + ): File { + val variants = httpClient.getHtml { url(apkMirror + downloadLink) } + .div { + withClass = "variants-table" + findFirst { // list of variants + children.drop(1).map { + Variant( + apkType = it.div { + findFirst { + span { + findFirst { + enumValueOf(text) + } + } + } + }, + arch = it.div { + findSecond { + text + } + }, + link = it.div { + findFirst { + a { + findFirst { + attribute("href") + } + } + } + } + ) + } + } + } + + val orderedAPKTypes = mutableListOf(APKType.APK, APKType.BUNDLE) + .also { if (preferSplit) it.reverse() } + + val variant = orderedAPKTypes.firstNotNullOfOrNull { apkType -> + supportedArches.firstNotNullOfOrNull { arch -> + variants.find { it.arch == arch && it.apkType == apkType } + } + } ?: throw Exception("No compatible variant found") + + if (variant.apkType == APKType.BUNDLE) throw Exception("Split apks are not supported yet") // TODO + + val downloadPage = httpClient.getHtml { url(apkMirror + variant.link) } + .a { + withClass = "downloadButton" + findFirst { + attribute("href") + } + } + + val downloadLink = httpClient.getHtml { url(apkMirror + downloadPage) } + .form { + withId = "filedownload" + findFirst { + val apkLink = attribute("action") + val id = input { + withAttribute = "name" to "id" + findFirst { + attribute("value") + } + } + val key = input { + withAttribute = "name" to "key" + findFirst { + attribute("value") + } + } + "$apkLink?id=$id&key=$key" + } + } + + val saveLocation = if (variant.apkType == APKType.BUNDLE) + saveDirectory.resolve(version).also { it.mkdirs() } + else + saveDirectory.resolve("$version.apk") + + try { + val downloadLocation = if (variant.apkType == APKType.BUNDLE) + saveLocation.resolve("temp.zip") + else + saveLocation + + httpClient.download(downloadLocation) { + url(apkMirror + downloadLink) + onDownload { bytesSentTotal, contentLength -> + onDownload(bytesSentTotal.div(100000).toFloat().div(10) to contentLength.div(100000).toFloat().div(10)) + } + } + + if (variant.apkType == APKType.BUNDLE) { + // TODO: Extract temp.zip + + downloadLocation.delete() + } + } catch (e: Exception) { + saveLocation.deleteRecursively() + throw e + } finally { + onDownload(null) + } + + return saveLocation + } + } + + companion object { + const val apkMirror = "https://www.apkmirror.com" + + val supportedArches = listOf("universal", "noarch") + SUPPORTED_ABIS + } + +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/downloader/AppDownloader.kt b/app/src/main/java/app/revanced/manager/network/downloader/AppDownloader.kt new file mode 100644 index 0000000000..a6a17622f4 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/downloader/AppDownloader.kt @@ -0,0 +1,28 @@ +package app.revanced.manager.network.downloader + +import android.os.Parcelable +import kotlinx.coroutines.flow.Flow +import java.io.File + +interface AppDownloader { + + /** + * Returns all downloadable apps. + * + * @param packageName The package name of the app. + * @param versionFilter A set of versions to filter. + */ + fun getAvailableVersions(packageName: String, versionFilter: Set<String>): Flow<App> + + interface App : Parcelable { + val packageName: String + val version: String + + suspend fun download( + saveDirectory: File, + preferSplit: Boolean, + onDownload: suspend (downloadProgress: Pair<Float, Float>?) -> Unit = {} + ): File + } + +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/dto/BundleInfo.kt b/app/src/main/java/app/revanced/manager/network/dto/BundleInfo.kt new file mode 100644 index 0000000000..e2b56a8705 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/dto/BundleInfo.kt @@ -0,0 +1,9 @@ +package app.revanced.manager.network.dto + +import kotlinx.serialization.Serializable + +@Serializable +data class BundleInfo(val patches: BundleAsset, val integrations: BundleAsset) + +@Serializable +data class BundleAsset(val version: String, val url: String) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/dto/GithubChangelog.kt b/app/src/main/java/app/revanced/manager/network/dto/GithubChangelog.kt new file mode 100644 index 0000000000..52789017f9 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/dto/GithubChangelog.kt @@ -0,0 +1,16 @@ +package app.revanced.manager.network.dto + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GithubChangelog( + @SerialName("tag_name") val version: String, + @SerialName("body") val body: String, + @SerialName("assets") val assets: List<GithubAsset> +) + +@Serializable +data class GithubAsset( + @SerialName("download_count") val downloadCount: Int, +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/dto/ReVancedContributors.kt b/app/src/main/java/app/revanced/manager/network/dto/ReVancedContributors.kt new file mode 100644 index 0000000000..ef52108c72 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/dto/ReVancedContributors.kt @@ -0,0 +1,21 @@ +package app.revanced.manager.network.dto + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class ReVancedGitRepositories( + val repositories: List<ReVancedGitRepository>, +) + +@Serializable +data class ReVancedGitRepository( + val name: String, + val contributors: List<ReVancedContributor>, +) + +@Serializable +data class ReVancedContributor( + val username: String, + @SerialName("avatar_url") val avatarUrl: String, +) diff --git a/app/src/main/java/app/revanced/manager/network/dto/ReVancedRelease.kt b/app/src/main/java/app/revanced/manager/network/dto/ReVancedRelease.kt new file mode 100644 index 0000000000..d97b335ce2 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/dto/ReVancedRelease.kt @@ -0,0 +1,32 @@ +package app.revanced.manager.network.dto + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class ReVancedLatestRelease( + val release: ReVancedRelease, +) + +@Serializable +data class ReVancedRelease( + val metadata: ReVancedReleaseMeta, + val assets: List<Asset> +) + +@Serializable +data class ReVancedReleaseMeta( + @SerialName("tag_name") val tag: String, + val name: String, + val draft: Boolean, + val prerelease: Boolean, + @SerialName("created_at") val createdAt: String, + @SerialName("published_at") val publishedAt: String +) + +@Serializable +data class Asset( + val name: String, + @SerialName("browser_download_url") val downloadUrl: String, + @SerialName("content_type") val contentType: String +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/service/GithubService.kt b/app/src/main/java/app/revanced/manager/network/service/GithubService.kt new file mode 100644 index 0000000000..2c293848ee --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/service/GithubService.kt @@ -0,0 +1,15 @@ +package app.revanced.manager.network.service + +import app.revanced.manager.network.dto.GithubChangelog +import app.revanced.manager.network.utils.APIResponse +import io.ktor.client.request.url +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext + +class GithubService(private val client: HttpService) { + suspend fun getChangelog(repo: String): APIResponse<GithubChangelog> = withContext(Dispatchers.IO) { + client.request { + url("https://api.github.com/repos/revanced/$repo/releases/latest") + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/service/HttpService.kt b/app/src/main/java/app/revanced/manager/network/service/HttpService.kt new file mode 100644 index 0000000000..3781c3b4c8 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/service/HttpService.kt @@ -0,0 +1,91 @@ +package app.revanced.manager.network.service + +import android.util.Log +import app.revanced.manager.network.utils.APIError +import app.revanced.manager.network.utils.APIFailure +import app.revanced.manager.network.utils.APIResponse +import app.revanced.manager.util.tag +import io.ktor.client.HttpClient +import io.ktor.client.call.body +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.get +import io.ktor.client.request.prepareGet +import io.ktor.client.request.request +import io.ktor.client.statement.bodyAsText +import io.ktor.http.HttpStatusCode +import io.ktor.http.isSuccess +import io.ktor.utils.io.ByteReadChannel +import io.ktor.utils.io.core.isNotEmpty +import io.ktor.utils.io.core.readBytes +import it.skrape.core.htmlDocument +import kotlinx.serialization.json.Json +import java.io.File + +/** + * @author Aliucord Authors, DiamondMiner88 + */ +class HttpService( + val json: Json, + val http: HttpClient, +) { + suspend inline fun <reified T> request(builder: HttpRequestBuilder.() -> Unit = {}): APIResponse<T> { + var body: String? = null + + val response = try { + val response = http.request(builder) + + if (response.status.isSuccess()) { + body = response.bodyAsText() + + if (T::class == String::class) { + return APIResponse.Success(body as T) + } + + APIResponse.Success(json.decodeFromString<T>(body)) + } else { + body = try { + response.bodyAsText() + } catch (t: Throwable) { + null + } + + Log.e(tag, "Failed to fetch: API error, http status: ${response.status}, body: $body") + APIResponse.Error(APIError(response.status, body)) + } + } catch (t: Throwable) { + Log.e(tag, "Failed to fetch: error: $t, body: $body") + APIResponse.Failure(APIFailure(t, body)) + } + return response + } + + suspend fun download( + saveLocation: File, + builder: HttpRequestBuilder.() -> Unit + ) { + http.prepareGet(builder).execute { httpResponse -> + if (httpResponse.status.isSuccess()) { + + saveLocation.outputStream().use { stream -> + val channel: ByteReadChannel = httpResponse.body() + while (!channel.isClosedForRead) { + val packet = channel.readRemaining(DEFAULT_BUFFER_SIZE.toLong()) + while (packet.isNotEmpty) { + val bytes = packet.readBytes() + stream.write(bytes) + } + } + } + + } else { + throw HttpException(httpResponse.status) + } + } + } + + suspend fun getHtml(builder: HttpRequestBuilder.() -> Unit) = htmlDocument( + html = http.get(builder).bodyAsText() + ) + + class HttpException(status: HttpStatusCode) : Exception("Failed to fetch: http status: $status") +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/service/ReVancedService.kt b/app/src/main/java/app/revanced/manager/network/service/ReVancedService.kt new file mode 100644 index 0000000000..b5681afef2 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/service/ReVancedService.kt @@ -0,0 +1,26 @@ +package app.revanced.manager.network.service + +import app.revanced.manager.network.dto.ReVancedLatestRelease +import app.revanced.manager.network.dto.ReVancedGitRepositories +import app.revanced.manager.network.utils.APIResponse +import io.ktor.client.request.* +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext + +class ReVancedService( + private val client: HttpService, +) { + suspend fun getRelease(api: String, repo: String): APIResponse<ReVancedLatestRelease> = + withContext(Dispatchers.IO) { + client.request { + url("$api/v2/$repo/releases/latest") + } + } + + suspend fun getContributors(api: String): APIResponse<ReVancedGitRepositories> = + withContext(Dispatchers.IO) { + client.request { + url("$api/contributors") + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/network/utils/APIResponse.kt b/app/src/main/java/app/revanced/manager/network/utils/APIResponse.kt new file mode 100644 index 0000000000..04765f888f --- /dev/null +++ b/app/src/main/java/app/revanced/manager/network/utils/APIResponse.kt @@ -0,0 +1,86 @@ +@file:Suppress("NOTHING_TO_INLINE") + +package app.revanced.manager.network.utils + +import io.ktor.http.* + +/** + * @author Aliucord Authors, DiamondMiner88 + */ + +sealed interface APIResponse<T> { + data class Success<T>(val data: T) : APIResponse<T> + data class Error<T>(val error: APIError) : APIResponse<T> + data class Failure<T>(val error: APIFailure) : APIResponse<T> +} + +class APIError(code: HttpStatusCode, body: String?) : Exception("HTTP Code $code, Body: $body") + +class APIFailure(error: Throwable, body: String?) : Exception(body ?: error.message, error) + +inline fun <T, R> APIResponse<T>.fold( + success: (T) -> R, + error: (APIError) -> R, + failure: (APIFailure) -> R +): R { + return when (this) { + is APIResponse.Success -> success(this.data) + is APIResponse.Error -> error(this.error) + is APIResponse.Failure -> failure(this.error) + } +} + +inline fun <T, R> APIResponse<T>.fold( + success: (T) -> R, + fail: (Exception) -> R, +): R { + return when (this) { + is APIResponse.Success -> success(data) + is APIResponse.Error -> fail(error) + is APIResponse.Failure -> fail(error) + } +} + +@Suppress("UNCHECKED_CAST") +inline fun <T, R> APIResponse<T>.transform(block: (T) -> R): APIResponse<R> { + return if (this !is APIResponse.Success) { + // Error and Failure do not use the generic value + this as APIResponse<R> + } else { + APIResponse.Success(block(data)) + } +} + +inline fun <T> APIResponse<T>.getOrThrow(): T { + return fold( + success = { it }, + fail = { throw it } + ) +} + +inline fun <T> APIResponse<T>.getOrNull(): T? { + return fold( + success = { it }, + fail = { null } + ) +} + +@Suppress("UNCHECKED_CAST") +inline fun <T, R> APIResponse<T>.chain(block: (T) -> APIResponse<R>): APIResponse<R> { + return if (this !is APIResponse.Success) { + // Error and Failure do not use the generic value + this as APIResponse<R> + } else { + block(data) + } +} + +@Suppress("UNCHECKED_CAST") +inline fun <T, R> APIResponse<T>.chain(secondary: APIResponse<R>): APIResponse<R> { + return if (secondary is APIResponse.Success) { + secondary + } else { + // Error and Failure do not use the generic value + this as APIResponse<R> + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/patcher/Aligning.kt b/app/src/main/java/app/revanced/manager/patcher/Aligning.kt new file mode 100644 index 0000000000..d8a672d61e --- /dev/null +++ b/app/src/main/java/app/revanced/manager/patcher/Aligning.kt @@ -0,0 +1,38 @@ +package app.revanced.manager.patcher + +import app.revanced.manager.patcher.alignment.ZipAligner +import app.revanced.manager.patcher.alignment.zip.ZipFile +import app.revanced.manager.patcher.alignment.zip.structures.ZipEntry +import app.revanced.patcher.PatcherResult +import java.io.File + +// This is the same aligner used by the CLI. +// It will be removed eventually. +object Aligning { + fun align(result: PatcherResult, inputFile: File, outputFile: File) { + // logger.info("Aligning ${inputFile.name} to ${outputFile.name}") + + if (outputFile.exists()) outputFile.delete() + + ZipFile(outputFile).use { file -> + result.dexFiles.forEach { + file.addEntryCompressData( + ZipEntry.createWithName(it.name), + it.stream.readBytes() + ) + } + + result.resourceFile?.let { + file.copyEntriesFromFileAligned( + ZipFile(it), + ZipAligner::getEntryAlignment + ) + } + + file.copyEntriesFromFileAligned( + ZipFile(inputFile, readonly = true), + ZipAligner::getEntryAlignment + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/patcher/Session.kt b/app/src/main/java/app/revanced/manager/patcher/Session.kt new file mode 100644 index 0000000000..14e26ade24 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/patcher/Session.kt @@ -0,0 +1,81 @@ +package app.revanced.manager.patcher + +import app.revanced.patcher.Patcher +import app.revanced.patcher.PatcherOptions +import app.revanced.patcher.data.Context +import app.revanced.patcher.logging.Logger +import app.revanced.patcher.patch.Patch +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import java.io.Closeable +import java.io.File +import java.nio.file.Files +import java.nio.file.StandardCopyOption + +internal typealias PatchClass = Class<out Patch<Context>> +internal typealias PatchList = List<PatchClass> + +class Session( + cacheDir: String, + frameworkDir: String, + aaptPath: String, + private val logger: Logger, + private val input: File, + private val onStepSucceeded: suspend () -> Unit +) : Closeable { + private val temporary = File(cacheDir).resolve("manager").also { it.mkdirs() } + private val patcher = Patcher( + PatcherOptions( + inputFile = input, + resourceCacheDirectory = temporary.resolve("aapt-resources").path, + frameworkDirectory = frameworkDir, + aaptPath = aaptPath, + logger = logger, + ) + ) + + private suspend fun Patcher.applyPatchesVerbose() { + this.executePatches(true).forEach { (patch, result) -> + if (result.isSuccess) { + logger.info("$patch succeeded") + onStepSucceeded() + return@forEach + } + logger.error("$patch failed:") + result.exceptionOrNull()!!.let { + logger.error(result.exceptionOrNull()!!.stackTraceToString()) + + throw it + } + } + } + + suspend fun run(output: File, selectedPatches: PatchList, integrations: List<File>) { + onStepSucceeded() // Unpacking + with(patcher) { + logger.info("Merging integrations") + addIntegrations(integrations) {} + addPatches(selectedPatches) + onStepSucceeded() // Merging + + logger.info("Applying patches...") + applyPatchesVerbose() + } + + logger.info("Writing patched files...") + val result = patcher.save() + + val aligned = temporary.resolve("aligned.apk").also { Aligning.align(result, input, it) } + + logger.info("Patched apk saved to $aligned") + + withContext(Dispatchers.IO) { + Files.move(aligned.toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING) + } + onStepSucceeded() // Saving + } + + override fun close() { + temporary.delete() + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/patcher/aapt/Aapt.kt b/app/src/main/java/app/revanced/manager/patcher/aapt/Aapt.kt new file mode 100644 index 0000000000..25e26be448 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/patcher/aapt/Aapt.kt @@ -0,0 +1,13 @@ +package app.revanced.manager.patcher.aapt + +import android.content.Context +import java.io.File + +object Aapt { + fun binary(context: Context): File? { + return File(context.applicationInfo.nativeLibraryDir).resolveAapt() + } +} + +private fun File.resolveAapt() = + list { _, f -> !File(f).isDirectory && f.contains("aapt") }?.firstOrNull()?.let { resolve(it) } diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/aligning/ZipAligner.kt b/app/src/main/java/app/revanced/manager/patcher/alignment/ZipAlign.kt similarity index 71% rename from android/app/src/main/kotlin/app/revanced/manager/flutter/utils/aligning/ZipAligner.kt rename to app/src/main/java/app/revanced/manager/patcher/alignment/ZipAlign.kt index 088aad5993..4f8504c86c 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/aligning/ZipAligner.kt +++ b/app/src/main/java/app/revanced/manager/patcher/alignment/ZipAlign.kt @@ -1,6 +1,6 @@ -package app.revanced.manager.flutter.utils.aligning +package app.revanced.manager.patcher.alignment -import app.revanced.manager.flutter.utils.zip.structures.ZipEntry +import app.revanced.manager.patcher.alignment.zip.structures.ZipEntry internal object ZipAligner { private const val DEFAULT_ALIGNMENT = 4 @@ -8,4 +8,4 @@ internal object ZipAligner { fun getEntryAlignment(entry: ZipEntry): Int? = if (entry.compression.toUInt() != 0u) null else if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT else DEFAULT_ALIGNMENT -} +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/Extensions.kt b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/Extensions.kt similarity index 76% rename from android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/Extensions.kt rename to app/src/main/java/app/revanced/manager/patcher/alignment/zip/Extensions.kt index 3ff0516de5..c022005fe1 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/Extensions.kt +++ b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/Extensions.kt @@ -1,6 +1,4 @@ -@file:Suppress("unused") - -package app.revanced.manager.flutter.utils.zip +package app.revanced.manager.patcher.alignment.zip import java.io.DataInput import java.io.DataOutput @@ -16,11 +14,11 @@ fun UInt.toBigEndian() = (((this.toInt() and 0xff) shl 24) or ((this.toInt() and fun UShort.toBigEndian() = (this.toUInt() shl 16).toBigEndian().toUShort() -fun ByteBuffer.getUShort() = this.short.toUShort() -fun ByteBuffer.getUInt() = this.int.toUInt() +fun ByteBuffer.getUShort() = this.getShort().toUShort() +fun ByteBuffer.getUInt() = this.getInt().toUInt() -fun ByteBuffer.putUShort(ushort: UShort): ByteBuffer = this.putShort(ushort.toShort()) -fun ByteBuffer.putUInt(uint: UInt): ByteBuffer = this.putInt(uint.toInt()) +fun ByteBuffer.putUShort(ushort: UShort) = this.putShort(ushort.toShort()) +fun ByteBuffer.putUInt(uint: UInt) = this.putInt(uint.toInt()) fun DataInput.readUShort() = this.readShort().toUShort() fun DataInput.readUInt() = this.readInt().toUInt() @@ -32,4 +30,4 @@ fun DataInput.readUShortLE() = this.readUShort().toBigEndian() fun DataInput.readUIntLE() = this.readUInt().toBigEndian() fun DataOutput.writeUShortLE(ushort: UShort) = this.writeUShort(ushort.toLittleEndian()) -fun DataOutput.writeUIntLE(uint: UInt) = this.writeUInt(uint.toLittleEndian()) +fun DataOutput.writeUIntLE(uint: UInt) = this.writeUInt(uint.toLittleEndian()) \ No newline at end of file diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/ZipFile.kt b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/ZipFile.kt similarity index 91% rename from android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/ZipFile.kt rename to app/src/main/java/app/revanced/manager/patcher/alignment/zip/ZipFile.kt index 2330938b3b..a49ffed170 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/ZipFile.kt +++ b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/ZipFile.kt @@ -1,19 +1,21 @@ -package app.revanced.manager.flutter.utils.zip +package app.revanced.manager.patcher.alignment.zip + +import app.revanced.manager.patcher.alignment.zip.structures.ZipEndRecord +import app.revanced.manager.patcher.alignment.zip.structures.ZipEntry -import app.revanced.manager.flutter.utils.zip.structures.ZipEndRecord -import app.revanced.manager.flutter.utils.zip.structures.ZipEntry import java.io.Closeable import java.io.File +import java.io.IOException import java.io.RandomAccessFile import java.nio.ByteBuffer import java.nio.channels.FileChannel import java.util.zip.CRC32 import java.util.zip.Deflater -class ZipFile(file: File) : Closeable { +class ZipFile(file: File, private val readonly: Boolean = false) : Closeable { var entries: MutableList<ZipEntry> = mutableListOf() - private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw") + private val filePointer: RandomAccessFile = RandomAccessFile(file, if (readonly) "r" else "rw") private var CDNeedsRewrite = false private val compressionLevel = 5 @@ -33,6 +35,10 @@ class ZipFile(file: File) : Closeable { filePointer.seek(0) } + private fun assertWritable() { + if (readonly) throw IOException("Archive is read-only") + } + private fun findEndRecord(): ZipEndRecord { //look from end to start since end record is at the end for (i in filePointer.length() - 1 downTo 0) { @@ -109,6 +115,8 @@ class ZipFile(file: File) : Closeable { } fun addEntryCompressData(entry: ZipEntry, data: ByteArray) { + assertWritable() + val compressor = Deflater(compressionLevel, true) compressor.setInput(data) compressor.finish() @@ -135,6 +143,8 @@ class ZipFile(file: File) : Closeable { } private fun addEntryCopyData(entry: ZipEntry, data: ByteBuffer, alignment: Int? = null) { + assertWritable() + alignment?.let { //calculate where data would end up val dataOffset = filePointer.filePointer + entry.LFHSize @@ -161,6 +171,8 @@ class ZipFile(file: File) : Closeable { } fun copyEntriesFromFileAligned(file: ZipFile, entryAlignment: (entry: ZipEntry) -> Int?) { + assertWritable() + for (entry in file.entries) { if (entries.any { it.fileName == entry.fileName }) continue //don't add duplicates @@ -173,4 +185,4 @@ class ZipFile(file: File) : Closeable { if (CDNeedsRewrite) writeCD() filePointer.close() } -} +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/structures/ZipEndRecord.kt b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/structures/ZipEndRecord.kt similarity index 86% rename from android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/structures/ZipEndRecord.kt rename to app/src/main/java/app/revanced/manager/patcher/alignment/zip/structures/ZipEndRecord.kt index e7b9b58e26..06555cd3fc 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/structures/ZipEndRecord.kt +++ b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/structures/ZipEndRecord.kt @@ -1,9 +1,9 @@ -package app.revanced.manager.flutter.utils.zip.structures +package app.revanced.manager.patcher.alignment.zip.structures -import app.revanced.manager.flutter.utils.zip.putUInt -import app.revanced.manager.flutter.utils.zip.putUShort -import app.revanced.manager.flutter.utils.zip.readUIntLE -import app.revanced.manager.flutter.utils.zip.readUShortLE +import app.revanced.manager.patcher.alignment.zip.putUInt +import app.revanced.manager.patcher.alignment.zip.putUShort +import app.revanced.manager.patcher.alignment.zip.readUIntLE +import app.revanced.manager.patcher.alignment.zip.readUShortLE import java.io.DataInput import java.nio.ByteBuffer import java.nio.ByteOrder @@ -58,8 +58,7 @@ data class ZipEndRecord( fun toECD(): ByteBuffer { val commentBytes = fileComment.toByteArray(Charsets.UTF_8) - val buffer = ByteBuffer.allocate(ECD_HEADER_SIZE + commentBytes.size) - .also { it.order(ByteOrder.LITTLE_ENDIAN) } + val buffer = ByteBuffer.allocate(ECD_HEADER_SIZE + commentBytes.size).also { it.order(ByteOrder.LITTLE_ENDIAN) } buffer.putUInt(ECD_SIGNATURE) buffer.putUShort(diskNumber) @@ -75,4 +74,4 @@ data class ZipEndRecord( buffer.flip() return buffer } -} +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/structures/ZipEntry.kt b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/structures/ZipEntry.kt similarity index 98% rename from android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/structures/ZipEntry.kt rename to app/src/main/java/app/revanced/manager/patcher/alignment/zip/structures/ZipEntry.kt index bda1398e7c..f070386c2f 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/zip/structures/ZipEntry.kt +++ b/app/src/main/java/app/revanced/manager/patcher/alignment/zip/structures/ZipEntry.kt @@ -1,6 +1,6 @@ -package app.revanced.manager.flutter.utils.zip.structures +package app.revanced.manager.patcher.alignment.zip.structures -import app.revanced.manager.flutter.utils.zip.* +import app.revanced.manager.patcher.alignment.zip.* import java.io.DataInput import java.nio.ByteBuffer import java.nio.ByteOrder @@ -186,5 +186,4 @@ data class ZipEntry( buffer.flip() return buffer } -} - +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/patcher/patch/PatchBundle.kt b/app/src/main/java/app/revanced/manager/patcher/patch/PatchBundle.kt new file mode 100644 index 0000000000..a8e248d23d --- /dev/null +++ b/app/src/main/java/app/revanced/manager/patcher/patch/PatchBundle.kt @@ -0,0 +1,50 @@ +package app.revanced.manager.patcher.patch + +import android.util.Log +import app.revanced.manager.patcher.PatchClass +import app.revanced.manager.util.tag +import app.revanced.patcher.Patcher +import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages +import app.revanced.patcher.util.patch.PatchBundle +import dalvik.system.PathClassLoader +import java.io.File + +class PatchBundle(private val loader: Iterable<PatchClass>, val integrations: File?) { + constructor(bundleJar: File, integrations: File?) : this( + object : Iterable<PatchClass> { + private fun load(): List<PatchClass> { + val path = bundleJar.absolutePath + return PatchBundle.Dex( + path, + PathClassLoader(path, Patcher::class.java.classLoader) + ).loadPatches() + } + + override fun iterator() = load().iterator() + }, + integrations + ) { + Log.d(tag, "Loaded patch bundle: $bundleJar") + } + + /** + * A list containing the metadata of every patch inside this bundle. + */ + val patches = loader.map(::PatchInfo) + + /** + * Load all patches compatible with the specified package. + */ + fun patchClasses(packageName: String) = loader.filter { patch -> + val compatiblePackages = patch.compatiblePackages + ?: // The patch has no compatibility constraints, which means it is universal. + return@filter true + + if (!compatiblePackages.any { it.name == packageName }) { + // Patch is not compatible with this package. + return@filter false + } + + true + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/patcher/patch/PatchInfo.kt b/app/src/main/java/app/revanced/manager/patcher/patch/PatchInfo.kt new file mode 100644 index 0000000000..13e37fea87 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/patcher/patch/PatchInfo.kt @@ -0,0 +1,50 @@ +package app.revanced.manager.patcher.patch + +import androidx.compose.runtime.Immutable +import app.revanced.manager.patcher.PatchClass +import app.revanced.patcher.annotation.Package +import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages +import app.revanced.patcher.extensions.PatchExtensions.dependencies +import app.revanced.patcher.extensions.PatchExtensions.description +import app.revanced.patcher.extensions.PatchExtensions.include +import app.revanced.patcher.extensions.PatchExtensions.options +import app.revanced.patcher.extensions.PatchExtensions.patchName +import app.revanced.patcher.patch.PatchOption +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList + +data class PatchInfo( + val name: String, + val description: String?, + val dependencies: ImmutableList<String>?, + val include: Boolean, + val compatiblePackages: ImmutableList<CompatiblePackage>?, + val options: ImmutableList<Option>? +) { + constructor(patch: PatchClass) : this( + patch.patchName, + patch.description, + patch.dependencies?.map { it.java.patchName }?.toImmutableList(), + patch.include, + patch.compatiblePackages?.map { CompatiblePackage(it) }?.toImmutableList(), + patch.options?.map { Option(it) }?.toImmutableList()) + + fun compatibleWith(packageName: String) = compatiblePackages?.any { it.packageName == packageName } ?: true + + fun supportsVersion(versionName: String) = + compatiblePackages?.any { compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == versionName } } } + ?: true +} + +@Immutable +data class CompatiblePackage( + val packageName: String, + val versions: ImmutableList<String> +) { + constructor(pkg: Package) : this(pkg.name, pkg.versions.toList().toImmutableList()) +} + +@Immutable +data class Option(val title: String, val key: String, val description: String, val required: Boolean, val type: Class<out PatchOption<*>>, val defaultValue: Any?) { + constructor(option: PatchOption<*>) : this(option.title, option.key, option.description, option.required, option::class.java, option.value) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/patcher/worker/PatcherProgressManager.kt b/app/src/main/java/app/revanced/manager/patcher/worker/PatcherProgressManager.kt new file mode 100644 index 0000000000..b138b3bd5a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/patcher/worker/PatcherProgressManager.kt @@ -0,0 +1,109 @@ +package app.revanced.manager.patcher.worker + +import android.content.Context +import androidx.annotation.StringRes +import app.revanced.manager.R +import app.revanced.manager.ui.model.SelectedApp +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf +import kotlinx.collections.immutable.toImmutableList +import kotlinx.coroutines.flow.StateFlow + +enum class State { + WAITING, COMPLETED, FAILED +} + +class SubStep( + val name: String, + val state: State = State.WAITING, + val message: String? = null, + val progress: StateFlow<Pair<Float, Float>?>? = null +) + +class Step( + @StringRes val name: Int, + val subSteps: ImmutableList<SubStep>, + val state: State = State.WAITING +) + +class PatcherProgressManager(context: Context, selectedPatches: List<String>, selectedApp: SelectedApp, downloadProgress: StateFlow<Pair<Float, Float>?>) { + val steps = generateSteps(context, selectedPatches, selectedApp, downloadProgress) + private var currentStep: StepKey? = StepKey(0, 0) + + private fun update(key: StepKey, state: State, message: String? = null) { + val isLastSubStep: Boolean + steps[key.step] = steps[key.step].let { step -> + isLastSubStep = key.substep == step.subSteps.lastIndex + + val newStepState = when { + // This step failed because one of its sub-steps failed. + state == State.FAILED -> State.FAILED + // All sub-steps succeeded. + state == State.COMPLETED && isLastSubStep -> State.COMPLETED + // Keep the old status. + else -> step.state + } + + Step(step.name, step.subSteps.mapIndexed { index, subStep -> + if (index != key.substep) subStep else SubStep(subStep.name, state, message) + }.toImmutableList(), newStepState) + } + + val isFinal = isLastSubStep && key.step == steps.lastIndex + + if (state == State.COMPLETED) { + // Move the cursor to the next step. + currentStep = when { + isFinal -> null // Final step has been completed. + isLastSubStep -> StepKey(key.step + 1, 0) // Move to the next step. + else -> StepKey( + key.step, + key.substep + 1 + ) // Move to the next sub-step. + } + } + } + + fun replacePatchesList(newList: List<String>) { + steps[1] = generatePatchesStep(newList) + } + + private fun updateCurrent(newState: State, message: String? = null) { + currentStep?.let { update(it, newState, message) } + } + + fun failure(error: Throwable) = updateCurrent( + State.FAILED, + error.stackTraceToString() + ) + + fun success() = updateCurrent(State.COMPLETED) + + fun getProgress(): List<Step> = steps + + companion object { + private fun generatePatchesStep(selectedPatches: List<String>) = Step( + R.string.patcher_step_group_patching, + selectedPatches.map { SubStep(it) }.toImmutableList() + ) + + fun generateSteps(context: Context, selectedPatches: List<String>, selectedApp: SelectedApp, downloadProgress: StateFlow<Pair<Float, Float>?>? = null) = mutableListOf( + Step( + R.string.patcher_step_group_prepare, + listOfNotNull( + SubStep(context.getString(R.string.patcher_step_load_patches)), + SubStep("Download apk", progress = downloadProgress).takeIf { selectedApp is SelectedApp.Download }, + SubStep(context.getString(R.string.patcher_step_unpack)), + SubStep(context.getString(R.string.patcher_step_integrations)) + ).toImmutableList() + ), + generatePatchesStep(selectedPatches), + Step( + R.string.patcher_step_group_saving, + persistentListOf(SubStep(context.getString(R.string.patcher_step_write_patched))) + ) + ) + } + + private data class StepKey(val step: Int, val substep: Int) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/patcher/worker/PatcherWorker.kt b/app/src/main/java/app/revanced/manager/patcher/worker/PatcherWorker.kt new file mode 100644 index 0000000000..16b99e969a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/patcher/worker/PatcherWorker.kt @@ -0,0 +1,222 @@ +package app.revanced.manager.patcher.worker + +import android.app.Notification +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.graphics.drawable.Icon +import android.os.PowerManager +import android.util.Log +import android.view.WindowManager +import androidx.core.content.ContextCompat +import androidx.work.ForegroundInfo +import androidx.work.WorkerParameters +import app.revanced.manager.R +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.domain.repository.DownloadedAppRepository +import app.revanced.manager.domain.repository.PatchBundleRepository +import app.revanced.manager.domain.worker.Worker +import app.revanced.manager.domain.worker.WorkerRepository +import app.revanced.manager.patcher.Session +import app.revanced.manager.patcher.aapt.Aapt +import app.revanced.manager.ui.model.SelectedApp +import app.revanced.manager.util.Options +import app.revanced.manager.util.PM +import app.revanced.manager.util.PatchesSelection +import app.revanced.manager.util.tag +import app.revanced.patcher.extensions.PatchExtensions.options +import app.revanced.patcher.extensions.PatchExtensions.patchName +import app.revanced.patcher.logging.Logger +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.first +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject +import java.io.File +import java.io.FileNotFoundException + +class PatcherWorker( + context: Context, + parameters: WorkerParameters +) : Worker<PatcherWorker.Args>(context, parameters), KoinComponent { + + private val patchBundleRepository: PatchBundleRepository by inject() + private val workerRepository: WorkerRepository by inject() + private val prefs: PreferencesManager by inject() + private val downloadedAppRepository: DownloadedAppRepository by inject() + private val pm: PM by inject() + + data class Args( + val input: SelectedApp, + val output: String, + val selectedPatches: PatchesSelection, + val options: Options, + val packageName: String, + val packageVersion: String, + val progress: MutableStateFlow<ImmutableList<Step>>, + val logger: Logger + ) + + companion object { + private const val logPrefix = "[Worker]:" + private fun String.logFmt() = "$logPrefix $this" + } + + override suspend fun getForegroundInfo() = ForegroundInfo(1, createNotification()) + + private fun createNotification(): Notification { + val notificationIntent = Intent(applicationContext, PatcherWorker::class.java) + val pendingIntent: PendingIntent = PendingIntent.getActivity( + applicationContext, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE + ) + val channel = NotificationChannel( + "revanced-patcher-patching", "Patching", NotificationManager.IMPORTANCE_HIGH + ) + val notificationManager = + ContextCompat.getSystemService(applicationContext, NotificationManager::class.java) + notificationManager!!.createNotificationChannel(channel) + return Notification.Builder(applicationContext, channel.id) + .setContentTitle(applicationContext.getText(R.string.app_name)) + .setContentText(applicationContext.getText(R.string.patcher_notification_message)) + .setLargeIcon(Icon.createWithResource(applicationContext, R.drawable.ic_notification)) + .setSmallIcon(Icon.createWithResource(applicationContext, R.drawable.ic_notification)) + .setContentIntent(pendingIntent).build() + } + + override suspend fun doWork(): Result { + if (runAttemptCount > 0) { + Log.d(tag, "Android requested retrying but retrying is disabled.".logFmt()) + return Result.failure() + } + + val args = workerRepository.claimInput(this) + + try { + // This does not always show up for some reason. + setForeground(getForegroundInfo()) + } catch (e: Exception) { + Log.d(tag, "Failed to set foreground info:", e) + } + + val wakeLock: PowerManager.WakeLock = + (applicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager).run { + newWakeLock(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, "$tag::Patcher").apply { + acquire(10 * 60 * 1000L) + Log.d(tag, "Acquired wakelock.") + } + } + + return try { + runPatcher(args) + } finally { + wakeLock.release() + } + } + + private suspend fun runPatcher(args: Args): Result { + val aaptPath = + Aapt.binary(applicationContext)?.absolutePath + ?: throw FileNotFoundException("Could not resolve aapt.") + + val frameworkPath = + applicationContext.cacheDir.resolve("framework").also { it.mkdirs() }.absolutePath + + val bundles = patchBundleRepository.bundles.first() + val integrations = bundles.mapNotNull { (_, bundle) -> bundle.integrations } + + val downloadProgress = MutableStateFlow<Pair<Float, Float>?>(null) + + val progressManager = + PatcherProgressManager( + applicationContext, + args.selectedPatches.flatMap { it.value }, + args.input, + downloadProgress + ) + + val progressFlow = args.progress + + fun updateProgress(advanceCounter: Boolean = true) { + if (advanceCounter) { + progressManager.success() + } + progressFlow.value = progressManager.getProgress().toImmutableList() + } + + return try { + // TODO: consider passing all the classes directly now that the input no longer needs to be serializable. + val selectedBundles = args.selectedPatches.keys + val allPatches = bundles.filterKeys { selectedBundles.contains(it) } + .mapValues { (_, bundle) -> bundle.patchClasses(args.packageName) } + + // Set all patch options. + args.options.forEach { (bundle, configuredPatchOptions) -> + val patches = allPatches[bundle] ?: return@forEach + configuredPatchOptions.forEach { (patchName, options) -> + patches.single { it.patchName == patchName }.options?.let { + options.forEach { (key, value) -> + it[key] = value + } + } + } + } + + val patches = args.selectedPatches.flatMap { (bundle, selected) -> + allPatches[bundle]?.filter { selected.contains(it.patchName) } + ?: throw IllegalArgumentException("Patch bundle $bundle does not exist") + } + + + // Ensure they are in the correct order so we can track progress properly. + progressManager.replacePatchesList(patches.map { it.patchName }) + updateProgress() // Loading patches + + val inputFile = when (val selectedApp = args.input) { + is SelectedApp.Download -> { + val savePath = applicationContext.filesDir.resolve("downloaded-apps") + .resolve(args.input.packageName).also { it.mkdirs() } + + selectedApp.app.download( + savePath, + prefs.preferSplits.get(), + onDownload = { downloadProgress.emit(it) } + ).also { + downloadedAppRepository.add( + args.input.packageName, + args.input.version, + it + ) + updateProgress() // Downloading + } + } + + is SelectedApp.Local -> selectedApp.file + is SelectedApp.Installed -> File(pm.getPackageInfo(selectedApp.packageName)!!.applicationInfo.sourceDir) + } + + Session( + applicationContext.cacheDir.absolutePath, + frameworkPath, + aaptPath, + args.logger, + inputFile, + onStepSucceeded = ::updateProgress + ).use { session -> + session.run(File(args.output), patches, integrations) + } + + Log.i(tag, "Patching succeeded".logFmt()) + progressManager.success() + Result.success() + } catch (e: Exception) { + Log.e(tag, "Exception while patching".logFmt(), e) + progressManager.failure(e) + Result.failure() + } finally { + updateProgress(false) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/service/InstallService.kt b/app/src/main/java/app/revanced/manager/service/InstallService.kt new file mode 100644 index 0000000000..420a5dc0b7 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/service/InstallService.kt @@ -0,0 +1,52 @@ +package app.revanced.manager.service + +import android.app.Service +import android.content.Intent +import android.content.pm.PackageInstaller +import android.os.Build +import android.os.IBinder + +@Suppress("DEPRECATION") +class InstallService : Service() { + + override fun onStartCommand( + intent: Intent, flags: Int, startId: Int + ): Int { + val extraStatus = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999) + val extraStatusMessage = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE) + val extraPackageName = intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME) + when (extraStatus) { + PackageInstaller.STATUS_PENDING_USER_ACTION -> { + startActivity(if (Build.VERSION.SDK_INT >= 33) { + intent.getParcelableExtra(Intent.EXTRA_INTENT, Intent::class.java) + } else { + intent.getParcelableExtra(Intent.EXTRA_INTENT) + }.apply { + this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + }) + } + + else -> { + sendBroadcast(Intent().apply { + action = APP_INSTALL_ACTION + putExtra(EXTRA_INSTALL_STATUS, extraStatus) + putExtra(EXTRA_INSTALL_STATUS_MESSAGE, extraStatusMessage) + putExtra(EXTRA_PACKAGE_NAME, extraPackageName) + }) + } + } + stopSelf() + return START_NOT_STICKY + } + + override fun onBind(intent: Intent?): IBinder? = null + + companion object { + const val APP_INSTALL_ACTION = "APP_INSTALL_ACTION" + + const val EXTRA_INSTALL_STATUS = "EXTRA_INSTALL_STATUS" + const val EXTRA_INSTALL_STATUS_MESSAGE = "EXTRA_INSTALL_STATUS_MESSAGE" + const val EXTRA_PACKAGE_NAME = "EXTRA_PACKAGE_NAME" + } + +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/service/UninstallService.kt b/app/src/main/java/app/revanced/manager/service/UninstallService.kt new file mode 100644 index 0000000000..cefd3528a8 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/service/UninstallService.kt @@ -0,0 +1,53 @@ +package app.revanced.manager.service + +import android.app.Service +import android.content.Intent +import android.content.pm.PackageInstaller +import android.os.Build +import android.os.IBinder + +@Suppress("DEPRECATION") +class UninstallService : Service() { + + override fun onStartCommand( + intent: Intent, + flags: Int, + startId: Int + ): Int { + val extraStatus = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999) + val extraStatusMessage = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE) + + when (extraStatus) { + PackageInstaller.STATUS_PENDING_USER_ACTION -> { + startActivity(if (Build.VERSION.SDK_INT >= 33) { + intent.getParcelableExtra(Intent.EXTRA_INTENT, Intent::class.java) + } else { + intent.getParcelableExtra(Intent.EXTRA_INTENT) + }.apply { + this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + }) + } + + else -> { + sendBroadcast(Intent().apply { + action = APP_UNINSTALL_ACTION + + putExtra(EXTRA_UNINSTALL_STATUS, extraStatus) + putExtra(EXTRA_UNINSTALL_STATUS_MESSAGE, extraStatusMessage) + }) + } + } + stopSelf() + return START_NOT_STICKY + } + + override fun onBind(intent: Intent?): IBinder? = null + + companion object { + const val APP_UNINSTALL_ACTION = "APP_UNINSTALL_ACTION" + + const val EXTRA_UNINSTALL_STATUS = "EXTRA_UNINSTALL_STATUS" + const val EXTRA_UNINSTALL_STATUS_MESSAGE = "EXTRA_INSTALL_STATUS_MESSAGE" + } + +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/AppIcon.kt b/app/src/main/java/app/revanced/manager/ui/component/AppIcon.kt new file mode 100644 index 0000000000..6eb101f93b --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/AppIcon.kt @@ -0,0 +1,49 @@ +package app.revanced.manager.ui.component + +import android.content.pm.PackageInfo +import androidx.compose.foundation.Image +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Android +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.graphics.vector.rememberVectorPainter +import coil.compose.AsyncImage +import com.google.accompanist.placeholder.placeholder + +@Composable +fun AppIcon( + packageInfo: PackageInfo?, + contentDescription: String?, + modifier: Modifier = Modifier +) { + var showPlaceHolder by rememberSaveable { mutableStateOf(true) } + + if (packageInfo == null) { + val image = rememberVectorPainter(Icons.Default.Android) + val colorFilter = ColorFilter.tint(LocalContentColor.current) + + Image( + image, + contentDescription, + Modifier.placeholder(visible = showPlaceHolder, color = MaterialTheme.colorScheme.inverseOnSurface, shape = RoundedCornerShape(100)).then(modifier), + colorFilter = colorFilter + ) + + showPlaceHolder = false + } else { + AsyncImage( + packageInfo, + contentDescription, + Modifier.placeholder(visible = showPlaceHolder, color = MaterialTheme.colorScheme.inverseOnSurface, shape = RoundedCornerShape(100)).then(modifier), + onSuccess = { showPlaceHolder = false } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/AppLabel.kt b/app/src/main/java/app/revanced/manager/ui/component/AppLabel.kt new file mode 100644 index 0000000000..9723e58dcc --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/AppLabel.kt @@ -0,0 +1,52 @@ +package app.revanced.manager.ui.component + +import android.content.pm.PackageInfo +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.LocalTextStyle +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.TextStyle +import app.revanced.manager.R +import com.google.accompanist.placeholder.placeholder +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext + +@Composable +fun AppLabel( + packageInfo: PackageInfo?, + modifier: Modifier = Modifier, + style: TextStyle = LocalTextStyle.current, + defaultText: String? = stringResource(R.string.not_installed) +) { + val context = LocalContext.current + + var label: String? by rememberSaveable { mutableStateOf(null) } + + LaunchedEffect(packageInfo) { + label = withContext(Dispatchers.IO) { + packageInfo?.applicationInfo?.loadLabel(context.packageManager)?.toString() + ?: defaultText + } + } + + Text( + label ?: stringResource(R.string.loading), + modifier = Modifier + .placeholder( + visible = label == null, + color = MaterialTheme.colorScheme.inverseOnSurface, + shape = RoundedCornerShape(100) + ) + .then(modifier), + style = style + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/AppScaffold.kt b/app/src/main/java/app/revanced/manager/ui/component/AppScaffold.kt new file mode 100644 index 0000000000..1785e7803d --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/AppScaffold.kt @@ -0,0 +1,67 @@ +package app.revanced.manager.ui.component + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.RowScope +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.R + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AppScaffold( + topBar: @Composable (TopAppBarScrollBehavior) -> Unit = {}, + bottomBar: @Composable () -> Unit = {}, + floatingActionButton: @Composable () -> Unit = {}, + content: @Composable (PaddingValues) -> Unit +) { + val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState()) + + Scaffold( + modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), + topBar = { topBar(scrollBehavior) }, + bottomBar = bottomBar, + floatingActionButton = floatingActionButton, + content = content + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AppTopBar( + title: String, + onBackClick: (() -> Unit)? = null, + backIcon: @Composable (() -> Unit) = @Composable { + Icon( + imageVector = Icons.Default.ArrowBack, contentDescription = stringResource( + R.string.back + ) + ) + }, + actions: @Composable (RowScope.() -> Unit) = {}, + scrollBehavior: TopAppBarScrollBehavior? = null +) { + val containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp) + + TopAppBar( + title = { Text(title) }, + scrollBehavior = scrollBehavior, + navigationIcon = { + if (onBackClick != null) { + IconButton(onClick = onBackClick) { + backIcon() + } + } + }, + actions = actions, + colors = TopAppBarDefaults.topAppBarColors( + containerColor = containerColor + ) + ) +} + diff --git a/app/src/main/java/app/revanced/manager/ui/component/ArrowButton.kt b/app/src/main/java/app/revanced/manager/ui/component/ArrowButton.kt new file mode 100644 index 0000000000..2c1e3c19aa --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/ArrowButton.kt @@ -0,0 +1,27 @@ +package app.revanced.manager.ui.component + +import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.KeyboardArrowUp +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.rotate +import androidx.compose.ui.res.stringResource +import app.revanced.manager.R + +@Composable +fun ArrowButton(expanded: Boolean, onClick: () -> Unit) { + IconButton(onClick = onClick) { + val description = if (expanded) R.string.collapse_content else R.string.expand_content + val rotation by animateFloatAsState(targetValue = if (expanded) 0f else 180f) + + Icon( + imageVector = Icons.Filled.KeyboardArrowUp, + contentDescription = stringResource(description), + modifier = Modifier.rotate(rotation) + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/AutoUpdatesDialog.kt b/app/src/main/java/app/revanced/manager/ui/component/AutoUpdatesDialog.kt new file mode 100644 index 0000000000..78fcbeb2cc --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/AutoUpdatesDialog.kt @@ -0,0 +1,115 @@ +package app.revanced.manager.ui.component + +import androidx.annotation.StringRes +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Source +import androidx.compose.material.icons.outlined.Update +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.Checkbox +import androidx.compose.material3.Divider +import androidx.compose.material3.Icon +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import app.revanced.manager.R + +@Composable +fun AutoUpdatesDialog(onSubmit: (Boolean, Boolean) -> Unit) { + var patchesEnabled by rememberSaveable { mutableStateOf(true) } + var managerEnabled by rememberSaveable { mutableStateOf(true) } + + AlertDialog( + onDismissRequest = {}, + confirmButton = { + TextButton( + onClick = { onSubmit(managerEnabled, patchesEnabled) } + ) { + Text(stringResource(R.string.save)) + } + }, + icon = { + Icon(Icons.Outlined.Update, null) + }, + title = { + Text( + text = stringResource(R.string.auto_updates_dialog_title), + style = MaterialTheme.typography.headlineSmall.copy(textAlign = TextAlign.Center), + color = MaterialTheme.colorScheme.onSurface, + ) + }, + text = { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(16.dp), + ) { + Text( + text = stringResource(R.string.auto_updates_dialog_description), + style = MaterialTheme.typography.bodyMedium, + ) + + AutoUpdatesItem( + headline = R.string.auto_updates_dialog_manager, + icon = Icons.Outlined.Update, + checked = managerEnabled, + onCheckedChange = { managerEnabled = it } + ) + Divider() + AutoUpdatesItem( + headline = R.string.auto_updates_dialog_patches, + icon = Icons.Outlined.Source, + checked = patchesEnabled, + onCheckedChange = { patchesEnabled = it } + ) + + Text( + text = stringResource(R.string.auto_updates_dialog_note), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + modifier = Modifier.fillMaxWidth() + ) + } + } + ) +} + +@Composable +private fun AutoUpdatesItem( + @StringRes headline: Int, + icon: ImageVector, + checked: Boolean, + onCheckedChange: (Boolean) -> Unit +) { + ListItem( + leadingContent = { Icon(icon, null, tint = MaterialTheme.colorScheme.onSurface) }, + headlineContent = { + Text( + text = stringResource(headline), + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurface + ) + }, + trailingContent = { + Checkbox( + checked = checked, + onCheckedChange = onCheckedChange + ) + }, + modifier = Modifier.clickable { onCheckedChange(!checked) } + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/ContentSelector.kt b/app/src/main/java/app/revanced/manager/ui/component/ContentSelector.kt new file mode 100644 index 0000000000..3e7117b1f8 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/ContentSelector.kt @@ -0,0 +1,21 @@ +package app.revanced.manager.ui.component + +import android.net.Uri +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.material3.Button +import androidx.compose.runtime.Composable + +@Composable +fun ContentSelector(mime: String, onSelect: (Uri) -> Unit, content: @Composable () -> Unit) { + val activityLauncher = rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { uri -> + uri?.let(onSelect) + } + Button( + onClick = { + activityLauncher.launch(mime) + } + ) { + content() + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/GroupHeader.kt b/app/src/main/java/app/revanced/manager/ui/component/GroupHeader.kt new file mode 100644 index 0000000000..f7ca27aebc --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/GroupHeader.kt @@ -0,0 +1,23 @@ +package app.revanced.manager.ui.component + +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.semantics.heading +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.unit.dp + +@Composable +fun GroupHeader( + title: String, + modifier: Modifier = Modifier +) { + Text( + text = title, + color = MaterialTheme.colorScheme.primary, + style = MaterialTheme.typography.labelLarge, + modifier = Modifier.padding(16.dp).semantics { heading() }.then(modifier) + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/LoadingIndicator.kt b/app/src/main/java/app/revanced/manager/ui/component/LoadingIndicator.kt new file mode 100644 index 0000000000..61e9488804 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/LoadingIndicator.kt @@ -0,0 +1,37 @@ +package app.revanced.manager.ui.component + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.CircularProgressIndicator +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp + +@Composable +fun LoadingIndicator( + modifier: Modifier = Modifier, + progress: Float? = null, + text: String? = null +) { + Column( + modifier = Modifier.fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + text?.let { Text(text) } + + progress?.let { + CircularProgressIndicator( + progress = progress, + modifier = Modifier.padding(vertical = 16.dp).then(modifier) + ) + } ?: + CircularProgressIndicator( + modifier = Modifier.padding(vertical = 16.dp).then(modifier) + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/Markdown.kt b/app/src/main/java/app/revanced/manager/ui/component/Markdown.kt new file mode 100644 index 0000000000..ec8e5bfe12 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/Markdown.kt @@ -0,0 +1,112 @@ +package app.revanced.manager.ui.component + +import android.annotation.SuppressLint +import android.view.MotionEvent +import android.view.ViewGroup +import android.webkit.WebResourceRequest +import android.webkit.WebView +import androidx.compose.foundation.background +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext +import app.revanced.manager.util.hexCode +import app.revanced.manager.util.openUrl +import com.google.accompanist.web.AccompanistWebViewClient +import com.google.accompanist.web.WebView +import com.google.accompanist.web.rememberWebViewStateWithHTMLData + +@Composable +@SuppressLint("ClickableViewAccessibility") +fun Markdown( + text: String, + modifier: Modifier = Modifier +) { + val ctx = LocalContext.current + val state = rememberWebViewStateWithHTMLData(data = generateMdHtml(source = text)) + val client = remember { + object : AccompanistWebViewClient() { + override fun shouldOverrideUrlLoading( + view: WebView?, + request: WebResourceRequest? + ): Boolean { + if (request != null) ctx.openUrl(request.url.toString()) + return true + } + } + } + + WebView( + state, + modifier = Modifier + .background(Color.Transparent) + .then(modifier), + client = client, + onCreated = { + it.setBackgroundColor(android.graphics.Color.TRANSPARENT) + it.isVerticalScrollBarEnabled = false + it.isHorizontalScrollBarEnabled = false + it.setOnTouchListener { _, event -> event.action == MotionEvent.ACTION_MOVE } + it.layoutParams = ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ) + } + ) +} + +@Composable +fun generateMdHtml( + source: String, + wrap: Boolean = false, + headingColor: Color = MaterialTheme.colorScheme.onSurface, + textColor: Color = MaterialTheme.colorScheme.onSurfaceVariant, + linkColor: Color = MaterialTheme.colorScheme.primary +) = remember(source, wrap, headingColor, textColor, linkColor) { + """<html> + <head> + <meta charset="utf-8" /> + <title>Markdown + + + + + $source + + """ +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/NotificationCard.kt b/app/src/main/java/app/revanced/manager/ui/component/NotificationCard.kt new file mode 100644 index 0000000000..4c23afd477 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/NotificationCard.kt @@ -0,0 +1,57 @@ +package app.revanced.manager.ui.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Card +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.unit.dp + +@Composable +fun NotificationCard( + color: Color, + icon: ImageVector, + text: String, + content: @Composable () -> Unit +) { + Card( + modifier = Modifier + .fillMaxWidth() + .clip(RoundedCornerShape(28.dp)) + .background(color) + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy( + 16.dp, + Alignment.Start + ) + ) { + Icon( + imageVector = icon, + contentDescription = null, + ) + Text( + modifier = Modifier.width(220.dp), + text = text, + style = MaterialTheme.typography.bodyMedium + ) + content() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/PasswordField.kt b/app/src/main/java/app/revanced/manager/ui/component/PasswordField.kt new file mode 100644 index 0000000000..ee64c05ba0 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/PasswordField.kt @@ -0,0 +1,50 @@ +package app.revanced.manager.ui.component + +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Visibility +import androidx.compose.material.icons.outlined.VisibilityOff +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.OutlinedTextField +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.text.input.PasswordVisualTransformation +import androidx.compose.ui.text.input.VisualTransformation +import app.revanced.manager.R + +@Composable +fun PasswordField(modifier: Modifier = Modifier, value: String, onValueChange: (String) -> Unit, label: @Composable (() -> Unit)? = null, placeholder: @Composable (() -> Unit)? = null) { + var visible by rememberSaveable { + mutableStateOf(false) + } + + OutlinedTextField( + value = value, + onValueChange = onValueChange, + placeholder = placeholder, + label = label, + modifier = modifier, + trailingIcon = { + IconButton(onClick = { + visible = !visible + }) { + val (icon, description) = remember(visible) { + if (visible) Icons.Outlined.VisibilityOff to R.string.hide_password_field else Icons.Outlined.Visibility to R.string.show_password_field + } + Icon(icon, stringResource(description)) + } + }, + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Password + ), + visualTransformation = if (visible) VisualTransformation.None else PasswordVisualTransformation() + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/SegmentedButton.kt b/app/src/main/java/app/revanced/manager/ui/component/SegmentedButton.kt new file mode 100644 index 0000000000..c2dc9463cb --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/SegmentedButton.kt @@ -0,0 +1,68 @@ +package app.revanced.manager.ui.component + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background +import androidx.compose.foundation.basicMarquee +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.surfaceColorAtElevation +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.painter.Painter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.unit.dp + +/** + * Credits to [Vendetta](https://github.com/vendetta-mod) + */ +@OptIn(ExperimentalFoundationApi::class) +@Composable +fun RowScope.SegmentedButton( + icon: Any, + iconDescription: String? = null, + text: String, + onClick: () -> Unit +) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterVertically), + modifier = Modifier + .clickable(onClick = onClick) + .background(MaterialTheme.colorScheme.surfaceColorAtElevation(2.dp)) + .weight(1f) + .padding(vertical = 20.dp) + ) { + when (icon) { + is ImageVector -> { + Icon( + imageVector = icon, + contentDescription = iconDescription, + tint = MaterialTheme.colorScheme.primary + ) + } + + is Painter -> { + Icon( + painter = icon, + contentDescription = iconDescription, + tint = MaterialTheme.colorScheme.primary + ) + } + } + + Text( + text = text, + style = MaterialTheme.typography.labelLarge, + color = MaterialTheme.colorScheme.primary, + maxLines = 1, + modifier = Modifier.basicMarquee() + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/TextInputDialog.kt b/app/src/main/java/app/revanced/manager/ui/component/TextInputDialog.kt new file mode 100644 index 0000000000..d0484f1e98 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/TextInputDialog.kt @@ -0,0 +1,51 @@ +package app.revanced.manager.ui.component + +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.material3.TextField +import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.ui.res.stringResource +import app.revanced.manager.R + +@Composable +fun TextInputDialog( + initial: String, + title: String, + onDismissRequest: () -> Unit, + onConfirm: (String) -> Unit, + validator: (String) -> Boolean = String::isNotEmpty, +) { + val (value, setValue) = rememberSaveable(initial) { + mutableStateOf(initial) + } + val valid = remember(value, validator) { + validator(value) + } + + AlertDialog( + onDismissRequest = onDismissRequest, + confirmButton = { + TextButton( + onClick = { onConfirm(value) }, + enabled = valid + ) { + Text(stringResource(R.string.ok)) + } + }, + dismissButton = { + TextButton(onClick = onDismissRequest) { + Text(stringResource(R.string.cancel)) + } + }, + title = { + Text(title) + }, + text = { + TextField(value = value, onValueChange = setValue) + } + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/BaseBundleDialog.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/BaseBundleDialog.kt new file mode 100644 index 0000000000..042449d241 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/BaseBundleDialog.kt @@ -0,0 +1,186 @@ +package app.revanced.manager.ui.component.bundle + +import android.webkit.URLUtil +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.ArrowRight +import androidx.compose.material3.FilledTonalButton +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Switch +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.R +import app.revanced.manager.ui.component.TextInputDialog + +@Composable +fun BaseBundleDialog( + modifier: Modifier = Modifier, + isDefault: Boolean, + name: String, + onNameChange: ((String) -> Unit)? = null, + remoteUrl: String?, + onRemoteUrlChange: ((String) -> Unit)? = null, + patchCount: Int, + version: String?, + autoUpdate: Boolean, + onAutoUpdateChange: (Boolean) -> Unit, + onPatchesClick: () -> Unit, + onBundleTypeClick: () -> Unit = {}, + extraFields: @Composable ColumnScope.() -> Unit = {} +) = Column( + modifier = Modifier + .fillMaxWidth() + .verticalScroll(rememberScrollState()) + .padding( + start = 8.dp, + top = 8.dp, + end = 4.dp, + ) + .then(modifier) +) { + var showNameInputDialog by rememberSaveable { + mutableStateOf(false) + } + if (showNameInputDialog) { + TextInputDialog( + initial = name, + title = stringResource(R.string.bundle_input_name), + onDismissRequest = { + showNameInputDialog = false + }, + onConfirm = { + showNameInputDialog = false + onNameChange?.invoke(it) + }, + validator = { + it.length in 1..19 + } + ) + } + BundleListItem( + headlineText = stringResource(R.string.bundle_input_name), + supportingText = name.ifEmpty { stringResource(R.string.field_not_set) }, + modifier = Modifier.clickable(enabled = onNameChange != null) { + showNameInputDialog = true + } + ) + + remoteUrl?.takeUnless { isDefault }?.let { url -> + var showUrlInputDialog by rememberSaveable { + mutableStateOf(false) + } + if (showUrlInputDialog) { + TextInputDialog( + initial = url, + title = stringResource(R.string.bundle_input_source_url), + onDismissRequest = { showUrlInputDialog = false }, + onConfirm = { + showUrlInputDialog = false + onRemoteUrlChange?.invoke(it) + }, + validator = { + if (it.isEmpty()) return@TextInputDialog false + + URLUtil.isValidUrl(it) + } + ) + } + + BundleListItem( + modifier = Modifier.clickable(enabled = onRemoteUrlChange != null) { + showUrlInputDialog = true + }, + headlineText = stringResource(R.string.bundle_input_source_url), + supportingText = url.ifEmpty { stringResource(R.string.field_not_set) } + ) + } + + extraFields() + + if (remoteUrl != null) { + BundleListItem( + headlineText = stringResource(R.string.automatically_update), + supportingText = stringResource(R.string.automatically_update_description), + trailingContent = { + Switch( + checked = autoUpdate, + onCheckedChange = onAutoUpdateChange + ) + }, + modifier = Modifier.clickable { + onAutoUpdateChange(!autoUpdate) + } + ) + } + + BundleListItem( + headlineText = stringResource(R.string.bundle_type), + supportingText = stringResource(R.string.bundle_type_description), + modifier = Modifier.clickable { + onBundleTypeClick() + } + ) { + FilledTonalButton( + onClick = onBundleTypeClick, + content = { + if (remoteUrl == null) { + Text(stringResource(R.string.local)) + } else { + Text(stringResource(R.string.remote)) + } + } + ) + } + + if (version != null || patchCount > 0) { + Text( + text = stringResource(R.string.information), + modifier = Modifier.padding( + horizontal = 16.dp, + vertical = 12.dp + ), + style = MaterialTheme.typography.labelLarge, + color = MaterialTheme.colorScheme.primary, + ) + } + + if (patchCount > 0) { + BundleListItem( + headlineText = stringResource(R.string.patches), + supportingText = if (patchCount == 0) stringResource(R.string.no_patches) + else stringResource(R.string.patches_available, patchCount), + trailingContent = { + if (patchCount > 0) { + IconButton(onClick = onPatchesClick) { + Icon( + Icons.Outlined.ArrowRight, + stringResource(R.string.patches) + ) + } + } + } + ) + } + + version?.let { + BundleListItem( + headlineText = stringResource(R.string.version), + supportingText = it, + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleInformationDialog.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleInformationDialog.kt new file mode 100644 index 0000000000..a34024fae6 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleInformationDialog.kt @@ -0,0 +1,118 @@ +package app.revanced.manager.ui.component.bundle + +import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.outlined.DeleteOutline +import androidx.compose.material.icons.outlined.Refresh +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Scaffold +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.domain.bundles.LocalPatchBundle +import app.revanced.manager.domain.bundles.RemotePatchBundle +import app.revanced.manager.domain.bundles.PatchBundleSource +import app.revanced.manager.domain.bundles.PatchBundleSource.Companion.asRemoteOrNull +import app.revanced.manager.domain.bundles.PatchBundleSource.Companion.isDefault +import app.revanced.manager.domain.bundles.PatchBundleSource.Companion.propsOrNullFlow +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.launch + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun BundleInformationDialog( + onDismissRequest: () -> Unit, + onDeleteRequest: () -> Unit, + bundle: PatchBundleSource, + onRefreshButton: () -> Unit, +) { + val composableScope = rememberCoroutineScope() + var viewCurrentBundlePatches by remember { mutableStateOf(false) } + val isLocal = bundle is LocalPatchBundle + val patchCount by remember(bundle) { + bundle.state.map { it.patchBundleOrNull()?.patches?.size ?: 0 } + }.collectAsStateWithLifecycle(0) + val props by remember(bundle) { + bundle.propsOrNullFlow() + }.collectAsStateWithLifecycle(null) + + if (viewCurrentBundlePatches) { + BundlePatchesDialog( + onDismissRequest = { + viewCurrentBundlePatches = false + }, + bundle = bundle, + ) + } + + Dialog( + onDismissRequest = onDismissRequest, + properties = DialogProperties( + usePlatformDefaultWidth = false, + dismissOnBackPress = true + ) + ) { + Scaffold( + topBar = { + BundleTopBar( + title = bundle.name, + onBackClick = onDismissRequest, + onBackIcon = { + Icon( + imageVector = Icons.Default.ArrowBack, + contentDescription = stringResource(R.string.back) + ) + }, + actions = { + if (!bundle.isDefault) { + IconButton(onClick = onDeleteRequest) { + Icon( + Icons.Outlined.DeleteOutline, + stringResource(R.string.delete) + ) + } + } + if (!isLocal) { + IconButton(onClick = onRefreshButton) { + Icon( + Icons.Outlined.Refresh, + stringResource(R.string.refresh) + ) + } + } + } + ) + }, + ) { paddingValues -> + BaseBundleDialog( + modifier = Modifier.padding(paddingValues), + isDefault = bundle.isDefault, + name = bundle.name, + remoteUrl = bundle.asRemoteOrNull?.endpoint, + patchCount = patchCount, + version = props?.versionInfo?.patches, + autoUpdate = props?.autoUpdate ?: false, + onAutoUpdateChange = { + composableScope.launch { + bundle.asRemoteOrNull?.setAutoUpdate(it) + } + }, + onPatchesClick = { + viewCurrentBundlePatches = true + }, + ) + } + } +} diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleItem.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleItem.kt new file mode 100644 index 0000000000..04f3f64ab9 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleItem.kt @@ -0,0 +1,108 @@ +package app.revanced.manager.ui.component.bundle + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.ErrorOutline +import androidx.compose.material.icons.outlined.Warning +import androidx.compose.material3.Icon +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.pluralStringResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.domain.bundles.PatchBundleSource +import app.revanced.manager.domain.bundles.PatchBundleSource.Companion.propsOrNullFlow +import kotlinx.coroutines.flow.map + +@Composable +fun BundleItem( + bundle: PatchBundleSource, + onDelete: () -> Unit, + onUpdate: () -> Unit +) { + var viewBundleDialogPage by rememberSaveable { mutableStateOf(false) } + val state by bundle.state.collectAsStateWithLifecycle() + + val version by remember(bundle) { + bundle.propsOrNullFlow().map { props -> props?.versionInfo?.patches } + }.collectAsStateWithLifecycle(null) + + if (viewBundleDialogPage) { + BundleInformationDialog( + onDismissRequest = { viewBundleDialogPage = false }, + onDeleteRequest = { + viewBundleDialogPage = false + onDelete() + }, + bundle = bundle, + onRefreshButton = onUpdate, + ) + } + + ListItem( + modifier = Modifier + .height(64.dp) + .fillMaxWidth() + .clickable { + viewBundleDialogPage = true + }, + headlineContent = { + Text( + text = bundle.name, + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurface + ) + }, + supportingContent = { + state.patchBundleOrNull()?.patches?.size?.let { patchCount -> + Text( + text = pluralStringResource(R.plurals.patches_count, patchCount, patchCount), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + }, + trailingContent = { + Row { + val icon = remember(state) { + when (state) { + is PatchBundleSource.State.Failed -> Icons.Outlined.ErrorOutline to R.string.bundle_error + is PatchBundleSource.State.Missing -> Icons.Outlined.Warning to R.string.bundle_missing + is PatchBundleSource.State.Loaded -> null + } + } + + icon?.let { (vector, description) -> + Icon( + imageVector = vector, + contentDescription = stringResource(description), + modifier = Modifier.size(24.dp), + tint = MaterialTheme.colorScheme.error + ) + } + + version?.let { txt -> + Text( + text = txt, + style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + } + }, + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleListItem.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleListItem.kt new file mode 100644 index 0000000000..48a1ac17ed --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleListItem.kt @@ -0,0 +1,33 @@ +package app.revanced.manager.ui.component.bundle + +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier + +@Composable +fun BundleListItem( + modifier: Modifier = Modifier, + headlineText: String, + supportingText: String = "", + trailingContent: @Composable (() -> Unit)? = null, +) { + ListItem( + headlineContent = { + Text( + text = headlineText, + style = MaterialTheme.typography.titleLarge + ) + }, + supportingContent = { + Text( + text = supportingText, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.outline + ) + }, + trailingContent = trailingContent, + modifier = modifier + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/BundlePatchesDialog.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundlePatchesDialog.kt new file mode 100644 index 0000000000..2ff2a555ab --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundlePatchesDialog.kt @@ -0,0 +1,114 @@ +package app.revanced.manager.ui.component.bundle + +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.outlined.Close +import androidx.compose.material.icons.outlined.Lightbulb +import androidx.compose.material3.Divider +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.domain.bundles.PatchBundleSource +import app.revanced.manager.ui.component.NotificationCard + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun BundlePatchesDialog( + onDismissRequest: () -> Unit, + bundle: PatchBundleSource, +) { + var informationCardVisible by remember { mutableStateOf(true) } + val state by bundle.state.collectAsStateWithLifecycle() + + Dialog( + onDismissRequest = onDismissRequest, + properties = DialogProperties( + usePlatformDefaultWidth = false, + dismissOnBackPress = true + ) + ) { + Scaffold( + topBar = { + BundleTopBar( + title = stringResource(R.string.bundle_patches), + onBackClick = onDismissRequest, + onBackIcon = { + Icon( + imageVector = Icons.Default.ArrowBack, + contentDescription = stringResource(R.string.back) + ) + }, + ) + }, + ) { paddingValues -> + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .padding(paddingValues) + .padding(16.dp) + ) { + item { + AnimatedVisibility(visible = informationCardVisible) { + NotificationCard( + color = MaterialTheme.colorScheme.secondaryContainer, + icon = Icons.Outlined.Lightbulb, + text = stringResource(R.string.tap_on_patches) + ) { + IconButton(onClick = { informationCardVisible = false }) { + Icon( + imageVector = Icons.Outlined.Close, + contentDescription = stringResource(R.string.close), + ) + } + } + } + } + + state.patchBundleOrNull()?.let { bundle -> + items(bundle.patches.size) { bundleIndex -> + val patch = bundle.patches[bundleIndex] + ListItem( + headlineContent = { + Text( + text = patch.name, + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurface + ) + }, + supportingContent = { + patch.description?.let { + Text( + text = it, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + } + } + ) + Divider() + } + } + } + } + } +} diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleSelector.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleSelector.kt new file mode 100644 index 0000000000..55da7e0f8a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleSelector.kt @@ -0,0 +1,73 @@ +package app.revanced.manager.ui.component.bundle + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import app.revanced.manager.domain.bundles.PatchBundleSource + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun BundleSelector(bundles: List, onFinish: (PatchBundleSource?) -> Unit) { + LaunchedEffect(bundles) { + if (bundles.size == 1) { + onFinish(bundles[0]) + } + } + + if (bundles.size < 2) { + return + } + + ModalBottomSheet( + onDismissRequest = { onFinish(null) } + ) { + Column( + modifier = Modifier.fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(12.dp) + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + modifier = Modifier + .height(48.dp) + .fillMaxWidth() + ) { + Text( + text = "Select bundle", + style = MaterialTheme.typography.titleLarge, + color = MaterialTheme.colorScheme.onSurface + ) + } + bundles.forEach { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + modifier = Modifier + .height(48.dp) + .fillMaxWidth() + .clickable { + onFinish(it) + } + ) { + Text( + text = it.name, + style = MaterialTheme.typography.titleMedium, + color = MaterialTheme.colorScheme.onSurface + ) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleTopBar.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleTopBar.kt new file mode 100644 index 0000000000..7f98f01434 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/BundleTopBar.kt @@ -0,0 +1,46 @@ +package app.revanced.manager.ui.component.bundle + +import androidx.compose.foundation.layout.RowScope +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.TopAppBarScrollBehavior +import androidx.compose.material3.surfaceColorAtElevation +import androidx.compose.runtime.Composable +import androidx.compose.ui.unit.dp + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun BundleTopBar( + title: String, + onBackClick: (() -> Unit)? = null, + actions: @Composable (RowScope.() -> Unit) = {}, + scrollBehavior: TopAppBarScrollBehavior? = null, + onBackIcon: @Composable () -> Unit, +) { + val containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp) + + TopAppBar( + title = { + Text( + text = title, + style = MaterialTheme.typography.titleLarge + ) + }, + scrollBehavior = scrollBehavior, + navigationIcon = { + if (onBackClick != null) { + IconButton(onClick = onBackClick) { + onBackIcon() + } + } + }, + actions = actions, + colors = TopAppBarDefaults.topAppBarColors( + containerColor = containerColor + ) + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/bundle/ImportBundleDialog.kt b/app/src/main/java/app/revanced/manager/ui/component/bundle/ImportBundleDialog.kt new file mode 100644 index 0000000000..d5bc9c0357 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/bundle/ImportBundleDialog.kt @@ -0,0 +1,163 @@ +package app.revanced.manager.ui.component.bundle + +import android.net.Uri +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Close +import androidx.compose.material.icons.filled.Topic +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import app.revanced.manager.R +import app.revanced.manager.util.APK_MIMETYPE +import app.revanced.manager.util.JAR_MIMETYPE + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun ImportBundleDialog( + onDismissRequest: () -> Unit, + onRemoteSubmit: (String, String, Boolean) -> Unit, + onLocalSubmit: (String, Uri, Uri?) -> Unit +) { + var name by rememberSaveable { mutableStateOf("") } + var remoteUrl by rememberSaveable { mutableStateOf("") } + var autoUpdate by rememberSaveable { mutableStateOf(true) } + var isLocal by rememberSaveable { mutableStateOf(false) } + var patchBundle by rememberSaveable { mutableStateOf(null) } + var integrations by rememberSaveable { mutableStateOf(null) } + + val inputsAreValid by remember { + derivedStateOf { + name.isNotEmpty() && if (isLocal) patchBundle != null else remoteUrl.isNotEmpty() + } + } + + val patchActivityLauncher = + rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { uri -> + uri?.let { patchBundle = it } + } + fun launchPatchActivity() { + patchActivityLauncher.launch(JAR_MIMETYPE) + } + + val integrationsActivityLauncher = + rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { uri -> + uri?.let { integrations = it } + } + fun launchIntegrationsActivity() { + integrationsActivityLauncher.launch(APK_MIMETYPE) + } + + Dialog( + onDismissRequest = onDismissRequest, + properties = DialogProperties( + usePlatformDefaultWidth = false, + dismissOnBackPress = true + ) + ) { + Scaffold( + topBar = { + BundleTopBar( + title = stringResource(R.string.import_bundle), + onBackClick = onDismissRequest, + onBackIcon = { + Icon( + imageVector = Icons.Default.Close, + contentDescription = stringResource(R.string.close) + ) + }, + actions = { + TextButton( + enabled = inputsAreValid, + onClick = { + if (isLocal) { + onLocalSubmit(name, patchBundle!!, integrations) + } else { + onRemoteSubmit( + name, + remoteUrl, + autoUpdate + ) + } + }, + modifier = Modifier.padding(end = 16.dp) + ) { + Text(stringResource(R.string.import_)) + } + } + ) + }, + ) { paddingValues -> + BaseBundleDialog( + modifier = Modifier.padding(paddingValues), + isDefault = false, + name = name, + onNameChange = { name = it }, + remoteUrl = remoteUrl.takeUnless { isLocal }, + onRemoteUrlChange = { remoteUrl = it }, + patchCount = 0, + version = null, + autoUpdate = autoUpdate, + onAutoUpdateChange = { autoUpdate = it }, + onPatchesClick = {}, + onBundleTypeClick = { isLocal = !isLocal }, + ) { + if (!isLocal) return@BaseBundleDialog + + BundleListItem( + headlineText = stringResource(R.string.patch_bundle_field), + supportingText = stringResource(if (patchBundle != null) R.string.file_field_set else R.string.file_field_not_set), + trailingContent = { + IconButton( + onClick = ::launchPatchActivity + ) { + Icon( + imageVector = Icons.Default.Topic, + contentDescription = null + ) + } + }, + modifier = Modifier.clickable { + launchPatchActivity() + } + ) + + BundleListItem( + headlineText = stringResource(R.string.integrations_field), + supportingText = stringResource(if (integrations != null) R.string.file_field_set else R.string.file_field_not_set), + trailingContent = { + IconButton( + onClick = ::launchIntegrationsActivity + ) { + Icon( + imageVector = Icons.Default.Topic, + contentDescription = null + ) + } + }, + modifier = Modifier.clickable { + launchIntegrationsActivity() + } + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/patches/OptionFields.kt b/app/src/main/java/app/revanced/manager/ui/component/patches/OptionFields.kt new file mode 100644 index 0000000000..bd822ad0ed --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/patches/OptionFields.kt @@ -0,0 +1,205 @@ +package app.revanced.manager.ui.component.patches + +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.compose.foundation.clickable +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Edit +import androidx.compose.material.icons.outlined.Folder +import androidx.compose.material.icons.outlined.MoreVert +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Switch +import androidx.compose.material3.Text +import androidx.compose.material3.ListItem +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.getValue +import androidx.compose.runtime.setValue +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import app.revanced.manager.R +import app.revanced.manager.data.platform.FileSystem +import app.revanced.manager.patcher.patch.Option +import app.revanced.manager.util.toast +import app.revanced.patcher.patch.PatchOption +import org.koin.compose.rememberKoinInject + +// Composable functions do not support function references, so we have to use composable lambdas instead. +private typealias OptionImpl = @Composable (Option, Any?, (Any?) -> Unit) -> Unit + +@Composable +private fun OptionListItem( + option: Option, + onClick: () -> Unit, + trailingContent: @Composable () -> Unit +) { + ListItem( + modifier = Modifier.clickable(onClick = onClick), + headlineContent = { Text(option.title) }, + supportingContent = { Text(option.description) }, + trailingContent = trailingContent + ) +} + +@Composable +private fun StringOptionDialog( + name: String, + value: String?, + onSubmit: (String) -> Unit, + onDismissRequest: () -> Unit +) { + var showFileDialog by rememberSaveable { mutableStateOf(false) } + var fieldValue by rememberSaveable(value) { + mutableStateOf(value.orEmpty()) + } + + val fs: FileSystem = rememberKoinInject() + val (contract, permissionName) = fs.permissionContract() + val permissionLauncher = rememberLauncherForActivityResult(contract = contract) { + showFileDialog = it + } + + if (showFileDialog) { + PathSelectorDialog( + root = fs.externalFilesDir() + ) { + showFileDialog = false + it?.let { path -> + fieldValue = path.toString() + } + } + } + + AlertDialog( + onDismissRequest = onDismissRequest, + title = { Text(name) }, + text = { + OutlinedTextField( + value = fieldValue, + onValueChange = { fieldValue = it }, + placeholder = { + Text(stringResource(R.string.string_option_placeholder)) + }, + trailingIcon = { + var showDropdownMenu by rememberSaveable { mutableStateOf(false) } + IconButton( + onClick = { showDropdownMenu = true } + ) { + Icon( + Icons.Outlined.MoreVert, + contentDescription = stringResource(R.string.string_option_menu_description) + ) + } + + DropdownMenu( + expanded = showDropdownMenu, + onDismissRequest = { showDropdownMenu = false } + ) { + DropdownMenuItem( + leadingIcon = { + Icon(Icons.Outlined.Folder, null) + }, + text = { + Text(stringResource(R.string.path_selector)) + }, + onClick = { + showDropdownMenu = false + if (fs.hasStoragePermission()) { + showFileDialog = true + } else { + permissionLauncher.launch(permissionName) + } + } + ) + } + } + ) + }, + confirmButton = { + TextButton(onClick = { onSubmit(fieldValue) }) { + Text(stringResource(R.string.save)) + } + }, + dismissButton = { + TextButton(onClick = onDismissRequest) { + Text(stringResource(R.string.cancel)) + } + }, + ) +} + +private val StringOption: OptionImpl = { option, value, setValue -> + var showInputDialog by rememberSaveable { mutableStateOf(false) } + fun showInputDialog() { + showInputDialog = true + } + + fun dismissInputDialog() { + showInputDialog = false + } + + if (showInputDialog) { + StringOptionDialog( + name = option.title, + value = value as? String, + onSubmit = { + dismissInputDialog() + setValue(it) + }, + onDismissRequest = ::dismissInputDialog + ) + } + + OptionListItem( + option = option, + onClick = ::showInputDialog + ) { + IconButton(onClick = ::showInputDialog) { + Icon( + Icons.Outlined.Edit, + contentDescription = stringResource(R.string.string_option_icon_description) + ) + } + } +} + +private val BooleanOption: OptionImpl = { option, value, setValue -> + val current = (value as? Boolean) ?: false + + OptionListItem( + option = option, + onClick = { setValue(!current) } + ) { + Switch(checked = current, onCheckedChange = setValue) + } +} + +private val UnknownOption: OptionImpl = { option, _, _ -> + val context = LocalContext.current + OptionListItem( + option = option, + onClick = { context.toast("Unknown type: ${option.type.name}") }, + trailingContent = {}) +} + +@Composable +fun OptionItem(option: Option, value: Any?, setValue: (Any?) -> Unit) { + val implementation = remember(option.type) { + when (option.type) { + // These are the only two types that are currently used by the official patches. + PatchOption.StringOption::class.java -> StringOption + PatchOption.BooleanOption::class.java -> BooleanOption + else -> UnknownOption + } + } + + implementation(option, value, setValue) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/patches/PathSelectorDialog.kt b/app/src/main/java/app/revanced/manager/ui/component/patches/PathSelectorDialog.kt new file mode 100644 index 0000000000..6818da14e9 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/patches/PathSelectorDialog.kt @@ -0,0 +1,136 @@ +package app.revanced.manager.ui.component.patches + +import androidx.activity.compose.BackHandler +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Close +import androidx.compose.material.icons.outlined.ArrowBack +import androidx.compose.material.icons.outlined.DocumentScanner +import androidx.compose.material.icons.outlined.Folder +import androidx.compose.material.icons.outlined.InsertDriveFile +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.ListItem +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.GroupHeader +import app.revanced.manager.util.saver.PathSaver +import java.nio.file.Path +import kotlin.io.path.absolutePathString +import kotlin.io.path.isDirectory +import kotlin.io.path.isReadable +import kotlin.io.path.listDirectoryEntries +import kotlin.io.path.name + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun PathSelectorDialog(root: Path, onSelect: (Path?) -> Unit) { + var currentDirectory by rememberSaveable(root, stateSaver = PathSaver) { mutableStateOf(root) } + val notAtRootDir = remember(currentDirectory) { + currentDirectory != root + } + val (directories, files) = remember(currentDirectory) { + currentDirectory.listDirectoryEntries().filter(Path::isReadable).partition(Path::isDirectory) + } + + Dialog( + onDismissRequest = { onSelect(null) }, + properties = DialogProperties( + usePlatformDefaultWidth = false, + dismissOnBackPress = true + ) + ) { + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.path_selector), + onBackClick = { onSelect(null) }, + backIcon = { + Icon(Icons.Filled.Close, contentDescription = stringResource(R.string.close)) + } + ) + }, + ) { paddingValues -> + BackHandler(enabled = notAtRootDir) { + currentDirectory = currentDirectory.parent + } + + LazyColumn( + modifier = Modifier.padding(paddingValues) + ) { + item(key = "current") { + PathItem( + onClick = { onSelect(currentDirectory) }, + icon = Icons.Outlined.Folder, + name = currentDirectory.toString() + ) + } + + if (notAtRootDir) { + item(key = "parent") { + PathItem( + onClick = { currentDirectory = currentDirectory.parent }, + icon = Icons.Outlined.ArrowBack, + name = stringResource(R.string.path_selector_parent_dir) + ) + } + } + + if (directories.isNotEmpty()) { + item(key = "dirs_header") { + GroupHeader(title = stringResource(R.string.path_selector_dirs)) + } + } + items(directories, key = { it.absolutePathString() }) { + PathItem( + onClick = { currentDirectory = it }, + icon = Icons.Outlined.Folder, + name = it.name + ) + } + + if (files.isNotEmpty()) { + item(key = "files_header") { + GroupHeader(title = stringResource(R.string.path_selector_files)) + } + } + items(files, key = { it.absolutePathString() }) { + PathItem( + onClick = { onSelect(it) }, + icon = Icons.Outlined.InsertDriveFile, + name = it.name + ) + } + } + } + } +} + +@Composable +private fun PathItem( + onClick: () -> Unit, + icon: ImageVector, + name: String +) { + ListItem( + modifier = Modifier.clickable(onClick = onClick), + headlineContent = { Text(name) }, + leadingContent = { Icon(icon, contentDescription = null) } + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/component/settings/BooleanItem.kt b/app/src/main/java/app/revanced/manager/ui/component/settings/BooleanItem.kt new file mode 100644 index 0000000000..8ed787756c --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/component/settings/BooleanItem.kt @@ -0,0 +1,50 @@ +package app.revanced.manager.ui.component.settings + +import androidx.annotation.StringRes +import androidx.compose.foundation.clickable +import androidx.compose.material3.ListItem +import androidx.compose.material3.Switch +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import app.revanced.manager.domain.manager.base.Preference +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch + +@Composable +fun BooleanItem( + preference: Preference, + coroutineScope: CoroutineScope = rememberCoroutineScope(), + @StringRes headline: Int, + @StringRes description: Int +) { + val value by preference.getAsState() + + BooleanItem( + value = value, + onValueChange = { coroutineScope.launch { preference.update(it) } }, + headline = headline, + description = description + ) +} + +@Composable +fun BooleanItem( + value: Boolean, + onValueChange: (Boolean) -> Unit, + @StringRes headline: Int, + @StringRes description: Int +) = ListItem( + modifier = Modifier.clickable { onValueChange(!value) }, + headlineContent = { Text(stringResource(headline)) }, + supportingContent = { Text(stringResource(description)) }, + trailingContent = { + Switch( + checked = value, + onCheckedChange = onValueChange, + ) + } +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/destination/Destination.kt b/app/src/main/java/app/revanced/manager/ui/destination/Destination.kt new file mode 100644 index 0000000000..e737ed8c40 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/destination/Destination.kt @@ -0,0 +1,34 @@ +package app.revanced.manager.ui.destination + +import android.os.Parcelable +import app.revanced.manager.data.room.apps.installed.InstalledApp +import app.revanced.manager.ui.model.SelectedApp +import app.revanced.manager.util.Options +import app.revanced.manager.util.PatchesSelection +import kotlinx.parcelize.Parcelize +import kotlinx.parcelize.RawValue + +sealed interface Destination : Parcelable { + + @Parcelize + object Dashboard : Destination + + @Parcelize + data class ApplicationInfo(val installedApp: InstalledApp) : Destination + + @Parcelize + object AppSelector : Destination + + @Parcelize + object Settings : Destination + + @Parcelize + data class VersionSelector(val packageName: String, val patchesSelection: PatchesSelection? = null) : Destination + + @Parcelize + data class PatchesSelector(val selectedApp: SelectedApp, val patchesSelection: PatchesSelection? = null) : Destination + + @Parcelize + data class Installer(val selectedApp: SelectedApp, val selectedPatches: PatchesSelection, val options: @RawValue Options) : Destination + +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/destination/SettingsDestination.kt b/app/src/main/java/app/revanced/manager/ui/destination/SettingsDestination.kt new file mode 100644 index 0000000000..ffdf20bca2 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/destination/SettingsDestination.kt @@ -0,0 +1,41 @@ +package app.revanced.manager.ui.destination + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +sealed interface SettingsDestination : Parcelable { + + @Parcelize + object Settings : SettingsDestination + + @Parcelize + object General : SettingsDestination + + @Parcelize + object Advanced : SettingsDestination + + @Parcelize + object Updates : SettingsDestination + + @Parcelize + object Downloads : SettingsDestination + + @Parcelize + object ImportExport : SettingsDestination + + @Parcelize + object About : SettingsDestination + + @Parcelize + object UpdateProgress : SettingsDestination + + @Parcelize + object UpdateChangelog : SettingsDestination + + @Parcelize + object Contributors: SettingsDestination + + @Parcelize + object Licenses: SettingsDestination + +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/model/SelectedApp.kt b/app/src/main/java/app/revanced/manager/ui/model/SelectedApp.kt new file mode 100644 index 0000000000..424d07e7cd --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/model/SelectedApp.kt @@ -0,0 +1,20 @@ +package app.revanced.manager.ui.model + +import android.os.Parcelable +import app.revanced.manager.network.downloader.AppDownloader +import kotlinx.parcelize.Parcelize +import java.io.File + +sealed class SelectedApp : Parcelable { + abstract val packageName: String + abstract val version: String + + @Parcelize + data class Download(override val packageName: String, override val version: String, val app: AppDownloader.App) : SelectedApp() + + @Parcelize + data class Local(override val packageName: String, override val version: String, val file: File) : SelectedApp() + + @Parcelize + data class Installed(override val packageName: String, override val version: String) : SelectedApp() +} diff --git a/app/src/main/java/app/revanced/manager/ui/screen/AppInfoScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/AppInfoScreen.kt new file mode 100644 index 0000000000..74b5c1857a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/AppInfoScreen.kt @@ -0,0 +1,158 @@ +package app.revanced.manager.ui.screen + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowRight +import androidx.compose.material.icons.outlined.Delete +import androidx.compose.material.icons.outlined.OpenInNew +import androidx.compose.material.icons.outlined.Update +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.pluralStringResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppIcon +import app.revanced.manager.ui.component.AppLabel +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.SegmentedButton +import app.revanced.manager.ui.viewmodel.AppInfoViewModel +import app.revanced.manager.util.PatchesSelection + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AppInfoScreen( + onPatchClick: (packageName: String, patchesSelection: PatchesSelection) -> Unit, + onBackClick: () -> Unit, + viewModel: AppInfoViewModel +) { + SideEffect { + viewModel.onBackClick = onBackClick + } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.app_info), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 16.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + AppIcon( + viewModel.appInfo, + contentDescription = null, + modifier = Modifier + .size(100.dp) + .padding(bottom = 5.dp) + ) + + AppLabel( + viewModel.appInfo, + style = MaterialTheme.typography.titleLarge, + defaultText = null + ) + + Text(viewModel.installedApp.version, style = MaterialTheme.typography.bodySmall) + } + + Row( + horizontalArrangement = Arrangement.spacedBy(2.dp), + modifier = Modifier + .padding(horizontal = 16.dp) + .clip(RoundedCornerShape(24.dp)) + ) { + SegmentedButton( + icon = Icons.Outlined.OpenInNew, + text = stringResource(R.string.open_app), + onClick = viewModel::launch + ) + + SegmentedButton( + icon = Icons.Outlined.Delete, + text = stringResource(R.string.uninstall), + onClick = viewModel::uninstall + ) + + SegmentedButton( + icon = Icons.Outlined.Update, + text = stringResource(R.string.repatch), + onClick = { + viewModel.appliedPatches?.let { + onPatchClick(viewModel.installedApp.originalPackageName, it) + } + } + ) + } + + Column( + modifier = Modifier.padding(vertical = 16.dp) + ) { + ListItem( + modifier = Modifier.clickable { }, + headlineContent = { Text(stringResource(R.string.applied_patches)) }, + supportingContent = { + Text( + (viewModel.appliedPatches?.values?.sumOf { it.size } ?: 0).let { + pluralStringResource( + id = R.plurals.applied_patches, + it, + it + ) + } + ) + }, + trailingContent = { Icon(Icons.Filled.ArrowRight, contentDescription = stringResource(R.string.view_applied_patches)) } + ) + + ListItem( + headlineContent = { Text(stringResource(R.string.package_name)) }, + supportingContent = { Text(viewModel.installedApp.currentPackageName) } + ) + + if (viewModel.installedApp.originalPackageName != viewModel.installedApp.currentPackageName) { + ListItem( + headlineContent = { Text(stringResource(R.string.original_package_name)) }, + supportingContent = { Text(viewModel.installedApp.originalPackageName) } + ) + } + + ListItem( + headlineContent = { Text(stringResource(R.string.install_type)) }, + supportingContent = { Text(stringResource(viewModel.installedApp.installType.stringResource)) } + ) + } + + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/AppSelectorScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/AppSelectorScreen.kt new file mode 100644 index 0000000000..f1a71e59db --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/AppSelectorScreen.kt @@ -0,0 +1,225 @@ +package app.revanced.manager.ui.screen + +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.filled.Storage +import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material.icons.outlined.Search +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.pluralStringResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppIcon +import app.revanced.manager.ui.component.AppLabel +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.LoadingIndicator +import app.revanced.manager.ui.model.SelectedApp +import app.revanced.manager.ui.viewmodel.AppSelectorViewModel +import app.revanced.manager.util.APK_MIMETYPE +import app.revanced.manager.util.toast +import org.koin.androidx.compose.getViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AppSelectorScreen( + onAppClick: (packageName: String) -> Unit, + onStorageClick: (SelectedApp.Local) -> Unit, + onBackClick: () -> Unit, + vm: AppSelectorViewModel = getViewModel() +) { + val context = LocalContext.current + + val pickApkLauncher = + rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { uri -> + uri?.let { apkUri -> + vm.loadSelectedFile(apkUri)?.let(onStorageClick) ?: context.toast( + context.getString( + R.string.failed_to_load_apk + ) + ) + } + } + + var filterText by rememberSaveable { mutableStateOf("") } + var search by rememberSaveable { mutableStateOf(false) } + + val appList by vm.appList.collectAsStateWithLifecycle(initialValue = emptyList()) + val filteredAppList = remember(appList, filterText) { + appList.filter { app -> + (vm.loadLabel(app.packageInfo)).contains( + filterText, + true + ) or app.packageName.contains(filterText, true) + } + } + + // TODO: find something better for this + if (search) { + SearchBar( + query = filterText, + onQueryChange = { filterText = it }, + onSearch = { }, + active = true, + onActiveChange = { search = it }, + modifier = Modifier.fillMaxSize(), + placeholder = { Text(stringResource(R.string.search_apps)) }, + leadingIcon = { + IconButton({ search = false }) { + Icon( + Icons.Default.ArrowBack, + stringResource(R.string.back) + ) + } + }, + content = { + + if (appList.isNotEmpty() && filterText.isNotEmpty()) { + + LazyColumn( + modifier = Modifier.fillMaxSize() + ) { + + items( + items = filteredAppList, + key = { it.packageName } + ) { app -> + ListItem( + modifier = Modifier.clickable { onAppClick(app.packageName) }, + leadingContent = { + AppIcon( + app.packageInfo, + null, + Modifier.size(36.dp) + ) + }, + headlineContent = { AppLabel(app.packageInfo) }, + supportingContent = { Text(app.packageName) }, + trailingContent = app.patches?.let { + { + Text( + pluralStringResource( + R.plurals.patches_count, + it, + it + ) + ) + } + } + ) + + } + } + } else { + Column( + modifier = Modifier.fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon( + imageVector = Icons.Outlined.Search, + contentDescription = stringResource(R.string.search), + modifier = Modifier.size(64.dp) + ) + + Text( + text = stringResource(R.string.type_anything), + style = MaterialTheme.typography.bodyLarge + ) + } + } + + } + ) + } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.select_app), + onBackClick = onBackClick, + actions = { + IconButton(onClick = { }) { + Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help)) + } + IconButton(onClick = { search = true }) { + Icon(Icons.Outlined.Search, stringResource(R.string.search)) + } + } + ) + } + ) { paddingValues -> + LazyColumn( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + ) { + item { + ListItem( + modifier = Modifier.clickable { + pickApkLauncher.launch(APK_MIMETYPE) + }, + leadingContent = { + Box(Modifier.size(36.dp), Alignment.Center) { + Icon( + Icons.Default.Storage, + null, + modifier = Modifier.size(24.dp) + ) + } + }, + headlineContent = { Text(stringResource(R.string.select_from_storage)) }, + supportingContent = { + Text(stringResource(R.string.select_from_storage_description)) + } + ) + Divider() + } + + if (appList.isNotEmpty()) { + items( + items = appList, + key = { it.packageName } + ) { app -> + + ListItem( + modifier = Modifier.clickable { onAppClick(app.packageName) }, + leadingContent = { AppIcon(app.packageInfo, null, Modifier.size(36.dp)) }, + headlineContent = { AppLabel(app.packageInfo) }, + supportingContent = { Text(app.packageName) }, + trailingContent = app.patches?.let { + { + Text( + pluralStringResource( + R.plurals.patches_count, + it, + it + ) + ) + } + } + ) + + } + } else { + item { LoadingIndicator() } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/BundlesScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/BundlesScreen.kt new file mode 100644 index 0000000000..a12b222cbd --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/BundlesScreen.kt @@ -0,0 +1,35 @@ +package app.revanced.manager.ui.screen + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.ui.component.bundle.BundleItem +import app.revanced.manager.ui.viewmodel.BundlesViewModel +import org.koin.androidx.compose.getViewModel + +@Composable +fun BundlesScreen( + vm: BundlesViewModel = getViewModel(), +) { + val sources by vm.sources.collectAsStateWithLifecycle(initialValue = emptyList()) + + Column( + modifier = Modifier + .fillMaxSize(), + ) { + sources.forEach { + BundleItem( + bundle = it, + onDelete = { + vm.delete(it) + }, + onUpdate = { + vm.update(it) + } + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/DashboardScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/DashboardScreen.kt new file mode 100644 index 0000000000..33dee138b8 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/DashboardScreen.kt @@ -0,0 +1,159 @@ +package app.revanced.manager.ui.screen + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Add +import androidx.compose.material.icons.outlined.Apps +import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material.icons.outlined.Settings +import androidx.compose.material.icons.outlined.Source +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.data.room.apps.installed.InstalledApp +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.bundle.ImportBundleDialog +import app.revanced.manager.ui.viewmodel.DashboardViewModel +import app.revanced.manager.util.toast +import kotlinx.coroutines.launch +import org.koin.androidx.compose.getViewModel + +enum class DashboardPage( + val titleResId: Int, + val icon: ImageVector +) { + DASHBOARD(R.string.tab_apps, Icons.Outlined.Apps), + BUNDLES(R.string.tab_bundles, Icons.Outlined.Source), +} + +@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class) +@Composable +fun DashboardScreen( + vm: DashboardViewModel = getViewModel(), + onAppSelectorClick: () -> Unit, + onSettingsClick: () -> Unit, + onAppClick: (InstalledApp) -> Unit +) { + var showImportBundleDialog by rememberSaveable { mutableStateOf(false) } + val pages: Array = DashboardPage.values() + val availablePatches by vm.availablePatches.collectAsStateWithLifecycle(0) + val androidContext = LocalContext.current + + val pagerState = rememberPagerState() + val composableScope = rememberCoroutineScope() + + if (showImportBundleDialog) { + fun dismiss() { + showImportBundleDialog = false + } + + ImportBundleDialog( + onDismissRequest = ::dismiss, + onLocalSubmit = { name, patches, integrations -> + dismiss() + vm.createLocalSource(name, patches, integrations) + }, + onRemoteSubmit = { name, url, autoUpdate -> + dismiss() + vm.createRemoteSource(name, url, autoUpdate) + }, + ) + } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.app_name), + actions = { + IconButton(onClick = {}) { + Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help)) + } + IconButton(onClick = onSettingsClick) { + Icon(Icons.Outlined.Settings, stringResource(R.string.settings)) + } + } + ) + }, + floatingActionButton = { + FloatingActionButton( + onClick = { + when (pagerState.currentPage) { + DashboardPage.DASHBOARD.ordinal -> { + if (availablePatches < 1) { + androidContext.toast(androidContext.getString(R.string.patches_unavailable)) + composableScope.launch { + pagerState.animateScrollToPage( + DashboardPage.BUNDLES.ordinal + ) + } + return@FloatingActionButton + } + + onAppSelectorClick() + } + + DashboardPage.BUNDLES.ordinal -> { + showImportBundleDialog = true + } + } + } + ) { + Icon(Icons.Default.Add, stringResource(R.string.add)) + } + } + ) { paddingValues -> + Column(Modifier.padding(paddingValues)) { + TabRow( + selectedTabIndex = pagerState.currentPage, + containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp) + ) { + pages.forEachIndexed { index, page -> + Tab( + selected = pagerState.currentPage == index, + onClick = { composableScope.launch { pagerState.animateScrollToPage(index) } }, + text = { Text(stringResource(page.titleResId)) }, + icon = { Icon(page.icon, null) }, + selectedContentColor = MaterialTheme.colorScheme.primary, + unselectedContentColor = MaterialTheme.colorScheme.onSurfaceVariant + ) + } + } + + HorizontalPager( + pageCount = pages.size, + state = pagerState, + userScrollEnabled = true, + modifier = Modifier.fillMaxSize(), + pageContent = { index -> + when (pages[index]) { + DashboardPage.DASHBOARD -> { + InstalledAppsScreen( + onAppClick = onAppClick + ) + } + + DashboardPage.BUNDLES -> { + BundlesScreen() + } + } + } + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/InstalledAppsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/InstalledAppsScreen.kt new file mode 100644 index 0000000000..82bd6f6bb1 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/InstalledAppsScreen.kt @@ -0,0 +1,73 @@ +package app.revanced.manager.ui.screen + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.data.room.apps.installed.InstalledApp +import app.revanced.manager.ui.component.AppIcon +import app.revanced.manager.ui.component.AppLabel +import app.revanced.manager.ui.component.LoadingIndicator +import app.revanced.manager.ui.viewmodel.InstalledAppsViewModel +import org.koin.androidx.compose.getViewModel + +@Composable +fun InstalledAppsScreen( + onAppClick: (InstalledApp) -> Unit, + viewModel: InstalledAppsViewModel = getViewModel() +) { + val installedApps by viewModel.apps.collectAsStateWithLifecycle(initialValue = null) + + LazyColumn( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = installedApps?.let { if (it.isEmpty()) Arrangement.Center else Arrangement.Top } ?: Arrangement.Center + ) { + installedApps?.let { installedApps -> + + if (installedApps.isNotEmpty()) { + items( + installedApps, + key = { it.currentPackageName } + ) { installedApp -> + viewModel.packageInfoMap[installedApp.currentPackageName].let { packageInfo -> + ListItem( + modifier = Modifier.clickable { onAppClick(installedApp) }, + leadingContent = { + AppIcon( + packageInfo, + contentDescription = null, + Modifier.size(36.dp) + ) + }, + headlineContent = { AppLabel(packageInfo, defaultText = null) }, + supportingContent = { Text(installedApp.currentPackageName) } + ) + + } + } + } else { + item { + Text( + text = stringResource(R.string.no_patched_apps_found), + style = MaterialTheme.typography.titleLarge + ) + } + } + + } ?: item { LoadingIndicator() } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/InstallerScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/InstallerScreen.kt new file mode 100644 index 0000000000..69d9c07497 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/InstallerScreen.kt @@ -0,0 +1,257 @@ +package app.revanced.manager.ui.screen + +import androidx.activity.compose.BackHandler +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.contract.ActivityResultContracts.CreateDocument +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Cancel +import androidx.compose.material.icons.filled.CheckCircle +import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material.icons.outlined.MoreVert +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.patcher.worker.Step +import app.revanced.manager.patcher.worker.State +import app.revanced.manager.ui.component.AppScaffold +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.ArrowButton +import app.revanced.manager.ui.viewmodel.InstallerViewModel +import app.revanced.manager.util.APK_MIMETYPE +import kotlin.math.floor + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun InstallerScreen( + onBackClick: () -> Unit, + vm: InstallerViewModel +) { + BackHandler(onBack = onBackClick) + + val context = LocalContext.current + val exportApkLauncher = + rememberLauncherForActivityResult(CreateDocument(APK_MIMETYPE), vm::export) + val patcherState by vm.patcherState.observeAsState(null) + val steps by vm.progress.collectAsStateWithLifecycle() + val canInstall by remember { derivedStateOf { patcherState == true && (vm.installedPackageName != null || !vm.isInstalling) } } + var dropdownActive by rememberSaveable { mutableStateOf(false) } + + AppScaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.installer), + onBackClick = onBackClick, + actions = { + IconButton(onClick = {}) { + Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help)) + } + IconButton(onClick = { dropdownActive = true }) { + Icon(Icons.Outlined.MoreVert, stringResource(R.string.more)) + } + DropdownMenu( + expanded = dropdownActive, + onDismissRequest = { dropdownActive = false } + ) { + DropdownMenuItem( + text = { Text(stringResource(R.string.save_logs)) }, + onClick = { vm.exportLogs(context) }, + enabled = patcherState != null + ) + } + } + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + .fillMaxSize() + ) { + steps.forEach { + InstallStep(it) + } + Spacer(modifier = Modifier.weight(1f)) + Row( + verticalAlignment = Alignment.Bottom, + horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.End), + modifier = Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp, bottom = 16.dp) + ) { + Button( + onClick = { exportApkLauncher.launch("${vm.packageName}.apk") }, + enabled = canInstall + ) { + Text(stringResource(R.string.export_app)) + } + + Button( + onClick = vm::installOrOpen, + enabled = canInstall + ) { + Text(stringResource(vm.appButtonText)) + } + } + } + } +} + +// Credits: https://github.com/Aliucord/AliucordManager/blob/main/app/src/main/kotlin/com/aliucord/manager/ui/component/installer/InstallGroup.kt + +@Composable +fun InstallStep(step: Step) { + var expanded by rememberSaveable { mutableStateOf(true) } + Column( + modifier = Modifier + .padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 8.dp) + .fillMaxWidth() + .clip(RoundedCornerShape(16.dp)) + .run { + if (expanded) { + background(MaterialTheme.colorScheme.secondaryContainer) + } else this + } + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(12.dp), + modifier = Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp) + .background(if (expanded) MaterialTheme.colorScheme.secondaryContainer else MaterialTheme.colorScheme.surface) + ) { + StepIcon(step.state, size = 24.dp) + + Text(text = stringResource(step.name), style = MaterialTheme.typography.titleMedium) + + Spacer(modifier = Modifier.weight(1f)) + + ArrowButton(expanded = expanded) { + expanded = !expanded + } + } + + AnimatedVisibility(visible = expanded) { + Column( + verticalArrangement = Arrangement.spacedBy(16.dp), + modifier = Modifier + .background(MaterialTheme.colorScheme.background.copy(0.6f)) + .fillMaxWidth() + .padding(16.dp) + .padding(start = 4.dp) + ) { + step.subSteps.forEach { subStep -> + var messageExpanded by rememberSaveable { mutableStateOf(true) } + val stacktrace = subStep.message + val downloadProgress = subStep.progress?.collectAsStateWithLifecycle() + + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp), + ) { + StepIcon(subStep.state, downloadProgress?.value, size = 18.dp) + + Text( + text = subStep.name, + style = MaterialTheme.typography.titleSmall, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + modifier = Modifier.weight(1f, true), + ) + + if (stacktrace != null) { + ArrowButton(expanded = messageExpanded) { + messageExpanded = !messageExpanded + } + } else { + downloadProgress?.value?.let { (downloaded, total) -> + Text( + "$downloaded/$total MB", + style = MaterialTheme.typography.labelSmall + ) + } + } + } + + AnimatedVisibility(visible = messageExpanded && stacktrace != null) { + Text( + text = stacktrace ?: "", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.secondary + ) + } + } + } + } + } +} + +@Composable +fun StepIcon(status: State, downloadProgress: Pair? = null, size: Dp) { + val strokeWidth = Dp(floor(size.value / 10) + 1) + + when (status) { + State.COMPLETED -> Icon( + Icons.Filled.CheckCircle, + contentDescription = stringResource(R.string.step_completed), + tint = MaterialTheme.colorScheme.surfaceTint, + modifier = Modifier.size(size) + ) + + State.FAILED -> Icon( + Icons.Filled.Cancel, + contentDescription = stringResource(R.string.step_failed), + tint = MaterialTheme.colorScheme.error, + modifier = Modifier.size(size) + ) + + State.WAITING -> + downloadProgress?.let { (downloaded, total) -> + CircularProgressIndicator( + progress = downloaded / total, + strokeWidth = strokeWidth, + modifier = stringResource(R.string.step_running).let { description -> + Modifier + .size(size) + .semantics { + contentDescription = description + } + } + ) + } ?: CircularProgressIndicator( + strokeWidth = strokeWidth, + modifier = stringResource(R.string.step_running).let { description -> + Modifier + .size(size) + .semantics { + contentDescription = description + } + } + ) + } +} diff --git a/app/src/main/java/app/revanced/manager/ui/screen/PatchesSelectorScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/PatchesSelectorScreen.kt new file mode 100644 index 0000000000..722e65e1b6 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/PatchesSelectorScreen.kt @@ -0,0 +1,374 @@ +package app.revanced.manager.ui.screen + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListScope +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Build +import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material.icons.outlined.Restore +import androidx.compose.material.icons.outlined.Search +import androidx.compose.material.icons.outlined.Settings +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.Checkbox +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExtendedFloatingActionButton +import androidx.compose.material3.FilterChip +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.ScrollableTabRow +import androidx.compose.material3.Tab +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.material3.surfaceColorAtElevation +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.patcher.patch.PatchInfo +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.patches.OptionItem +import app.revanced.manager.ui.viewmodel.PatchesSelectorViewModel +import app.revanced.manager.ui.viewmodel.PatchesSelectorViewModel.Companion.SHOW_SUPPORTED +import app.revanced.manager.ui.viewmodel.PatchesSelectorViewModel.Companion.SHOW_UNIVERSAL +import app.revanced.manager.ui.viewmodel.PatchesSelectorViewModel.Companion.SHOW_UNSUPPORTED +import app.revanced.manager.util.Options +import app.revanced.manager.util.PatchesSelection +import kotlinx.coroutines.launch + +@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class) +@Composable +fun PatchesSelectorScreen( + onPatchClick: (PatchesSelection, Options) -> Unit, + onBackClick: () -> Unit, + vm: PatchesSelectorViewModel +) { + val pagerState = rememberPagerState() + val composableScope = rememberCoroutineScope() + + val bundles by vm.bundlesFlow.collectAsStateWithLifecycle(initialValue = emptyList()) + + if (vm.compatibleVersions.isNotEmpty()) + UnsupportedDialog( + appVersion = vm.input.selectedApp.version, + supportedVersions = vm.compatibleVersions, + onDismissRequest = vm::dismissDialogs + ) + + vm.optionsDialog?.let { (bundle, patch) -> + OptionsDialog( + onDismissRequest = vm::dismissDialogs, + patch = patch, + values = vm.getOptions(bundle, patch), + reset = { vm.resetOptions(bundle, patch) }, + set = { key, value -> vm.setOption(bundle, patch, key, value) } + ) + } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.select_patches), + onBackClick = onBackClick, + actions = { + IconButton(onClick = { }) { + Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help)) + } + IconButton(onClick = { }) { + Icon(Icons.Outlined.Search, stringResource(R.string.search)) + } + } + ) + }, + floatingActionButton = { + ExtendedFloatingActionButton( + text = { Text(stringResource(R.string.patch)) }, + icon = { Icon(Icons.Default.Build, null) }, + onClick = { + composableScope.launch { + // TODO: only allow this if all required options have been set. + onPatchClick(vm.getAndSaveSelection(), vm.getOptions()) + } + } + ) + } + ) { paddingValues -> + Column( + Modifier + .fillMaxSize() + .padding(paddingValues) + ) { + if (bundles.size > 1) { + ScrollableTabRow( + selectedTabIndex = pagerState.currentPage, + containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp) + ) { + bundles.forEachIndexed { index, bundle -> + Tab( + selected = pagerState.currentPage == index, + onClick = { + composableScope.launch { + pagerState.animateScrollToPage( + index + ) + } + }, + text = { Text(bundle.name) }, + selectedContentColor = MaterialTheme.colorScheme.primary, + unselectedContentColor = MaterialTheme.colorScheme.onSurfaceVariant + ) + } + } + } + + HorizontalPager( + pageCount = bundles.size, + state = pagerState, + userScrollEnabled = true, + pageContent = { index -> + val bundle = bundles[index] + + Column { + + Row( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 10.dp, vertical = 2.dp), + horizontalArrangement = Arrangement.spacedBy(5.dp) + ) { + FilterChip( + selected = vm.filter and SHOW_SUPPORTED != 0 && bundle.supported.isNotEmpty(), + onClick = { vm.toggleFlag(SHOW_SUPPORTED) }, + label = { Text(stringResource(R.string.supported)) }, + enabled = bundle.supported.isNotEmpty() + ) + + FilterChip( + selected = vm.filter and SHOW_UNIVERSAL != 0 && bundle.universal.isNotEmpty(), + onClick = { vm.toggleFlag(SHOW_UNIVERSAL) }, + label = { Text(stringResource(R.string.universal)) }, + enabled = bundle.universal.isNotEmpty() + ) + + FilterChip( + selected = vm.filter and SHOW_UNSUPPORTED != 0 && bundle.unsupported.isNotEmpty(), + onClick = { vm.toggleFlag(SHOW_UNSUPPORTED) }, + label = { Text(stringResource(R.string.unsupported)) }, + enabled = bundle.unsupported.isNotEmpty() + ) + } + + val allowExperimental by vm.allowExperimental.getAsState() + + LazyColumn( + modifier = Modifier.fillMaxSize() + ) { + fun LazyListScope.patchList( + patches: List, + filterFlag: Int, + supported: Boolean, + header: (@Composable () -> Unit)? = null + ) { + if (patches.isNotEmpty() && (vm.filter and filterFlag) != 0 || vm.filter == 0) { + header?.let { + item { + it() + } + } + + items( + items = patches, + key = { it.name } + ) { patch -> + PatchItem( + patch = patch, + onOptionsDialog = { + vm.optionsDialog = bundle.uid to patch + }, + selected = supported && vm.isSelected( + bundle.uid, + patch + ), + onToggle = { vm.togglePatch(bundle.uid, patch) }, + supported = supported + ) + } + } + } + + patchList( + patches = bundle.supported, + filterFlag = SHOW_SUPPORTED, + supported = true + ) + patchList( + patches = bundle.universal, + filterFlag = SHOW_UNIVERSAL, + supported = true + ) { + ListHeader( + title = stringResource(R.string.universal_patches), + onHelpClick = { } + ) + } + patchList( + patches = bundle.unsupported, + filterFlag = SHOW_UNSUPPORTED, + supported = allowExperimental + ) { + ListHeader( + title = stringResource(R.string.unsupported_patches), + onHelpClick = { vm.openUnsupportedDialog(bundle.unsupported) } + ) + } + } + } + } + ) + } + } +} + +@Composable +fun PatchItem( + patch: PatchInfo, + onOptionsDialog: () -> Unit, + selected: Boolean, + onToggle: () -> Unit, + supported: Boolean = true +) = ListItem( + modifier = Modifier + .let { if (!supported) it.alpha(0.5f) else it } + .clickable(enabled = supported, onClick = onToggle) + .fillMaxSize(), + leadingContent = { + Checkbox( + checked = selected, + onCheckedChange = null, + enabled = supported + ) + }, + headlineContent = { Text(patch.name) }, + supportingContent = patch.description?.let { { Text(it) } }, + trailingContent = { + if (patch.options?.isNotEmpty() == true) { + IconButton(onClick = onOptionsDialog, enabled = supported) { + Icon(Icons.Outlined.Settings, null) + } + } + } +) + +@Composable +fun ListHeader( + title: String, + onHelpClick: (() -> Unit)? = null +) { + ListItem( + headlineContent = { + Text( + text = title, + color = MaterialTheme.colorScheme.primary, + style = MaterialTheme.typography.labelLarge + ) + }, + trailingContent = onHelpClick?.let { + { + IconButton(onClick = onHelpClick) { + Icon( + Icons.Outlined.HelpOutline, + stringResource(R.string.help) + ) + } + } + } + ) +} + +@Composable +fun UnsupportedDialog( + appVersion: String, + supportedVersions: List, + onDismissRequest: () -> Unit +) = AlertDialog( + onDismissRequest = onDismissRequest, + confirmButton = { + TextButton(onClick = onDismissRequest) { + Text(stringResource(R.string.ok)) + } + }, + title = { Text(stringResource(R.string.unsupported_app)) }, + text = { + Text( + stringResource( + R.string.app_not_supported, + appVersion, + supportedVersions.joinToString(", ") + ) + ) + } +) + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun OptionsDialog( + patch: PatchInfo, + values: Map?, + reset: () -> Unit, + set: (String, Any?) -> Unit, + onDismissRequest: () -> Unit, +) = Dialog( + onDismissRequest = onDismissRequest, + properties = DialogProperties( + usePlatformDefaultWidth = false, + dismissOnBackPress = true + ) +) { + Scaffold( + topBar = { + AppTopBar( + title = patch.name, + onBackClick = onDismissRequest, + actions = { + IconButton(onClick = reset) { + Icon(Icons.Outlined.Restore, stringResource(R.string.reset)) + } + } + ) + } + ) { paddingValues -> + LazyColumn( + modifier = Modifier.padding(paddingValues) + ) { + if (patch.options == null) return@LazyColumn + + items(patch.options, key = { it.key }) { option -> + val key = option.key + val value = + if (values == null || !values.contains(key)) option.defaultValue else values[key] + + OptionItem(option = option, value = value, setValue = { set(key, it) }) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/SettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/SettingsScreen.kt new file mode 100644 index 0000000000..59e3ffb022 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/SettingsScreen.kt @@ -0,0 +1,223 @@ +package app.revanced.manager.ui.screen + +import android.annotation.SuppressLint +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.os.PowerManager +import android.provider.Settings +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.ExperimentalAnimationApi +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.BatteryAlert +import androidx.compose.material.icons.outlined.* +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.destination.SettingsDestination +import app.revanced.manager.ui.screen.settings.* +import app.revanced.manager.ui.screen.settings.update.ManagerUpdateChangelog +import app.revanced.manager.ui.screen.settings.update.UpdateProgressScreen +import app.revanced.manager.ui.screen.settings.update.UpdatesSettingsScreen +import app.revanced.manager.ui.viewmodel.SettingsViewModel +import dev.olshevski.navigation.reimagined.* +import org.koin.androidx.compose.getViewModel + +@SuppressLint("BatteryLife") +@OptIn(ExperimentalMaterial3Api::class, ExperimentalAnimationApi::class) +@Composable +fun SettingsScreen( + onBackClick: () -> Unit, + viewModel: SettingsViewModel = getViewModel() +) { + val navController = + rememberNavController(startDestination = SettingsDestination.Settings) + + val context = LocalContext.current + val pm = context.getSystemService(Context.POWER_SERVICE) as PowerManager + var showBatteryButton by remember { mutableStateOf(!pm.isIgnoringBatteryOptimizations(context.packageName)) } + + val settingsSections = listOf( + Triple( + R.string.general, + R.string.general_description, + Icons.Outlined.Settings + ) to SettingsDestination.General, + Triple( + R.string.updates, + R.string.updates_description, + Icons.Outlined.Update + ) to SettingsDestination.Updates, + Triple( + R.string.downloads, + R.string.downloads_description, + Icons.Outlined.Download + ) to SettingsDestination.Downloads, + Triple( + R.string.import_export, + R.string.import_export_description, + Icons.Outlined.SwapVert + ) to SettingsDestination.ImportExport, + Triple( + R.string.advanced, + R.string.advanced_description, + Icons.Outlined.Tune + ) to SettingsDestination.Advanced, + Triple( + R.string.about, + R.string.about_description, + Icons.Outlined.Info + ) to SettingsDestination.About, + ) + NavBackHandler(navController) + + AnimatedNavHost( + controller = navController + ) { destination -> + when (destination) { + + is SettingsDestination.General -> GeneralSettingsScreen( + onBackClick = { navController.pop() }, + viewModel = viewModel + ) + + is SettingsDestination.Advanced -> AdvancedSettingsScreen( + onBackClick = { navController.pop() } + ) + + is SettingsDestination.Updates -> UpdatesSettingsScreen( + onBackClick = { navController.pop() }, + onChangelogClick = { navController.navigate(SettingsDestination.UpdateChangelog) }, + onUpdateClick = { navController.navigate(SettingsDestination.UpdateProgress) } + ) + + is SettingsDestination.Downloads -> DownloadsSettingsScreen( + onBackClick = { navController.pop() } + ) + + is SettingsDestination.ImportExport -> ImportExportSettingsScreen( + onBackClick = { navController.pop() } + ) + + is SettingsDestination.About -> AboutSettingsScreen( + onBackClick = { navController.pop() }, + onContributorsClick = { navController.navigate(SettingsDestination.Contributors) }, + onLicensesClick = { navController.navigate(SettingsDestination.Licenses) } + ) + + is SettingsDestination.UpdateProgress -> UpdateProgressScreen( + { navController.pop() }, + ) + + is SettingsDestination.UpdateChangelog -> ManagerUpdateChangelog( + onBackClick = { navController.pop() }, + ) + + is SettingsDestination.Contributors -> ContributorScreen( + onBackClick = { navController.pop() }, + ) + + is SettingsDestination.Licenses -> LicensesScreen( + onBackClick = { navController.pop() }, + ) + + is SettingsDestination.Settings -> { + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.settings), + onBackClick = onBackClick, + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .padding(paddingValues) + .fillMaxSize() + .verticalScroll(rememberScrollState()), + verticalArrangement = Arrangement.spacedBy(12.dp) + ) { + AnimatedVisibility(visible = showBatteryButton) { + Card( + onClick = { + context.startActivity(Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS).apply { + data = Uri.parse("package:${context.packageName}") + }) + showBatteryButton = + !pm.isIgnoringBatteryOptimizations(context.packageName) + }, + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) + .clip(RoundedCornerShape(24.dp)) + .background(MaterialTheme.colorScheme.tertiaryContainer), + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + Icon( + imageVector = Icons.Default.BatteryAlert, + contentDescription = null, + tint = MaterialTheme.colorScheme.onTertiaryContainer, + modifier = Modifier.size(24.dp) + ) + Text( + text = stringResource(R.string.battery_optimization_notification), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onTertiaryContainer + ) + } + } + } + settingsSections.forEach { (titleDescIcon, destination) -> + ListItem( + modifier = Modifier.clickable { navController.navigate(destination) }, + headlineContent = { + Text( + stringResource(titleDescIcon.first), + style = MaterialTheme.typography.titleLarge + ) + }, + supportingContent = { + Text( + stringResource(titleDescIcon.second), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.outline + ) + }, + leadingContent = { Icon(titleDescIcon.third, null) } + ) + } + } + } + } + } + } +} diff --git a/app/src/main/java/app/revanced/manager/ui/screen/VersionSelectorScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/VersionSelectorScreen.kt new file mode 100644 index 0000000000..374cfad6d3 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/VersionSelectorScreen.kt @@ -0,0 +1,172 @@ +package app.revanced.manager.ui.screen + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Check +import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExtendedFloatingActionButton +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.ListItem +import androidx.compose.material3.RadioButton +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha +import androidx.compose.ui.res.pluralStringResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.GroupHeader +import app.revanced.manager.ui.component.LoadingIndicator +import app.revanced.manager.ui.model.SelectedApp +import app.revanced.manager.ui.viewmodel.VersionSelectorViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun VersionSelectorScreen( + onBackClick: () -> Unit, + onAppClick: (SelectedApp) -> Unit, + viewModel: VersionSelectorViewModel +) { + val supportedVersions by viewModel.supportedVersions.collectAsStateWithLifecycle(emptyMap()) + val downloadedVersions by viewModel.downloadedVersions.collectAsStateWithLifecycle(emptyList()) + + val list by remember { + derivedStateOf { + (downloadedVersions + viewModel.downloadableVersions) + .distinctBy { it.version } + .sortedWith( + compareByDescending { + it is SelectedApp.Local + }.thenByDescending { supportedVersions[it.version] } + .thenByDescending { it.version } + ) + } + } + + var selectedVersion: SelectedApp? by rememberSaveable { mutableStateOf(null) } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.select_version), + onBackClick = onBackClick, + actions = { + IconButton(onClick = { }) { + Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help)) + } + } + ) + }, + floatingActionButton = { + ExtendedFloatingActionButton( + text = { Text("Select version") }, + icon = { Icon(Icons.Default.Check, null) }, + onClick = { selectedVersion?.let(onAppClick) } + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .padding(paddingValues) + .fillMaxSize() + .verticalScroll(rememberScrollState()) + ) { + viewModel.installedApp?.let { (packageInfo, alreadyPatched) -> + SelectedApp.Installed( + packageName = viewModel.packageName, + version = packageInfo.versionName + ).let { + SelectedAppItem( + selectedApp = it, + selected = selectedVersion == it, + onClick = { selectedVersion = it }, + patchCount = supportedVersions[it.version], + alreadyPatched = alreadyPatched + ) + } + } + + GroupHeader("Downloadable versions") + + list.forEach { + SelectedAppItem( + selectedApp = it, + selected = selectedVersion == it, + onClick = { selectedVersion = it }, + patchCount = supportedVersions[it.version] + ) + } + + if (viewModel.errorMessage != null) { + Column( + modifier = Modifier.fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text(stringResource(R.string.error_occurred)) + Text( + text = viewModel.errorMessage!!, + modifier = Modifier.padding(horizontal = 15.dp) + ) + } + } else if (viewModel.isLoading) + LoadingIndicator() + + } + } +} + +@Composable +fun SelectedAppItem( + selectedApp: SelectedApp, + selected: Boolean, + onClick: () -> Unit, + patchCount: Int?, + alreadyPatched: Boolean = false +) { + ListItem( + leadingContent = { RadioButton(selected, null) }, + headlineContent = { Text(selectedApp.version) }, + supportingContent = when (selectedApp) { + is SelectedApp.Installed -> + if (alreadyPatched) { + { Text("Already patched") } + } else { + { Text("Installed") } + } + + is SelectedApp.Local -> { + { Text(stringResource(R.string.already_downloaded)) } + } + + else -> null + }, + trailingContent = patchCount?.let { { + Text(pluralStringResource(R.plurals.patches_count, it, it)) + } }, + modifier = Modifier + .clickable(enabled = !alreadyPatched, onClick = onClick) + .run { + if (alreadyPatched) alpha(0.5f) + else this + } + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/AboutSettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/AboutSettingsScreen.kt new file mode 100644 index 0000000000..b47e8fd519 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/AboutSettingsScreen.kt @@ -0,0 +1,194 @@ +package app.revanced.manager.ui.screen.settings + +import androidx.compose.foundation.Image +import androidx.compose.foundation.border +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Code +import androidx.compose.material.icons.outlined.FavoriteBorder +import androidx.compose.material.icons.outlined.Language +import androidx.compose.material.icons.outlined.MailOutline +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.BuildConfig +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.destination.SettingsDestination +import app.revanced.manager.util.openUrl +import com.google.accompanist.drawablepainter.rememberDrawablePainter +import dev.olshevski.navigation.reimagined.NavController +import dev.olshevski.navigation.reimagined.navigate + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AboutSettingsScreen( + onBackClick: () -> Unit, + onContributorsClick: () -> Unit, + onLicensesClick: () -> Unit, +) { + val context = LocalContext.current + val icon = rememberDrawablePainter(context.packageManager.getApplicationIcon(context.packageName)) + + val filledButton = listOf( + Triple(Icons.Outlined.FavoriteBorder, stringResource(R.string.donate)) { + context.openUrl("https://revanced.app/donate") + }, + Triple(Icons.Outlined.Language, stringResource(R.string.website), third = { + context.openUrl("https://revanced.app") + }), + ) + + val outlinedButton = listOf( + Triple(Icons.Outlined.Code, stringResource(R.string.github), third = { + context.openUrl("https://revanced.app/github") + }), + Triple(Icons.Outlined.MailOutline, stringResource(R.string.contact), third = { + context.openUrl("mailto:nosupport@revanced.app") + }), + ) + + val listItems = listOf( + Triple(stringResource(R.string.submit_feedback), stringResource(R.string.submit_feedback_description), + third = { /*TODO*/ }), + Triple(stringResource(R.string.contributors), stringResource(R.string.contributors_description), + third = onContributorsClick), + Triple(stringResource(R.string.developer_options), stringResource(R.string.developer_options_description), + third = { /*TODO*/ }), + Triple(stringResource(R.string.opensource_licenses), stringResource(R.string.opensource_licenses_description), + third = onLicensesClick) + ) + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.about), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 16.dp), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(4.dp) + ) { + Image(painter = icon, contentDescription = null) + Text(stringResource(R.string.app_name), style = MaterialTheme.typography.titleLarge) + Text( text = stringResource(R.string.version) + " " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")", style = MaterialTheme.typography.bodyMedium) + Row( + modifier = Modifier.padding(top = 12.dp) + ) { + filledButton.forEach { (icon, text, onClick) -> + FilledTonalButton( + onClick = onClick, + modifier = Modifier.padding(end = 8.dp) + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + Icon( + icon, + contentDescription = null, + modifier = Modifier + .size(28.dp) + .padding(end = 8.dp), + tint = MaterialTheme.colorScheme.primary + ) + Text( + text, + style = MaterialTheme.typography.labelLarge, + ) + } + } + } + } + + Row( + modifier = Modifier.padding(top = 12.dp) + ) { + outlinedButton.forEach { (icon, text, onClick) -> + Button( + onClick = onClick, + modifier = Modifier.padding(end = 8.dp), + colors = ButtonDefaults.buttonColors( + containerColor = Color.Transparent, + contentColor = MaterialTheme.colorScheme.onSecondaryContainer + ), + border = ButtonDefaults.outlinedButtonBorder + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + Icon( + icon, + contentDescription = null, + modifier = Modifier + .size(28.dp) + .padding(end = 8.dp), + tint = MaterialTheme.colorScheme.primary + ) + Text( + text, + style = MaterialTheme.typography.labelLarge, + color = MaterialTheme.colorScheme.primary + ) + } + } + } + } + } + + Box( + modifier = Modifier + .padding(vertical = 8.dp, horizontal = 16.dp) + .border( + width = 1.dp, + color = MaterialTheme.colorScheme.outlineVariant, + shape = MaterialTheme.shapes.medium + ) + .padding(16.dp) + ) { + Column { + Text( + text = stringResource(R.string.about_revanced_manager), + style = MaterialTheme.typography.titleMedium, + modifier = Modifier.padding(bottom = 8.dp), + ) + Text( + text = stringResource(R.string.revanced_manager_description), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + } + + } + + listItems.forEach { (title, description, onClick) -> + ListItem( + modifier = Modifier + .fillMaxWidth() + .padding(8.dp) + .clickable { onClick() }, + headlineContent = { Text(title, style = MaterialTheme.typography.titleLarge) }, + supportingContent = { Text(description, style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.outline) } + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/AdvancedSettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/AdvancedSettingsScreen.kt new file mode 100644 index 0000000000..e390332a2c --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/AdvancedSettingsScreen.kt @@ -0,0 +1,175 @@ +package app.revanced.manager.ui.screen.settings + +import android.app.ActivityManager +import android.os.Build +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Http +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.core.content.getSystemService +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.GroupHeader +import app.revanced.manager.ui.viewmodel.AdvancedSettingsViewModel +import org.koin.androidx.compose.getViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AdvancedSettingsScreen( + onBackClick: () -> Unit, + vm: AdvancedSettingsViewModel = getViewModel() +) { + val context = LocalContext.current + val memoryLimit = remember { + val activityManager = context.getSystemService()!! + context.getString( + R.string.device_memory_limit_format, + activityManager.memoryClass, + activityManager.largeMemoryClass + ) + } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.advanced), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + val apiUrl by vm.apiUrl.getAsState() + var showApiUrlDialog by rememberSaveable { mutableStateOf(false) } + + if (showApiUrlDialog) { + APIUrlDialog(apiUrl) { + showApiUrlDialog = false + it?.let(vm::setApiUrl) + } + } + ListItem( + headlineContent = { Text(stringResource(R.string.api_url)) }, + supportingContent = { Text(apiUrl) }, + modifier = Modifier.clickable { + showApiUrlDialog = true + } + ) + + GroupHeader(stringResource(R.string.patch_bundles_section)) + ListItem( + headlineContent = { Text(stringResource(R.string.patch_bundles_redownload)) }, + modifier = Modifier.clickable { + vm.redownloadBundles() + } + ) + ListItem( + headlineContent = { Text(stringResource(R.string.patch_bundles_reset)) }, + modifier = Modifier.clickable { + vm.resetBundles() + } + ) + + GroupHeader(stringResource(R.string.device)) + ListItem( + headlineContent = { Text(stringResource(R.string.device_model)) }, + supportingContent = { Text(Build.MODEL) } + ) + ListItem( + headlineContent = { Text(stringResource(R.string.device_android_version)) }, + supportingContent = { Text(Build.VERSION.RELEASE) } + ) + ListItem( + headlineContent = { Text(stringResource(R.string.device_architectures)) }, + supportingContent = { Text(Build.SUPPORTED_ABIS.joinToString(", ")) } + ) + ListItem( + headlineContent = { Text(stringResource(R.string.device_memory_limit)) }, + supportingContent = { Text(memoryLimit) } + ) + } + } +} + +@Composable +private fun APIUrlDialog(currentUrl: String, onSubmit: (String?) -> Unit) { + var url by rememberSaveable(currentUrl) { mutableStateOf(currentUrl) } + + AlertDialog( + onDismissRequest = { onSubmit(null) }, + confirmButton = { + TextButton( + onClick = { + onSubmit(url) + } + ) { + Text(stringResource(R.string.api_url_dialog_save)) + } + }, + dismissButton = { + TextButton(onClick = { onSubmit(null) }) { + Text(stringResource(R.string.cancel)) + } + }, + icon = { + Icon(Icons.Outlined.Http, null) + }, + title = { + Text( + text = stringResource(R.string.api_url_dialog_title), + style = MaterialTheme.typography.headlineSmall.copy(textAlign = TextAlign.Center), + color = MaterialTheme.colorScheme.onSurface, + ) + }, + text = { + Column( + verticalArrangement = Arrangement.spacedBy(16.dp) + ) { + Text( + text = stringResource(R.string.api_url_dialog_description), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + Text( + text = stringResource(R.string.api_url_dialog_warning), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.error + ) + OutlinedTextField( + value = url, + onValueChange = { url = it }, + label = { Text(stringResource(R.string.api_url)) } + ) + } + } + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/ContributorScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/ContributorScreen.kt new file mode 100644 index 0000000000..313eec2475 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/ContributorScreen.kt @@ -0,0 +1,136 @@ +package app.revanced.manager.ui.screen.settings + +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.ArrowDropDown +import androidx.compose.material.icons.outlined.ArrowDropUp +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.R +import app.revanced.manager.network.dto.ReVancedContributor +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.ArrowButton +import app.revanced.manager.ui.component.LoadingIndicator +import app.revanced.manager.ui.viewmodel.ContributorViewModel +import coil.compose.AsyncImage +import org.koin.androidx.compose.getViewModel + + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun ContributorScreen( + onBackClick: () -> Unit, + viewModel: ContributorViewModel = getViewModel() +) { + val repositories = viewModel.repositories + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.contributors), + onBackClick = onBackClick + ) + }, + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxHeight() + .padding(paddingValues) + .fillMaxWidth() + .verticalScroll(rememberScrollState()) + ) { + if(repositories.isEmpty()) { + LoadingIndicator() + } + repositories.forEach { + ExpandableListCard( + title = it.name, + contributors = it.contributors + ) + } + } + } +} +@OptIn(ExperimentalLayoutApi::class) +@Composable +fun ExpandableListCard( + title: String, + contributors: List +) { + var expanded by remember { mutableStateOf(false) } + Card( + shape = RoundedCornerShape(30.dp), + elevation = CardDefaults.outlinedCardElevation(), + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) + .border( + width = 2.dp, + color = MaterialTheme.colorScheme.outline, + shape = MaterialTheme.shapes.medium + ), + colors = CardDefaults.outlinedCardColors(), + ) { + Column() { + Row() { + ListItem( + headlineContent = { + Text( + text = processHeadlineText(title), + style = MaterialTheme.typography.titleMedium + ) + }, + trailingContent = { + if (contributors.isNotEmpty()) { + ArrowButton( + expanded = expanded, + onClick = { expanded = !expanded } + ) + } + }, + ) + } + if (expanded) { + FlowRow( + modifier = Modifier + .fillMaxWidth() + .wrapContentHeight() + .padding(8.dp), + ) { + contributors.forEach { + AsyncImage( + model = it.avatarUrl, + contentDescription = it.avatarUrl, + contentScale = ContentScale.Crop, + modifier = Modifier + .padding(16.dp) + .size(45.dp) + .clip(CircleShape) + ) + } + } + } + } + } +} +fun processHeadlineText(repositoryName: String): String { + return "Revanced " + repositoryName.replace("revanced/revanced-", "") + .replace("-", " ") + .split(" ") + .map { if (it.length > 3) it else it.uppercase() } + .joinToString(" ") + .replaceFirstChar { it.uppercase() } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/DownloadsSettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/DownloadsSettingsScreen.kt new file mode 100644 index 0000000000..f13a5dfd1a --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/DownloadsSettingsScreen.kt @@ -0,0 +1,79 @@ +package app.revanced.manager.ui.screen.settings + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Delete +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.ListItem +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.GroupHeader +import app.revanced.manager.ui.component.settings.BooleanItem +import app.revanced.manager.ui.viewmodel.DownloadsViewModel +import org.koin.androidx.compose.getViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun DownloadsSettingsScreen( + onBackClick: () -> Unit, + viewModel: DownloadsViewModel = getViewModel() +) { + val prefs = viewModel.prefs + + val downloadedApps by viewModel.downloadedApps.collectAsStateWithLifecycle(initialValue = emptyList()) + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.downloads), + onBackClick = onBackClick, + actions = { + if (viewModel.selection.isNotEmpty()) { + IconButton(onClick = { viewModel.delete() }) { + Icon(Icons.Default.Delete, stringResource(R.string.delete)) + } + } + } + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + BooleanItem( + preference = prefs.preferSplits, + headline = R.string.prefer_splits, + description = R.string.prefer_splits_description, + ) + + GroupHeader(stringResource(R.string.downloaded_apps)) + + downloadedApps.forEach { + ListItem( + modifier = Modifier.clickable { viewModel.toggleItem(it) }, + headlineContent = { Text(it.packageName) }, + supportingContent = { Text(it.version) }, + tonalElevation = if (viewModel.selection.contains(it)) 8.dp else 0.dp + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/GeneralSettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/GeneralSettingsScreen.kt new file mode 100644 index 0000000000..6838f927a1 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/GeneralSettingsScreen.kt @@ -0,0 +1,134 @@ +package app.revanced.manager.ui.screen.settings + +import android.os.Build +import androidx.annotation.StringRes +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.GroupHeader +import app.revanced.manager.ui.component.settings.BooleanItem +import app.revanced.manager.ui.theme.Theme +import app.revanced.manager.ui.viewmodel.SettingsViewModel +import kotlinx.coroutines.launch +import org.koin.compose.koinInject + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun GeneralSettingsScreen( + onBackClick: () -> Unit, + viewModel: SettingsViewModel +) { + val prefs = viewModel.prefs + val coroutineScope = viewModel.viewModelScope + var showThemePicker by rememberSaveable { mutableStateOf(false) } + + if (showThemePicker) { + ThemePicker( + onDismiss = { showThemePicker = false }, + onConfirm = { viewModel.setTheme(it) } + ) + } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.general), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + GroupHeader(stringResource(R.string.appearance)) + + val theme by prefs.theme.getAsState() + ListItem( + modifier = Modifier.clickable { showThemePicker = true }, + headlineContent = { Text(stringResource(R.string.theme)) }, + supportingContent = { Text(stringResource(R.string.theme_description)) }, + trailingContent = { + Button( + onClick = { + showThemePicker = true + } + ) { + Text(stringResource(theme.displayName)) + } + } + ) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + BooleanItem( + preference = prefs.dynamicColor, + coroutineScope = coroutineScope, + headline = R.string.dynamic_color, + description = R.string.dynamic_color_description + ) + } + + GroupHeader(stringResource(R.string.patcher)) + BooleanItem( + preference = prefs.allowExperimental, + coroutineScope = coroutineScope, + headline = R.string.experimental_patches, + description = R.string.experimental_patches_description + ) + } + } +} + +@Composable +private fun ThemePicker( + onDismiss: () -> Unit, + onConfirm: (Theme) -> Unit, + prefs: PreferencesManager = koinInject() +) { + var selectedTheme by rememberSaveable { mutableStateOf(prefs.theme.getBlocking()) } + + AlertDialog( + onDismissRequest = onDismiss, + title = { Text(stringResource(R.string.theme)) }, + text = { + Column { + Theme.values().forEach { + Row( + modifier = Modifier + .fillMaxWidth() + .clickable { selectedTheme = it }, + verticalAlignment = Alignment.CenterVertically + ) { + RadioButton( + selected = selectedTheme == it, + onClick = { selectedTheme = it }) + Text(stringResource(it.displayName)) + } + } + } + }, + confirmButton = { + Button(onClick = { + onConfirm(selectedTheme) + onDismiss() + }) { + Text(stringResource(R.string.apply)) + } + } + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/ImportExportSettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/ImportExportSettingsScreen.kt new file mode 100644 index 0000000000..80db8178d1 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/ImportExportSettingsScreen.kt @@ -0,0 +1,214 @@ +package app.revanced.manager.ui.screen.settings + +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.contract.ActivityResultContracts +import androidx.annotation.StringRes +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Key +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.ui.viewmodel.ImportExportViewModel +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.GroupHeader +import app.revanced.manager.ui.component.PasswordField +import app.revanced.manager.ui.component.bundle.BundleSelector +import app.revanced.manager.util.toast +import kotlinx.coroutines.launch +import org.koin.androidx.compose.getViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun ImportExportSettingsScreen( + onBackClick: () -> Unit, + vm: ImportExportViewModel = getViewModel() +) { + val context = LocalContext.current + + val importKeystoreLauncher = + rememberLauncherForActivityResult(contract = ActivityResultContracts.GetContent()) { + it?.let { uri -> vm.startKeystoreImport(uri) } + } + val exportKeystoreLauncher = + rememberLauncherForActivityResult(ActivityResultContracts.CreateDocument("*/*")) { + it?.let(vm::exportKeystore) + } + + vm.selectionAction?.let { action -> + val sources by vm.sources.collectAsStateWithLifecycle(initialValue = emptyList()) + val launcher = rememberLauncherForActivityResult(action.activityContract) { uri -> + if (uri == null) { + vm.clearSelectionAction() + } else { + vm.executeSelectionAction(uri) + } + } + + if (vm.selectedBundle == null) { + BundleSelector(sources) { + if (it == null) { + vm.clearSelectionAction() + } else { + vm.selectBundle(it) + launcher.launch(action.activityArg) + } + } + } + } + + if (vm.showCredentialsDialog) { + KeystoreCredentialsDialog( + onDismissRequest = vm::cancelKeystoreImport, + onSubmit = { cn, pass -> + vm.viewModelScope.launch { + val result = vm.tryKeystoreImport(cn, pass) + if (!result) context.toast(context.getString(R.string.import_keystore_wrong_credentials)) + } + } + ) + } + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.import_export), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + GroupHeader(stringResource(R.string.signing)) + GroupItem( + onClick = { + importKeystoreLauncher.launch("*/*") + }, + headline = R.string.import_keystore, + description = R.string.import_keystore_descripion + ) + GroupItem( + onClick = { + if (!vm.canExport()) { + context.toast(context.getString(R.string.export_keystore_unavailable)) + return@GroupItem + } + exportKeystoreLauncher.launch("Manager.keystore") + }, + headline = R.string.export_keystore, + description = R.string.export_keystore_description + ) + GroupItem( + onClick = vm::regenerateKeystore, + headline = R.string.regenerate_keystore, + description = R.string.regenerate_keystore_description + ) + + GroupHeader(stringResource(R.string.patches_selection)) + GroupItem( + onClick = vm::importSelection, + headline = R.string.restore_patches_selection, + description = R.string.restore_patches_selection_description + ) + GroupItem( + onClick = vm::exportSelection, + headline = R.string.backup_patches_selection, + description = R.string.backup_patches_selection_description + ) + GroupItem( + onClick = vm::resetSelection, + headline = R.string.clear_patches_selection, + description = R.string.clear_patches_selection_description + ) + } + } +} + +@Composable +private fun GroupItem(onClick: () -> Unit, @StringRes headline: Int, @StringRes description: Int) = + ListItem( + modifier = Modifier.clickable { onClick() }, + headlineContent = { Text(stringResource(headline)) }, + supportingContent = { Text(stringResource(description)) } + ) + +@Composable +fun KeystoreCredentialsDialog( + onDismissRequest: () -> Unit, + onSubmit: (String, String) -> Unit +) { + var cn by rememberSaveable { mutableStateOf("") } + var pass by rememberSaveable { mutableStateOf("") } + + AlertDialog( + onDismissRequest = onDismissRequest, + confirmButton = { + TextButton( + onClick = { + onSubmit(cn, pass) + } + ) { + Text(stringResource(R.string.import_keystore_dialog_button)) + } + }, + dismissButton = { + TextButton(onClick = onDismissRequest) { + Text(stringResource(R.string.cancel)) + } + }, + icon = { + Icon(Icons.Outlined.Key, null) + }, + title = { + Text( + text = stringResource(R.string.import_keystore_dialog_title), + style = MaterialTheme.typography.headlineSmall.copy(textAlign = TextAlign.Center), + color = MaterialTheme.colorScheme.onSurface, + ) + }, + text = { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(16.dp) + ) { + Text( + text = stringResource(R.string.import_keystore_dialog_description), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + OutlinedTextField( + value = cn, + onValueChange = { cn = it }, + label = { Text(stringResource(R.string.import_keystore_dialog_alias_field)) } + ) + PasswordField( + value = pass, + onValueChange = { pass = it }, + label = { Text(stringResource(R.string.import_keystore_dialog_password_field)) } + ) + } + } + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/LicensesScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/LicensesScreen.kt new file mode 100644 index 0000000000..70d433d89e --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/LicensesScreen.kt @@ -0,0 +1,41 @@ +package app.revanced.manager.ui.screen.settings + +import androidx.compose.foundation.layout.* +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppScaffold +import app.revanced.manager.ui.component.AppTopBar +import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer +import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun LicensesScreen( + onBackClick: () -> Unit, +) { + AppScaffold( + topBar = { scrollBehavior -> + AppTopBar( + title = stringResource(R.string.opensource_licenses), + scrollBehavior = scrollBehavior, + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column(modifier = Modifier.padding(paddingValues)) { + LibrariesContainer( + modifier = Modifier + .fillMaxSize(), + colors = LibraryDefaults.libraryColors( + backgroundColor = MaterialTheme.colorScheme.background, + contentColor = MaterialTheme.colorScheme.onBackground, + badgeBackgroundColor = MaterialTheme.colorScheme.primary, + badgeContentColor = MaterialTheme.colorScheme.onPrimary, + ) + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/update/ManagerUpdateChangelog.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/update/ManagerUpdateChangelog.kt new file mode 100644 index 0000000000..a1b1f86233 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/update/ManagerUpdateChangelog.kt @@ -0,0 +1,115 @@ +package app.revanced.manager.ui.screen.settings.update + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.Campaign +import androidx.compose.material.icons.outlined.FileDownload +import androidx.compose.material.icons.outlined.Sell +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.component.Markdown +import app.revanced.manager.ui.viewmodel.ManagerUpdateChangelogViewModel +import org.koin.androidx.compose.getViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun ManagerUpdateChangelog( + onBackClick: () -> Unit, + vm: ManagerUpdateChangelogViewModel = getViewModel() +) { + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.changelog), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .padding(start = 16.dp, end = 16.dp, top = 16.dp) + .verticalScroll(rememberScrollState()) + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 4.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.Start), + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Outlined.Campaign, + contentDescription = null, + tint = MaterialTheme.colorScheme.primary, + modifier = Modifier + .size(32.dp) + ) + Text( + vm.changelog.version.removePrefix("v"), + style = MaterialTheme.typography.headlineMedium, + color = MaterialTheme.colorScheme.primary, + ) + } + Row( + horizontalArrangement = Arrangement.spacedBy(16.dp), + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 16.dp), + ) { + Row( + horizontalArrangement = Arrangement.spacedBy(6.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Outlined.Sell, + contentDescription = null, + modifier = Modifier.size(16.dp) + ) + Text( + vm.changelog.version, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.outline, + ) + } + Row( + horizontalArrangement = Arrangement.spacedBy(6.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Outlined.FileDownload, + contentDescription = null, + modifier = Modifier.size(16.dp) + ) + Text( + vm.formattedDownloadCount, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.outline, + ) + } + } + Markdown( + vm.changelogHtml, + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/update/UpdateProgressScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/update/UpdateProgressScreen.kt new file mode 100644 index 0000000000..b1a5f152e3 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/update/UpdateProgressScreen.kt @@ -0,0 +1,98 @@ +package app.revanced.manager.ui.screen.settings.update + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Button +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.LinearProgressIndicator +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Stable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar +import app.revanced.manager.ui.viewmodel.UpdateProgressViewModel +import org.koin.androidx.compose.getViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +@Stable +fun UpdateProgressScreen( + onBackClick: () -> Unit, + vm: UpdateProgressViewModel = getViewModel() +) { + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.updates), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .padding(vertical = 16.dp, horizontal = 24.dp) + .verticalScroll(rememberScrollState()), + ) { + Text( + text = if (vm.isInstalling) stringResource(R.string.installing_manager_update) else stringResource( + R.string.downloading_manager_update + ), style = MaterialTheme.typography.headlineMedium + ) + LinearProgressIndicator( + progress = vm.downloadProgress, + modifier = Modifier + .padding(vertical = 16.dp) + .fillMaxWidth() + ) + Text( + text = if (!vm.isInstalling) "${vm.downloadedSize.div(1000000)} MB / ${ + vm.totalSize.div( + 1000000 + ) + } MB (${vm.downloadProgress.times(100).toInt()}%)" else stringResource(R.string.installing_message), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.outline, + modifier = Modifier.align(Alignment.CenterHorizontally), + textAlign = TextAlign.Center + ) + Text( + text = "This update adds many functionality and fixes many issues in Manager. New experiment toggles are also added, they can be found in Settings > Advanced. Please submit some feedback in Settings > About > Submit issues or feedback. Thank you, everyone!", + style = MaterialTheme.typography.bodyMedium, + modifier = Modifier.padding(vertical = 32.dp), + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + Spacer(modifier = Modifier.weight(1f)) + Row( + verticalAlignment = Alignment.Bottom, + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth() + ) { + TextButton( + onClick = onBackClick, + ) { + Text(text = stringResource(R.string.cancel)) + } + Button(onClick = vm::installUpdate, enabled = vm.finished) { + Text(text = stringResource(R.string.update)) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/update/UpdatesSettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/update/UpdatesSettingsScreen.kt new file mode 100644 index 0000000000..18b9fc9750 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/update/UpdatesSettingsScreen.kt @@ -0,0 +1,127 @@ +package app.revanced.manager.ui.screen.settings.update + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Update +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import app.revanced.manager.R +import app.revanced.manager.ui.component.AppTopBar + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun UpdatesSettingsScreen( + onBackClick: () -> Unit, + onChangelogClick: () -> Unit, + onUpdateClick: () -> Unit, +) { + val listItems = listOf( + Triple( + stringResource(R.string.update_channel), + stringResource(R.string.update_channel_description), + third = { /*TODO*/ } + ), + Triple( + stringResource(R.string.update_notifications), + stringResource(R.string.update_notifications_description), + third = { /*TODO*/ } + ), + Triple( + stringResource(R.string.changelog), + stringResource(R.string.changelog_description), + third = onChangelogClick + ), + ) + + + Scaffold( + topBar = { + AppTopBar( + title = stringResource(R.string.updates), + onBackClick = onBackClick + ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + UpdateNotification( + onClick = onUpdateClick + ) + + listItems.forEach { (title, description, onClick) -> + ListItem( + modifier = Modifier + .fillMaxWidth() + .padding(8.dp) + .clickable { onClick() }, + headlineContent = { + Text( + title, + style = MaterialTheme.typography.titleLarge + ) + }, + supportingContent = { + Text( + description, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.outline + ) + } + ) + } + } + } +} + +@Composable +fun UpdateNotification( + onClick: () -> Unit +) { + Box( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) + .clip(RoundedCornerShape(24.dp)) + .background(MaterialTheme.colorScheme.secondaryContainer) + .clickable { onClick() }, + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + Icon(imageVector = Icons.Default.Update, contentDescription = null) + Text( + text = stringResource(R.string.update_notification), + style = MaterialTheme.typography.bodyMedium + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/theme/Color.kt b/app/src/main/java/app/revanced/manager/ui/theme/Color.kt new file mode 100644 index 0000000000..9626a96207 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/theme/Color.kt @@ -0,0 +1,65 @@ +package app.revanced.manager.ui.theme + +import androidx.compose.ui.graphics.Color + +val rv_theme_light_primary = Color(0xFF005FAC) +val rv_theme_light_onPrimary = Color(0xFFFFFFFF) +val rv_theme_light_primaryContainer = Color(0xFFD4E3FF) +val rv_theme_light_onPrimaryContainer = Color(0xFF001C39) +val rv_theme_light_secondary = Color(0xFF545F71) +val rv_theme_light_onSecondary = Color(0xFFFFFFFF) +val rv_theme_light_secondaryContainer = Color(0xFFD8E3F8) +val rv_theme_light_onSecondaryContainer = Color(0xFF111C2B) +val rv_theme_light_tertiary = Color(0xFF6D5677) +val rv_theme_light_onTertiary = Color(0xFFFFFFFF) +val rv_theme_light_tertiaryContainer = Color(0xFFF6D9FF) +val rv_theme_light_onTertiaryContainer = Color(0xFF271430) +val rv_theme_light_error = Color(0xFFBA1A1A) +val rv_theme_light_errorContainer = Color(0xFFFFDAD6) +val rv_theme_light_onError = Color(0xFFFFFFFF) +val rv_theme_light_onErrorContainer = Color(0xFF410002) +val rv_theme_light_background = Color(0xFFFDFCFF) +val rv_theme_light_onBackground = Color(0xFF1A1C1E) +val rv_theme_light_surface = Color(0xFFFDFCFF) +val rv_theme_light_onSurface = Color(0xFF1A1C1E) +val rv_theme_light_surfaceVariant = Color(0xFFDFE2EB) +val rv_theme_light_onSurfaceVariant = Color(0xFF43474E) +val rv_theme_light_outline = Color(0xFF73777F) +val rv_theme_light_inverseOnSurface = Color(0xFFF1F0F4) +val rv_theme_light_inverseSurface = Color(0xFF2F3033) +val rv_theme_light_inversePrimary = Color(0xFFA4C9FF) +//val rv_theme_light_shadow = Color(0xFF000000) +val rv_theme_light_surfaceTint = Color(0xFF005FAC) +val rv_theme_light_outlineVariant = Color(0xFFC3C6CF) +val rv_theme_light_scrim = Color(0xFF000000) + +val rv_theme_dark_primary = Color(0xFFA4C9FF) +val rv_theme_dark_onPrimary = Color(0xFF00315D) +val rv_theme_dark_primaryContainer = Color(0xFF004884) +val rv_theme_dark_onPrimaryContainer = Color(0xFFD4E3FF) +val rv_theme_dark_secondary = Color(0xFFBCC7DB) +val rv_theme_dark_onSecondary = Color(0xFF263141) +val rv_theme_dark_secondaryContainer = Color(0xFF3D4758) +val rv_theme_dark_onSecondaryContainer = Color(0xFFD8E3F8) +val rv_theme_dark_tertiary = Color(0xFFD9BDE3) +val rv_theme_dark_onTertiary = Color(0xFF3D2946) +val rv_theme_dark_tertiaryContainer = Color(0xFF543F5E) +val rv_theme_dark_onTertiaryContainer = Color(0xFFF6D9FF) +val rv_theme_dark_error = Color(0xFFFFB4AB) +val rv_theme_dark_errorContainer = Color(0xFF93000A) +val rv_theme_dark_onError = Color(0xFF690005) +val rv_theme_dark_onErrorContainer = Color(0xFFFFDAD6) +val rv_theme_dark_background = Color(0xFF1A1C1E) +val rv_theme_dark_onBackground = Color(0xFFE3E2E6) +val rv_theme_dark_surface = Color(0xFF1A1C1E) +val rv_theme_dark_onSurface = Color(0xFFE3E2E6) +val rv_theme_dark_surfaceVariant = Color(0xFF43474E) +val rv_theme_dark_onSurfaceVariant = Color(0xFFC3C6CF) +val rv_theme_dark_outline = Color(0xFF8D9199) +val rv_theme_dark_inverseOnSurface = Color(0xFF1A1C1E) +val rv_theme_dark_inverseSurface = Color(0xFFE3E2E6) +val rv_theme_dark_inversePrimary = Color(0xFF005FAC) +//val rv_theme_dark_shadow = Color(0xFF000000) +val rv_theme_dark_surfaceTint = Color(0xFFA4C9FF) +val rv_theme_dark_outlineVariant = Color(0xFF43474E) +val rv_theme_dark_scrim = Color(0xFF000000) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/theme/Theme.kt b/app/src/main/java/app/revanced/manager/ui/theme/Theme.kt new file mode 100644 index 0000000000..17c89a5ca7 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/theme/Theme.kt @@ -0,0 +1,124 @@ +package app.revanced.manager.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat +import app.revanced.manager.R + +private val DarkColorScheme = darkColorScheme( + primary = rv_theme_dark_primary, + onPrimary = rv_theme_dark_onPrimary, + primaryContainer = rv_theme_dark_primaryContainer, + onPrimaryContainer = rv_theme_dark_onPrimaryContainer, + secondary = rv_theme_dark_secondary, + onSecondary = rv_theme_dark_onSecondary, + secondaryContainer = rv_theme_dark_secondaryContainer, + onSecondaryContainer = rv_theme_dark_onSecondaryContainer, + tertiary = rv_theme_dark_tertiary, + onTertiary = rv_theme_dark_onTertiary, + tertiaryContainer = rv_theme_dark_tertiaryContainer, + onTertiaryContainer = rv_theme_dark_onTertiaryContainer, + error = rv_theme_dark_error, + errorContainer = rv_theme_dark_errorContainer, + onError = rv_theme_dark_onError, + onErrorContainer = rv_theme_dark_onErrorContainer, + background = rv_theme_dark_background, + onBackground = rv_theme_dark_onBackground, + surface = rv_theme_dark_surface, + onSurface = rv_theme_dark_onSurface, + surfaceVariant = rv_theme_dark_surfaceVariant, + onSurfaceVariant = rv_theme_dark_onSurfaceVariant, + outline = rv_theme_dark_outline, + inverseOnSurface = rv_theme_dark_inverseOnSurface, + inverseSurface = rv_theme_dark_inverseSurface, + inversePrimary = rv_theme_dark_inversePrimary, + surfaceTint = rv_theme_dark_surfaceTint, + outlineVariant = rv_theme_dark_outlineVariant, + scrim = rv_theme_dark_scrim, +) + +private val LightColorScheme = lightColorScheme( + primary = rv_theme_light_primary, + onPrimary = rv_theme_light_onPrimary, + primaryContainer = rv_theme_light_primaryContainer, + onPrimaryContainer = rv_theme_light_onPrimaryContainer, + secondary = rv_theme_light_secondary, + onSecondary = rv_theme_light_onSecondary, + secondaryContainer = rv_theme_light_secondaryContainer, + onSecondaryContainer = rv_theme_light_onSecondaryContainer, + tertiary = rv_theme_light_tertiary, + onTertiary = rv_theme_light_onTertiary, + tertiaryContainer = rv_theme_light_tertiaryContainer, + onTertiaryContainer = rv_theme_light_onTertiaryContainer, + error = rv_theme_light_error, + errorContainer = rv_theme_light_errorContainer, + onError = rv_theme_light_onError, + onErrorContainer = rv_theme_light_onErrorContainer, + background = rv_theme_light_background, + onBackground = rv_theme_light_onBackground, + surface = rv_theme_light_surface, + onSurface = rv_theme_light_onSurface, + surfaceVariant = rv_theme_light_surfaceVariant, + onSurfaceVariant = rv_theme_light_onSurfaceVariant, + outline = rv_theme_light_outline, + inverseOnSurface = rv_theme_light_inverseOnSurface, + inverseSurface = rv_theme_light_inverseSurface, + inversePrimary = rv_theme_light_inversePrimary, + surfaceTint = rv_theme_light_surfaceTint, + outlineVariant = rv_theme_light_outlineVariant, + scrim = rv_theme_light_scrim, +) + +@Composable +fun ReVancedManagerTheme( + darkTheme: Boolean, + dynamicColor: Boolean, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) + dynamicDarkColorScheme(context) + else + dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + val view = LocalView.current + if (!view.isInEditMode) { + SideEffect { + val activity = view.context as Activity + + WindowCompat.setDecorFitsSystemWindows(activity.window, false) + + activity.window.statusBarColor = Color.Transparent.toArgb() + activity.window.navigationBarColor = Color.Transparent.toArgb() + + WindowCompat.getInsetsController(activity.window, view).isAppearanceLightStatusBars = !darkTheme + WindowCompat.getInsetsController(activity.window, view).isAppearanceLightNavigationBars = !darkTheme + } + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} + +enum class Theme(val displayName: Int) { + SYSTEM(R.string.system), + LIGHT(R.string.light), + DARK(R.string.dark); +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/theme/Type.kt b/app/src/main/java/app/revanced/manager/ui/theme/Type.kt new file mode 100644 index 0000000000..d999aae2c0 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/theme/Type.kt @@ -0,0 +1,17 @@ +package app.revanced.manager.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/AdvancedSettingsViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/AdvancedSettingsViewModel.kt new file mode 100644 index 0000000000..6b084005c1 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/AdvancedSettingsViewModel.kt @@ -0,0 +1,37 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.domain.repository.PatchBundleRepository +import app.revanced.manager.domain.bundles.RemotePatchBundle +import app.revanced.manager.util.uiSafe +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch + +class AdvancedSettingsViewModel( + prefs: PreferencesManager, + private val app: Application, + private val patchBundleRepository: PatchBundleRepository +) : ViewModel() { + val apiUrl = prefs.api + + fun setApiUrl(value: String) = viewModelScope.launch(Dispatchers.Default) { + if (value == apiUrl.get()) return@launch + + apiUrl.update(value) + patchBundleRepository.reloadApiBundles() + } + + fun redownloadBundles() = viewModelScope.launch { + uiSafe(app, R.string.source_download_fail, RemotePatchBundle.updateFailMsg) { + patchBundleRepository.redownloadRemoteBundles() + } + } + + fun resetBundles() = viewModelScope.launch { + patchBundleRepository.reset() + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/AppInfoViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/AppInfoViewModel.kt new file mode 100644 index 0000000000..73a0c6b048 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/AppInfoViewModel.kt @@ -0,0 +1,96 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.content.pm.PackageInfo +import android.content.pm.PackageInstaller +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.data.room.apps.installed.InstallType +import app.revanced.manager.data.room.apps.installed.InstalledApp +import app.revanced.manager.domain.repository.InstalledAppRepository +import app.revanced.manager.service.UninstallService +import app.revanced.manager.util.PM +import app.revanced.manager.util.PatchesSelection +import app.revanced.manager.util.toast +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject + +class AppInfoViewModel( + val installedApp: InstalledApp +) : ViewModel(), KoinComponent { + private val app: Application by inject() + private val pm: PM by inject() + private val installedAppRepository: InstalledAppRepository by inject() + + lateinit var onBackClick: () -> Unit + + var appInfo: PackageInfo? by mutableStateOf(null) + private set + var appliedPatches: PatchesSelection? by mutableStateOf(null) + + fun launch() = pm.launch(installedApp.currentPackageName) + + fun uninstall() { + when (installedApp.installType) { + InstallType.DEFAULT -> pm.uninstallPackage(installedApp.currentPackageName) + + InstallType.ROOT -> TODO() + } + } + + private val uninstallBroadcastReceiver = object : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + when (intent?.action) { + UninstallService.APP_UNINSTALL_ACTION -> { + val extraStatus = intent.getIntExtra(UninstallService.EXTRA_UNINSTALL_STATUS, -999) + val extraStatusMessage = intent.getStringExtra(UninstallService.EXTRA_UNINSTALL_STATUS_MESSAGE) + + if (extraStatus == PackageInstaller.STATUS_SUCCESS) { + viewModelScope.launch { + installedAppRepository.delete(installedApp) + withContext(Dispatchers.Main) { onBackClick() } + } + } else if (extraStatus != PackageInstaller.STATUS_FAILURE_ABORTED) { + app.toast(app.getString(R.string.uninstall_app_fail, extraStatusMessage)) + } + + } + } + } + } + + init { + viewModelScope.launch { + appInfo = withContext(Dispatchers.IO) { + pm.getPackageInfo(installedApp.currentPackageName) + } + } + + viewModelScope.launch { + appliedPatches = withContext(Dispatchers.IO) { + installedAppRepository.getAppliedPatches(installedApp.currentPackageName) + } + } + + app.registerReceiver( + uninstallBroadcastReceiver, + IntentFilter(UninstallService.APP_UNINSTALL_ACTION) + ) + } + + override fun onCleared() { + super.onCleared() + app.unregisterReceiver(uninstallBroadcastReceiver) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/AppSelectorViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/AppSelectorViewModel.kt new file mode 100644 index 0000000000..7b9cac2f5b --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/AppSelectorViewModel.kt @@ -0,0 +1,35 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import android.content.pm.PackageInfo +import android.net.Uri +import androidx.lifecycle.ViewModel +import app.revanced.manager.ui.model.SelectedApp +import app.revanced.manager.util.PM +import java.io.File +import java.nio.file.Files + +class AppSelectorViewModel( + private val app: Application, + pm: PM +) : ViewModel() { + private val packageManager = app.packageManager + + val appList = pm.appList + + fun loadLabel(app: PackageInfo?) = (app?.applicationInfo?.loadLabel(packageManager) ?: "Not installed").toString() + + @Suppress("DEPRECATION") + fun loadSelectedFile(uri: Uri) = + app.contentResolver.openInputStream(uri)?.use { stream -> + File(app.cacheDir, "input.apk").also { + it.delete() + Files.copy(stream, it.toPath()) + }.let { file -> + packageManager.getPackageArchiveInfo(file.absolutePath, 0) + ?.let { packageInfo -> + SelectedApp.Local(packageName = packageInfo.packageName, version = packageInfo.versionName, file = file) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/BundlesViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/BundlesViewModel.kt new file mode 100644 index 0000000000..89d2876af1 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/BundlesViewModel.kt @@ -0,0 +1,33 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.domain.bundles.PatchBundleSource +import app.revanced.manager.domain.bundles.RemotePatchBundle +import app.revanced.manager.domain.repository.PatchBundleRepository +import app.revanced.manager.util.uiSafe +import kotlinx.coroutines.launch + +class BundlesViewModel( + private val app: Application, + private val patchBundleRepository: PatchBundleRepository +) : ViewModel() { + val sources = patchBundleRepository.sources + + fun delete(bundle: PatchBundleSource) = + viewModelScope.launch { patchBundleRepository.remove(bundle) } + + fun update(bundle: PatchBundleSource) = viewModelScope.launch { + if (bundle !is RemotePatchBundle) return@launch + + uiSafe( + app, + R.string.source_download_fail, + RemotePatchBundle.updateFailMsg + ) { + bundle.update() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/ContributorViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/ContributorViewModel.kt new file mode 100644 index 0000000000..3230c0117c --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/ContributorViewModel.kt @@ -0,0 +1,23 @@ +package app.revanced.manager.ui.viewmodel + +import androidx.compose.runtime.mutableStateListOf +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.network.api.ReVancedAPI +import app.revanced.manager.network.dto.ReVancedGitRepository +import app.revanced.manager.network.utils.getOrNull +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext + +class ContributorViewModel(private val reVancedAPI: ReVancedAPI) : ViewModel() { + val repositories = mutableStateListOf() + + init { + viewModelScope.launch { + withContext(Dispatchers.IO) { reVancedAPI.getContributors().getOrNull() }?.let( + repositories::addAll + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/DashboardViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/DashboardViewModel.kt new file mode 100644 index 0000000000..362aff444f --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/DashboardViewModel.kt @@ -0,0 +1,35 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import android.content.ContentResolver +import android.net.Uri +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.domain.repository.PatchBundleRepository +import io.ktor.http.Url +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.launch + +class DashboardViewModel( + app: Application, + private val patchBundleRepository: PatchBundleRepository +) : ViewModel() { + val availablePatches = + patchBundleRepository.bundles.map { it.values.sumOf { bundle -> bundle.patches.size } } + private val contentResolver: ContentResolver = app.contentResolver + + fun createLocalSource(name: String, patchBundle: Uri, integrations: Uri?) = + viewModelScope.launch { + contentResolver.openInputStream(patchBundle)!!.use { patchesStream -> + val integrationsStream = integrations?.let { contentResolver.openInputStream(it) } + try { + patchBundleRepository.createLocal(name, patchesStream, integrationsStream) + } finally { + integrationsStream?.close() + } + } + } + + fun createRemoteSource(name: String, apiUrl: String, autoUpdate: Boolean) = + viewModelScope.launch { patchBundleRepository.createRemote(name, apiUrl, autoUpdate) } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/DownloadsViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/DownloadsViewModel.kt new file mode 100644 index 0000000000..4688cf16b6 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/DownloadsViewModel.kt @@ -0,0 +1,46 @@ +package app.revanced.manager.ui.viewmodel + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.data.room.apps.downloaded.DownloadedApp +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.domain.repository.DownloadedAppRepository +import app.revanced.manager.util.mutableStateSetOf +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.NonCancellable +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext + +class DownloadsViewModel( + private val downloadedAppRepository: DownloadedAppRepository, + val prefs: PreferencesManager +) : ViewModel() { + val downloadedApps = downloadedAppRepository.getAll().map { downloadedApps -> + downloadedApps.sortedWith( + compareBy { + it.packageName + }.thenBy { it.version } + ) + } + + val selection = mutableStateSetOf() + + fun toggleItem(downloadedApp: DownloadedApp) { + if (selection.contains(downloadedApp)) + selection.remove(downloadedApp) + else + selection.add(downloadedApp) + } + + fun delete() { + viewModelScope.launch(NonCancellable) { + downloadedAppRepository.delete(selection) + + withContext(Dispatchers.Main) { + selection.clear() + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/ImportExportViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/ImportExportViewModel.kt new file mode 100644 index 0000000000..2bdee157cd --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/ImportExportViewModel.kt @@ -0,0 +1,179 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import android.net.Uri +import androidx.activity.result.contract.ActivityResultContract +import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.domain.manager.KeystoreManager +import app.revanced.manager.domain.repository.PatchSelectionRepository +import app.revanced.manager.domain.repository.SerializedSelection +import app.revanced.manager.domain.repository.PatchBundleRepository +import app.revanced.manager.domain.bundles.PatchBundleSource +import app.revanced.manager.util.JSON_MIMETYPE +import app.revanced.manager.util.toast +import app.revanced.manager.util.uiSafe +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import kotlinx.serialization.ExperimentalSerializationApi +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.decodeFromStream +import kotlinx.serialization.json.encodeToStream +import java.io.File +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardCopyOption +import kotlin.io.path.deleteExisting + +@OptIn(ExperimentalSerializationApi::class) +class ImportExportViewModel( + private val app: Application, + private val keystoreManager: KeystoreManager, + private val selectionRepository: PatchSelectionRepository, + patchBundleRepository: PatchBundleRepository +) : ViewModel() { + private val contentResolver = app.contentResolver + val sources = patchBundleRepository.sources + var selectedBundle by mutableStateOf(null) + private set + var selectionAction by mutableStateOf(null) + private set + private var keystoreImportPath by mutableStateOf(null) + val showCredentialsDialog by derivedStateOf { keystoreImportPath != null } + + fun startKeystoreImport(content: Uri) = viewModelScope.launch { + val path = withContext(Dispatchers.IO) { + File.createTempFile("signing", "ks", app.cacheDir).toPath().also { + Files.copy( + contentResolver.openInputStream(content)!!, + it, + StandardCopyOption.REPLACE_EXISTING + ) + } + } + + knownPasswords.forEach { + if (tryKeystoreImport(KeystoreManager.DEFAULT, it, path)) { + return@launch + } + } + + keystoreImportPath = path + } + + fun cancelKeystoreImport() { + keystoreImportPath?.deleteExisting() + keystoreImportPath = null + } + + suspend fun tryKeystoreImport(cn: String, pass: String) = + tryKeystoreImport(cn, pass, keystoreImportPath!!) + + private suspend fun tryKeystoreImport(cn: String, pass: String, path: Path): Boolean { + if (keystoreManager.import(cn, pass, path)) { + cancelKeystoreImport() + return true + } + + return false + } + + override fun onCleared() { + super.onCleared() + + cancelKeystoreImport() + } + + fun canExport() = keystoreManager.hasKeystore() + + fun exportKeystore(target: Uri) = viewModelScope.launch { + keystoreManager.export(contentResolver.openOutputStream(target)!!) + } + + fun regenerateKeystore() = viewModelScope.launch { + keystoreManager.regenerate() + app.toast(app.getString(R.string.regenerate_keystore_success)) + } + + fun resetSelection() = viewModelScope.launch(Dispatchers.Default) { + selectionRepository.reset() + } + + fun executeSelectionAction(target: Uri) = viewModelScope.launch { + val source = selectedBundle!! + val action = selectionAction!! + clearSelectionAction() + + action.execute(source.uid, target) + } + + fun selectBundle(bundle: PatchBundleSource) { + selectedBundle = bundle + } + + fun clearSelectionAction() { + selectionAction = null + selectedBundle = null + } + + fun importSelection() = clearSelectionAction().also { + selectionAction = Import() + } + + fun exportSelection() = clearSelectionAction().also { + selectionAction = Export() + } + + sealed interface SelectionAction { + suspend fun execute(bundleUid: Int, location: Uri) + val activityContract: ActivityResultContract + val activityArg: String + } + + private inner class Import : SelectionAction { + override val activityContract = ActivityResultContracts.GetContent() + override val activityArg = JSON_MIMETYPE + override suspend fun execute(bundleUid: Int, location: Uri) = uiSafe( + app, + R.string.restore_patches_selection_fail, + "Failed to restore patches selection" + ) { + val selection = withContext(Dispatchers.IO) { + contentResolver.openInputStream(location)!!.use { + Json.decodeFromStream(it) + } + } + + selectionRepository.import(bundleUid, selection) + } + } + + private inner class Export : SelectionAction { + override val activityContract = ActivityResultContracts.CreateDocument(JSON_MIMETYPE) + override val activityArg = "selection.json" + override suspend fun execute(bundleUid: Int, location: Uri) = uiSafe( + app, + R.string.backup_patches_selection_fail, + "Failed to backup patches selection" + ) { + val selection = selectionRepository.export(bundleUid) + + withContext(Dispatchers.IO) { + contentResolver.openOutputStream(location, "wt")!!.use { + Json.Default.encodeToStream(selection, it) + } + } + } + } + + private companion object { + val knownPasswords = setOf("ReVanced", "s3cur3p@ssw0rd") + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/InstalledAppsViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/InstalledAppsViewModel.kt new file mode 100644 index 0000000000..6ed37b55c0 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/InstalledAppsViewModel.kt @@ -0,0 +1,33 @@ +package app.revanced.manager.ui.viewmodel + +import android.content.pm.PackageInfo +import androidx.compose.runtime.mutableStateMapOf +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.domain.repository.InstalledAppRepository +import app.revanced.manager.util.PM +import app.revanced.manager.util.collectEach +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.flowOn +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext + +class InstalledAppsViewModel( + private val installedAppsRepository: InstalledAppRepository, + private val pm: PM +) : ViewModel() { + val apps = installedAppsRepository.getAll().flowOn(Dispatchers.IO) + + val packageInfoMap = mutableStateMapOf() + + init { + viewModelScope.launch { + apps.collectEach { installedApp -> + packageInfoMap[installedApp.currentPackageName] = withContext(Dispatchers.IO) { + pm.getPackageInfo(installedApp.currentPackageName) + .also { if (it == null) installedAppsRepository.delete(installedApp) } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/InstallerViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/InstallerViewModel.kt new file mode 100644 index 0000000000..82174d9ac0 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/InstallerViewModel.kt @@ -0,0 +1,246 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.content.pm.PackageInstaller +import android.net.Uri +import android.util.Log +import androidx.compose.runtime.Stable +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.map +import androidx.lifecycle.viewModelScope +import androidx.work.WorkInfo +import androidx.work.WorkManager +import app.revanced.manager.R +import app.revanced.manager.data.room.apps.installed.InstallType +import app.revanced.manager.domain.manager.KeystoreManager +import app.revanced.manager.domain.repository.InstalledAppRepository +import app.revanced.manager.domain.worker.WorkerRepository +import app.revanced.manager.patcher.worker.PatcherProgressManager +import app.revanced.manager.patcher.worker.PatcherWorker +import app.revanced.manager.patcher.worker.Step +import app.revanced.manager.service.InstallService +import app.revanced.manager.service.UninstallService +import app.revanced.manager.ui.destination.Destination +import app.revanced.manager.util.PM +import app.revanced.manager.util.tag +import app.revanced.manager.util.toast +import app.revanced.patcher.logging.Logger +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject +import java.io.File +import java.nio.file.Files +import java.util.UUID + +@Stable +class InstallerViewModel(input: Destination.Installer) : ViewModel(), KoinComponent { + private val keystoreManager: KeystoreManager by inject() + private val app: Application by inject() + private val pm: PM by inject() + private val workerRepository: WorkerRepository by inject() + private val installedAppReceiver: InstalledAppRepository by inject() + + val packageName: String = input.selectedApp.packageName + private val outputFile = File(app.cacheDir, "output.apk") + private val signedFile = File(app.cacheDir, "signed.apk").also { if (it.exists()) it.delete() } + private var hasSigned = false + + var isInstalling by mutableStateOf(false) + private set + var installedPackageName by mutableStateOf(null) + private set + val appButtonText by derivedStateOf { if (installedPackageName == null) R.string.install_app else R.string.open_app } + + private val workManager = WorkManager.getInstance(app) + + private val _progress: MutableStateFlow> + private val patcherWorkerId: UUID + private val logger = ManagerLogger() + + init { + val (selectedApp, patches, options) = input + + _progress = MutableStateFlow(PatcherProgressManager.generateSteps( + app, + patches.flatMap { (_, selected) -> selected }, + input.selectedApp + ).toImmutableList()) + patcherWorkerId = + workerRepository.launchExpedited( + "patching", PatcherWorker.Args( + selectedApp, + outputFile.path, + patches, + options, + packageName, + selectedApp.version, + _progress, + logger + ) + ) + } + + val progress = _progress.asStateFlow() + + val patcherState = + workManager.getWorkInfoByIdLiveData(patcherWorkerId).map { workInfo: WorkInfo -> + when (workInfo.state) { + WorkInfo.State.SUCCEEDED -> true + WorkInfo.State.FAILED -> false + else -> null + } + } + + private val installBroadcastReceiver = object : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + when (intent?.action) { + InstallService.APP_INSTALL_ACTION -> { + val pmStatus = intent.getIntExtra(InstallService.EXTRA_INSTALL_STATUS, -999) + val extra = intent.getStringExtra(InstallService.EXTRA_INSTALL_STATUS_MESSAGE)!! + + if (pmStatus == PackageInstaller.STATUS_SUCCESS) { + app.toast(app.getString(R.string.install_app_success)) + installedPackageName = + intent.getStringExtra(InstallService.EXTRA_PACKAGE_NAME) + viewModelScope.launch { + installedAppReceiver.add( + installedPackageName!!, + packageName, + input.selectedApp.version, + InstallType.DEFAULT, + input.selectedPatches + ) + } + } else { + app.toast(app.getString(R.string.install_app_fail, extra)) + } + } + + UninstallService.APP_UNINSTALL_ACTION -> { + } + } + } + } + + init { + app.registerReceiver(installBroadcastReceiver, IntentFilter().apply { + addAction(InstallService.APP_INSTALL_ACTION) + addAction(UninstallService.APP_UNINSTALL_ACTION) + }) + } + + fun exportLogs(context: Context) { + val sendIntent: Intent = Intent().apply { + action = Intent.ACTION_SEND + putExtra(Intent.EXTRA_TEXT, logger.export()) + type = "text/plain" + } + + val shareIntent = Intent.createChooser(sendIntent, null) + context.startActivity(shareIntent) + } + + override fun onCleared() { + super.onCleared() + app.unregisterReceiver(installBroadcastReceiver) + workManager.cancelWorkById(patcherWorkerId) + + outputFile.delete() + signedFile.delete() + } + + private suspend fun signApk(): Boolean { + if (!hasSigned) { + try { + withContext(Dispatchers.Default) { + keystoreManager.sign(outputFile, signedFile) + } + } catch (e: Exception) { + Log.e(tag, "Got exception while signing", e) + app.toast(app.getString(R.string.sign_fail, e::class.simpleName)) + return false + } + } + + return true + } + + fun export(uri: Uri?) = viewModelScope.launch { + uri?.let { + if (signApk()) { + withContext(Dispatchers.IO) { + app.contentResolver.openOutputStream(it) + .use { stream -> Files.copy(signedFile.toPath(), stream) } + } + app.toast(app.getString(R.string.export_app_success)) + } + } + } + + fun installOrOpen() = viewModelScope.launch { + installedPackageName?.let { + pm.launch(it) + return@launch + } + + isInstalling = true + try { + if (!signApk()) return@launch + pm.installApp(listOf(signedFile)) + } finally { + isInstalling = false + } + } +} + +private class ManagerLogger : Logger { + private val logs = mutableListOf>() + private fun log(level: LogLevel, msg: String) { + level.androidLog(msg) + if (level == LogLevel.TRACE) return + logs.add(level to msg) + } + + fun export() = + logs.asSequence().map { (level, msg) -> "[${level.name}]: $msg" }.joinToString("\n") + + override fun trace(msg: String) = log(LogLevel.TRACE, msg) + override fun info(msg: String) = log(LogLevel.INFO, msg) + override fun warn(msg: String) = log(LogLevel.WARN, msg) + override fun error(msg: String) = log(LogLevel.ERROR, msg) +} + +enum class LogLevel { + TRACE { + override fun androidLog(msg: String) = Log.v(androidTag, msg) + }, + INFO { + override fun androidLog(msg: String) = Log.i(androidTag, msg) + }, + WARN { + override fun androidLog(msg: String) = Log.w(androidTag, msg) + }, + ERROR { + override fun androidLog(msg: String) = Log.e(androidTag, msg) + }; + + abstract fun androidLog(msg: String): Int + + private companion object { + const val androidTag = "ReVanced Patcher" + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/MainViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/MainViewModel.kt new file mode 100644 index 0000000000..5592d3e79d --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/MainViewModel.kt @@ -0,0 +1,33 @@ +package app.revanced.manager.ui.viewmodel + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.domain.bundles.PatchBundleSource.Companion.asRemoteOrNull +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.domain.repository.PatchBundleRepository +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.launch + +class MainViewModel( + private val patchBundleRepository: PatchBundleRepository, + val prefs: PreferencesManager +) : ViewModel() { + + fun applyAutoUpdatePrefs(manager: Boolean, patches: Boolean) = viewModelScope.launch { + prefs.showAutoUpdatesDialog.update(false) + + prefs.managerAutoUpdates.update(manager) + if (patches) { + with(patchBundleRepository) { + sources + .first() + .find { it.uid == 0 } + ?.asRemoteOrNull + ?.setAutoUpdate(true) + + updateCheck() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/ManagerUpdateChangelogViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/ManagerUpdateChangelogViewModel.kt new file mode 100644 index 0000000000..e4d774007e --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/ManagerUpdateChangelogViewModel.kt @@ -0,0 +1,58 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.domain.repository.GithubRepository +import app.revanced.manager.network.dto.GithubChangelog +import app.revanced.manager.network.utils.getOrThrow +import app.revanced.manager.util.uiSafe +import kotlinx.coroutines.launch +import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor +import org.intellij.markdown.html.HtmlGenerator +import org.intellij.markdown.parser.MarkdownParser + +class ManagerUpdateChangelogViewModel( + private val githubRepository: GithubRepository, + private val app: Application, +) : ViewModel() { + private val markdownFlavour = GFMFlavourDescriptor() + private val markdownParser = MarkdownParser(flavour = markdownFlavour) + + var changelog by mutableStateOf( + GithubChangelog( + "...", + app.getString(R.string.changelog_loading), + emptyList() + ) + ) + private set + val formattedDownloadCount by derivedStateOf { + val downloadCount = changelog.assets.firstOrNull()?.downloadCount?.toDouble() ?: 0.0 + if (downloadCount > 1000) { + val roundedValue = + (downloadCount / 100).toInt() / 10.0 // Divide by 100 and round to one decimal place + "${roundedValue}k" + } else { + downloadCount.toString() + } + } + val changelogHtml by derivedStateOf { + val markdown = changelog.body + val parsedTree = markdownParser.buildMarkdownTreeFromString(markdown) + HtmlGenerator(markdown, parsedTree, markdownFlavour).generateHtml() + } + + init { + viewModelScope.launch { + uiSafe(app, R.string.changelog_download_fail, "Failed to download changelog") { + changelog = githubRepository.getChangelog("revanced-manager").getOrThrow() + } + } + } +} diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/PatchesSelectorViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/PatchesSelectorViewModel.kt new file mode 100644 index 0000000000..b5c6b67065 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/PatchesSelectorViewModel.kt @@ -0,0 +1,213 @@ +package app.revanced.manager.ui.viewmodel + +import androidx.compose.runtime.Stable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateListOf +import androidx.compose.runtime.mutableStateMapOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.Saver +import androidx.compose.runtime.setValue +import androidx.compose.runtime.snapshots.SnapshotStateMap +import androidx.lifecycle.SavedStateHandle +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.compose.SavedStateHandleSaveableApi +import androidx.lifecycle.viewmodel.compose.saveable +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.domain.repository.PatchSelectionRepository +import app.revanced.manager.domain.repository.PatchBundleRepository +import app.revanced.manager.patcher.patch.PatchInfo +import app.revanced.manager.ui.destination.Destination +import app.revanced.manager.util.Options +import app.revanced.manager.util.PatchesSelection +import app.revanced.manager.util.SnapshotStateSet +import app.revanced.manager.util.flatMapLatestAndCombine +import app.revanced.manager.util.mutableStateSetOf +import app.revanced.manager.util.saver.snapshotStateMapSaver +import app.revanced.manager.util.saver.snapshotStateSetSaver +import app.revanced.manager.util.toMutableStateSet +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import org.koin.core.component.KoinComponent +import org.koin.core.component.get + +@Stable +@OptIn(SavedStateHandleSaveableApi::class) +class PatchesSelectorViewModel( + val input: Destination.PatchesSelector +) : ViewModel(), KoinComponent { + private val selectionRepository: PatchSelectionRepository = get() + private val savedStateHandle: SavedStateHandle = get() + + val allowExperimental = get().allowExperimental + val bundlesFlow = get().sources.flatMapLatestAndCombine( + combiner = { it.filterNotNull() } + ) { source -> + // Regenerate bundle information whenever this source updates. + source.state.map { state -> + val bundle = state.patchBundleOrNull() ?: return@map null + + val supported = mutableListOf() + val unsupported = mutableListOf() + val universal = mutableListOf() + + bundle.patches.filter { it.compatibleWith(input.selectedApp.packageName) }.forEach { + val targetList = when { + it.compatiblePackages == null -> universal + it.supportsVersion(input.selectedApp.version) -> supported + else -> unsupported + } + + targetList.add(it) + } + + BundleInfo(source.name, source.uid, bundle.patches, supported, unsupported, universal) + } + } + + private val selectedPatches: SnapshotStatePatchesSelection by savedStateHandle.saveable( + saver = patchesSelectionSaver, + init = { + val map: SnapshotStatePatchesSelection = mutableStateMapOf() + viewModelScope.launch(Dispatchers.Default) { + val bundles = bundlesFlow.first() + val filteredSelection = + (input.patchesSelection + ?: selectionRepository.getSelection(input.selectedApp.packageName)) + .mapValues { (uid, patches) -> + // Filter out patches that don't exist. + val filteredPatches = bundles.singleOrNull { it.uid == uid } + ?.let { bundle -> + val allPatches = bundle.all.map { it.name } + patches.filter { allPatches.contains(it) } + } + ?: patches + + filteredPatches.toMutableStateSet() + } + + withContext(Dispatchers.Main) { + map.putAll(filteredSelection) + } + } + return@saveable map + }) + private val patchOptions: SnapshotStateOptions by savedStateHandle.saveable( + saver = optionsSaver, + init = ::mutableStateMapOf + ) + + /** + * Show the patch options dialog for this patch. + */ + var optionsDialog by mutableStateOf?>(null) + + val compatibleVersions = mutableStateListOf() + + var filter by mutableStateOf(SHOW_SUPPORTED or SHOW_UNSUPPORTED) + private set + + private fun getOrCreateSelection(bundle: Int) = + selectedPatches.getOrPut(bundle, ::mutableStateSetOf) + + fun isSelected(bundle: Int, patch: PatchInfo) = + selectedPatches[bundle]?.contains(patch.name) ?: false + + fun togglePatch(bundle: Int, patch: PatchInfo) { + val name = patch.name + val patches = getOrCreateSelection(bundle) + + if (patches.contains(name)) patches.remove(name) else patches.add(name) + } + + suspend fun getAndSaveSelection(): PatchesSelection = + selectedPatches.also { + withContext(Dispatchers.Default) { + selectionRepository.updateSelection(input.selectedApp.packageName, it) + } + }.mapValues { it.value.toMutableSet() }.apply { + if (allowExperimental.get()) { + return@apply + } + + // Filter out unsupported patches that may have gotten selected through the database if the setting is not enabled. + bundlesFlow.first().forEach { + this[it.uid]?.removeAll(it.unsupported.map { patch -> patch.name }.toSet()) + } + } + + fun getOptions(): Options = patchOptions + fun getOptions(bundle: Int, patch: PatchInfo) = patchOptions[bundle]?.get(patch.name) + + fun setOption(bundle: Int, patch: PatchInfo, key: String, value: Any?) { + patchOptions.getOrCreate(bundle).getOrCreate(patch.name)[key] = value + } + + fun resetOptions(bundle: Int, patch: PatchInfo) { + patchOptions[bundle]?.remove(patch.name) + } + + fun dismissDialogs() { + optionsDialog = null + compatibleVersions.clear() + } + + fun openUnsupportedDialog(unsupportedVersions: List) { + val set = HashSet() + + unsupportedVersions.forEach { patch -> + patch.compatiblePackages?.find { it.packageName == input.selectedApp.packageName } + ?.let { compatiblePackage -> + set.addAll(compatiblePackage.versions) + } + } + + compatibleVersions.addAll(set) + } + + fun toggleFlag(flag: Int) { + filter = filter xor flag + } + + companion object { + const val SHOW_SUPPORTED = 1 // 2^0 + const val SHOW_UNIVERSAL = 2 // 2^1 + const val SHOW_UNSUPPORTED = 4 // 2^2 + + private fun SnapshotStateMap>.getOrCreate(key: K) = + getOrPut(key, ::mutableStateMapOf) + + private val optionsSaver: Saver = snapshotStateMapSaver( + // Patch name -> Options + valueSaver = snapshotStateMapSaver( + // Option key -> Option value + valueSaver = snapshotStateMapSaver() + ) + ) + + private val patchesSelectionSaver: Saver = + snapshotStateMapSaver(valueSaver = snapshotStateSetSaver()) + } + + data class BundleInfo( + val name: String, + val uid: Int, + val all: List, + val supported: List, + val unsupported: List, + val universal: List + ) +} + +/** + * [Options] but with observable collection types. + */ +private typealias SnapshotStateOptions = SnapshotStateMap>> + +/** + * [PatchesSelection] but with observable collection types. + */ +private typealias SnapshotStatePatchesSelection = SnapshotStateMap> \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/SettingsViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/SettingsViewModel.kt new file mode 100644 index 0000000000..1e75bdeaa6 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/SettingsViewModel.kt @@ -0,0 +1,15 @@ +package app.revanced.manager.ui.viewmodel + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.domain.manager.PreferencesManager +import app.revanced.manager.ui.theme.Theme +import kotlinx.coroutines.launch + +class SettingsViewModel( + val prefs: PreferencesManager +) : ViewModel() { + fun setTheme(theme: Theme) = viewModelScope.launch { + prefs.theme.update(theme) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/UpdateProgressViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/UpdateProgressViewModel.kt new file mode 100644 index 0000000000..2ee6ed33d5 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/UpdateProgressViewModel.kt @@ -0,0 +1,75 @@ +package app.revanced.manager.ui.viewmodel + +import android.app.Application +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.R +import app.revanced.manager.network.api.ReVancedAPI +import app.revanced.manager.network.api.ReVancedAPI.Extensions.findAssetByType +import app.revanced.manager.network.service.HttpService +import app.revanced.manager.network.utils.getOrThrow +import app.revanced.manager.util.APK_MIMETYPE +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import app.revanced.manager.util.PM +import app.revanced.manager.util.uiSafe +import io.ktor.client.plugins.onDownload +import io.ktor.client.request.url +import kotlinx.coroutines.withContext +import java.io.File + +class UpdateProgressViewModel( + app: Application, + private val reVancedAPI: ReVancedAPI, + private val http: HttpService, + private val pm: PM +) : ViewModel() { + var downloadedSize by mutableStateOf(0L) + private set + var totalSize by mutableStateOf(0L) + private set + val downloadProgress by derivedStateOf { + if (downloadedSize == 0L || totalSize == 0L) return@derivedStateOf 0f + + downloadedSize.toFloat() / totalSize.toFloat() + } + val isInstalling by derivedStateOf { downloadProgress >= 1 } + var finished by mutableStateOf(false) + private set + + private val location = File.createTempFile("updater", ".apk", app.cacheDir) + private val job = viewModelScope.launch { + uiSafe(app, R.string.download_manager_failed, "Failed to download manager") { + withContext(Dispatchers.IO) { + val asset = reVancedAPI + .getRelease("revanced-manager") + .getOrThrow() + .findAssetByType(APK_MIMETYPE) + + http.download(location) { + url(asset.downloadUrl) + onDownload { bytesSentTotal, contentLength -> + downloadedSize = bytesSentTotal + totalSize = contentLength + } + } + } + finished = true + } + } + + fun installUpdate() = viewModelScope.launch { + pm.installApp(listOf(location)) + } + + override fun onCleared() { + super.onCleared() + + job.cancel() + location.delete() + } +} diff --git a/app/src/main/java/app/revanced/manager/ui/viewmodel/VersionSelectorViewModel.kt b/app/src/main/java/app/revanced/manager/ui/viewmodel/VersionSelectorViewModel.kt new file mode 100644 index 0000000000..87ca563b26 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/ui/viewmodel/VersionSelectorViewModel.kt @@ -0,0 +1,117 @@ +package app.revanced.manager.ui.viewmodel + +import android.content.pm.PackageInfo +import android.util.Log +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import app.revanced.manager.data.room.apps.installed.InstallType +import app.revanced.manager.domain.repository.DownloadedAppRepository +import app.revanced.manager.domain.repository.InstalledAppRepository +import app.revanced.manager.domain.repository.PatchBundleRepository +import app.revanced.manager.network.downloader.APKMirror +import app.revanced.manager.network.downloader.AppDownloader +import app.revanced.manager.ui.model.SelectedApp +import app.revanced.manager.util.PM +import app.revanced.manager.util.mutableStateSetOf +import app.revanced.manager.util.simpleMessage +import app.revanced.manager.util.tag +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject + +class VersionSelectorViewModel( + val packageName: String +) : ViewModel(), KoinComponent { + private val downloadedAppRepository: DownloadedAppRepository by inject() + private val installedAppRepository: InstalledAppRepository by inject() + private val patchBundleRepository: PatchBundleRepository by inject() + private val pm: PM by inject() + private val appDownloader: AppDownloader = APKMirror() + + var installedApp: Pair? by mutableStateOf(null) + private set + var isLoading by mutableStateOf(true) + private set + var errorMessage: String? by mutableStateOf(null) + private set + + val downloadableVersions = mutableStateSetOf() + + val supportedVersions = patchBundleRepository.bundles.map { bundles -> + var patchesWithoutVersions = 0 + + bundles.flatMap { (_, bundle) -> + bundle.patches.flatMap { patch -> + patch.compatiblePackages.orEmpty() + .filter { it.packageName == packageName } + .onEach { if (it.versions.isEmpty()) patchesWithoutVersions++ } + .flatMap { it.versions } + } + }.groupingBy { it } + .eachCount() + .toMutableMap() + .apply { + replaceAll { _, count -> + count + patchesWithoutVersions + } + } + } + + val downloadedVersions = downloadedAppRepository.getAll().map { downloadedApps -> + downloadedApps.filter { it.packageName == packageName }.map { SelectedApp.Local(it.packageName, it.version, it.file) } + } + + init { + viewModelScope.launch(Dispatchers.Main) { + val packageInfo = async(Dispatchers.IO) { pm.getPackageInfo(packageName) } + val alreadyPatched = async(Dispatchers.IO) { + installedAppRepository.get(packageName) + ?.let { it.installType == InstallType.DEFAULT } + ?: false + } + + installedApp = + packageInfo.await()?.let { + it to alreadyPatched.await() + } + } + + viewModelScope.launch(Dispatchers.IO) { + try { + val compatibleVersions = supportedVersions.first() + + appDownloader.getAvailableVersions( + packageName, + compatibleVersions.keys + ).collect { + if (it.version in compatibleVersions || compatibleVersions.isEmpty()) { + downloadableVersions.add( + SelectedApp.Download( + packageName, + it.version, + it + ) + ) + } + } + + withContext(Dispatchers.Main) { + isLoading = false + } + } catch (e: Exception) { + withContext(Dispatchers.Main) { + Log.e(tag, "Failed to load apps", e) + errorMessage = e.simpleMessage() + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/Constants.kt b/app/src/main/java/app/revanced/manager/util/Constants.kt new file mode 100644 index 0000000000..983a7c427f --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/Constants.kt @@ -0,0 +1,14 @@ +package app.revanced.manager.util + +private const val team = "revanced" +const val ghOrganization = "https://github.com/$team" +const val ghCli = "$team/revanced-cli" +const val ghPatches = "$team/revanced-patches" +const val ghPatcher = "$team/revanced-patcher" +const val ghManager = "$team/revanced-manager" +const val ghIntegrations = "$team/revanced-integrations" +const val tag = "ReVanced Manager" + +const val JAR_MIMETYPE = "application/java-archive" +const val APK_MIMETYPE = "application/vnd.android.package-archive" +const val JSON_MIMETYPE = "application/json" \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/PM.kt b/app/src/main/java/app/revanced/manager/util/PM.kt new file mode 100644 index 0000000000..96710e364c --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/PM.kt @@ -0,0 +1,155 @@ +package app.revanced.manager.util + +import android.annotation.SuppressLint +import android.app.Application +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.content.pm.PackageInfo +import android.content.pm.PackageInstaller +import android.content.pm.PackageManager +import android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES +import android.content.pm.PackageManager.NameNotFoundException +import android.os.Build +import android.os.Parcelable +import androidx.compose.runtime.Immutable +import app.revanced.manager.domain.repository.PatchBundleRepository +import app.revanced.manager.service.InstallService +import app.revanced.manager.service.UninstallService +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.flow.flowOn +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.withContext +import kotlinx.parcelize.Parcelize +import java.io.File + +private const val byteArraySize = 1024 * 1024 // Because 1,048,576 is not readable + +@Immutable +@Parcelize +data class AppInfo( + val packageName: String, + val patches: Int?, + val packageInfo: PackageInfo?, + val path: File? = null +) : Parcelable + +@SuppressLint("QueryPermissionsNeeded") +@Suppress("DEPRECATION") +class PM( + private val app: Application, + patchBundleRepository: PatchBundleRepository +) { + private val scope = CoroutineScope(Dispatchers.IO) + + val appList = patchBundleRepository.bundles.map { bundles -> + val compatibleApps = scope.async { + val compatiblePackages = bundles.values + .flatMap { it.patches } + .flatMap { it.compatiblePackages.orEmpty() } + .groupingBy { it.packageName } + .eachCount() + + compatiblePackages.keys.map { pkg -> + getPackageInfo(pkg)?.let { packageInfo -> + AppInfo( + pkg, + compatiblePackages[pkg], + packageInfo, + File(packageInfo.applicationInfo.sourceDir) + ) + } ?: AppInfo( + pkg, + compatiblePackages[pkg], + null + ) + } + } + + val installedApps = scope.async { + app.packageManager.getInstalledPackages(MATCH_UNINSTALLED_PACKAGES).map { packageInfo -> + AppInfo( + packageInfo.packageName, + 0, + packageInfo, + File(packageInfo.applicationInfo.sourceDir) + ) + } + } + + if (compatibleApps.await().isNotEmpty()) { + (compatibleApps.await() + installedApps.await()) + .distinctBy { it.packageName } + .sortedWith( + compareByDescending { + it.patches + }.thenBy { it.packageInfo?.applicationInfo?.loadLabel(app.packageManager).toString() }.thenBy { it.packageName } + ) + } else { emptyList() } + }.flowOn(Dispatchers.IO) + + fun getPackageInfo(packageName: String): PackageInfo? = + try { + app.packageManager.getPackageInfo(packageName, 0) + } catch (e: NameNotFoundException) { + null + } + + suspend fun installApp(apks: List) = withContext(Dispatchers.IO) { + val packageInstaller = app.packageManager.packageInstaller + packageInstaller.openSession(packageInstaller.createSession(sessionParams)).use { session -> + apks.forEach { apk -> session.writeApk(apk) } + session.commit(app.installIntentSender) + } + } + + fun uninstallPackage(pkg: String) { + val packageInstaller = app.packageManager.packageInstaller + packageInstaller.uninstall(pkg, app.uninstallIntentSender) + } + + fun launch(pkg: String) = app.packageManager.getLaunchIntentForPackage(pkg)?.let { + it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + app.startActivity(it) + } +} + +private fun PackageInstaller.Session.writeApk(apk: File) { + apk.inputStream().use { inputStream -> + openWrite(apk.name, 0, apk.length()).use { outputStream -> + inputStream.copyTo(outputStream, byteArraySize) + fsync(outputStream) + } + } +} + +private val intentFlags + get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) + PendingIntent.FLAG_MUTABLE + else + 0 + +private val sessionParams + get() = PackageInstaller.SessionParams( + PackageInstaller.SessionParams.MODE_FULL_INSTALL + ).apply { + setInstallReason(PackageManager.INSTALL_REASON_USER) + } + +private val Context.installIntentSender + get() = PendingIntent.getService( + this, + 0, + Intent(this, InstallService::class.java), + intentFlags + ).intentSender + +private val Context.uninstallIntentSender + get() = PendingIntent.getService( + this, + 0, + Intent(this, UninstallService::class.java), + intentFlags + ).intentSender \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/RequestManageStorageContract.kt b/app/src/main/java/app/revanced/manager/util/RequestManageStorageContract.kt new file mode 100644 index 0000000000..8d7b7ec31c --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/RequestManageStorageContract.kt @@ -0,0 +1,18 @@ +package app.revanced.manager.util + +import android.content.Context +import android.content.Intent +import android.os.Build +import android.os.Environment +import android.provider.Settings +import androidx.activity.result.contract.ActivityResultContract +import androidx.annotation.RequiresApi + +@RequiresApi(Build.VERSION_CODES.R) +class RequestManageStorageContract(private val forceLaunch: Boolean = false) : ActivityResultContract() { + override fun createIntent(context: Context, input: String) = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION) + + override fun getSynchronousResult(context: Context, input: String): SynchronousResult? = if (!forceLaunch && Environment.isExternalStorageManager()) SynchronousResult(true) else null + + override fun parseResult(resultCode: Int, intent: Intent?) = Environment.isExternalStorageManager() +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/SnapshotStateSet.kt b/app/src/main/java/app/revanced/manager/util/SnapshotStateSet.kt new file mode 100644 index 0000000000..bada2676b1 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/SnapshotStateSet.kt @@ -0,0 +1,60 @@ +package app.revanced.manager.util + +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Source: https://gist.github.com/alexvanyo/a31826820ded6f654fb96291aff6b425 + +import androidx.compose.runtime.Stable +import androidx.compose.runtime.mutableStateMapOf +import androidx.compose.runtime.snapshots.SnapshotStateMap +import androidx.compose.runtime.snapshots.StateObject + +/** + * An implementation of [MutableSet] that can be observed and snapshot. This is the result type + * created by [mutableStateSetOf]. + * + * This class closely implements the same semantics as [HashSet]. + * + * This class is backed by a [SnapshotStateMap]. + * + * @see mutableStateSetOf + */ +@Stable +class SnapshotStateSet private constructor( + private val delegateSnapshotStateMap: SnapshotStateMap, +) : MutableSet by delegateSnapshotStateMap.keys, StateObject by delegateSnapshotStateMap { + constructor() : this(delegateSnapshotStateMap = mutableStateMapOf()) + + override fun add(element: T): Boolean = + delegateSnapshotStateMap.put(element, Unit) == null + + override fun addAll(elements: Collection): Boolean = + elements.map(::add).any() + + override fun remove(element: T) = delegateSnapshotStateMap.remove(element) != null +} + +/** + * Create a instance of [MutableSet] that is observable and can be snapshot. + */ +fun mutableStateSetOf() = SnapshotStateSet() + +/** + * Create an instance of [MutableSet] from a collection that is observable and can be + * snapshot. + */ +fun Collection.toMutableStateSet() = SnapshotStateSet().also { it.addAll(this) } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/Util.kt b/app/src/main/java/app/revanced/manager/util/Util.kt new file mode 100644 index 0000000000..e8f38056e4 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/Util.kt @@ -0,0 +1,100 @@ +package app.revanced.manager.util + +import android.content.Context +import android.content.Intent +import android.util.Log +import android.widget.Toast +import androidx.annotation.StringRes +import androidx.compose.ui.graphics.Color +import androidx.core.net.toUri +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.flatMapLatest +import kotlinx.coroutines.launch +import java.util.Locale + +typealias PatchesSelection = Map> +typealias Options = Map>> + +fun Context.openUrl(url: String) { + startActivity(Intent(Intent.ACTION_VIEW, url.toUri()).apply { + flags = Intent.FLAG_ACTIVITY_NEW_TASK + }) +} + +fun Context.toast(string: String, duration: Int = Toast.LENGTH_SHORT) { + Toast.makeText(this, string, duration).show() +} + +/** + * Safely perform an operation that may fail to avoid crashing the app. + * If [block] fails, the error will be logged and a toast will be shown to the user to inform them that the action failed. + * + * @param context The android [Context]. + * @param toastMsg The toast message to show if [block] throws. + * @param logMsg The log message. + * @param block The code to execute. + */ +inline fun uiSafe(context: Context, @StringRes toastMsg: Int, logMsg: String, block: () -> Unit) { + try { + block() + } catch (error: Exception) { + context.toast( + context.getString( + toastMsg, + error.simpleMessage() + ) + ) + Log.e(tag, logMsg, error) + } +} + +fun Throwable.simpleMessage() = this.message ?: this.cause?.message ?: this::class.simpleName + +inline fun LifecycleOwner.launchAndRepeatWithViewLifecycle( + minActiveState: Lifecycle.State = Lifecycle.State.STARTED, + crossinline block: suspend CoroutineScope.() -> Unit +) { + lifecycleScope.launch { + lifecycle.repeatOnLifecycle(minActiveState) { + block() + } + } +} + +/** + * Run [transformer] on the [Iterable] and then [combine] the result using [combiner]. + * This is used to transform collections that contain [Flow]s into something that is easier to work with. + */ +@OptIn(ExperimentalCoroutinesApi::class) +inline fun Flow>.flatMapLatestAndCombine( + crossinline combiner: (Array) -> C, + crossinline transformer: (T) -> Flow, +): Flow = flatMapLatest { iterable -> + combine(iterable.map(transformer)) { + combiner(it) + } +} + +val Color.hexCode: String + inline get() { + val a: Int = (alpha * 255).toInt() + val r: Int = (red * 255).toInt() + val g: Int = (green * 255).toInt() + val b: Int = (blue * 255).toInt() + return java.lang.String.format(Locale.getDefault(), "%02X%02X%02X%02X", r, g, b, a) + } + +suspend fun Flow>.collectEach(block: suspend (T) -> Unit) { + this.collect { iterable -> + iterable.forEach { + block(it) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/saver/PathSaver.kt b/app/src/main/java/app/revanced/manager/util/saver/PathSaver.kt new file mode 100644 index 0000000000..d16eeb9234 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/saver/PathSaver.kt @@ -0,0 +1,13 @@ +package app.revanced.manager.util.saver + +import androidx.compose.runtime.saveable.Saver +import java.nio.file.Path +import kotlin.io.path.Path + +/** + * A [Saver] that can save [Path]s. Only works with the default filesystem. + */ +val PathSaver = Saver( + save = { it.toString() }, + restore = { Path(it) } +) \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/saver/SnapshotStateCollectionSavers.kt b/app/src/main/java/app/revanced/manager/util/saver/SnapshotStateCollectionSavers.kt new file mode 100644 index 0000000000..985cbeb6ab --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/saver/SnapshotStateCollectionSavers.kt @@ -0,0 +1,75 @@ +package app.revanced.manager.util.saver + +import androidx.compose.runtime.mutableStateMapOf +import androidx.compose.runtime.saveable.Saver +import androidx.compose.runtime.snapshots.SnapshotStateList +import androidx.compose.runtime.snapshots.SnapshotStateMap +import androidx.compose.runtime.toMutableStateList +import androidx.compose.runtime.toMutableStateMap +import app.revanced.manager.util.SnapshotStateSet +import app.revanced.manager.util.toMutableStateSet + +/** + * Create a [Saver] for [SnapshotStateList]s. + */ +fun snapshotStateListSaver() = Saver, List>( + save = { + it.toMutableList() + }, + restore = { + it.toMutableStateList() + } +) + +/** + * Create a [Saver] for [SnapshotStateSet]s. + */ +fun snapshotStateSetSaver() = Saver, Set>( + save = { + it.toMutableSet() + }, + restore = { + it.toMutableStateSet() + } +) + +/** + * Create a [Saver] for [SnapshotStateMap]s. + */ +fun snapshotStateMapSaver() = Saver, Map>( + save = { + it.toMutableMap() + }, + restore = { + mutableStateMapOf().apply { + this.putAll(it) + } + } +) + +/** + * Create a saver for [SnapshotStateMap]s with a custom [Saver] used for the values. + * Null values will not be saved by this [Saver]. + * + * @param valueSaver The [Saver] used for the values of the [Map]. + */ +fun snapshotStateMapSaver( + valueSaver: Saver +) = Saver, Map>( + save = { + buildMap { + it.forEach { (key, value) -> + with(valueSaver) { + save(value)?.let { + this@buildMap[key] = it + } + } + } + } + }, + restore = { + it.mapNotNull { (key, value) -> + valueSaver.restore(value)?.let { restored -> key to restored } + }.toMutableStateMap() + } +) \ No newline at end of file diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/signing/Signer.kt b/app/src/main/java/app/revanced/manager/util/signing/Signer.kt similarity index 57% rename from android/app/src/main/kotlin/app/revanced/manager/flutter/utils/signing/Signer.kt rename to app/src/main/java/app/revanced/manager/util/signing/Signer.kt index 1e1a08a21c..de875e91f2 100644 --- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/signing/Signer.kt +++ b/app/src/main/java/app/revanced/manager/util/signing/Signer.kt @@ -1,5 +1,7 @@ -package app.revanced.manager.flutter.utils.signing +package app.revanced.manager.util.signing +import android.util.Log +import app.revanced.manager.util.tag import com.android.apksig.ApkSigner import org.bouncycastle.asn1.x500.X500Name import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo @@ -9,33 +11,38 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider import org.bouncycastle.operator.ContentSigner import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder import java.io.File -import java.io.FileInputStream -import java.io.FileOutputStream +import java.io.InputStream import java.math.BigInteger +import java.nio.file.Path import java.security.* import java.security.cert.X509Certificate import java.util.* +import kotlin.io.path.exists +import kotlin.io.path.inputStream +import kotlin.io.path.name +import kotlin.io.path.outputStream -internal class Signer( - private val cn: String, password: String +class Signer( + private val signingOptions: SigningOptions ) { - private val passwordCharArray = password.toCharArray() - private fun newKeystore(out: File) { + private val passwordCharArray = signingOptions.password.toCharArray() + private fun newKeystore(out: Path) { val (publicKey, privateKey) = createKey() val privateKS = KeyStore.getInstance("BKS", "BC") privateKS.load(null, passwordCharArray) privateKS.setKeyEntry("alias", privateKey, passwordCharArray, arrayOf(publicKey)) - privateKS.store(FileOutputStream(out), passwordCharArray) + out.outputStream().use { stream -> privateKS.store(stream, passwordCharArray) } } + fun regenerateKeystore() = newKeystore(signingOptions.keyStoreFilePath) + private fun createKey(): Pair { val gen = KeyPairGenerator.getInstance("RSA") - gen.initialize(2048) + gen.initialize(4096) val pair = gen.generateKeyPair() var serialNumber: BigInteger - do serialNumber = - BigInteger.valueOf(SecureRandom().nextLong()) while (serialNumber < BigInteger.ZERO) - val x500Name = X500Name("CN=$cn") + do serialNumber = BigInteger.valueOf(SecureRandom().nextLong()) while (serialNumber < BigInteger.ZERO) + val x500Name = X500Name("CN=${signingOptions.cn}") val builder = X509v3CertificateBuilder( x500Name, serialNumber, @@ -49,26 +56,46 @@ internal class Signer( return JcaX509CertificateConverter().getCertificate(builder.build(signer)) to pair.private } - fun signApk(input: File, output: File, ks: File) { + private fun loadKeystore(): KeyStore { + val ks = signingOptions.keyStoreFilePath + if (!ks.exists()) newKeystore(ks) else { + Log.i(tag, "Found existing keystore: ${ks.name}") + } + Security.addProvider(BouncyCastleProvider()) + val keyStore = KeyStore.getInstance("BKS", "BC") + ks.inputStream().use { keyStore.load(it, null) } + return keyStore + } - if (!ks.exists()) newKeystore(ks) + fun canUnlock(): Boolean { + val keyStore = loadKeystore() + val alias = keyStore.aliases().nextElement() - val keyStore = KeyStore.getInstance("BKS", "BC") - FileInputStream(ks).use { fis -> keyStore.load(fis, null) } + try { + keyStore.getKey(alias, passwordCharArray) + } catch (_: UnrecoverableKeyException) { + return false + } + + return true + } + + fun signApk(input: File, output: File) { + val keyStore = loadKeystore() val alias = keyStore.aliases().nextElement() val config = ApkSigner.SignerConfig.Builder( - cn, + signingOptions.cn, keyStore.getKey(alias, passwordCharArray) as PrivateKey, listOf(keyStore.getCertificate(alias) as X509Certificate) ).build() val signer = ApkSigner.Builder(listOf(config)) - signer.setCreatedBy(cn) + signer.setCreatedBy(signingOptions.cn) signer.setInputApk(input) signer.setOutputApk(output) signer.build().sign() } -} +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/util/signing/SigningOptions.kt b/app/src/main/java/app/revanced/manager/util/signing/SigningOptions.kt new file mode 100644 index 0000000000..a0ca4d94f1 --- /dev/null +++ b/app/src/main/java/app/revanced/manager/util/signing/SigningOptions.kt @@ -0,0 +1,9 @@ +package app.revanced.manager.util.signing + +import java.nio.file.Path + +data class SigningOptions( + val cn: String, + val password: String, + val keyStoreFilePath: Path +) \ No newline at end of file diff --git a/android/app/src/main/jniLibs/arm64-v8a/libaapt2.so b/app/src/main/jniLibs/arm64-v8a/libaapt2.so similarity index 100% rename from android/app/src/main/jniLibs/arm64-v8a/libaapt2.so rename to app/src/main/jniLibs/arm64-v8a/libaapt2.so diff --git a/android/app/src/main/jniLibs/armeabi-v7a/libaapt2.so b/app/src/main/jniLibs/armeabi-v7a/libaapt2.so similarity index 100% rename from android/app/src/main/jniLibs/armeabi-v7a/libaapt2.so rename to app/src/main/jniLibs/armeabi-v7a/libaapt2.so diff --git a/android/app/src/main/jniLibs/x86/libaapt2.so b/app/src/main/jniLibs/x86/libaapt2.so similarity index 100% rename from android/app/src/main/jniLibs/x86/libaapt2.so rename to app/src/main/jniLibs/x86/libaapt2.so diff --git a/android/app/src/main/jniLibs/x86_64/libaapt2.so b/app/src/main/jniLibs/x86_64/libaapt2.so similarity index 100% rename from android/app/src/main/jniLibs/x86_64/libaapt2.so rename to app/src/main/jniLibs/x86_64/libaapt2.so diff --git a/android/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml similarity index 100% rename from android/app/src/main/res/drawable/ic_launcher_foreground.xml rename to app/src/main/res/drawable/ic_launcher_foreground.xml diff --git a/android/app/src/main/res/drawable/ic_launcher_round.png b/app/src/main/res/drawable/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res/drawable/ic_launcher_round.png rename to app/src/main/res/drawable/ic_launcher_round.png diff --git a/android/app/src/main/res/drawable/ic_notification.png b/app/src/main/res/drawable/ic_notification.png similarity index 100% rename from android/app/src/main/res/drawable/ic_notification.png rename to app/src/main/res/drawable/ic_notification.png diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi/ic_launcher.xml similarity index 100% rename from android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to app/src/main/res/mipmap-anydpi/ic_launcher.xml diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000000..6be58a6139 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,12 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + + #1B1B1B + \ No newline at end of file diff --git a/app/src/main/res/values/plurals.xml b/app/src/main/res/values/plurals.xml new file mode 100644 index 0000000000..c64f7d979a --- /dev/null +++ b/app/src/main/res/values/plurals.xml @@ -0,0 +1,11 @@ + + + + %d patch + %d patches + + + %d applied patch + %d applied patches + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000..73c2a734c2 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,247 @@ + + ReVanced Manager + Patcher + Patches + Integrations + CLI + Manager + + Dashboard + Settings + Select an app + Select patches + + Import + Import patch bundle + Bundle patches + Patch bundle + Integrations + Provided + Not provided + + Not set + + Missing + Error + + Select version + + Select updates to receive + Periodically connect to update providers to check for updates. + Manager updates + Patches + These settings can be changed later. + + General + General settings + Advanced + Advanced settings + Updates + Updates for ReVanced Manager + Open source licenses + View all the libraries used to make this application + Downloads + Manage downloaded content + Import & export + Import and export settings + About + About ReVanced + + Contributors + View the contributors of ReVanced + Dynamic color + Adapt colors to the wallpaper + Theme + Choose between light or dark theme + Allow experimental patches + Allow patching incompatible patches with experimental versions, something may break + Import keystore + Import a custom keystore + Enter keystore credentials + You\'ll need enter the keystore’s credentials to import it. + Username (Alias) + Password + Import + Wrong keystore credentials + Export keystore + Export the current keystore + No keystore to export + Regenerate keystore + Generate a new keystore + The keystore has been successfully replaced + Patches selection + Restore patches selections + Restore patches selection from a file + Failed to restore patches selection: %s + Backup patches selections + Backup patches selection to a file + Failed to backup patches selection: %s + Clear patches selection + Clear all patches selection + Prefer split apks + Prefer split apks instead of full apks + Prefer universal apks + Prefer universal instead of arch-specific apks + + Search apps… + Loading… + Downloading patch bundle… + Downloading Integrations… + + Options + OK + Reset + Patch + Select from storage + Select an APK file from storage using file picker + Type anything to continue + Search + Apply + Help + Back + Add + Close + System + Light + Information + Dark + Appearance + Downloaded apps + API URL + Set custom API URL + You may have issues with features when using a custom API URL. + Only use API\'s you trust! + Set + Device + Android version + Model + CPU Architectures + Memory limits + Normal: %1$d MB, Large: %2$d MB + Patch bundles + Redownload all patch bundles + Reset patch bundles + Patching + Signing + Storage + No patches are available. Check your bundles + Apps + Patch bundles + Delete + Refresh + Remote + Local + Continue anyways + Download another version + Download app + Failed to download patch bundle: %s + Failed to load updated patch bundle: %s + Failed to update integrations: %s + No patched apps found + No patches available to view + %d Patches available, tap to view + Tap on the patches to get more information about them + Unsupported app + Unsupported patches + Universal patches + Supported + Universal + Unsupported + Some of the patches do not support this app version (%1$s). The patches only support the following version(s): %2$s. + Continue with this version? + Not all patches support this version (%s). Do you want to continue anyway? + Download application? + The app you selected isn\'t installed. Do you want to download it? + Failed to load apk + Loading… + Not installed + + App info + Uninstall + Repatch + Installation type + Package name + Original package name + Applied patches + View applied patches + Default + Root + + An error occurred + Already downloaded + + Edit + More options + Value + + Select from storage + Previous directory + Directories + Files + + Show password + Hide password + + Installer + Install + App installed + Failed to install app: %s + Failed to uninstall app: %s + Open + Export + Apk exported + Failed to sign Apk: %s + Save logs + + Preparation + Load patches + Unpack Apk + Merge Integrations + Patching + Saving + Write patched Apk + Patching in progress… + + completed + failed + running + + expand + collapse + + More + Donate + Website + GitHub + Contact + Version + Submit issue or feedback + Help us improve this application + Developer options + Options for debugging issues + Name + Source URL + Automatically update + Automatically update this bundle when ReVanced starts + Bundle type + Choose the type of bundle you want + About ReVanced Manager + ReVanced Manager is an application designed to work with ReVanced Patcher, which allows for long-lasting patches to be created for Android apps. The patching system is designed to automatically work with new versions of apps with minimal maintenance. + A minor update for ReVanced Manager is available. Click here to update and get the latest features and fixes! + Update channel + Stable + Update notifications + Dialog on app launch + badges + Changelog + Loading changelog + Failed to download changelog: %s + Check out the latest changes in this update + Battery optimization must be turned off in order for ReVanced Manager to work correctly in the background. Tap here to turn off. + Installing update… + Downloading update… + Failed to download update: %s + Cancel + Save + Update + Tap on Update when prompted. \n ReVanced Manager will close when updating. + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000000..25bde821a6 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000000..fa0f996d2c --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000000..9ee9997b0b --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/assets/i18n/en_US.json b/assets/i18n/en_US.json deleted file mode 100644 index 63e8267798..0000000000 --- a/assets/i18n/en_US.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "okButton": "OK", - "cancelButton": "Cancel", - "quitButton": "Quit", - "updateButton": "Update", - "enabledLabel": "Enabled", - "disabledLabel": "Disabled", - "installed":"Installed: {version}", - "suggested":"Suggested: {version}", - "yesButton": "Yes", - "noButton": "No", - "warning": "Warning", - "notice": "Notice", - "noShowAgain": "Don't show this again", - "new": "New", - "navigationView": { - "dashboardTab": "Dashboard", - "patcherTab": "Patcher", - "settingsTab": "Settings" - }, - "homeView": { - "refreshSuccess": "Refreshed successfully", - "widgetTitle": "Dashboard", - - "updatesSubtitle": "Updates", - "patchedSubtitle": "Patched applications", - - "noUpdates": "No updates available", - - "WIP": "Work in progress...", - - "noInstallations": "No patched applications installed", - "installUpdate": "Continue to install the update?", - - "updateDialogTitle": "Update Manager", - "updatePatchesDialogTitle": "Update ReVanced Patches", - "updateChangelogTitle": "Changelog", - - "patchesConsentDialogText": "ReVanced Patches needs to be downloaded.", - "patchesConsentDialogText2": "This will connect you to {url}.", - "patchesConsentDialogText3": "Auto update?", - "patchesConsentDialogText3Sub": "You can change this in settings at a later time.", - - "notificationTitle": "Update downloaded", - "notificationText": "Tap to install the update", - - "downloadingMessage": "Downloading update...", - "downloadedMessage": "Update downloaded!", - - "installingMessage": "Installing update...", - - "errorDownloadMessage": "Unable to download update", - "errorInstallMessage": "Unable to install update", - - "noConnection": "No internet connection", - "updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again." - }, - "applicationItem": { - "patchButton": "Patch", - "infoButton": "Info", - "changelogLabel": "Changelog" - }, - "latestCommitCard": { - "loadingLabel": "Loading...", - "timeagoLabel": "{time} ago", - "patcherLabel": "Patcher: ", - "managerLabel": "Manager: ", - "updateButton": "Update Manager" - }, - "patcherView": { - "widgetTitle": "Patcher", - "patchButton": "Patch", - - "patchDialogText": "You have selected a resource patch and a split APK installation has been detected, so patching errors may occur.\nAre you sure you want to proceed?", - "armv7WarningDialogText": "Patching on ARMv7 devices is not yet supported and might fail. Proceed anyways?", - "splitApkWarningDialogText": "Patching a split APK is not yet supported and might fail. Proceed anyways?", - "removedPatchesWarningDialogText": "The following patches have been removed since the last time you used them.\n\n{patches}\n\nProceed anyways?" - }, - "appSelectorCard": { - "widgetTitle": "Select an application", - "widgetTitleSelected": "Selected application", - "widgetSubtitle": "No application selected", - - "noAppsLabel": "No applications found", - "notInstalled":"App not installed", - - "currentVersion": "Current", - "suggestedVersion": "Suggested", - "allVersions": "All versions" - }, - "patchSelectorCard": { - "widgetTitle": "Select patches", - "widgetTitleSelected": "Selected patches", - - "widgetSubtitle": "Select an application first", - "widgetEmptySubtitle": "No patches selected" - }, - "socialMediaCard": { - "widgetTitle": "Socials", - "widgetSubtitle": "We are online!" - }, - "appSelectorView": { - "viewTitle": "Select an application", - "searchBarHint": "Search applications", - - "storageButton": "Storage", - "selectFromStorageButton": "Select from storage", - - "errorMessage": "Unable to use selected application", - - "downloadToast": "Download function is not available yet", - - "featureNotAvailable": "Feature not implemented", - "featureNotAvailableText": "This application is a split APK and cannot be selected. Unfortunately, this feature is only available for rooted users at the moment. However, you can still install the application by selecting its APK files from your device's storage instead" - }, - "patchesSelectorView": { - "viewTitle": "Select patches", - "searchBarHint": "Search patches", - "universalPatches": "Universal patches", - - "doneButton": "Done", - - "default": "Default", - "defaultTooltip": "Select all default patches", - - "none": "None", - "noneTooltip": "Deselect all patches", - - "loadPatchesSelection": "Load patches selection", - "noSavedPatches": "No saved patches for the selected app.\nPress Done to save current selection.", - "noPatchesFound": "No patches found for the selected app", - - "selectAllPatchesWarningContent": "You are about to select all patches, that includes non-suggested patches and can cause unwanted behavior." - }, - "patchItem": { - "unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nSupported versions:\n{supportedVersions}", - "unsupportedPatchVersion": "Patch is not supported for this app version. Enable the experimental toggle in settings to proceed.", - - "newPatchDialogText": "This is a new patch that has been added since the last time you have patched this app.", - "newPatch": "New patch", - - "patchesChangeWarningDialogText": "It is recommended to use the default selection of patches because changing it may cause unexpected issues.\n\nIf you know what you are doing, you can enable \"Enable changing selection\" in the settings.", - "patchesChangeWarningDialogButton": "Use default selection" - }, - "installerView": { - "widgetTitle": "Installer", - "installType": "Select install type", - "installTypeDescription": "Select the installation type to proceed with.", - - "installButton": "Install", - "installRootType": "Root", - "installNonRootType": "Non-root", - "installRecommendedType": "Recommended", - - "pressBackAgain": "Press back again to cancel", - "openButton": "Open", - "shareButton": "Share file", - - "notificationTitle": "ReVanced Manager is patching", - "notificationText": "Tap to return to the installer", - - "exportApkButtonTooltip": "Export patched APK", - "exportLogButtonTooltip": "Export log", - - "installErrorDialogTitle": "Error", - "installErrorDialogText1": "Root install is not possible with the current patches selection.\nRepatch your app or choose non-root install.", - "installErrorDialogText2": "Non-root install is not possible with the current patches selection.\nRepatch your app or choose root install if you have your device rooted.", - "installErrorDialogText3": "Root install is not possible as the original APK was selected from storage.\nSelect an installed app or choose non-root install.", - "noExit": "Installer is still running, cannot exit..." - }, - "settingsView": { - "widgetTitle": "Settings", - - "appearanceSectionTitle": "Appearance", - "teamSectionTitle": "Team", - "infoSectionTitle": "Info", - "advancedSectionTitle": "Advanced", - "exportSectionTitle": "Import & export", - "logsSectionTitle": "Logs", - - "darkThemeLabel": "Dark mode", - "darkThemeHint": "Welcome to the dark side", - - "dynamicThemeLabel": "Material You", - "dynamicThemeHint": "Enjoy an experience closer to your device", - - "languageLabel": "Language", - "englishOption": "English", - - "sourcesLabel": "Sources", - "sourcesLabelHint": "Configure your custom sources", - "sourcesIntegrationsLabel": "Integrations source", - "sourcesResetDialogTitle": "Reset", - "sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?", - "apiURLResetDialogText": "Are you sure you want to reset API URL to its default value?", - "sourcesUpdateNote": "Note: ReVanced Patches will be updated to the latest version automatically.\n\nThis will reveal your IP address to the server.", - - "apiURLLabel": "API URL", - "apiURLHint": "Configure your custom API URL", - "selectApiURL": "API URL", - "hostRepositoryLabel": "Repository API", - "orgPatchesLabel": "Patches organization", - "sourcesPatchesLabel": "Patches source", - "orgIntegrationsLabel": "Integrations organization", - - "contributorsLabel": "Contributors", - "contributorsHint": "A list of contributors of ReVanced", - - "logsLabel": "Logs", - "logsHint": "Share Manager's logs", - - "enablePatchesSelectionLabel": "Enable changing selection", - "enablePatchesSelectionHint": "Enable changing the selection of patches.", - "enablePatchesSelectionWarningText": "Changing the default selection of patches may cause unexpected issues.\n\nEnable anyways?", - "disablePatchesSelectionWarningText": "You are about to disable changing the selection of patches.\nThe default selection of patches will be restored.\n\nDisable anyways?", - - "autoUpdatePatchesLabel": "Auto update patches", - "autoUpdatePatchesHint": "Automatically update ReVanced Patches to the latest version", - "experimentalUniversalPatchesLabel": "Experimental universal patches support", - "experimentalUniversalPatchesHint": "Display all applications to use with universal patches, loading list of apps may be slower", - "experimentalPatchesLabel": "Experimental patches support", - "experimentalPatchesHint": "Enable usage of unsupported patches in any app version", - "enabledExperimentalPatches": "Experimental patches support enabled", - - "aboutLabel": "About", - "snackbarMessage": "Copied to clipboard", - "restartAppForChanges": "Restart the app to apply changes", - - "deleteTempDirLabel": "Delete temporary files", - "deleteTempDirHint": "Delete unused temporary files", - "deletedTempDir": "Temporary files deleted", - - "exportPatchesLabel": "Export patches selection", - "exportPatchesHint": "Export patches selection to a JSON file", - "exportedPatches": "Patches selection exported", - "noExportFileFound": "No patches selection to export", - - "importPatchesLabel": "Import patches selection", - "importPatchesHint": "Import patches selection from a JSON file", - "importedPatches": "Patches selection imported", - - "resetStoredPatchesLabel": "Reset patches", - "resetStoredPatchesHint": "Reset the stored patches selection", - - "resetStoredPatchesDialogTitle": "Reset patches selection?", - "resetStoredPatchesDialogText": "Resetting patches selection will remove all selected patches.", - "resetStoredPatches": "Patches selection has been reset", - - "deleteLogsLabel": "Delete logs", - "deleteLogsHint": "Delete collected manager logs", - "deletedLogs": "Logs deleted", - - "regenerateKeystoreLabel": "Regenerate keystore", - "regenerateKeystoreHint": "Regenerate the keystore used to sign the app", - - "regenerateKeystoreDialogTitle": "Regenerate keystore?", - "regenerateKeystoreDialogText": "Patched apps signed with the old keystore will no longer be able to update.", - "regeneratedKeystore": "Keystore regenerated", - - "exportKeystoreLabel": "Export keystore", - "exportKeystoreHint": "Export keystore used to sign apps", - "exportedKeystore": "Keystore exported", - "noKeystoreExportFileFound": "No keystore to export", - - "importKeystoreLabel": "Import keystore", - "importKeystoreHint": "Import keystore used to sign apps", - "importedKeystore": "Keystore imported", - - "selectKeystorePassword": "Keystore Password", - "selectKeystorePasswordHint": "Select keystore password used to sign the apk", - - "jsonSelectorErrorMessage": "Unable to use selected JSON file", - "keystoreSelectorErrorMessage": "Unable to use selected KEYSTORE file" - }, - "appInfoView": { - "widgetTitle": "App info", - "openButton": "Open", - "uninstallButton": "Uninstall", - "unpatchButton": "Unpatch", - "rootDialogTitle": "Error", - - "unpatchDialogText": "Are you sure you want to unpatch this app?", - "rootDialogText": "App was installed with superuser permissions, but currently ReVanced Manager has no permissions.\nPlease grant superuser permissions first.", - - "packageNameLabel": "Package name", - "originalPackageNameLabel": "Original package name", - "installTypeLabel": "Installation type", - "rootTypeLabel": "Root", - "nonRootTypeLabel": "Non-root", - "patchedDateLabel": "Patched date", - "appliedPatchesLabel": "Applied patches", - - "patchedDateHint": "{date} at {time}", - "appliedPatchesHint": "{quantity} applied patches", - - "updateNotImplemented": "This feature has not been implemented yet" - }, - "contributorsView": { - "widgetTitle": "Contributors", - "patcherContributors": "Patcher contributors", - "patchesContributors": "Patches contributors", - "integrationsContributors": "Integrations contributors", - "cliContributors": "CLI contributors", - "managerContributors": "Manager contributors" - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000..89d27215ee --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,6 @@ +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.devtools) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.about.libraries) apply false +} diff --git a/crowdin.yml b/crowdin.yml deleted file mode 100644 index 177682aae4..0000000000 --- a/crowdin.yml +++ /dev/null @@ -1,9 +0,0 @@ -project_id_env: CROWDIN_PROJECT_ID -api_token_env: CROWDIN_PERSONAL_TOKEN - -commit_message: 'chore(i18n): sync translations' - -preserve_hierarchy: true -files: - - source: assets/i18n/en_US.json - translation: assets/i18n/%locale_with_underscore%.json \ No newline at end of file diff --git a/docs/0_prerequisites.md b/docs/0_prerequisites.md deleted file mode 100644 index a53b46fb9c..0000000000 --- a/docs/0_prerequisites.md +++ /dev/null @@ -1,16 +0,0 @@ -# 💼 Prerequisites - -In order to use ReVanced Manager, certain requirements must be met. - -## 🤝 Requirements - -- An Android device running Android 8 or higher -- Any device architecture except ARMv7[^1] - -[^1]: This constraint only applies to patches, that require patching APK resources which is why some patches may or may not work on ARMv7 architecture. You can find out, which architectures your device supports here: [⚙️ Configuring ReVanced Manager](2_4_settings.md#%E2%84%B9%EF%B8%8F-about). - -## ⏭️ What's next - -The next page will guide you through patching an app. - -Continue: [⬇️ Installation](1_installation.md) diff --git a/docs/1_installation.md b/docs/1_installation.md deleted file mode 100644 index d4c08984af..0000000000 --- a/docs/1_installation.md +++ /dev/null @@ -1,14 +0,0 @@ -# ⬇️ Installation - -In order to use ReVanced on your Android device, ReVanced Manager must be installed. - -## ✅ Installation steps - -1. Download the latest version of ReVanced Manager from [here](https://github.com/revanced/revanced-manager/releases/latest) -2. Install ReVanced Manager - -## ⏭️ What's next - -The next page will guide you through using ReVanced Manager. - -Continue: [🛠️ Usage](2_usage.md) diff --git a/docs/2_1_patching.md b/docs/2_1_patching.md deleted file mode 100644 index 428660cebf..0000000000 --- a/docs/2_1_patching.md +++ /dev/null @@ -1,27 +0,0 @@ -# 🧩 Patching apps - -The following pages will guide you through using ReVanced Manager to patch apps. - -## ✅ Steps to patch apps - -1. Navigate to the **Patcher** tab from the bottom navigation bar -2. Tap on the **Select an app** card -3. Choose an app to patch[^1] - > **Note**: The suggested version is visible in each app's card. -4. Tap on the **Select patches** card and select the patches you want to apply[^2] - > **Warning**: If you see a warning you can click on it for more information. -5. Tap on the **Done** then **Patch** button - > **Warning**: The patching process may take ~5 minutes. Exiting the app may increase the time it takes to patch. -6. Tap on the **Install** button - > **Note**: If you are rooted, you can mount the patched app on top of the original app.[^3] - > Optionally, you may export the patched app to storage using the options in the top right corner. - -[^1]: Non-root users may be prompted to select an APK from storage, in which case you have to source the APK file yourself. ReVanced does not provide any APK files. -[^2]: It is suggested to use the default set of patches by tapping on the **Default** button above the list of patches. -[^3]: Mounting the patched app on top of the original app will only work if the installed app version matches the version of the app selected in step 3. above. - -## ⏭️ What's next - -The next page will bring you back to the usage page. - -Continue: [🛠️ Usage](2_usage.md) diff --git a/docs/2_2_managing.md b/docs/2_2_managing.md deleted file mode 100644 index 1ad02229b1..0000000000 --- a/docs/2_2_managing.md +++ /dev/null @@ -1,15 +0,0 @@ -# 🧰 Managing patched apps - -After patching an app, you may want to manage it. This page will guide you through managing patched apps. - -## ✅ Steps to manage patched apps - -1. Tap on the **Dashboard** tab in the bottom navigation bar -2. Tap on the **Info** button for the app you want to manage -3. Choose one of the options from the menu - -## ⏭️ What's next - -The next page will bring you back to the usage page. - -Continue: [🛠️ Usage](2_usage.md) diff --git a/docs/2_3_updating.md b/docs/2_3_updating.md deleted file mode 100644 index 9851ac900a..0000000000 --- a/docs/2_3_updating.md +++ /dev/null @@ -1,14 +0,0 @@ -# 🔄 Updating ReVanced Manager - -In order to keep up with the latest features and bug fixes, it is recommended to keep ReVanced Manager up to date. - -## ✅ Updating steps - -1. Navigate to the **Dashboard** tab from the bottom navigation bar -2. Tap on the **Update** button in the **Updates** section - -## ⏭️ What's next - -The next page will bring you back to the usage page. - -Continue: [🛠️ Usage](2_usage.md) diff --git a/docs/2_4_settings.md b/docs/2_4_settings.md deleted file mode 100644 index 008cda463b..0000000000 --- a/docs/2_4_settings.md +++ /dev/null @@ -1,39 +0,0 @@ -# ⚙️ Configuring ReVanced Manager - -ReVanced Manager has settings that can be configured to your liking. - -## ⭐ Essential settings - -- ### 🔗 API URL - - Specify the URL of the API to use. This is used to fetch ReVanced Patches and update ReVanced Manager. - -- ### 🧬 Sources - - Override the API and change the source of ReVanced Patches. - -- ### 🧪 Experimental ReVanced Patches support - - Lift app version constraints from ReVanced Patches. This allows you to patch any version of an app, even if the patch is not explicitly compatible with it. - -- ### 🧑‍🔬 Experimental universal support - - This will show or hide ReVanced Patches, which are not meant for any app in particular but rather for all apps but may not work on all apps. - -- ### 🔑 Export, import or delete keystore - - Manage the keystore used to sign patched apps. - -- ### 📄 Export, import or reset ReVanced Patches selection - - Manage the ReVanced Patches selection. This is useful if you want to share your ReVanced Patches selection with others or reset it to the default selection. - -- ### ℹ️ About - - View information about your device and ReVanced Manager. This includes the version of ReVanced Manager and supported architectures of your device. - -## ⏭️ What's next - -The next page will bring you back to the usage page. - -Continue: [🛠️ Usage](2_usage.md) diff --git a/docs/2_usage.md b/docs/2_usage.md deleted file mode 100644 index f079782f9c..0000000000 --- a/docs/2_usage.md +++ /dev/null @@ -1,16 +0,0 @@ -# 🛠️ Usage - -The following pages will guide you through using ReVanced Manager to patch apps, manage patched apps, and update ReVanced Manager. - -## 📖 Table of contents - -1. [🧩 Patching apps](2_1_patching.md) -2. [🧰 Managing patched apps](2_2_managing.md) -3. [🔄 Updating ReVanced Manager](2_3_updating.md) -4. [⚙️ Configuring ReVanced Manager](2_4_settings.md) - -## ⏭️ What's next - -The next page will guide you through troubleshooting ReVanced Manager. - -Continue: [❔ Troubleshooting](3_troubleshooting.md) diff --git a/docs/3_troubleshooting.md b/docs/3_troubleshooting.md deleted file mode 100644 index 5a860c6b12..0000000000 --- a/docs/3_troubleshooting.md +++ /dev/null @@ -1,31 +0,0 @@ -# ❔ Troubleshooting - -In case you encounter any issues while using ReVanced Manager, please refer to this page for possible solutions. - -- 💉 Patching fails with an error - - Make sure ReVanced Manager is up to date by following [🔄 Updating ReVanced Manager](2_3_updating.md) and select the **Default** button when choosing patches. - -- 💥 App not installed as package conflicts with an existing package - - An existing installation of the app you're trying to patch is conflicting with the patched app. Uninstall the existing app before installing the patched app. - -- ❗️ Error code `135`, `139` or `1` when patching the app - - Your device is not supported. Refer to the [Prerequisites](0_prerequisites.md) page for supported devices. - - Alternatively, you can use [ReVanced CLI](https://github.com/revanced/revanced-cli) to patch the app. - -- 🚫 Non-root install is not possible with the current patches selection - - Select the **Default** button when choosing patches. - -- 🚨 Patched app crashes on launch - - Select the **Default** button when choosing patches. - -## ⏭️ What's next - -The next page will teach you how to build ReVanced Manager from source. - -Continue: [🔨 Building from source](4_building.md) diff --git a/docs/4_building.md b/docs/4_building.md deleted file mode 100644 index d4c0887cc8..0000000000 --- a/docs/4_building.md +++ /dev/null @@ -1,40 +0,0 @@ -# 🛠️ Building 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) - -2. Clone the repository - - ```sh - git clone https://github.com/revanced/revanced-manager.git && cd revanced-manager - ``` - -3. Create a GitHub personal access token with the `read:packages` scope [here](https://github.com/settings/tokens/new?scopes=read:packages&description=ReVanced) - -4. Add your GitHub username and the token to `~/.gradle/gradle.properties` - - ```properties - gpr.user = YourUsername - gpr.key = ghp_longrandomkey - ``` - -5. Get dependencies - - ```sh - flutter pub get - ``` - -6. Delete conflicting outputs - - ```sh - flutter packages pub run build_runner build --delete-conflicting-outputs - ``` - - > **Note**: Must be run every time you sync your local repository with the remote repository. - -7. Build the APK - - ```sh - flutter build apk - ``` diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index af2926b6c1..0000000000 --- a/docs/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# 💊 ReVanced Manager - -This documentation explains how to use [ReVanced Manager](https://github.com/revanced/revanced-manager). - -## 📖 Table of contents - -0. [💼 Prerequisites](0_prerequisites.md) -1. [⬇️ Installation](1_installation.md) -2. [🛠️ Usage](2_usage.md) - 1. [🧩 Patching apps](2_1_patching.md) - 2. [🧰 Managing patched apps](2_2_managing.md) - 3. [🔄 Updating ReVanced Manager](2_3_updating.md) - 4. [⚙️ Configuring ReVanced Manager](2_4_settings.md) -3. [❔ Troubleshooting](3_troubleshooting.md) -4. [🔨 Building from source](4_building.md) - -## ⏭️ Start here - -The next page will tell you about the prerequisites for using ReVanced Manager. - -Continue: [💼 Prerequisites](0_prerequisites.md) diff --git a/fastlane/Appfile b/fastlane/Appfile deleted file mode 100644 index 5f978f40e5..0000000000 --- a/fastlane/Appfile +++ /dev/null @@ -1,2 +0,0 @@ -json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one -package_name("app.revanced.manager.flutter") # e.g. com.krausefx.app diff --git a/fastlane/Fastfile b/fastlane/Fastfile deleted file mode 100644 index 19c557cc6e..0000000000 --- a/fastlane/Fastfile +++ /dev/null @@ -1,38 +0,0 @@ -# This file contains the fastlane.tools configuration -# You can find the documentation at https://docs.fastlane.tools -# -# For a list of all available actions, check out -# -# https://docs.fastlane.tools/actions -# -# For a list of all available plugins, check out -# -# https://docs.fastlane.tools/plugins/available-plugins -# - -# Uncomment the line if you want fastlane to automatically update itself -# update_fastlane - -default_platform(:android) - -platform :android do - desc "Runs all the tests" - lane :test do - gradle(task: "test") - end - - desc "Submit a new Beta Build to Crashlytics Beta" - lane :beta do - gradle(task: "clean assembleRelease") - crashlytics - - # sh "your_script.sh" - # You can also use other beta testing services here - end - - desc "Deploy a new version to the Google Play" - lane :deploy do - gradle(task: "clean assembleRelease") - upload_to_play_store - end -end diff --git a/fastlane/README.md b/fastlane/README.md deleted file mode 100644 index 7ec1207f1a..0000000000 --- a/fastlane/README.md +++ /dev/null @@ -1,48 +0,0 @@ -fastlane documentation ----- - -# Installation - -Make sure you have the latest version of the Xcode command line tools installed: - -```sh -xcode-select --install -``` - -For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) - -# Available Actions - -## Android - -### android test - -```sh -[bundle exec] fastlane android test -``` - -Runs all the tests - -### android beta - -```sh -[bundle exec] fastlane android beta -``` - -Submit a new Beta Build to Crashlytics Beta - -### android deploy - -```sh -[bundle exec] fastlane android deploy -``` - -Deploy a new version to the Google Play - ----- - -This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. - -More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). - -The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt deleted file mode 100644 index 673becbca2..0000000000 --- a/fastlane/metadata/android/en-US/full_description.txt +++ /dev/null @@ -1 +0,0 @@ -ReVanced Manager is an Android application that uses ReVanced Patcher to add, remove, and modify existing functionalities in Android applications diff --git a/fastlane/metadata/android/en-US/images/featureGraphic.png b/fastlane/metadata/android/en-US/images/featureGraphic.png deleted file mode 100644 index a872ceb726..0000000000 Binary files a/fastlane/metadata/android/en-US/images/featureGraphic.png and /dev/null differ diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png deleted file mode 100644 index bef6f58706..0000000000 Binary files a/fastlane/metadata/android/en-US/images/icon.png and /dev/null differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.jpg deleted file mode 100644 index 4cc5f0c802..0000000000 Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.jpg and /dev/null differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.jpg deleted file mode 100644 index cb85435142..0000000000 Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.jpg and /dev/null differ diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt deleted file mode 100644 index 15d7c30faf..0000000000 --- a/fastlane/metadata/android/en-US/short_description.txt +++ /dev/null @@ -1 +0,0 @@ -Patch your favorite apps, right on your device. diff --git a/fastlane/report.xml b/fastlane/report.xml deleted file mode 100644 index 35ac130b7b..0000000000 --- a/fastlane/report.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000..a2e90d87bd --- /dev/null +++ b/gradle.properties @@ -0,0 +1,25 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true +android.defaults.buildfeatures.buildconfig=true +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000..b5763f9533 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,105 @@ +[versions] +ktx = "1.10.1" +viewmodel-lifecycle = "2.6.1" +splash-screen = "1.0.1" +compose-activity = "1.7.2" +paging = "3.1.1" +preferences-datastore = "1.0.0" +work-runtime = "2.8.1" +compose-bom = "2023.06.01" +accompanist = "0.30.1" +serialization = "1.6.0" +collection = "0.3.5" +room-version = "2.5.2" +patcher = "12.1.1" +apksign = "8.1.1" +bcpkix-jdk18on = "1.76" +koin-version = "3.4.2" +koin-version-compose = "3.4.5" +reimagined-navigation = "1.4.0" +ktor = "2.3.2" +markdown = "0.4.1" +androidGradlePlugin = "8.1.1" +kotlinGradlePlugin = "1.9.0" +devToolsGradlePlugin = "1.9.0-1.0.12" +aboutLibrariesGradlePlugin = "10.8.2" +coil = "2.4.0" +app-icon-loader-coil = "1.5.0" +skrapeit = "1.2.1" + +[libraries] +# AndroidX Core +androidx-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "ktx" } +runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "viewmodel-lifecycle" } +runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "viewmodel-lifecycle" } +splash-screen = { group = "androidx.core", name = "core-splashscreen", version.ref = "splash-screen" } +compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "compose-activity" } +paging-common-ktx = { group = "androidx.paging", name = "paging-common-ktx", version.ref = "paging" } +work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "work-runtime" } +preferences-datastore = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "preferences-datastore" } + +# Compose +compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } +compose-ui = { group = "androidx.compose.ui", name = "ui" } +compose-ui-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +compose-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" } +compose-material3 = { group = "androidx.compose.material3", name = "material3" } +compose-material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended" } + +# Coil +coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } +coil-appiconloader = { group = "me.zhanghai.android.appiconloader", name = "appiconloader-coil", version.ref = "app-icon-loader-coil" } + +# Accompanist +accompanist-drawablepainter = { group = "com.google.accompanist", name = "accompanist-drawablepainter", version.ref = "accompanist" } +accompanist-webview = { group = "com.google.accompanist", name = "accompanist-webview", version.ref = "accompanist" } +accompanist-permissions = { group = "com.google.accompanist", name = "accompanist-permissions", version.ref = "accompanist" } +accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist" } +accompanist-placeholder = { group = "com.google.accompanist", name = "accompanist-placeholder-material", version.ref = "accompanist" } + +# Kotlinx +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" } +kotlinx-collection-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "collection" } + +# Room +room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room-version" } +room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room-version" } +room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room-version" } + +# Patcher +patcher = { group = "app.revanced", name = "revanced-patcher", version.ref = "patcher" } + +# Signing +apksign = { group = "com.android.tools.build", name = "apksig", version.ref = "apksign" } +bcpkix-jdk18on = { group = "org.bouncycastle", name = "bcpkix-jdk18on", version.ref = "bcpkix-jdk18on" } + +# Koin +koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin-version" } +koin-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin-version-compose" } +koin-workmanager = { group = "io.insert-koin", name = "koin-androidx-workmanager", version.ref = "koin-version" } + +# Compose Navigation +reimagined-navigation = { group = "dev.olshevski.navigation", name = "reimagined", version.ref = "reimagined-navigation" } + +# about-libraries +about-libraries = { group = "com.mikepenz", name = "aboutlibraries-compose", version.ref = "aboutLibrariesGradlePlugin" } + +# Ktor +ktor-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" } +ktor-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" } +ktor-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor" } +ktor-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" } +ktor-serialization = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" } + +# HTML Scraper +skrapeit-dsl = { group = "it.skrape", name = "skrapeit-dsl", version.ref = "skrapeit" } +skrapeit-parser = { group = "it.skrape", name = "skrapeit-html-parser", version.ref = "skrapeit" } + +# Markdown +markdown = { group = "org.jetbrains", name = "markdown", version.ref = "markdown" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinGradlePlugin" } +devtools = { id = "com.google.devtools.ksp", version.ref = "devToolsGradlePlugin" } +about-libraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibrariesGradlePlugin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..7f93135c49 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 61% rename from android/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties index 76777308a3..864d6c4751 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=a01b6587e15fe7ed120a0ee299c25982a1eee045abd6a9dd5e216b2f628ef9ac -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip +distributionSha256Sum=591855b517fc635b9e04de1d05d5e76ada3f89f5fc76f87978d1b245b4f69225 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000000..0adc8e1a53 --- /dev/null +++ b/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000000..6689b85bee --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/lib/app/app.dart b/lib/app/app.dart deleted file mode 100644 index 76c32b193c..0000000000 --- a/lib/app/app.dart +++ /dev/null @@ -1,43 +0,0 @@ -import 'package:revanced_manager/services/github_api.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/patcher_api.dart'; -import 'package:revanced_manager/services/revanced_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/app_selector/app_selector_view.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/navigation/navigation_view.dart'; -import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_view.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/views/patches_selector/patches_selector_view.dart'; -import 'package:revanced_manager/ui/views/settings/settings_view.dart'; -import 'package:revanced_manager/ui/widgets/appInfoView/app_info_view.dart'; -import 'package:stacked/stacked_annotations.dart'; -import 'package:stacked_services/stacked_services.dart'; - -@StackedApp( - routes: [ - MaterialRoute(page: NavigationView), - MaterialRoute(page: PatcherView), - MaterialRoute(page: AppSelectorView), - MaterialRoute(page: PatchesSelectorView), - MaterialRoute(page: InstallerView), - MaterialRoute(page: SettingsView), - MaterialRoute(page: ContributorsView), - MaterialRoute(page: AppInfoView), - ], - dependencies: [ - LazySingleton(classType: NavigationViewModel), - LazySingleton(classType: HomeViewModel), - LazySingleton(classType: PatcherViewModel), - LazySingleton(classType: NavigationService), - LazySingleton(classType: ManagerAPI), - LazySingleton(classType: PatcherAPI), - LazySingleton(classType: RevancedAPI), - LazySingleton(classType: GithubAPI), - LazySingleton(classType: Toast), - ], -) -class AppSetup {} diff --git a/lib/main.dart b/lib/main.dart deleted file mode 100644 index 29b715b9a9..0000000000 --- a/lib/main.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'dart:developer'; - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:revanced_manager/app/app.locator.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/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:stacked_themes/stacked_themes.dart'; -import 'package:timezone/data/latest.dart' as tz; - -late SharedPreferences prefs; -Future main() async { - await ThemeManager.initialise(); - await setupLocator(); - WidgetsFlutterBinding.ensureInitialized(); - await locator().initialize(); - final String apiUrl = locator().getApiUrl(); - await locator().initialize(apiUrl); - final String repoUrl = locator().getRepoUrl(); - locator().initialize(repoUrl); - tz.initializeTimeZones(); - prefs = await SharedPreferences.getInstance(); - - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - // String rawLocale = prefs.getString('language') ?? 'en_US'; - // String replaceLocale = rawLocale.replaceAll('_', '-'); - // List localeList = replaceLocale.split('-'); - // Locale locale = Locale(localeList[0], localeList[1]); - const Locale locale = Locale('en', 'US'); - - return DynamicThemeBuilder( - title: 'ReVanced Manager', - home: const NavigationView(), - localizationsDelegates: [ - FlutterI18nDelegate( - translationLoader: FileTranslationLoader( - fallbackFile: 'en_US', - forcedLocale: locale, - basePath: 'assets/i18n', - useCountryCode: true, - ), - missingTranslationHandler: (key, locale) { - log( - '--> Missing translation: key: $key, languageCode: ${locale?.languageCode}', - ); - }, - ), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ], - ); - } -} diff --git a/lib/models/patch.dart b/lib/models/patch.dart deleted file mode 100644 index 7acf05ba7e..0000000000 --- a/lib/models/patch.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:revanced_manager/utils/string.dart'; - -part 'patch.g.dart'; - -@JsonSerializable() -class Patch { - Patch({ - required this.name, - required this.description, - required this.excluded, - required this.dependencies, - required this.compatiblePackages, - }); - - factory Patch.fromJson(Map json) => _$PatchFromJson(json); - final String name; - final String description; - final bool excluded; - final List dependencies; - final List compatiblePackages; - - Map toJson() => _$PatchToJson(this); - - String getSimpleName() { - return name - .replaceAll('-', ' ') - .split('-') - .join(' ') - .toTitleCase() - .replaceFirst('Microg', 'MicroG'); - } -} - -@JsonSerializable() -class Package { - Package({ - required this.name, - required this.versions, - }); - - factory Package.fromJson(Map json) => - _$PackageFromJson(json); - final String name; - final List versions; - - Map toJson() => _$PackageToJson(this); -} diff --git a/lib/models/patched_application.dart b/lib/models/patched_application.dart deleted file mode 100644 index 90bfb9a31e..0000000000 --- a/lib/models/patched_application.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'dart:convert'; -import 'dart:typed_data'; -import 'package:json_annotation/json_annotation.dart'; - -part 'patched_application.g.dart'; - -@JsonSerializable() -class PatchedApplication { - PatchedApplication({ - required this.name, - required this.packageName, - required this.originalPackageName, - required this.version, - required this.apkFilePath, - required this.icon, - required this.patchDate, - this.isRooted = false, - this.isFromStorage = false, - this.hasUpdates = false, - this.appliedPatches = const [], - this.changelog = const [], - }); - - factory PatchedApplication.fromJson(Map json) => - _$PatchedApplicationFromJson(json); - String name; - String packageName; - String originalPackageName; - String version; - final String apkFilePath; - @JsonKey( - fromJson: decodeBase64, - toJson: encodeBase64, - ) - Uint8List icon; - DateTime patchDate; - bool isRooted; - bool isFromStorage; - bool hasUpdates; - List appliedPatches; - List changelog; - - Map toJson() => _$PatchedApplicationToJson(this); - - static Uint8List decodeBase64(String icon) => base64.decode(icon); - - static String encodeBase64(Uint8List bytes) => base64.encode(bytes); -} diff --git a/lib/services/github_api.dart b/lib/services/github_api.dart deleted file mode 100644 index de8c160b2b..0000000000 --- a/lib/services/github_api.dart +++ /dev/null @@ -1,268 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'package:collection/collection.dart'; -import 'package:dio/dio.dart'; -import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:injectable/injectable.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/services/manager_api.dart'; - -@lazySingleton -class GithubAPI { - late Dio _dio = Dio(); - late final ManagerAPI _managerAPI = locator(); - - final _cacheOptions = CacheOptions( - store: MemCacheStore(), - maxStale: const Duration(days: 1), - priority: CachePriority.high, - ); - - final Map repoAppPath = { - 'com.google.android.youtube': 'youtube', - 'com.google.android.apps.youtube.music': 'music', - 'com.twitter.android': 'twitter', - 'com.reddit.frontpage': 'reddit', - 'com.zhiliaoapp.musically': 'tiktok', - 'de.dwd.warnapp': 'warnwetter', - 'com.garzotto.pflotsh.ecmwf_a': 'ecmwf', - 'com.spotify.music': 'spotify', - }; - - Future initialize(String repoUrl) async { - try { - _dio = Dio( - BaseOptions( - baseUrl: repoUrl, - ), - ); - - _dio.interceptors.add(DioCacheInterceptor(options: _cacheOptions)); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future clearAllCache() async { - try { - await _cacheOptions.store!.clean(); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - 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?> getLatestPatchesRelease( - String repoName, - ) async { - try { - final response = await _dio.get( - '/repos/$repoName/releases/latest', - ); - return response.data; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - } - - Future?> getLatestManagerRelease( - String repoName, - ) async { - try { - final response = await _dio.get( - '/repos/$repoName/releases', - ); - final Map releases = response.data[0]; - int updates = 0; - final String currentVersion = - await ManagerAPI().getCurrentManagerVersion(); - while (response.data[updates]['tag_name'] != 'v$currentVersion') { - updates++; - } - for (int i = 1; i < updates; i++) { - releases.update( - 'body', - (value) => - value + - '\n' + - '# ' + - response.data[i]['tag_name'] + - '\n' + - response.data[i]['body'], - ); - } - return releases; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - } - - Future> getCommits( - String packageName, - String repoName, - DateTime since, - ) async { - final String path = - 'src/main/kotlin/app/revanced/patches/${repoAppPath[packageName]}'; - try { - final response = await _dio.get( - '/repos/$repoName/commits', - queryParameters: { - 'path': path, - 'since': since.toIso8601String(), - }, - ); - final List commits = response.data; - return commits - .map( - (commit) => commit['commit']['message'].split('\n')[0] + - ' - ' + - commit['commit']['author']['name'] + - '\n' as String, - ) - .toList(); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - return []; - } - - 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 DefaultCacheManager().getSingleFile( - asset['browser_download_url'], - ); - } - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - return null; - } - - Future getPatchesReleaseFile( - String extension, - String repoName, - String version, - String url, - ) async { - try { - if (url.isNotEmpty) { - return await DefaultCacheManager().getSingleFile( - url, - ); - } - final Map? release = - await getPatchesRelease(repoName, version); - if (release != null) { - final Map? asset = - (release['assets'] as List).firstWhereOrNull( - (asset) => (asset['name'] as String).endsWith(extension), - ); - if (asset != null) { - final String downloadUrl = asset['browser_download_url']; - if (extension == '.apk') { - _managerAPI.setIntegrationsDownloadURL(downloadUrl); - } else if (extension == '.json') { - _managerAPI.setPatchesDownloadURL(downloadUrl, false); - } else { - _managerAPI.setPatchesDownloadURL(downloadUrl, true); - } - return await DefaultCacheManager().getSingleFile( - downloadUrl, - ); - } - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - return null; - } - - Future> getPatches( - String repoName, - String version, - String url, - ) async { - List patches = []; - try { - final File? f = await getPatchesReleaseFile( - '.json', - repoName, - version, - url, - ); - if (f != null) { - final List list = jsonDecode(f.readAsStringSync()); - patches = list.map((patch) => Patch.fromJson(patch)).toList(); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - - return patches; - } -} diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart deleted file mode 100644 index 1391f707db..0000000000 --- a/lib/services/manager_api.dart +++ /dev/null @@ -1,759 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'package:device_apps/device_apps.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:injectable/injectable.dart'; -import 'package:package_info_plus/package_info_plus.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/github_api.dart'; -import 'package:revanced_manager/services/revanced_api.dart'; -import 'package:revanced_manager/services/root_api.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:revanced_manager/utils/check_for_supported_patch.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:timeago/timeago.dart'; - -@lazySingleton -class ManagerAPI { - final RevancedAPI _revancedAPI = locator(); - final GithubAPI _githubAPI = locator(); - final RootAPI _rootAPI = RootAPI(); - final String patcherRepo = 'revanced-patcher'; - final String cliRepo = 'revanced-cli'; - late SharedPreferences _prefs; - bool isRooted = false; - String storedPatchesFile = '/selected-patches.json'; - String keystoreFile = - '/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-manager.keystore'; - String defaultKeystorePassword = 's3cur3p@ssw0rd'; - String defaultApiUrl = 'https://api.revanced.app/'; - String defaultRepoUrl = 'https://api.github.com'; - String defaultPatcherRepo = 'revanced/revanced-patcher'; - String defaultPatchesRepo = 'revanced/revanced-patches'; - String defaultIntegrationsRepo = 'revanced/revanced-integrations'; - String defaultCliRepo = 'revanced/revanced-cli'; - String defaultManagerRepo = 'revanced/revanced-manager'; - String? patchesVersion = ''; - String? integrationsVersion = ''; - bool isDefaultPatchesRepo() { - return getPatchesRepo() == 'revanced/revanced-patches'; - } - - bool isDefaultIntegrationsRepo() { - return getIntegrationsRepo() == 'revanced/revanced-integrations'; - } - - Future initialize() async { - _prefs = await SharedPreferences.getInstance(); - isRooted = await _rootAPI.isRooted(); - storedPatchesFile = - (await getApplicationDocumentsDirectory()).path + storedPatchesFile; - } - - String getApiUrl() { - return _prefs.getString('apiUrl') ?? defaultApiUrl; - } - - Future setApiUrl(String url) async { - if (url.isEmpty || url == ' ') { - url = defaultApiUrl; - } - await _revancedAPI.initialize(url); - await _revancedAPI.clearAllCache(); - await _prefs.setString('apiUrl', url); - } - - String getRepoUrl() { - return _prefs.getString('repoUrl') ?? defaultRepoUrl; - } - - Future setRepoUrl(String url) async { - if (url.isEmpty || url == ' ') { - url = defaultRepoUrl; - } - await _prefs.setString('repoUrl', url); - } - - String getPatchesDownloadURL(bool bundle) { - return _prefs.getString('patchesDownloadURL-$bundle') ?? ''; - } - - Future setPatchesDownloadURL(String value, bool bundle) async { - await _prefs.setString('patchesDownloadURL-$bundle', value); - } - - String getPatchesRepo() { - return _prefs.getString('patchesRepo') ?? defaultPatchesRepo; - } - - Future setPatchesRepo(String value) async { - if (value.isEmpty || value.startsWith('/') || value.endsWith('/')) { - value = defaultPatchesRepo; - } - await _prefs.setString('patchesRepo', value); - } - - bool getPatchesConsent() { - return _prefs.getBool('patchesConsent') ?? false; - } - - Future setPatchesConsent(bool consent) async { - await _prefs.setBool('patchesConsent', consent); - } - - bool isPatchesAutoUpdate() { - return _prefs.getBool('patchesAutoUpdate') ?? false; - } - - bool isPatchesChangeEnabled() { - if (getPatchedApps().isNotEmpty && !isChangingToggleModified()) { - for (final apps in getPatchedApps()) { - if (getSavedPatches(apps.originalPackageName) - .indexWhere((patch) => patch.excluded) != - -1) { - setPatchesChangeWarning(false); - setPatchesChangeEnabled(true); - break; - } - } - } - return _prefs.getBool('patchesChangeEnabled') ?? false; - } - - void setPatchesChangeEnabled(bool value) { - _prefs.setBool('patchesChangeEnabled', value); - } - - bool showPatchesChangeWarning() { - return _prefs.getBool('showPatchesChangeWarning') ?? true; - } - - void setPatchesChangeWarning(bool value) { - _prefs.setBool('showPatchesChangeWarning', !value); - } - - bool isChangingToggleModified() { - return _prefs.getBool('isChangingToggleModified') ?? false; - } - - void setChangingToggleModified(bool value) { - _prefs.setBool('isChangingToggleModified', value); - } - - Future setPatchesAutoUpdate(bool value) async { - await _prefs.setBool('patchesAutoUpdate', value); - } - - List getSavedPatches(String packageName) { - final List patchesJson = - _prefs.getStringList('savedPatches-$packageName') ?? []; - final List patches = patchesJson.map((String patchJson) { - return Patch.fromJson(jsonDecode(patchJson)); - }).toList(); - return patches; - } - - Future savePatches(List patches, String packageName) async { - final List patchesJson = patches.map((Patch patch) { - return jsonEncode(patch.toJson()); - }).toList(); - await _prefs.setStringList('savedPatches-$packageName', patchesJson); - } - - String getIntegrationsDownloadURL() { - return _prefs.getString('integrationsDownloadURL') ?? ''; - } - - Future setIntegrationsDownloadURL(String value) async { - await _prefs.setString('integrationsDownloadURL', value); - } - - List getUsedPatches(String packageName) { - final List patchesJson = - _prefs.getStringList('usedPatches-$packageName') ?? []; - final List patches = patchesJson.map((String patchJson) { - return Patch.fromJson(jsonDecode(patchJson)); - }).toList(); - return patches; - } - - Future setUsedPatches(List patches, String packageName) async { - final List patchesJson = patches.map((Patch patch) { - return jsonEncode(patch.toJson()); - }).toList(); - await _prefs.setStringList('usedPatches-$packageName', patchesJson); - } - - String getIntegrationsRepo() { - return _prefs.getString('integrationsRepo') ?? defaultIntegrationsRepo; - } - - Future setIntegrationsRepo(String value) async { - if (value.isEmpty || value.startsWith('/') || value.endsWith('/')) { - value = defaultIntegrationsRepo; - } - await _prefs.setString('integrationsRepo', value); - } - - bool getUseDynamicTheme() { - return _prefs.getBool('useDynamicTheme') ?? false; - } - - Future setUseDynamicTheme(bool value) async { - await _prefs.setBool('useDynamicTheme', value); - } - - bool getUseDarkTheme() { - return _prefs.getBool('useDarkTheme') ?? false; - } - - Future setUseDarkTheme(bool value) async { - await _prefs.setBool('useDarkTheme', value); - } - - bool areUniversalPatchesEnabled() { - return _prefs.getBool('universalPatchesEnabled') ?? false; - } - - Future enableUniversalPatchesStatus(bool value) async { - await _prefs.setBool('universalPatchesEnabled', value); - } - - bool areExperimentalPatchesEnabled() { - return _prefs.getBool('experimentalPatchesEnabled') ?? false; - } - - Future enableExperimentalPatchesStatus(bool value) async { - await _prefs.setBool('experimentalPatchesEnabled', value); - } - - Future setKeystorePassword(String password) async { - await _prefs.setString('keystorePassword', password); - } - - String getKeystorePassword() { - return _prefs.getString('keystorePassword') ?? defaultKeystorePassword; - } - - Future deleteTempFolder() async { - final Directory dir = Directory('/data/local/tmp/revanced-manager'); - if (await dir.exists()) { - await dir.delete(recursive: true); - } - } - - Future deleteKeystore() async { - final File keystore = File( - keystoreFile, - ); - if (await keystore.exists()) { - await keystore.delete(); - } - } - - List getPatchedApps() { - final List apps = _prefs.getStringList('patchedApps') ?? []; - return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList(); - } - - Future setPatchedApps( - List patchedApps, - ) async { - if (patchedApps.length > 1) { - patchedApps.sort((a, b) => a.name.compareTo(b.name)); - } - await _prefs.setStringList( - 'patchedApps', - patchedApps.map((a) => json.encode(a.toJson())).toList(), - ); - } - - Future savePatchedApp(PatchedApplication app) async { - final List patchedApps = getPatchedApps(); - patchedApps.removeWhere((a) => a.packageName == app.packageName); - final ApplicationWithIcon? installed = await DeviceApps.getApp( - app.packageName, - true, - ) as ApplicationWithIcon?; - if (installed != null) { - app.name = installed.appName; - app.version = installed.versionName!; - app.icon = installed.icon; - } - patchedApps.add(app); - await setPatchedApps(patchedApps); - } - - Future deletePatchedApp(PatchedApplication app) async { - final List patchedApps = getPatchedApps(); - patchedApps.removeWhere((a) => a.packageName == app.packageName); - await setPatchedApps(patchedApps); - } - - Future clearAllData() async { - try { - _revancedAPI.clearAllCache(); - _githubAPI.clearAllCache(); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future>> getContributors() async { - return await _revancedAPI.getContributors(); - } - - Future> getPatches() async { - try { - final String repoName = getPatchesRepo(); - final String currentVersion = await getCurrentPatchesVersion(); - final String url = getPatchesDownloadURL(false); - return await _githubAPI.getPatches( - repoName, - currentVersion, - url, - ); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return []; - } - } - - Future downloadPatches() async { - try { - final String repoName = getPatchesRepo(); - final String currentVersion = await getCurrentPatchesVersion(); - final String url = getPatchesDownloadURL(true); - return await _githubAPI.getPatchesReleaseFile( - '.jar', - repoName, - currentVersion, - url, - ); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - } - - Future downloadIntegrations() async { - try { - final String repoName = getIntegrationsRepo(); - final String currentVersion = await getCurrentIntegrationsVersion(); - final String url = getIntegrationsDownloadURL(); - return await _githubAPI.getPatchesReleaseFile( - '.apk', - repoName, - currentVersion, - url, - ); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - } - - Future downloadManager() async { - return await _revancedAPI.getLatestReleaseFile( - '.apk', - defaultManagerRepo, - ); - } - - Future getLatestPatchesReleaseTime() async { - if (isDefaultPatchesRepo()) { - return await _revancedAPI.getLatestReleaseTime( - '.json', - defaultPatchesRepo, - ); - } else { - final release = - await _githubAPI.getLatestPatchesRelease(getPatchesRepo()); - if (release != null) { - final DateTime timestamp = - DateTime.parse(release['created_at'] as String); - return format(timestamp, locale: 'en_short'); - } else { - return null; - } - } - } - - Future getLatestManagerReleaseTime() async { - return await _revancedAPI.getLatestReleaseTime( - '.apk', - defaultManagerRepo, - ); - } - - Future getLatestManagerVersion() async { - return await _revancedAPI.getLatestReleaseVersion( - '.apk', - defaultManagerRepo, - ); - } - - Future getLatestIntegrationsVersion() async { - if (isDefaultIntegrationsRepo()) { - return await _revancedAPI.getLatestReleaseVersion( - '.apk', - defaultIntegrationsRepo, - ); - } else { - final release = await _githubAPI.getLatestRelease(getIntegrationsRepo()); - if (release != null) { - return release['tag_name']; - } else { - return null; - } - } - } - - Future getLatestPatchesVersion() async { - if (isDefaultPatchesRepo()) { - return await _revancedAPI.getLatestReleaseVersion( - '.json', - defaultPatchesRepo, - ); - } else { - final release = - await _githubAPI.getLatestPatchesRelease(getPatchesRepo()); - if (release != null) { - return release['tag_name']; - } else { - return null; - } - } - } - - Future getCurrentManagerVersion() async { - final PackageInfo packageInfo = await PackageInfo.fromPlatform(); - return packageInfo.version; - } - - Future getCurrentPatchesVersion() async { - patchesVersion = _prefs.getString('patchesVersion') ?? '0.0.0'; - if (patchesVersion == '0.0.0' || isPatchesAutoUpdate()) { - final String newPatchesVersion = - await getLatestPatchesVersion() ?? '0.0.0'; - if (patchesVersion != newPatchesVersion && newPatchesVersion != '0.0.0') { - await setCurrentPatchesVersion(newPatchesVersion); - } - } - return patchesVersion!; - } - - Future setCurrentPatchesVersion(String version) async { - await _prefs.setString('patchesVersion', version); - await setPatchesDownloadURL('', false); - await setPatchesDownloadURL('', true); - await downloadPatches(); - } - - Future getCurrentIntegrationsVersion() async { - integrationsVersion = _prefs.getString('integrationsVersion') ?? '0.0.0'; - if (integrationsVersion == '0.0.0' || isPatchesAutoUpdate()) { - final String newIntegrationsVersion = - await getLatestIntegrationsVersion() ?? '0.0.0'; - if (integrationsVersion != newIntegrationsVersion && - newIntegrationsVersion != '0.0.0') { - await setCurrentIntegrationsVersion(newIntegrationsVersion); - } - } - return integrationsVersion!; - } - - Future setCurrentIntegrationsVersion(String version) async { - await _prefs.setString('integrationsVersion', version); - await setIntegrationsDownloadURL(''); - await downloadIntegrations(); - } - - Future> getAppsToRemove( - List patchedApps, - ) async { - final List toRemove = []; - for (final PatchedApplication app in patchedApps) { - final bool isRemove = await isAppUninstalled(app); - if (isRemove) { - toRemove.add(app); - } - } - return toRemove; - } - - Future> getUnsavedApps( - List patchedApps, - ) async { - final List unsavedApps = []; - final bool hasRootPermissions = await _rootAPI.hasRootPermissions(); - if (hasRootPermissions) { - final List installedApps = await _rootAPI.getInstalledApps(); - for (final String packageName in installedApps) { - if (!patchedApps.any((app) => app.packageName == packageName)) { - final ApplicationWithIcon? application = await DeviceApps.getApp( - packageName, - true, - ) as ApplicationWithIcon?; - if (application != null) { - unsavedApps.add( - PatchedApplication( - name: application.appName, - packageName: application.packageName, - originalPackageName: application.packageName, - version: application.versionName!, - apkFilePath: application.apkFilePath, - icon: application.icon, - patchDate: DateTime.now(), - isRooted: true, - ), - ); - } - } - } - } - final List userApps = - await DeviceApps.getInstalledApplications(); - for (final Application app in userApps) { - if (app.packageName.startsWith('app.revanced') && - !app.packageName.startsWith('app.revanced.manager.') && - !patchedApps.any((uapp) => uapp.packageName == app.packageName)) { - final ApplicationWithIcon? application = await DeviceApps.getApp( - app.packageName, - true, - ) as ApplicationWithIcon?; - if (application != null) { - unsavedApps.add( - PatchedApplication( - name: application.appName, - packageName: application.packageName, - originalPackageName: application.packageName, - version: application.versionName!, - apkFilePath: application.apkFilePath, - icon: application.icon, - patchDate: DateTime.now(), - ), - ); - } - } - } - return unsavedApps; - } - - Future showPatchesChangeWarningDialog(BuildContext context) { - final ValueNotifier noShow = - ValueNotifier(!showPatchesChangeWarning()); - return showDialog( - barrierDismissible: false, - context: context, - builder: (context) => WillPopScope( - onWillPop: () async => false, - child: AlertDialog( - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - title: I18nText('warning'), - content: ValueListenableBuilder( - valueListenable: noShow, - builder: (context, value, child) { - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - I18nText( - 'patchItem.patchesChangeWarningDialogText', - child: const Text( - '', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - const SizedBox(height: 8), - CheckboxListTile( - value: value, - contentPadding: EdgeInsets.zero, - title: I18nText( - 'noShowAgain', - ), - onChanged: (selected) { - noShow.value = selected!; - }, - ), - ], - ); - }, - ), - actions: [ - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () { - setPatchesChangeWarning(noShow.value); - Navigator.of(context).pop(); - }, - ), - ], - ), - ), - ); - } - - Future reAssessSavedApps() async { - final List patchedApps = getPatchedApps(); - final List unsavedApps = - await getUnsavedApps(patchedApps); - patchedApps.addAll(unsavedApps); - final List toRemove = - await getAppsToRemove(patchedApps); - patchedApps.removeWhere((a) => toRemove.contains(a)); - for (final PatchedApplication app in patchedApps) { - app.hasUpdates = - await hasAppUpdates(app.originalPackageName, app.patchDate); - app.changelog = - await getAppChangelog(app.originalPackageName, app.patchDate); - if (!app.hasUpdates) { - final String? currentInstalledVersion = - (await DeviceApps.getApp(app.packageName))?.versionName; - if (currentInstalledVersion != null) { - final String currentSavedVersion = app.version; - final int currentInstalledVersionInt = int.parse( - currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''), - ); - final int currentSavedVersionInt = int.parse( - currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''), - ); - if (currentInstalledVersionInt > currentSavedVersionInt) { - app.hasUpdates = true; - } - } - } - } - await setPatchedApps(patchedApps); - } - - Future isAppUninstalled(PatchedApplication app) async { - bool existsRoot = false; - final bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName); - if (app.isRooted) { - final bool hasRootPermissions = await _rootAPI.hasRootPermissions(); - if (hasRootPermissions) { - existsRoot = await _rootAPI.isAppInstalled(app.packageName); - } - return !existsRoot || !existsNonRoot; - } - return !existsNonRoot; - } - - Future hasAppUpdates( - String packageName, - DateTime patchDate, - ) async { - final List commits = await _githubAPI.getCommits( - packageName, - getPatchesRepo(), - patchDate, - ); - return commits.isNotEmpty; - } - - Future> getAppChangelog( - String packageName, - DateTime patchDate, - ) async { - List newCommits = await _githubAPI.getCommits( - packageName, - getPatchesRepo(), - patchDate, - ); - if (newCommits.isEmpty) { - newCommits = await _githubAPI.getCommits( - packageName, - getPatchesRepo(), - patchDate, - ); - } - return newCommits; - } - - Future isSplitApk(PatchedApplication patchedApp) async { - Application? app; - if (patchedApp.isFromStorage) { - app = await DeviceApps.getAppFromStorage(patchedApp.apkFilePath); - } else { - app = await DeviceApps.getApp(patchedApp.packageName); - } - return app != null && app.isSplit; - } - - Future setSelectedPatches( - String app, - List patches, - ) async { - final File selectedPatchesFile = File(storedPatchesFile); - final Map patchesMap = await readSelectedPatchesFile(); - if (patches.isEmpty) { - patchesMap.remove(app); - } else { - patchesMap[app] = patches; - } - selectedPatchesFile.writeAsString(jsonEncode(patchesMap)); - } - - // get default patches for app - Future> getDefaultPatches() async { - final List patches = await getPatches(); - final List defaultPatches = []; - if (areExperimentalPatchesEnabled() == false) { - defaultPatches.addAll( - patches - .where( - (element) => - element.excluded == false && isPatchSupported(element), - ) - .map((p) => p.name), - ); - } else { - defaultPatches.addAll( - patches - .where((element) => isPatchSupported(element)) - .map((p) => p.name), - ); - } - return defaultPatches; - } - - Future> getSelectedPatches(String app) async { - final Map patchesMap = await readSelectedPatchesFile(); - final List defaultPatches = await getDefaultPatches(); - return List.from(patchesMap.putIfAbsent(app, () => defaultPatches)); - } - - Future> readSelectedPatchesFile() async { - final File selectedPatchesFile = File(storedPatchesFile); - if (!selectedPatchesFile.existsSync()) { - return {}; - } - final String string = selectedPatchesFile.readAsStringSync(); - if (string.trim().isEmpty) { - return {}; - } - return jsonDecode(string); - } - - Future resetLastSelectedPatches() async { - final File selectedPatchesFile = File(storedPatchesFile); - selectedPatchesFile.deleteSync(); - } -} diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart deleted file mode 100644 index dfaaf3ec95..0000000000 --- a/lib/services/patcher_api.dart +++ /dev/null @@ -1,336 +0,0 @@ -import 'dart:io'; - -import 'package:collection/collection.dart'; -import 'package:cr_file_saver/file_saver.dart'; -import 'package:device_apps/device_apps.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; -import 'package:injectable/injectable.dart'; -import 'package:install_plugin/install_plugin.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/root_api.dart'; -import 'package:share_extend/share_extend.dart'; - -@lazySingleton -class PatcherAPI { - static const patcherChannel = - MethodChannel('app.revanced.manager.flutter/patcher'); - final ManagerAPI _managerAPI = locator(); - final RootAPI _rootAPI = RootAPI(); - late Directory _dataDir; - late Directory _tmpDir; - late File _keyStoreFile; - List _patches = []; - Map filteredPatches = >{}; - File? _outFile; - - Future initialize() async { - await _loadPatches(); - await _managerAPI.downloadPatches(); - await _managerAPI.downloadIntegrations(); - final Directory appCache = await getTemporaryDirectory(); - _dataDir = await getExternalStorageDirectory() ?? appCache; - _tmpDir = Directory('${appCache.path}/patcher'); - _keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore'); - cleanPatcher(); - } - - void cleanPatcher() { - if (_tmpDir.existsSync()) { - _tmpDir.deleteSync(recursive: true); - } - } - - Future _loadPatches() async { - try { - if (_patches.isEmpty) { - _patches = await _managerAPI.getPatches(); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - _patches = List.empty(); - } - } - - Future> getFilteredInstalledApps( - bool showUniversalPatches, - ) async { - final List filteredApps = []; - final bool allAppsIncluded = - _patches.any((patch) => patch.compatiblePackages.isEmpty) && - showUniversalPatches; - if (allAppsIncluded) { - final allPackages = await DeviceApps.getInstalledApplications( - includeAppIcons: true, - onlyAppsWithLaunchIntent: true, - ); - for (final pkg in allPackages) { - if (!filteredApps.any((app) => app.packageName == pkg.packageName)) { - final appInfo = await DeviceApps.getApp( - pkg.packageName, - true, - ) as ApplicationWithIcon?; - if (appInfo != null) { - filteredApps.add(appInfo); - } - } - } - } - for (final Patch patch in _patches) { - for (final Package package in patch.compatiblePackages) { - try { - if (!filteredApps.any((app) => app.packageName == package.name)) { - final ApplicationWithIcon? app = await DeviceApps.getApp( - package.name, - true, - ) as ApplicationWithIcon?; - if (app != null) { - filteredApps.add(app); - } - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - } - return filteredApps; - } - - List getFilteredPatches(String packageName) { - final List patches = _patches - .where( - (patch) => - patch.compatiblePackages.isEmpty || - !patch.name.contains('settings') && - patch.compatiblePackages - .any((pack) => pack.name == packageName), - ) - .toList(); - if (!_managerAPI.areUniversalPatchesEnabled()) { - filteredPatches[packageName] = patches - .where((patch) => patch.compatiblePackages.isNotEmpty) - .toList(); - } else { - filteredPatches[packageName] = patches; - } - return filteredPatches[packageName]; - } - - Future> getAppliedPatches( - List appliedPatches, - ) async { - return _patches - .where((patch) => appliedPatches.contains(patch.name)) - .toList(); - } - - Future needsResourcePatching( - List selectedPatches, - ) async { - return selectedPatches.any( - (patch) => patch.dependencies.any( - (dep) => dep.contains('resource-'), - ), - ); - } - - Future needsSettingsPatch(List selectedPatches) async { - return selectedPatches.any( - (patch) => patch.dependencies.any( - (dep) => dep.contains('settings'), - ), - ); - } - - Future runPatcher( - String packageName, - String apkFilePath, - List selectedPatches, - ) async { - final bool includeSettings = await needsSettingsPatch(selectedPatches); - if (includeSettings) { - try { - final Patch? settingsPatch = _patches.firstWhereOrNull( - (patch) => - patch.name.contains('settings') && - patch.compatiblePackages.any((pack) => pack.name == packageName), - ); - if (settingsPatch != null) { - selectedPatches.add(settingsPatch); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - final File? patchBundleFile = await _managerAPI.downloadPatches(); - final File? integrationsFile = await _managerAPI.downloadIntegrations(); - if (patchBundleFile != null) { - _dataDir.createSync(); - _tmpDir.createSync(); - final Directory workDir = _tmpDir.createTempSync('tmp-'); - final File inputFile = File('${workDir.path}/base.apk'); - final File patchedFile = File('${workDir.path}/patched.apk'); - _outFile = File('${workDir.path}/out.apk'); - final Directory cacheDir = Directory('${workDir.path}/cache'); - cacheDir.createSync(); - final String originalFilePath = apkFilePath; - try { - await patcherChannel.invokeMethod( - 'runPatcher', - { - 'patchBundleFilePath': patchBundleFile.path, - 'originalFilePath': originalFilePath, - 'inputFilePath': inputFile.path, - 'patchedFilePath': patchedFile.path, - 'outFilePath': _outFile!.path, - 'integrationsPath': integrationsFile!.path, - 'selectedPatches': selectedPatches.map((p) => p.name).toList(), - 'cacheDirPath': cacheDir.path, - 'keyStoreFilePath': _keyStoreFile.path, - 'keystorePassword': _managerAPI.getKeystorePassword(), - }, - ); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - } - - Future stopPatcher() async { - try { - await patcherChannel.invokeMethod('stopPatcher'); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future installPatchedFile(PatchedApplication patchedApp) async { - if (_outFile != null) { - try { - if (patchedApp.isRooted) { - final bool hasRootPermissions = await _rootAPI.hasRootPermissions(); - if (hasRootPermissions) { - return _rootAPI.installApp( - patchedApp.packageName, - patchedApp.apkFilePath, - _outFile!.path, - ); - } - } else { - final install = await InstallPlugin.installApk(_outFile!.path); - return install['isSuccess']; - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return false; - } - } - return false; - } - - void exportPatchedFile(String appName, String version) { - try { - if (_outFile != null) { - final String newName = _getFileName(appName, version); - CRFileSaver.saveFileWithDialog( - SaveFileDialogParams( - sourceFilePath: _outFile!.path, - destinationFileName: newName, - ), - ); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - void sharePatchedFile(String appName, String version) { - try { - if (_outFile != null) { - final String newName = _getFileName(appName, version); - final int lastSeparator = _outFile!.path.lastIndexOf('/'); - final String newPath = - _outFile!.path.substring(0, lastSeparator + 1) + newName; - final File shareFile = _outFile!.copySync(newPath); - ShareExtend.share(shareFile.path, 'file'); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - String _getFileName(String appName, String version) { - final String prefix = appName.toLowerCase().replaceAll(' ', '-'); - final String newName = '$prefix-revanced_v$version.apk'; - return newName; - } - - Future exportPatcherLog(String logs) async { - final Directory appCache = await getTemporaryDirectory(); - final Directory logDir = Directory('${appCache.path}/logs'); - logDir.createSync(); - final String dateTime = DateTime.now() - .toIso8601String() - .replaceAll('-', '') - .replaceAll(':', '') - .replaceAll('T', '') - .replaceAll('.', ''); - final String fileName = 'revanced-manager_patcher_$dateTime.log'; - final File log = File('${logDir.path}/$fileName'); - log.writeAsStringSync(logs); - CRFileSaver.saveFileWithDialog( - SaveFileDialogParams( - sourceFilePath: log.path, - destinationFileName: fileName, - ), - ); - } - - String getSuggestedVersion(String packageName) { - final Map versions = {}; - for (final Patch patch in _patches) { - final Package? package = patch.compatiblePackages.firstWhereOrNull( - (pack) => pack.name == packageName, - ); - if (package != null) { - for (final String version in package.versions) { - versions.update( - version, - (value) => versions[version]! + 1, - ifAbsent: () => 1, - ); - } - } - } - if (versions.isNotEmpty) { - final entries = versions.entries.toList() - ..sort((a, b) => a.value.compareTo(b.value)); - versions - ..clear() - ..addEntries(entries); - versions.removeWhere((key, value) => value != versions.values.last); - return (versions.keys.toList()..sort()).last; - } - return ''; - } -} diff --git a/lib/services/revanced_api.dart b/lib/services/revanced_api.dart deleted file mode 100644 index dde23cee5e..0000000000 --- a/lib/services/revanced_api.dart +++ /dev/null @@ -1,190 +0,0 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:collection/collection.dart'; -import 'package:dio/dio.dart'; -import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:injectable/injectable.dart'; -import 'package:timeago/timeago.dart'; - -@lazySingleton -class RevancedAPI { - late Dio _dio = Dio(); - - final _cacheOptions = CacheOptions( - store: MemCacheStore(), - maxStale: const Duration(days: 1), - priority: CachePriority.high, - ); - - Future initialize(String apiUrl) async { - try { - _dio = Dio( - BaseOptions( - baseUrl: apiUrl, - ), - ); - - _dio.interceptors.add(DioCacheInterceptor(options: _cacheOptions)); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future clearAllCache() async { - try { - await _cacheOptions.store!.clean(); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future>> getContributors() async { - final Map> contributors = {}; - try { - final response = await _dio.get('/contributors'); - final List repositories = response.data['repositories']; - for (final Map repo in repositories) { - final String name = repo['name']; - contributors[name] = repo['contributors']; - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return {}; - } - return contributors; - } - - Future?> _getLatestRelease( - String extension, - String repoName, - ) async { - try { - final response = await _dio.get('/tools'); - final List tools = response.data['tools']; - return tools.firstWhereOrNull( - (t) => - t['repository'] == repoName && - (t['name'] as String).endsWith(extension), - ); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - } - - Future getLatestReleaseVersion( - String extension, - String repoName, - ) async { - try { - final Map? release = await _getLatestRelease( - extension, - repoName, - ); - if (release != null) { - return release['version']; - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - return null; - } - - Future getLatestReleaseFile( - String extension, - String repoName, - ) async { - try { - final Map? release = await _getLatestRelease( - extension, - repoName, - ); - if (release != null) { - final String url = release['browser_download_url']; - return await DefaultCacheManager().getSingleFile(url); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - return null; - } - - StreamController managerUpdateProgress = - StreamController.broadcast(); - - void updateManagerDownloadProgress(int progress) { - managerUpdateProgress.add(progress.toDouble()); - } - - Stream getManagerUpdateProgress() { - return managerUpdateProgress.stream; - } - - void disposeManagerUpdateProgress() { - managerUpdateProgress.close(); - } - - Future downloadManager() async { - final Map? release = await _getLatestRelease( - '.apk', - 'revanced/revanced-manager', - ); - File? outputFile; - await for (final result in DefaultCacheManager().getFileStream( - release!['browser_download_url'] as String, - withProgress: true, - )) { - if (result is DownloadProgress) { - final totalSize = result.totalSize ?? 10000000; - final progress = (result.downloaded / totalSize * 100).round(); - - updateManagerDownloadProgress(progress); - } else if (result is FileInfo) { - disposeManagerUpdateProgress(); - // The download is complete; convert the FileInfo object to a File object - outputFile = File(result.file.path); - } - } - return outputFile; - } - - Future getLatestReleaseTime( - String extension, - String repoName, - ) async { - try { - final Map? release = await _getLatestRelease( - extension, - repoName, - ); - if (release != null) { - final DateTime timestamp = - DateTime.parse(release['timestamp'] as String); - return format(timestamp, locale: 'en_short'); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - return null; - } -} diff --git a/lib/services/root_api.dart b/lib/services/root_api.dart deleted file mode 100644 index f0c7d9173f..0000000000 --- a/lib/services/root_api.dart +++ /dev/null @@ -1,257 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:root/root.dart'; - -class RootAPI { - // TODO(ponces): remove in the future, keep it for now during migration. - final String _revancedOldDirPath = '/data/local/tmp/revanced-manager'; - final String _revancedDirPath = '/data/adb/revanced'; - final String _postFsDataDirPath = '/data/adb/post-fs-data.d'; - final String _serviceDDirPath = '/data/adb/service.d'; - - Future isRooted() async { - try { - final bool? isRooted = await Root.isRootAvailable(); - return isRooted != null && isRooted; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return false; - } - } - - Future hasRootPermissions() async { - try { - bool? isRooted = await Root.isRootAvailable(); - if (isRooted != null && isRooted) { - isRooted = await Root.isRooted(); - return isRooted != null && isRooted; - } - return false; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return false; - } - } - - Future setPermissions( - String permissions, - ownerGroup, - seLinux, - String filePath, - ) async { - try { - if (permissions.isNotEmpty) { - await Root.exec( - cmd: 'chmod $permissions "$filePath"', - ); - } - if (ownerGroup.isNotEmpty) { - await Root.exec( - cmd: 'chown $ownerGroup "$filePath"', - ); - } - if (seLinux.isNotEmpty) { - await Root.exec( - cmd: 'chcon $seLinux "$filePath"', - ); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future isAppInstalled(String packageName) async { - if (packageName.isNotEmpty) { - return fileExists('$_serviceDDirPath/$packageName.sh'); - } - return false; - } - - Future> getInstalledApps() async { - final List apps = List.empty(growable: true); - try { - String? res = await Root.exec( - cmd: 'ls "$_revancedDirPath"', - ); - if (res != null) { - final List list = res.split('\n'); - list.removeWhere((pack) => pack.isEmpty); - apps.addAll(list.map((pack) => pack.trim()).toList()); - } - // TODO(ponces): remove in the future, keep it for now during migration. - res = await Root.exec( - cmd: 'ls "$_revancedOldDirPath"', - ); - if (res != null) { - final List list = res.split('\n'); - list.removeWhere((pack) => pack.isEmpty); - apps.addAll(list.map((pack) => pack.trim()).toList()); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - return apps; - } - - Future deleteApp(String packageName, String originalFilePath) async { - await Root.exec( - cmd: 'am force-stop "$packageName"', - ); - await Root.exec( - cmd: 'su -mm -c "umount -l $originalFilePath"', - ); - // TODO(ponces): remove in the future, keep it for now during migration. - await Root.exec( - cmd: 'rm -rf "$_revancedOldDirPath/$packageName"', - ); - await Root.exec( - cmd: 'rm -rf "$_revancedDirPath/$packageName"', - ); - await Root.exec( - cmd: 'rm -rf "$_serviceDDirPath/$packageName.sh"', - ); - await Root.exec( - cmd: 'rm -rf "$_postFsDataDirPath/$packageName.sh"', - ); - } - - Future installApp( - String packageName, - String originalFilePath, - String patchedFilePath, - ) async { - try { - await deleteApp(packageName, originalFilePath); - await Root.exec( - cmd: 'mkdir -p "$_revancedDirPath/$packageName"', - ); - await setPermissions( - '0755', - 'shell:shell', - '', - '$_revancedDirPath/$packageName', - ); - await saveOriginalFilePath(packageName, originalFilePath); - await installServiceDScript(packageName); - await installPostFsDataScript(packageName); - await installApk(packageName, patchedFilePath); - await mountApk(packageName, originalFilePath); - return true; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return false; - } - } - - Future installServiceDScript(String packageName) async { - await Root.exec( - cmd: 'mkdir -p "$_serviceDDirPath"', - ); - final String content = '#!/system/bin/sh\n' - 'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 3; done\n' - 'base_path=$_revancedDirPath/$packageName/base.apk\n' - 'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n' - r'[ ! -z $stock_path ] && mount -o bind $base_path $stock_path'; - final String scriptFilePath = '$_serviceDDirPath/$packageName.sh'; - await Root.exec( - cmd: 'echo \'$content\' > "$scriptFilePath"', - ); - await setPermissions('0744', '', '', scriptFilePath); - } - - Future installPostFsDataScript(String packageName) async { - await Root.exec( - cmd: 'mkdir -p "$_postFsDataDirPath"', - ); - final String content = '#!/system/bin/sh\n' - 'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n' - r'[ ! -z $stock_path ] && umount -l $stock_path'; - final String scriptFilePath = '$_postFsDataDirPath/$packageName.sh'; - await Root.exec( - cmd: 'echo \'$content\' > "$scriptFilePath"', - ); - await setPermissions('0744', '', '', scriptFilePath); - } - - Future installApk(String packageName, String patchedFilePath) async { - final String newPatchedFilePath = '$_revancedDirPath/$packageName/base.apk'; - await Root.exec( - cmd: 'cp "$patchedFilePath" "$newPatchedFilePath"', - ); - await setPermissions( - '0644', - 'system:system', - 'u:object_r:apk_data_file:s0', - newPatchedFilePath, - ); - } - - Future mountApk(String packageName, String originalFilePath) async { - final String newPatchedFilePath = '$_revancedDirPath/$packageName/base.apk'; - await Root.exec( - cmd: 'am force-stop "$packageName"', - ); - await Root.exec( - cmd: 'su -mm -c "umount -l $originalFilePath"', - ); - await Root.exec( - cmd: 'su -mm -c "mount -o bind $newPatchedFilePath $originalFilePath"', - ); - } - - Future isMounted(String packageName) async { - final String? res = await Root.exec( - cmd: 'cat /proc/mounts | grep $packageName', - ); - return res != null && res.isNotEmpty; - } - - Future saveOriginalFilePath( - String packageName, - String originalFilePath, - ) async { - final String originalRootPath = - '$_revancedDirPath/$packageName/original.apk'; - await Root.exec( - cmd: 'mkdir -p "$_revancedDirPath/$packageName"', - ); - await setPermissions( - '0755', - 'shell:shell', - '', - '$_revancedDirPath/$packageName', - ); - await Root.exec( - cmd: 'cp "$originalFilePath" "$originalRootPath"', - ); - await setPermissions( - '0644', - 'shell:shell', - 'u:object_r:apk_data_file:s0', - originalFilePath, - ); - } - - Future fileExists(String path) async { - try { - final String? res = await Root.exec( - cmd: 'ls $path', - ); - return res != null && res.isNotEmpty; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return false; - } - } -} diff --git a/lib/services/third_party_services_modules.dart b/lib/services/third_party_services_modules.dart deleted file mode 100644 index 6f54f6fb6a..0000000000 --- a/lib/services/third_party_services_modules.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:injectable/injectable.dart'; -import 'package:stacked_services/stacked_services.dart'; - -@module -abstract class ThirdPartyServicesModule { - @lazySingleton - NavigationService get navigationService; - @lazySingleton - DialogService get dialogService; - @lazySingleton - SnackbarService get snackbarService; -} diff --git a/lib/services/toast.dart b/lib/services/toast.dart deleted file mode 100644 index cb9a62b705..0000000000 --- a/lib/services/toast.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:fluttertoast/fluttertoast.dart' as t; - -class Toast { - final t.FToast _fToast = t.FToast(); - late BuildContext buildContext; - - void initialize(BuildContext context) { - _fToast.init(context); - } - - void show(String text) { - t.Fluttertoast.showToast( - msg: FlutterI18n.translate( - _fToast.context!, - text, - ), - toastLength: t.Toast.LENGTH_LONG, - gravity: t.ToastGravity.CENTER, - ); - } - - void showBottom(String text) { - t.Fluttertoast.showToast( - msg: FlutterI18n.translate( - _fToast.context!, - text, - ), - toastLength: t.Toast.LENGTH_LONG, - gravity: t.ToastGravity.BOTTOM, - ); - } -} diff --git a/lib/theme.dart b/lib/theme.dart deleted file mode 100644 index 89c93d520b..0000000000 --- a/lib/theme.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; - -var lightCustomColorScheme = ColorScheme.fromSeed( - seedColor: Colors.blue, - primary: const Color(0xff1B73E8), -); - -var lightCustomTheme = ThemeData( - useMaterial3: true, - colorScheme: lightCustomColorScheme, - navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( - TextStyle( - color: lightCustomColorScheme.onSurface, - fontWeight: FontWeight.w500, - ), - ), - ), - textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme), -); - -var darkCustomColorScheme = ColorScheme.fromSeed( - seedColor: Colors.blue, - brightness: Brightness.dark, - primary: const Color(0xffA5CAFF), - surface: const Color(0xff1B1A1D), -); - -var darkCustomTheme = ThemeData( - useMaterial3: true, - colorScheme: darkCustomColorScheme, - navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( - TextStyle( - color: darkCustomColorScheme.onSurface, - fontWeight: FontWeight.w500, - ), - ), - ), - canvasColor: const Color(0xff1B1A1D), - scaffoldBackgroundColor: const Color(0xff1B1A1D), - textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme), -); diff --git a/lib/ui/theme/dynamic_theme_builder.dart b/lib/ui/theme/dynamic_theme_builder.dart deleted file mode 100644 index 65d74c2ca4..0000000000 --- a/lib/ui/theme/dynamic_theme_builder.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'package:dynamic_color/dynamic_color.dart'; -import 'package:dynamic_themes/dynamic_themes.dart'; -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:revanced_manager/app/app.router.dart'; -import 'package:revanced_manager/theme.dart'; -import 'package:stacked_services/stacked_services.dart'; - -class DynamicThemeBuilder extends StatelessWidget { - const DynamicThemeBuilder({ - Key? key, - required this.title, - required this.home, - required this.localizationsDelegates, - }) : super(key: key); - final String title; - final Widget home; - final Iterable localizationsDelegates; - - @override - Widget build(BuildContext context) { - return DynamicColorBuilder( - builder: (lightColorScheme, darkColorScheme) { - final ThemeData lightDynamicTheme = ThemeData( - useMaterial3: true, - navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( - GoogleFonts.roboto( - color: lightColorScheme?.onSurface, - fontWeight: FontWeight.w500, - ), - ), - ), - colorScheme: lightColorScheme?.harmonized(), - textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme), - ); - final ThemeData darkDynamicTheme = ThemeData( - useMaterial3: true, - navigationBarTheme: NavigationBarThemeData( - labelTextStyle: MaterialStateProperty.all( - GoogleFonts.roboto( - color: darkColorScheme?.onSurface, - fontWeight: FontWeight.w500, - ), - ), - ), - colorScheme: darkColorScheme?.harmonized(), - textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme), - ); - return DynamicTheme( - themeCollection: ThemeCollection( - themes: { - 0: lightCustomTheme, - 1: darkCustomTheme, - 2: lightDynamicTheme, - 3: darkDynamicTheme, - }, - fallbackTheme: lightCustomTheme, - ), - builder: (context, theme) => MaterialApp( - debugShowCheckedModeBanner: false, - title: title, - navigatorKey: StackedService.navigatorKey, - onGenerateRoute: StackedRouter().onGenerateRoute, - theme: theme, - home: home, - localizationsDelegates: localizationsDelegates, - ), - ); - }, - ); - } -} diff --git a/lib/ui/views/app_selector/app_selector_view.dart b/lib/ui/views/app_selector/app_selector_view.dart deleted file mode 100644 index 7877a226fa..0000000000 --- a/lib/ui/views/app_selector/app_selector_view.dart +++ /dev/null @@ -1,146 +0,0 @@ -import 'package:flutter/material.dart' hide SearchBar; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/appSelectorView/app_skeleton_loader.dart'; -import 'package:revanced_manager/ui/widgets/appSelectorView/installed_app_item.dart'; -import 'package:revanced_manager/ui/widgets/appSelectorView/not_installed_app_item.dart'; -import 'package:revanced_manager/ui/widgets/shared/search_bar.dart'; -import 'package:stacked/stacked.dart' hide SkeletonLoader; - -class AppSelectorView extends StatefulWidget { - const AppSelectorView({Key? key}) : super(key: key); - - @override - State createState() => _AppSelectorViewState(); -} - -class _AppSelectorViewState extends State { - String _query = ''; - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - onViewModelReady: (model) => model.initialize(), - viewModelBuilder: () => AppSelectorViewModel(), - builder: (context, model, child) => Scaffold( - resizeToAvoidBottomInset: false, - floatingActionButton: FloatingActionButton.extended( - label: I18nText('appSelectorView.storageButton'), - icon: const Icon(Icons.sd_storage), - onPressed: () { - model.selectAppFromStorage(context); - Navigator.of(context).pop(); - }, - ), - body: CustomScrollView( - slivers: [ - SliverAppBar( - pinned: true, - floating: true, - title: I18nText( - 'appSelectorView.viewTitle', - child: Text( - '', - style: TextStyle( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - leading: IconButton( - icon: Icon( - Icons.arrow_back, - color: Theme.of(context).textTheme.titleLarge!.color, - ), - onPressed: () => Navigator.of(context).pop(), - ), - bottom: PreferredSize( - preferredSize: const Size.fromHeight(64.0), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 8.0, - horizontal: 12.0, - ), - child: SearchBar( - hintText: FlutterI18n.translate( - context, - 'appSelectorView.searchBarHint', - ), - onQueryChanged: (searchQuery) { - setState(() { - _query = searchQuery; - }); - }, - ), - ), - ), - ), - SliverToBoxAdapter( - child: model.noApps - ? Center( - child: I18nText( - 'appSelectorCard.noAppsLabel', - child: Text( - '', - style: TextStyle( - color: - Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - ) - : model.allApps.isEmpty - ? const AppSkeletonLoader() - : Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0) - .copyWith( - bottom: - MediaQuery.viewPaddingOf(context).bottom + 8.0, - ), - child: Column( - children: [ - ...model - .getFilteredApps(_query) - .map( - (app) => InstalledAppItem( - name: app.appName, - pkgName: app.packageName, - icon: app.icon, - patchesCount: - model.patchesCount(app.packageName), - suggestedVersion: - model.getSuggestedVersion( - app.packageName, - ), - installedVersion: app.versionName!, - onTap: () => model.canSelectInstalled( - context, - app.packageName, - ), - ), - ) - .toList(), - ...model - .getFilteredAppsNames(_query) - .map( - (app) => NotInstalledAppItem( - name: app, - patchesCount: model.patchesCount(app), - suggestedVersion: - model.getSuggestedVersion(app), - onTap: () { - model.showDownloadToast(); - }, - ), - ) - .toList(), - const SizedBox(height: 70.0), - ], - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/views/app_selector/app_selector_viewmodel.dart b/lib/ui/views/app_selector/app_selector_viewmodel.dart deleted file mode 100644 index 9075b2a31e..0000000000 --- a/lib/ui/views/app_selector/app_selector_viewmodel.dart +++ /dev/null @@ -1,243 +0,0 @@ -import 'dart:io'; - -import 'package:device_apps/device_apps.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/patcher_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:stacked/stacked.dart'; - -class AppSelectorViewModel extends BaseViewModel { - final PatcherAPI _patcherAPI = locator(); - final ManagerAPI _managerAPI = locator(); - final Toast _toast = locator(); - final List apps = []; - List allApps = []; - bool noApps = false; - bool isRooted = false; - int patchesCount(String packageName) { - return _patcherAPI.getFilteredPatches(packageName).length; - } - - List patches = []; - - Future initialize() async { - patches = await _managerAPI.getPatches(); - isRooted = _managerAPI.isRooted; - - apps.addAll( - await _patcherAPI - .getFilteredInstalledApps(_managerAPI.areUniversalPatchesEnabled()), - ); - apps.sort( - (a, b) => _patcherAPI - .getFilteredPatches(b.packageName) - .length - .compareTo(_patcherAPI.getFilteredPatches(a.packageName).length), - ); - getAllApps(); - notifyListeners(); - } - - List getAllApps() { - allApps = patches - .expand((e) => e.compatiblePackages.map((p) => p.name)) - .toSet() - .where((name) => !apps.any((app) => app.packageName == name)) - .toList(); - noApps = allApps.isEmpty; - return allApps; - } - - String getSuggestedVersion(String packageName) { - return _patcherAPI.getSuggestedVersion(packageName); - } - - Future checkSplitApk(String packageName) async { - final app = await DeviceApps.getApp(packageName); - if (app != null) { - return app.isSplit; - } - return true; - } - - Future selectApp(ApplicationWithIcon application) async { - locator().selectedApp = PatchedApplication( - name: application.appName, - packageName: application.packageName, - originalPackageName: application.packageName, - version: application.versionName!, - apkFilePath: application.apkFilePath, - icon: application.icon, - patchDate: DateTime.now(), - ); - locator().loadLastSelectedPatches(); - } - - Future canSelectInstalled( - BuildContext context, - String packageName, - ) async { - final app = - await DeviceApps.getApp(packageName, true) as ApplicationWithIcon?; - if (app != null) { - if (await checkSplitApk(packageName) && !isRooted) { - return showSelectFromStorageDialog(context); - } else if (!await checkSplitApk(packageName) || isRooted) { - selectApp(app); - Navigator.pop(context); - } - } - } - - Future showSelectFromStorageDialog(BuildContext context) async { - return showDialog( - context: context, - builder: (context) => SimpleDialog( - alignment: Alignment.center, - contentPadding: - const EdgeInsets.symmetric(horizontal: 20, vertical: 20), - children: [ - const SizedBox(height: 10), - Icon( - Icons.block, - size: 28, - color: Theme.of(context).colorScheme.primary, - ), - const SizedBox(height: 20), - I18nText( - 'appSelectorView.featureNotAvailable', - child: const Text( - '', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w600, - wordSpacing: 1.5, - ), - ), - ), - const SizedBox(height: 20), - I18nText( - 'appSelectorView.featureNotAvailableText', - child: const Text( - '', - style: TextStyle( - fontSize: 14, - ), - ), - ), - const SizedBox(height: 30), - CustomMaterialButton( - onPressed: () => selectAppFromStorage(context).then( - (_) { - Navigator.pop(context); - Navigator.pop(context); - }, - ), - label: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon(Icons.sd_card), - const SizedBox(width: 10), - I18nText('appSelectorView.selectFromStorageButton'), - ], - ), - ), - const SizedBox(height: 10), - CustomMaterialButton( - isFilled: false, - onPressed: () { - Navigator.pop(context); - }, - label: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const SizedBox(width: 10), - I18nText('cancelButton'), - ], - ), - ), - ], - ), - ); - } - - Future selectAppFromStorage(BuildContext context) async { - try { - final FilePickerResult? result = await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['apk'], - ); - if (result != null && result.files.single.path != null) { - final File apkFile = File(result.files.single.path!); - final List pathSplit = result.files.single.path!.split('/'); - pathSplit.removeLast(); - final Directory filePickerCacheDir = Directory(pathSplit.join('/')); - final Iterable deletableFiles = - (await filePickerCacheDir.list().toList()).whereType(); - for (final file in deletableFiles) { - if (file.path != apkFile.path && file.path.endsWith('.apk')) { - file.delete(); - } - } - final ApplicationWithIcon? application = - await DeviceApps.getAppFromStorage( - apkFile.path, - true, - ) as ApplicationWithIcon?; - if (application != null) { - locator().selectedApp = PatchedApplication( - name: application.appName, - packageName: application.packageName, - originalPackageName: application.packageName, - version: application.versionName!, - apkFilePath: result.files.single.path!, - icon: application.icon, - patchDate: DateTime.now(), - isFromStorage: true, - ); - locator().loadLastSelectedPatches(); - } - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - _toast.showBottom('appSelectorView.errorMessage'); - } - } - - List getFilteredApps(String query) { - return apps - .where( - (app) => - query.isEmpty || - query.length < 2 || - app.appName.toLowerCase().contains(query.toLowerCase()), - ) - .toList(); - } - - List getFilteredAppsNames(String query) { - return allApps - .where( - (app) => - query.isEmpty || - query.length < 2 || - app.toLowerCase().contains(query.toLowerCase()), - ) - .toList(); - } - - void showDownloadToast() => - _toast.showBottom('appSelectorView.downloadToast'); -} diff --git a/lib/ui/views/contributors/contributors_view.dart b/lib/ui/views/contributors/contributors_view.dart deleted file mode 100644 index a409c17ecd..0000000000 --- a/lib/ui/views/contributors/contributors_view.dart +++ /dev/null @@ -1,70 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:revanced_manager/ui/views/contributors/contributors_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/contributorsView/contributors_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart'; -import 'package:stacked/stacked.dart'; - -class ContributorsView extends StatelessWidget { - const ContributorsView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - viewModelBuilder: () => ContributorsViewModel(), - onViewModelReady: (model) => model.getContributors(), - builder: (context, model, child) => Scaffold( - body: CustomScrollView( - slivers: [ - CustomSliverAppBar( - title: I18nText( - 'contributorsView.widgetTitle', - child: Text( - '', - style: GoogleFonts.inter( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - ), - SliverPadding( - padding: const EdgeInsets.all(20.0), - sliver: SliverList( - delegate: SliverChildListDelegate.fixed( - [ - ContributorsCard( - title: 'contributorsView.patcherContributors', - contributors: model.patcherContributors, - ), - const SizedBox(height: 20), - ContributorsCard( - title: 'contributorsView.patchesContributors', - contributors: model.patchesContributors, - ), - const SizedBox(height: 20), - ContributorsCard( - title: 'contributorsView.integrationsContributors', - contributors: model.integrationsContributors, - ), - const SizedBox(height: 20), - ContributorsCard( - title: 'contributorsView.cliContributors', - contributors: model.cliContributors, - ), - const SizedBox(height: 20), - ContributorsCard( - title: 'contributorsView.managerContributors', - contributors: model.managerContributors, - ), - SizedBox(height: MediaQuery.viewPaddingOf(context).bottom), - ], - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/views/contributors/contributors_viewmodel.dart b/lib/ui/views/contributors/contributors_viewmodel.dart deleted file mode 100644 index c8c7975fd8..0000000000 --- a/lib/ui/views/contributors/contributors_viewmodel.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:stacked/stacked.dart'; - -class ContributorsViewModel extends BaseViewModel { - final ManagerAPI _managerAPI = locator(); - List patcherContributors = []; - List patchesContributors = []; - List integrationsContributors = []; - List cliContributors = []; - List managerContributors = []; - - Future getContributors() async { - final Map> contributors = - await _managerAPI.getContributors(); - patcherContributors = contributors[_managerAPI.defaultPatcherRepo] ?? []; - patchesContributors = contributors[_managerAPI.getPatchesRepo()] ?? []; - integrationsContributors = - contributors[_managerAPI.getIntegrationsRepo()] ?? []; - cliContributors = contributors[_managerAPI.defaultCliRepo] ?? []; - managerContributors = contributors[_managerAPI.defaultManagerRepo] ?? []; - notifyListeners(); - } -} diff --git a/lib/ui/views/home/home_view.dart b/lib/ui/views/home/home_view.dart deleted file mode 100644 index 06ed6e9f28..0000000000 --- a/lib/ui/views/home/home_view.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/homeView/installed_apps_card.dart'; -import 'package:revanced_manager/ui/widgets/homeView/latest_commit_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart'; -import 'package:stacked/stacked.dart'; - -class HomeView extends StatelessWidget { - const HomeView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - disposeViewModel: false, - fireOnViewModelReadyOnce: true, - onViewModelReady: (model) => model.initialize(context), - viewModelBuilder: () => locator(), - builder: (context, model, child) => Scaffold( - body: RefreshIndicator( - onRefresh: () => model.forceRefresh(context), - child: CustomScrollView( - slivers: [ - CustomSliverAppBar( - isMainView: true, - title: I18nText( - 'homeView.widgetTitle', - child: Text( - '', - style: GoogleFonts.inter( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - ), - SliverPadding( - padding: const EdgeInsets.all(20.0), - sliver: SliverList( - delegate: SliverChildListDelegate.fixed( - [ - I18nText( - 'homeView.updatesSubtitle', - child: Text( - '', - style: Theme.of(context).textTheme.titleLarge, - ), - ), - const SizedBox(height: 10), - LatestCommitCard(model: model, parentContext: context), - const SizedBox(height: 23), - I18nText( - 'homeView.patchedSubtitle', - child: Text( - '', - style: Theme.of(context).textTheme.titleLarge, - ), - ), - const SizedBox(height: 10), - InstalledAppsCard(), - ], - ), - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/ui/views/home/home_viewmodel.dart b/lib/ui/views/home/home_viewmodel.dart deleted file mode 100644 index cfc99e66de..0000000000 --- a/lib/ui/views/home/home_viewmodel.dart +++ /dev/null @@ -1,480 +0,0 @@ -// ignore_for_file: use_build_context_synchronously -import 'dart:async'; -import 'dart:io'; -import 'package:cross_connectivity/cross_connectivity.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:injectable/injectable.dart'; -import 'package:install_plugin/install_plugin.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/app/app.router.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/github_api.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/patcher_api.dart'; -import 'package:revanced_manager/services/revanced_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/homeView/update_confirmation_dialog.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:stacked/stacked.dart'; -import 'package:stacked_services/stacked_services.dart'; - -@lazySingleton -class HomeViewModel extends BaseViewModel { - final NavigationService _navigationService = locator(); - final ManagerAPI _managerAPI = locator(); - final PatcherAPI _patcherAPI = locator(); - final GithubAPI _githubAPI = locator(); - final RevancedAPI _revancedAPI = locator(); - final Toast _toast = locator(); - final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - DateTime? _lastUpdate; - bool showUpdatableApps = false; - List patchedInstalledApps = []; - List patchedUpdatableApps = []; - String? _latestManagerVersion = ''; - File? downloadedApk; - - Future initialize(BuildContext context) async { - _latestManagerVersion = await _managerAPI.getLatestManagerVersion(); - if (!_managerAPI.getPatchesConsent()) { - await showPatchesConsent(context); - } - await _patcherAPI.initialize(); - await flutterLocalNotificationsPlugin.initialize( - const InitializationSettings( - android: AndroidInitializationSettings('ic_notification'), - ), - onDidReceiveNotificationResponse: (response) async { - if (response.id == 0) { - _toast.showBottom('homeView.installingMessage'); - final File? managerApk = await _managerAPI.downloadManager(); - if (managerApk != null) { - await InstallPlugin.installApk(managerApk.path); - } else { - _toast.showBottom('homeView.errorDownloadMessage'); - } - } - }, - ); - flutterLocalNotificationsPlugin - .resolvePlatformSpecificImplementation< - AndroidFlutterLocalNotificationsPlugin>() - ?.requestPermission(); - final bool isConnected = await Connectivity().checkConnection(); - if (!isConnected) { - _toast.showBottom('homeView.noConnection'); - } - final NotificationAppLaunchDetails? notificationAppLaunchDetails = - await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails(); - if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) { - _toast.showBottom('homeView.installingMessage'); - final File? managerApk = await _managerAPI.downloadManager(); - if (managerApk != null) { - await InstallPlugin.installApk(managerApk.path); - } else { - _toast.showBottom('homeView.errorDownloadMessage'); - } - } - _getPatchedApps(); - _managerAPI.reAssessSavedApps().then((_) => _getPatchedApps()); - } - - void navigateToAppInfo(PatchedApplication app) { - _navigationService.navigateTo( - Routes.appInfoView, - arguments: AppInfoViewArguments(app: app), - ); - } - - void toggleUpdatableApps(bool value) { - showUpdatableApps = value; - notifyListeners(); - } - - Future navigateToPatcher(PatchedApplication app) async { - locator().selectedApp = app; - locator().selectedPatches = - await _patcherAPI.getAppliedPatches(app.appliedPatches); - locator().notifyListeners(); - locator().setIndex(1); - } - - void _getPatchedApps() { - patchedInstalledApps = _managerAPI.getPatchedApps().toList(); - patchedUpdatableApps = _managerAPI - .getPatchedApps() - .where((app) => app.hasUpdates == true) - .toList(); - notifyListeners(); - } - - Future hasManagerUpdates() async { - String currentVersion = await _managerAPI.getCurrentManagerVersion(); - - // add v to current version - if (!currentVersion.startsWith('v')) { - currentVersion = 'v$currentVersion'; - } - - _latestManagerVersion = - await _managerAPI.getLatestManagerVersion() ?? currentVersion; - - if (_latestManagerVersion != currentVersion) { - return true; - } - return false; - } - - Future hasPatchesUpdates() async { - final String? latestVersion = await _managerAPI.getLatestPatchesVersion(); - final String currentVersion = await _managerAPI.getCurrentPatchesVersion(); - if (latestVersion != null) { - try { - final int latestVersionInt = - int.parse(latestVersion.replaceAll(RegExp('[^0-9]'), '')); - final int currentVersionInt = - int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), '')); - return latestVersionInt > currentVersionInt; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return false; - } - } - return false; - } - - Future downloadManager() async { - try { - final response = await _revancedAPI.downloadManager(); - final bytes = await response!.readAsBytes(); - final tempDir = await getTemporaryDirectory(); - final tempFile = File('${tempDir.path}/revanced-manager.apk'); - await tempFile.writeAsBytes(bytes); - return tempFile; - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - return null; - } - } - - Future showPatchesConsent(BuildContext context) async { - final ValueNotifier autoUpdate = ValueNotifier(true); - await showDialog( - context: context, - barrierDismissible: false, - builder: (context) => AlertDialog( - title: const Text('Download ReVanced Patches?'), - content: ValueListenableBuilder( - valueListenable: autoUpdate, - builder: (context, value, child) { - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - I18nText( - 'homeView.patchesConsentDialogText', - child: Text( - '', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: Theme.of(context).colorScheme.secondary, - ), - ), - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 10), - child: I18nText( - 'homeView.patchesConsentDialogText2', - translationParams: { - 'url': _managerAPI.defaultApiUrl.split('/')[2], - }, - child: Text( - '', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: Theme.of(context).colorScheme.error, - ), - ), - ), - ), - CheckboxListTile( - value: value, - contentPadding: EdgeInsets.zero, - title: I18nText( - 'homeView.patchesConsentDialogText3', - ), - subtitle: I18nText( - 'homeView.patchesConsentDialogText3Sub', - ), - onChanged: (selected) { - autoUpdate.value = selected!; - }, - ), - ], - ); - }, - ), - actions: [ - CustomMaterialButton( - isFilled: false, - onPressed: () async { - await _managerAPI.setPatchesConsent(false); - SystemNavigator.pop(); - }, - label: I18nText('quitButton'), - ), - CustomMaterialButton( - onPressed: () async { - await _managerAPI.setPatchesConsent(true); - await _managerAPI.setPatchesAutoUpdate(autoUpdate.value); - Navigator.of(context).pop(); - }, - label: I18nText('okButton'), - ), - ], - ), - ); - } - - Future updatePatches(BuildContext context) async { - _toast.showBottom('homeView.downloadingMessage'); - final String patchesVersion = - await _managerAPI.getLatestPatchesVersion() ?? '0.0.0'; - final String integrationsVersion = - await _managerAPI.getLatestIntegrationsVersion() ?? '0.0.0'; - if (patchesVersion != '0.0.0' && integrationsVersion != '0.0.0') { - await _managerAPI.setCurrentPatchesVersion(patchesVersion); - await _managerAPI.setCurrentIntegrationsVersion(integrationsVersion); - _toast.showBottom('homeView.downloadedMessage'); - forceRefresh(context); - } else { - _toast.showBottom('homeView.errorDownloadMessage'); - } - } - - Future updateManager(BuildContext context) async { - final ValueNotifier downloaded = ValueNotifier(false); - try { - _toast.showBottom('homeView.downloadingMessage'); - showDialog( - context: context, - builder: (context) => ValueListenableBuilder( - valueListenable: downloaded, - builder: (context, value, child) { - return SimpleDialog( - contentPadding: const EdgeInsets.all(16.0), - title: I18nText( - !value - ? 'homeView.downloadingMessage' - : 'homeView.downloadedMessage', - child: Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - color: Theme.of(context).colorScheme.secondary, - ), - ), - ), - children: [ - Column( - children: [ - Row( - children: [ - Icon( - Icons.new_releases_outlined, - color: Theme.of(context).colorScheme.secondary, - ), - const SizedBox(width: 8.0), - Text( - '$_latestManagerVersion', - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500, - color: Theme.of(context).colorScheme.secondary, - ), - ), - ], - ), - const SizedBox(height: 16.0), - if (!value) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - StreamBuilder( - initialData: 0.0, - stream: _revancedAPI.managerUpdateProgress.stream, - builder: (context, snapshot) { - return LinearProgressIndicator( - value: snapshot.data! * 0.01, - valueColor: AlwaysStoppedAnimation( - Theme.of(context).colorScheme.secondary, - ), - ); - }, - ), - const SizedBox(height: 16.0), - Align( - alignment: Alignment.centerRight, - child: CustomMaterialButton( - label: I18nText('cancelButton'), - onPressed: () { - _revancedAPI.disposeManagerUpdateProgress(); - Navigator.of(context).pop(); - }, - ), - ), - ], - ), - if (value) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - I18nText( - 'homeView.installUpdate', - child: Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - color: Theme.of(context).colorScheme.secondary, - ), - ), - ), - const SizedBox(height: 16.0), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Align( - alignment: Alignment.centerRight, - child: CustomMaterialButton( - isFilled: false, - label: I18nText('cancelButton'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ), - const SizedBox(width: 8.0), - Align( - alignment: Alignment.centerRight, - child: CustomMaterialButton( - label: I18nText('updateButton'), - onPressed: () async { - await InstallPlugin.installApk( - downloadedApk!.path, - ); - }, - ), - ), - ], - ), - ], - ), - ], - ), - ], - ); - }, - ), - ); - final File? managerApk = await downloadManager(); - if (managerApk != null) { - downloaded.value = true; - downloadedApk = managerApk; - // await flutterLocalNotificationsPlugin.zonedSchedule( - // 0, - // FlutterI18n.translate( - // context, - // 'homeView.notificationTitle', - // ), - // FlutterI18n.translate( - // context, - // 'homeView.notificationText', - // ), - // tz.TZDateTime.now(tz.local).add(const Duration(seconds: 5)), - // const NotificationDetails( - // android: AndroidNotificationDetails( - // 'revanced_manager_channel', - // 'ReVanced Manager Channel', - // importance: Importance.max, - // priority: Priority.high, - // ticker: 'ticker', - // ), - // ), - // androidAllowWhileIdle: true, - // uiLocalNotificationDateInterpretation: - // UILocalNotificationDateInterpretation.absoluteTime, - // ); - _toast.showBottom('homeView.installingMessage'); - await InstallPlugin.installApk(managerApk.path); - } else { - _toast.showBottom('homeView.errorDownloadMessage'); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - _toast.showBottom('homeView.errorInstallMessage'); - } - } - - void updatesAreDisabled() { - _toast.showBottom('homeView.updatesDisabled'); - } - - Future showUpdateConfirmationDialog( - BuildContext parentContext, - bool isPatches, - ) { - return showModalBottomSheet( - context: parentContext, - isScrollControlled: true, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(24.0)), - ), - builder: (context) => UpdateConfirmationDialog( - isPatches: isPatches, - ), - ); - } - - Future?> getLatestManagerRelease() { - return _githubAPI.getLatestManagerRelease(_managerAPI.defaultManagerRepo); - } - - Future?> getLatestPatchesRelease() { - return _githubAPI.getLatestPatchesRelease(_managerAPI.defaultPatchesRepo); - } - - Future getLatestPatchesReleaseTime() { - return _managerAPI.getLatestPatchesReleaseTime(); - } - - Future getLatestManagerReleaseTime() { - return _managerAPI.getLatestManagerReleaseTime(); - } - - Future forceRefresh(BuildContext context) async { - await Future.delayed(const Duration(seconds: 1)); - if (_lastUpdate == null || - _lastUpdate!.difference(DateTime.now()).inSeconds > 2) { - _managerAPI.clearAllData(); - } - _toast.showBottom('homeView.refreshSuccess'); - initialize(context); - } -} diff --git a/lib/ui/views/installer/installer_view.dart b/lib/ui/views/installer/installer_view.dart deleted file mode 100644 index 508c449d3e..0000000000 --- a/lib/ui/views/installer/installer_view.dart +++ /dev/null @@ -1,106 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/installerView/gradient_progress_indicator.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart'; -import 'package:stacked/stacked.dart'; - -class InstallerView extends StatelessWidget { - const InstallerView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - onViewModelReady: (model) => model.initialize(context), - viewModelBuilder: () => InstallerViewModel(), - builder: (context, model, child) => WillPopScope( - child: SafeArea( - top: false, - bottom: false, - child: Scaffold( - floatingActionButton: Visibility( - visible: !model.isPatching, - child: FloatingActionButton.extended( - label: I18nText('installerView.installButton'), - icon: const Icon(Icons.file_download_outlined), - onPressed: () => model.installTypeDialog(context), - elevation: 0, - ), - ), - floatingActionButtonLocation: - FloatingActionButtonLocation.endContained, - bottomNavigationBar: Visibility( - visible: !model.isPatching, - child: BottomAppBar( - child: Row( - children: [ - Visibility( - visible: !model.hasErrors, - child: IconButton.filledTonal( - tooltip: FlutterI18n.translate( - context, - 'installerView.exportApkButtonTooltip', - ), - icon: const Icon(Icons.save), - onPressed: () => model.onButtonPressed(0), - ), - ), - IconButton.filledTonal( - tooltip: FlutterI18n.translate( - context, - 'installerView.exportLogButtonTooltip', - ), - icon: const Icon(Icons.post_add), - onPressed: () => model.onButtonPressed(1), - ), - ], - ), - ), - ), - body: CustomScrollView( - controller: model.scrollController, - slivers: [ - CustomSliverAppBar( - title: Text( - model.headerLogs, - style: GoogleFonts.inter( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - onBackButtonPressed: () => model.onWillPop(context), - bottom: PreferredSize( - preferredSize: const Size(double.infinity, 1.0), - child: GradientProgressIndicator(progress: model.progress), - ), - ), - SliverPadding( - padding: const EdgeInsets.all(20.0), - sliver: SliverList( - delegate: SliverChildListDelegate.fixed( - [ - CustomCard( - child: Text( - model.logs, - style: GoogleFonts.jetBrainsMono( - fontSize: 13, - height: 1.5, - ), - ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - onWillPop: () => model.onWillPop(context), - ), - ); - } -} diff --git a/lib/ui/views/installer/installer_viewmodel.dart b/lib/ui/views/installer/installer_viewmodel.dart deleted file mode 100644 index b11d47da63..0000000000 --- a/lib/ui/views/installer/installer_viewmodel.dart +++ /dev/null @@ -1,391 +0,0 @@ -// ignore_for_file: use_build_context_synchronously -import 'package:device_apps/device_apps.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_background/flutter_background.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/patcher_api.dart'; -import 'package:revanced_manager/services/root_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:stacked/stacked.dart'; -import 'package:wakelock/wakelock.dart'; - -class InstallerViewModel extends BaseViewModel { - final ManagerAPI _managerAPI = locator(); - final PatcherAPI _patcherAPI = locator(); - final RootAPI _rootAPI = RootAPI(); - final Toast _toast = locator(); - final PatchedApplication _app = locator().selectedApp!; - final List _patches = locator().selectedPatches; - static const _installerChannel = MethodChannel( - 'app.revanced.manager.flutter/installer', - ); - final ScrollController scrollController = ScrollController(); - double? progress = 0.0; - String logs = ''; - String headerLogs = ''; - bool isRooted = false; - bool isPatching = true; - bool isInstalled = false; - bool hasErrors = false; - bool isCanceled = false; - bool cancel = false; - - Future initialize(BuildContext context) async { - isRooted = await _rootAPI.isRooted(); - if (await Permission.ignoreBatteryOptimizations.isGranted) { - try { - FlutterBackground.initialize( - androidConfig: FlutterBackgroundAndroidConfig( - notificationTitle: FlutterI18n.translate( - context, - 'installerView.notificationTitle', - ), - notificationText: FlutterI18n.translate( - context, - 'installerView.notificationText', - ), - notificationIcon: const AndroidResource( - name: 'ic_notification', - ), - ), - ).then((value) => FlutterBackground.enableBackgroundExecution()); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } // ignore - } - } - await Wakelock.enable(); - await handlePlatformChannelMethods(); - await runPatcher(); - } - - Future handlePlatformChannelMethods() async { - _installerChannel.setMethodCallHandler((call) async { - switch (call.method) { - case 'update': - if (call.arguments != null) { - final Map arguments = call.arguments; - final double progress = arguments['progress']; - final String header = arguments['header']; - final String log = arguments['log']; - update(progress, header, log); - } - break; - } - }); - } - - Future update(double value, String header, String log) async { - if (value >= 0.0) { - progress = value; - } - if (value == 0.0) { - logs = ''; - isPatching = true; - isInstalled = false; - hasErrors = false; - } else if (value == 1.0) { - isPatching = false; - hasErrors = false; - await _managerAPI.savePatches( - _patcherAPI.getFilteredPatches(_app.packageName), - _app.packageName, - ); - await _managerAPI.setUsedPatches(_patches, _app.packageName); - } else if (value == -100.0) { - isPatching = false; - hasErrors = true; - } - if (header.isNotEmpty) { - headerLogs = header; - } - if (log.isNotEmpty && !log.startsWith('Merging L')) { - if (logs.isNotEmpty) { - logs += '\n'; - } - logs += log; - if (logs[logs.length - 1] == '\n') { - logs = logs.substring(0, logs.length - 1); - } - Future.delayed(const Duration(milliseconds: 500)).then((value) { - scrollController.animateTo( - scrollController.position.maxScrollExtent, - duration: const Duration(milliseconds: 200), - curve: Curves.fastOutSlowIn, - ); - }); - } - notifyListeners(); - } - - Future runPatcher() async { - try { - update(0.0, 'Initializing...', 'Initializing installer'); - if (_patches.isNotEmpty) { - try { - update(0.1, '', 'Creating working directory'); - await _patcherAPI.runPatcher( - _app.packageName, - _app.apkFilePath, - _patches, - ); - } on Exception catch (e) { - update( - -100.0, - 'Aborted...', - 'An error occurred! Aborted\nError:\n$e', - ); - if (kDebugMode) { - print(e); - } - } - } else { - update(-100.0, 'Aborted...', 'No app or patches selected! Aborted'); - } - if (FlutterBackground.isBackgroundExecutionEnabled) { - try { - FlutterBackground.disableBackgroundExecution(); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } // ignore - } - } - await Wakelock.disable(); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future installTypeDialog(BuildContext context) async { - final ValueNotifier installType = ValueNotifier(0); - if (isRooted) { - await showDialog( - context: context, - barrierDismissible: false, - builder: (context) => AlertDialog( - title: I18nText( - 'installerView.installType', - ), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - icon: const Icon(Icons.file_download_outlined), - contentPadding: const EdgeInsets.symmetric(vertical: 16), - content: ValueListenableBuilder( - valueListenable: installType, - builder: (context, value, child) { - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 10, - ), - child: I18nText( - 'installerView.installTypeDescription', - child: Text( - '', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: Theme.of(context).colorScheme.secondary, - ), - ), - ), - ), - RadioListTile( - title: I18nText('installerView.installNonRootType'), - subtitle: I18nText('installerView.installRecommendedType'), - contentPadding: const EdgeInsets.symmetric(horizontal: 10), - value: 0, - groupValue: value, - onChanged: (selected) { - installType.value = selected!; - }, - ), - RadioListTile( - title: I18nText('installerView.installRootType'), - contentPadding: const EdgeInsets.symmetric(horizontal: 10), - value: 1, - groupValue: value, - onChanged: (selected) { - installType.value = selected!; - }, - ), - ], - ); - }, - ), - actions: [ - CustomMaterialButton( - label: I18nText('cancelButton'), - isFilled: false, - onPressed: () { - Navigator.of(context).pop(); - }, - ), - CustomMaterialButton( - label: I18nText('installerView.installButton'), - onPressed: () { - Navigator.of(context).pop(); - installResult(context, installType.value == 1); - }, - ), - ], - ), - ); - } else { - installResult(context, false); - } - } - - Future stopPatcher() async { - try { - isCanceled = true; - update(0.5, 'Aborting...', 'Canceling patching process'); - await _patcherAPI.stopPatcher(); - update(-100.0, 'Aborted...', 'Press back to exit'); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future installResult(BuildContext context, bool installAsRoot) async { - try { - _app.isRooted = installAsRoot; - final bool hasMicroG = - _patches.any((p) => p.name.endsWith('MicroG support')); - final bool rootMicroG = installAsRoot && hasMicroG; - final bool rootFromStorage = installAsRoot && _app.isFromStorage; - final bool ytWithoutRootMicroG = - !installAsRoot && !hasMicroG && _app.packageName.contains('youtube'); - if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('installerView.installErrorDialogTitle'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText( - rootMicroG - ? 'installerView.installErrorDialogText1' - : rootFromStorage - ? 'installerView.installErrorDialogText3' - : 'installerView.installErrorDialogText2', - ), - actions: [ - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ); - } else { - update( - 1.0, - 'Installing...', - _app.isRooted - ? 'Installing patched file using root method' - : 'Installing patched file using nonroot method', - ); - isInstalled = await _patcherAPI.installPatchedFile(_app); - if (isInstalled) { - update(1.0, 'Installed!', 'Installed!'); - _app.isFromStorage = false; - _app.patchDate = DateTime.now(); - _app.appliedPatches = _patches.map((p) => p.name).toList(); - if (hasMicroG) { - _app.name += ' ReVanced'; - _app.packageName = _app.packageName.replaceFirst( - 'com.google.', - 'app.revanced.', - ); - } - await _managerAPI.savePatchedApp(_app); - } - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - void exportResult() { - try { - _patcherAPI.exportPatchedFile(_app.name, _app.version); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - void exportLog() { - _patcherAPI.exportPatcherLog(logs); - } - - Future cleanPatcher() async { - try { - _patcherAPI.cleanPatcher(); - locator().selectedApp = null; - locator().selectedPatches.clear(); - locator().notifyListeners(); - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - void openApp() { - DeviceApps.openApp(_app.packageName); - } - - void onButtonPressed(int value) { - switch (value) { - case 0: - exportResult(); - break; - case 1: - exportLog(); - break; - } - } - - Future onWillPop(BuildContext context) async { - if (isPatching) { - if (!cancel) { - cancel = true; - _toast.showBottom('installerView.pressBackAgain'); - } else if (!isCanceled) { - await stopPatcher(); - } else { - _toast.showBottom('installerView.noExit'); - } - return false; - } - if (!cancel) { - cleanPatcher(); - } else { - _patcherAPI.cleanPatcher(); - } - Navigator.of(context).pop(); - return true; - } -} diff --git a/lib/ui/views/navigation/navigation_view.dart b/lib/ui/views/navigation/navigation_view.dart deleted file mode 100644 index 7089d06908..0000000000 --- a/lib/ui/views/navigation/navigation_view.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:animations/animations.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart'; -import 'package:stacked/stacked.dart'; - -class NavigationView extends StatelessWidget { - const NavigationView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - onViewModelReady: (model) => model.initialize(context), - viewModelBuilder: () => locator(), - builder: (context, model, child) => WillPopScope( - onWillPop: () async { - if (model.currentIndex == 0) { - return true; - } else { - model.setIndex(0); - return false; - } - }, - child: Scaffold( - body: PageTransitionSwitcher( - duration: const Duration(milliseconds: 400), - transitionBuilder: ( - Widget child, - Animation animation, - Animation secondaryAnimation, - ) { - return FadeThroughTransition( - animation: animation, - secondaryAnimation: secondaryAnimation, - fillColor: Theme.of(context).colorScheme.surface, - child: child, - ); - }, - child: model.getViewForIndex(model.currentIndex), - ), - bottomNavigationBar: NavigationBar( - onDestinationSelected: model.setIndex, - selectedIndex: model.currentIndex, - destinations: [ - NavigationDestination( - icon: model.isIndexSelected(0) - ? const Icon(Icons.dashboard) - : const Icon(Icons.dashboard_outlined), - label: FlutterI18n.translate( - context, - 'navigationView.dashboardTab', - ), - tooltip: '', - ), - NavigationDestination( - icon: model.isIndexSelected(1) - ? const Icon(Icons.build) - : const Icon(Icons.build_outlined), - label: FlutterI18n.translate( - context, - 'navigationView.patcherTab', - ), - tooltip: '', - ), - NavigationDestination( - icon: model.isIndexSelected(2) - ? const Icon(Icons.settings) - : const Icon(Icons.settings_outlined), - label: FlutterI18n.translate( - context, - 'navigationView.settingsTab', - ), - tooltip: '', - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/ui/views/navigation/navigation_viewmodel.dart b/lib/ui/views/navigation/navigation_viewmodel.dart deleted file mode 100644 index 99110cc188..0000000000 --- a/lib/ui/views/navigation/navigation_viewmodel.dart +++ /dev/null @@ -1,75 +0,0 @@ -// ignore_for_file: use_build_context_synchronously -import 'package:dynamic_themes/dynamic_themes.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:injectable/injectable.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/root_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/home/home_view.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_view.dart'; -import 'package:revanced_manager/ui/views/settings/settings_view.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:stacked/stacked.dart'; - -@lazySingleton -class NavigationViewModel extends IndexTrackingViewModel { - Future initialize(BuildContext context) async { - locator().initialize(context); - final SharedPreferences prefs = await SharedPreferences.getInstance(); - requestManageExternalStorage(); - - if (prefs.getBool('permissionsRequested') == null) { - await Permission.storage.request(); - await Permission.manageExternalStorage.request(); - await prefs.setBool('permissionsRequested', true); - RootAPI().hasRootPermissions().then( - (value) => Permission.requestInstallPackages.request().then( - (value) => Permission.ignoreBatteryOptimizations.request(), - ), - ); - } - - if (prefs.getBool('useDarkTheme') == null) { - final bool isDark = - MediaQuery.platformBrightnessOf(context) != Brightness.light; - await prefs.setBool('useDarkTheme', isDark); - await DynamicTheme.of(context)!.setTheme(isDark ? 1 : 0); - } - SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); - SystemChrome.setSystemUIOverlayStyle( - SystemUiOverlayStyle( - systemNavigationBarColor: Colors.transparent, - systemNavigationBarIconBrightness: - DynamicTheme.of(context)!.theme.brightness == Brightness.light - ? Brightness.dark - : Brightness.light, - ), - ); - } - - Future requestManageExternalStorage() async { - final manageExternalStorageStatus = - await Permission.manageExternalStorage.status; - if (manageExternalStorageStatus.isDenied) { - await Permission.manageExternalStorage.request(); - } - if (manageExternalStorageStatus.isPermanentlyDenied) { - await openAppSettings(); - } - } - - Widget getViewForIndex(int index) { - switch (index) { - case 0: - return const HomeView(); - case 1: - return const PatcherView(); - case 2: - return const SettingsView(); - default: - return const HomeView(); - } - } -} diff --git a/lib/ui/views/patcher/patcher_view.dart b/lib/ui/views/patcher/patcher_view.dart deleted file mode 100644 index ec593d18ab..0000000000 --- a/lib/ui/views/patcher/patcher_view.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/patcherView/app_selector_card.dart'; -import 'package:revanced_manager/ui/widgets/patcherView/patch_selector_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart'; -import 'package:stacked/stacked.dart'; - -class PatcherView extends StatelessWidget { - const PatcherView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - disposeViewModel: false, - viewModelBuilder: () => locator(), - builder: (context, model, child) => Scaffold( - floatingActionButton: Visibility( - visible: model.showPatchButton(), - child: FloatingActionButton.extended( - label: I18nText('patcherView.patchButton'), - icon: const Icon(Icons.build), - onPressed: () => model.showRemovedPatchesDialog(context), - ), - ), - body: CustomScrollView( - slivers: [ - CustomSliverAppBar( - isMainView: true, - title: I18nText( - 'patcherView.widgetTitle', - child: Text( - '', - style: GoogleFonts.inter( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - ), - SliverPadding( - padding: const EdgeInsets.all(20.0), - sliver: SliverList( - delegate: SliverChildListDelegate.fixed( - [ - AppSelectorCard( - onPressed: () => model.navigateToAppSelector(), - ), - const SizedBox(height: 16), - Opacity( - opacity: model.dimPatchesCard() ? 0.5 : 1, - child: PatchSelectorCard( - onPressed: model.dimPatchesCard() - ? () => {} - : () => model.navigateToPatchesSelector(), - ), - ), - ], - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/views/patcher/patcher_viewmodel.dart b/lib/ui/views/patcher/patcher_viewmodel.dart deleted file mode 100644 index 33ceb7195d..0000000000 --- a/lib/ui/views/patcher/patcher_viewmodel.dart +++ /dev/null @@ -1,214 +0,0 @@ -// ignore_for_file: use_build_context_synchronously - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:injectable/injectable.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/app/app.router.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/patcher_api.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:revanced_manager/utils/about_info.dart'; -import 'package:revanced_manager/utils/check_for_supported_patch.dart'; -import 'package:stacked/stacked.dart'; -import 'package:stacked_services/stacked_services.dart'; - -@lazySingleton -class PatcherViewModel extends BaseViewModel { - final NavigationService _navigationService = locator(); - final ManagerAPI _managerAPI = locator(); - final PatcherAPI _patcherAPI = locator(); - PatchedApplication? selectedApp; - List selectedPatches = []; - List removedPatches = []; - - void navigateToAppSelector() { - _navigationService.navigateTo(Routes.appSelectorView); - } - - void navigateToPatchesSelector() { - _navigationService.navigateTo(Routes.patchesSelectorView); - } - - void navigateToInstaller() { - _navigationService.navigateTo(Routes.installerView); - } - - bool showPatchButton() { - return selectedPatches.isNotEmpty; - } - - bool dimPatchesCard() { - return selectedApp == null; - } - - Future isValidPatchConfig() async { - final bool needsResourcePatching = await _patcherAPI.needsResourcePatching( - selectedPatches, - ); - if (needsResourcePatching && selectedApp != null) { - final bool isSplit = await _managerAPI.isSplitApk(selectedApp!); - return !isSplit; - } - return true; - } - - Future showPatchConfirmationDialog(BuildContext context) async { - final bool isValid = await isValidPatchConfig(); - if (context.mounted) { - if (isValid) { - showArmv7WarningDialog(context); - } else { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('warning'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText('patcherView.splitApkWarningDialogText'), - actions: [ - CustomMaterialButton( - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - isFilled: false, - onPressed: () { - Navigator.of(context).pop(); - showArmv7WarningDialog(context); - }, - ), - ], - ), - ); - } - } - } - - Future showRemovedPatchesDialog(BuildContext context) async { - if (removedPatches.isNotEmpty) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('notice'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText( - 'patcherView.removedPatchesWarningDialogText', - translationParams: {'patches': removedPatches.join('\n')}, - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () { - Navigator.of(context).pop(); - navigateToInstaller(); - }, - ), - ], - ), - ); - } else { - showArmv7WarningDialog(context); - } - } - - Future showArmv7WarningDialog(BuildContext context) async { - final bool armv7 = await AboutInfo.getInfo().then((info) { - final List archs = info['supportedArch']; - final supportedAbis = ['arm64-v8a', 'x86', 'x86_64']; - return !archs.any((arch) => supportedAbis.contains(arch)); - }); - if (context.mounted && armv7) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('warning'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText('patcherView.armv7WarningDialogText'), - actions: [ - CustomMaterialButton( - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - isFilled: false, - onPressed: () { - Navigator.of(context).pop(); - navigateToInstaller(); - }, - ), - ], - ), - ); - } else { - navigateToInstaller(); - } - } - - String getAppSelectionString() { - String text = '${selectedApp!.name} (${selectedApp!.packageName})'; - if (text.length > 32) { - text = '${text.substring(0, 32)}...)'; - } - return text; - } - - String getSuggestedVersionString(BuildContext context) { - String suggestedVersion = - _patcherAPI.getSuggestedVersion(selectedApp!.packageName); - if (suggestedVersion.isEmpty) { - suggestedVersion = FlutterI18n.translate( - context, - 'appSelectorCard.allVersions', - ); - } else { - suggestedVersion = 'v$suggestedVersion'; - } - return '${FlutterI18n.translate( - context, - 'appSelectorCard.currentVersion', - )}: v${selectedApp!.version}\n${FlutterI18n.translate( - context, - 'appSelectorCard.suggestedVersion', - )}: $suggestedVersion'; - } - - Future loadLastSelectedPatches() async { - this.selectedPatches.clear(); - removedPatches.clear(); - final List selectedPatches = - await _managerAPI.getSelectedPatches(selectedApp!.originalPackageName); - final List patches = - _patcherAPI.getFilteredPatches(selectedApp!.originalPackageName); - this - .selectedPatches - .addAll(patches.where((patch) => selectedPatches.contains(patch.name))); - if (!_managerAPI.isPatchesChangeEnabled()) { - this.selectedPatches.clear(); - this.selectedPatches.addAll(patches.where((patch) => !patch.excluded)); - } - if (!_managerAPI.areExperimentalPatchesEnabled()) { - this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch)); - } - if (!_managerAPI.areUniversalPatchesEnabled()) { - this - .selectedPatches - .removeWhere((patch) => patch.compatiblePackages.isEmpty); - } - final usedPatches = _managerAPI.getUsedPatches(selectedApp!.originalPackageName); - for (final patch in usedPatches){ - if (!patches.any((p) => p.name == patch.name)){ - removedPatches.add('\u2022 ${patch.name}'); - } - } - notifyListeners(); - } -} diff --git a/lib/ui/views/patches_selector/patches_selector_view.dart b/lib/ui/views/patches_selector/patches_selector_view.dart deleted file mode 100644 index 9039c2cefb..0000000000 --- a/lib/ui/views/patches_selector/patches_selector_view.dart +++ /dev/null @@ -1,264 +0,0 @@ -import 'package:flutter/material.dart' hide SearchBar; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart'; -import 'package:revanced_manager/ui/widgets/shared/search_bar.dart'; -import 'package:revanced_manager/utils/check_for_supported_patch.dart'; -import 'package:stacked/stacked.dart'; - -class PatchesSelectorView extends StatefulWidget { - const PatchesSelectorView({Key? key}) : super(key: key); - - @override - State createState() => _PatchesSelectorViewState(); -} - -class _PatchesSelectorViewState extends State { - String _query = ''; - final _managerAPI = locator(); - - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) async { - if (!_managerAPI.isPatchesChangeEnabled() && - _managerAPI.showPatchesChangeWarning()) { - _managerAPI.showPatchesChangeWarningDialog(context); - } - }); - } - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - onViewModelReady: (model) => model.initialize(), - viewModelBuilder: () => PatchesSelectorViewModel(), - builder: (context, model, child) => Scaffold( - resizeToAvoidBottomInset: false, - floatingActionButton: Visibility( - visible: model.patches.isNotEmpty, - child: FloatingActionButton.extended( - label: Row( - children: [ - I18nText('patchesSelectorView.doneButton'), - Text(' (${model.selectedPatches.length})'), - ], - ), - icon: const Icon(Icons.check), - onPressed: () { - model.selectPatches(); - Navigator.of(context).pop(); - }, - ), - ), - body: CustomScrollView( - slivers: [ - SliverAppBar( - pinned: true, - floating: true, - title: I18nText( - 'patchesSelectorView.viewTitle', - child: Text( - '', - style: TextStyle( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - leading: IconButton( - icon: Icon( - Icons.arrow_back, - color: Theme.of(context).textTheme.titleLarge!.color, - ), - onPressed: () => Navigator.of(context).pop(), - ), - actions: [ - FittedBox( - fit: BoxFit.scaleDown, - child: Container( - margin: const EdgeInsets.only(top: 12, bottom: 12), - padding: - const EdgeInsets.symmetric(horizontal: 6, vertical: 6), - decoration: BoxDecoration( - color: Theme.of(context) - .colorScheme - .tertiary - .withOpacity(0.5), - borderRadius: BorderRadius.circular(6), - ), - child: Text( - model.patchesVersion!, - style: TextStyle( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - ), - CustomPopupMenu( - onSelected: (value) => - {model.onMenuSelection(value, context)}, - children: { - 0: I18nText( - 'patchesSelectorView.loadPatchesSelection', - child: const Text( - '', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - ), - ), - }, - ), - ], - bottom: PreferredSize( - preferredSize: const Size.fromHeight(64.0), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 8.0, - horizontal: 12.0, - ), - child: SearchBar( - hintText: FlutterI18n.translate( - context, - 'patchesSelectorView.searchBarHint', - ), - onQueryChanged: (searchQuery) { - setState(() { - _query = searchQuery; - }); - }, - ), - ), - ), - ), - SliverToBoxAdapter( - child: model.patches.isEmpty - ? Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: I18nText( - 'patchesSelectorView.noPatchesFound', - child: Text( - '', - style: Theme.of(context).textTheme.bodyMedium, - ), - ), - ), - ) - : Padding( - padding: - const EdgeInsets.symmetric(horizontal: 12.0).copyWith( - bottom: MediaQuery.viewPaddingOf(context).bottom + 8.0, - ), - child: Column( - children: [ - Row( - children: [ - ActionChip( - label: I18nText('patchesSelectorView.default'), - tooltip: FlutterI18n.translate( - context, - 'patchesSelectorView.defaultTooltip', - ), - onPressed: () { - if (_managerAPI.isPatchesChangeEnabled()) { - model.selectDefaultPatches(); - } else { - model.showPatchesChangeDialog(context); - } - }, - ), - const SizedBox(width: 8), - ActionChip( - label: I18nText('patchesSelectorView.none'), - tooltip: FlutterI18n.translate( - context, - 'patchesSelectorView.noneTooltip', - ), - onPressed: () { - if (_managerAPI.isPatchesChangeEnabled()) { - model.clearPatches(); - } else { - model.showPatchesChangeDialog(context); - } - }, - ), - ], - ), - ...model.getQueriedPatches(_query).map( - (patch) { - if (patch.compatiblePackages.isNotEmpty) { - return PatchItem( - name: patch.name, - simpleName: patch.getSimpleName(), - description: patch.description, - packageVersion: model.getAppInfo().version, - supportedPackageVersions: - model.getSupportedVersions(patch), - isUnsupported: !isPatchSupported(patch), - isChangeEnabled: _managerAPI.isPatchesChangeEnabled(), - isNew: model.isPatchNew( - patch, - model.getAppInfo().packageName, - ), - isSelected: model.isSelected(patch), - onChanged: (value) => - model.selectPatch(patch, value, context), - ); - } else { - return Container(); - } - }, - ), - if (_managerAPI.areUniversalPatchesEnabled()) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.symmetric( - vertical: 10.0, - ), - child: I18nText( - 'patchesSelectorView.universalPatches', - ), - ), - ...model.getQueriedPatches(_query).map((patch) { - if (patch.compatiblePackages.isEmpty) { - return PatchItem( - name: patch.name, - simpleName: patch.getSimpleName(), - description: patch.description, - packageVersion: - model.getAppInfo().version, - supportedPackageVersions: - model.getSupportedVersions(patch), - isUnsupported: !isPatchSupported(patch), - isChangeEnabled: _managerAPI.isPatchesChangeEnabled(), - isNew: false, - isSelected: model.isSelected(patch), - onChanged: (value) => model.selectPatch( - patch, - value, - context, - ), - ); - } else { - return Container(); - } - }), - ], - ), - const SizedBox(height: 70.0), - ], - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart b/lib/ui/views/patches_selector/patches_selector_viewmodel.dart deleted file mode 100644 index 71e4a16eb1..0000000000 --- a/lib/ui/views/patches_selector/patches_selector_viewmodel.dart +++ /dev/null @@ -1,216 +0,0 @@ -import 'package:collection/collection.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/patcher_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:revanced_manager/utils/check_for_supported_patch.dart'; -import 'package:stacked/stacked.dart'; - -class PatchesSelectorViewModel extends BaseViewModel { - final PatcherAPI _patcherAPI = locator(); - final ManagerAPI _managerAPI = locator(); - final List patches = []; - final List selectedPatches = - locator().selectedPatches; - PatchedApplication? selectedApp = locator().selectedApp; - String? patchesVersion = ''; - bool isDefaultPatchesRepo() { - return _managerAPI.getPatchesRepo() == 'revanced/revanced-patches'; - } - - Future initialize() async { - getPatchesVersion().whenComplete(() => notifyListeners()); - patches.addAll( - _patcherAPI.getFilteredPatches( - selectedApp!.originalPackageName, - ), - ); - patches.sort((a, b) { - if (isPatchNew(a, selectedApp!.packageName) == - isPatchNew(b, selectedApp!.packageName)) { - return a.name.compareTo(b.name); - } else { - return isPatchNew(b, selectedApp!.packageName) ? 1 : -1; - } - }); - notifyListeners(); - } - - bool isSelected(Patch patch) { - return selectedPatches.any( - (element) => element.name == patch.name, - ); - } - - void selectPatch(Patch patch, bool isSelected, BuildContext context) { - if (_managerAPI.isPatchesChangeEnabled()) { - if (isSelected && !selectedPatches.contains(patch)) { - selectedPatches.add(patch); - } else { - selectedPatches.remove(patch); - } - notifyListeners(); - } else { - showPatchesChangeDialog(context); - } - } - - Future showPatchesChangeDialog(BuildContext context) async { - return showDialog( - context: context, - builder: (context) => AlertDialog( - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - title: I18nText('warning'), - content: I18nText( - 'patchItem.patchesChangeWarningDialogText', - child: const Text( - '', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('okButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('patchItem.patchesChangeWarningDialogButton'), - onPressed: () { - Navigator.of(context) - ..pop() - ..pop(); - }, - ), - ], - ), - ); - } - - void selectDefaultPatches() { - selectedPatches.clear(); - if (locator().selectedApp?.originalPackageName != null) { - selectedPatches.addAll( - _patcherAPI - .getFilteredPatches( - locator().selectedApp!.originalPackageName, - ) - .where( - (element) => - !element.excluded && - (_managerAPI.areExperimentalPatchesEnabled() || - isPatchSupported(element)), - ), - ); - } - notifyListeners(); - } - - void clearPatches() { - selectedPatches.clear(); - notifyListeners(); - } - - void selectPatches() { - locator().selectedPatches = selectedPatches; - saveSelectedPatches(); - locator().notifyListeners(); - } - - Future getPatchesVersion() async { - patchesVersion = await _managerAPI.getCurrentPatchesVersion(); - } - - List getQueriedPatches(String query) { - final List patch = patches - .where( - (patch) => - query.isEmpty || - query.length < 2 || - patch.name.toLowerCase().contains(query.toLowerCase()) || - patch.getSimpleName().toLowerCase().contains(query.toLowerCase()), - ) - .toList(); - if (_managerAPI.areUniversalPatchesEnabled()) { - return patch; - } else { - return patch - .where((patch) => patch.compatiblePackages.isNotEmpty) - .toList(); - } - } - - PatchedApplication getAppInfo() { - return locator().selectedApp!; - } - - bool isPatchNew(Patch patch, String packageName) { - final List savedPatches = _managerAPI.getSavedPatches(packageName); - if (savedPatches.isEmpty) { - return false; - } else { - return !savedPatches - .any((p) => p.getSimpleName() == patch.getSimpleName()); - } - } - - List getSupportedVersions(Patch patch) { - final PatchedApplication app = locator().selectedApp!; - final Package? package = patch.compatiblePackages.firstWhereOrNull( - (pack) => pack.name == app.packageName, - ); - if (package != null) { - return package.versions; - } else { - return List.empty(); - } - } - - void onMenuSelection(value, BuildContext context) { - switch (value) { - case 0: - loadSelectedPatches(context); - break; - } - } - - Future saveSelectedPatches() async { - final List selectedPatches = - this.selectedPatches.map((patch) => patch.name).toList(); - await _managerAPI.setSelectedPatches( - locator().selectedApp!.originalPackageName, - selectedPatches, - ); - } - - Future loadSelectedPatches(BuildContext context) async { - if (_managerAPI.isPatchesChangeEnabled()) { - final List selectedPatches = await _managerAPI.getSelectedPatches( - locator().selectedApp!.originalPackageName, - ); - if (selectedPatches.isNotEmpty) { - this.selectedPatches.clear(); - this.selectedPatches.addAll( - patches.where((patch) => selectedPatches.contains(patch.name)), - ); - if (!_managerAPI.areExperimentalPatchesEnabled()) { - this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch)); - } - } else { - locator().showBottom('patchesSelectorView.noSavedPatches'); - } - notifyListeners(); - } else { - showPatchesChangeDialog(context); - } - } -} diff --git a/lib/ui/views/settings/settingsFragment/settings_manage_api_url.dart b/lib/ui/views/settings/settingsFragment/settings_manage_api_url.dart deleted file mode 100644 index 964254beb5..0000000000 --- a/lib/ui/views/settings/settingsFragment/settings_manage_api_url.dart +++ /dev/null @@ -1,121 +0,0 @@ -// ignore_for_file: use_build_context_synchronously - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:stacked/stacked.dart'; - -class SManageApiUrl extends BaseViewModel { - final ManagerAPI _managerAPI = locator(); - final Toast _toast = locator(); - - final TextEditingController _apiUrlController = TextEditingController(); - - Future showApiUrlDialog(BuildContext context) async { - final String apiUrl = _managerAPI.getApiUrl(); - _apiUrlController.text = apiUrl.replaceAll('https://', ''); - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: Row( - children: [ - I18nText('settingsView.apiURLLabel'), - const Spacer(), - IconButton( - icon: const Icon(Icons.manage_history_outlined), - onPressed: () => showApiUrlResetDialog(context), - color: Theme.of(context).colorScheme.secondary, - ), - ], - ), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: SingleChildScrollView( - child: Column( - children: [ - CustomTextField( - leadingIcon: Icon( - Icons.api_outlined, - color: Theme.of(context).colorScheme.secondary, - ), - inputController: _apiUrlController, - label: I18nText('settingsView.selectApiURL'), - hint: apiUrl, - onChanged: (value) => notifyListeners(), - ), - ], - ), - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('cancelButton'), - onPressed: () { - _apiUrlController.clear(); - Navigator.of(context).pop(); - }, - ), - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () { - String apiUrl = _apiUrlController.text; - if (!apiUrl.startsWith('https')) { - apiUrl = 'https://$apiUrl'; - } - _managerAPI.setApiUrl(apiUrl); - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } - - Future showApiUrlResetDialog(BuildContext context) async { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('settingsView.sourcesResetDialogTitle'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText('settingsView.apiURLResetDialogText'), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () { - _managerAPI.setApiUrl(''); - _toast.showBottom('settingsView.restartAppForChanges'); - Navigator.of(context) - ..pop() - ..pop(); - }, - ), - ], - ), - ); - } -} - -final sManageApiUrl = SManageApiUrl(); - -class SManageApiUrlUI extends StatelessWidget { - const SManageApiUrlUI({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsTileDialog( - padding: const EdgeInsets.symmetric(horizontal: 20.0), - title: 'settingsView.apiURLLabel', - subtitle: 'settingsView.apiURLHint', - onTap: () => sManageApiUrl.showApiUrlDialog(context), - ); - } -} diff --git a/lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart b/lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart deleted file mode 100644 index 4ac4689bde..0000000000 --- a/lib/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart +++ /dev/null @@ -1,86 +0,0 @@ -// ignore_for_file: use_build_context_synchronously - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:stacked/stacked.dart'; - -class SManageKeystorePassword extends BaseViewModel { - final ManagerAPI _managerAPI = locator(); - - final TextEditingController _keystorePasswordController = - TextEditingController(); - - Future showKeystoreDialog(BuildContext context) async { - final String keystorePasswordText = _managerAPI.getKeystorePassword(); - _keystorePasswordController.text = keystorePasswordText; - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: Row( - children: [ - I18nText('settingsView.selectKeystorePassword'), - const Spacer(), - IconButton( - icon: const Icon(Icons.manage_history_outlined), - onPressed: () => _keystorePasswordController.text = - _managerAPI.defaultKeystorePassword, - color: Theme.of(context).colorScheme.secondary, - ), - ], - ), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: SingleChildScrollView( - child: Column( - children: [ - CustomTextField( - inputController: _keystorePasswordController, - label: I18nText('settingsView.selectKeystorePassword'), - hint: '', - onChanged: (value) => notifyListeners(), - ), - ], - ), - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('cancelButton'), - onPressed: () { - _keystorePasswordController.clear(); - Navigator.of(context).pop(); - }, - ), - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () { - final String passwd = _keystorePasswordController.text; - _managerAPI.setKeystorePassword(passwd); - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } -} - -final sManageKeystorePassword = SManageKeystorePassword(); - -class SManageKeystorePasswordUI extends StatelessWidget { - const SManageKeystorePasswordUI({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsTileDialog( - padding: const EdgeInsets.symmetric(horizontal: 20.0), - title: 'settingsView.selectKeystorePassword', - subtitle: 'settingsView.selectKeystorePasswordHint', - onTap: () => sManageKeystorePassword.showKeystoreDialog(context), - ); - } -} diff --git a/lib/ui/views/settings/settingsFragment/settings_manage_sources.dart b/lib/ui/views/settings/settingsFragment/settings_manage_sources.dart deleted file mode 100644 index 76e3171b1f..0000000000 --- a/lib/ui/views/settings/settingsFragment/settings_manage_sources.dart +++ /dev/null @@ -1,189 +0,0 @@ -// ignore_for_file: use_build_context_synchronously - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:stacked/stacked.dart'; - -class SManageSources extends BaseViewModel { - final ManagerAPI _managerAPI = locator(); - final Toast _toast = locator(); - - final TextEditingController _hostSourceController = TextEditingController(); - final TextEditingController _orgPatSourceController = TextEditingController(); - final TextEditingController _patSourceController = TextEditingController(); - final TextEditingController _orgIntSourceController = TextEditingController(); - final TextEditingController _intSourceController = TextEditingController(); - - Future showSourcesDialog(BuildContext context) async { - final String hostRepository = _managerAPI.getRepoUrl(); - final String patchesRepo = _managerAPI.getPatchesRepo(); - final String integrationsRepo = _managerAPI.getIntegrationsRepo(); - _hostSourceController.text = hostRepository; - _orgPatSourceController.text = patchesRepo.split('/')[0]; - _patSourceController.text = patchesRepo.split('/')[1]; - _orgIntSourceController.text = integrationsRepo.split('/')[0]; - _intSourceController.text = integrationsRepo.split('/')[1]; - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: Row( - children: [ - I18nText('settingsView.sourcesLabel'), - const Spacer(), - IconButton( - icon: const Icon(Icons.manage_history_outlined), - onPressed: () => showResetConfirmationDialog(context), - color: Theme.of(context).colorScheme.secondary, - ), - ], - ), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: SingleChildScrollView( - child: Column( - children: [ - CustomTextField( - leadingIcon: const Icon( - Icons.extension_outlined, - color: Colors.transparent, - ), - inputController: _hostSourceController, - label: I18nText('settingsView.hostRepositoryLabel'), - hint: hostRepository, - onChanged: (value) => notifyListeners(), - ), - const SizedBox(height: 20), - CustomTextField( - leadingIcon: Icon( - Icons.extension_outlined, - color: Theme.of(context).colorScheme.secondary, - ), - inputController: _orgPatSourceController, - label: I18nText('settingsView.orgPatchesLabel'), - hint: patchesRepo.split('/')[0], - onChanged: (value) => notifyListeners(), - ), - const SizedBox(height: 8), - CustomTextField( - leadingIcon: const Icon( - Icons.extension_outlined, - color: Colors.transparent, - ), - inputController: _patSourceController, - label: I18nText('settingsView.sourcesPatchesLabel'), - hint: patchesRepo.split('/')[1], - onChanged: (value) => notifyListeners(), - ), - const SizedBox(height: 20), - CustomTextField( - leadingIcon: Icon( - Icons.merge_outlined, - color: Theme.of(context).colorScheme.secondary, - ), - inputController: _orgIntSourceController, - label: I18nText('settingsView.orgIntegrationsLabel'), - hint: integrationsRepo.split('/')[0], - onChanged: (value) => notifyListeners(), - ), - const SizedBox(height: 8), - CustomTextField( - leadingIcon: const Icon( - Icons.merge_outlined, - color: Colors.transparent, - ), - inputController: _intSourceController, - label: I18nText('settingsView.sourcesIntegrationsLabel'), - hint: integrationsRepo.split('/')[1], - onChanged: (value) => notifyListeners(), - ), - const SizedBox(height: 20), - I18nText('settingsView.sourcesUpdateNote'), - ], - ), - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('cancelButton'), - onPressed: () { - _orgPatSourceController.clear(); - _patSourceController.clear(); - _orgIntSourceController.clear(); - _intSourceController.clear(); - Navigator.of(context).pop(); - }, - ), - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () { - _managerAPI.setRepoUrl(_hostSourceController.text.trim()); - _managerAPI.setPatchesRepo( - '${_orgPatSourceController.text.trim()}/${_patSourceController.text.trim()}', - ); - _managerAPI.setIntegrationsRepo( - '${_orgIntSourceController.text.trim()}/${_intSourceController.text.trim()}', - ); - _managerAPI.setCurrentPatchesVersion('0.0.0'); - _managerAPI.setCurrentIntegrationsVersion('0.0.0'); - _toast.showBottom('settingsView.restartAppForChanges'); - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } - - Future showResetConfirmationDialog(BuildContext context) async { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('settingsView.sourcesResetDialogTitle'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText('settingsView.sourcesResetDialogText'), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () { - _managerAPI.setRepoUrl(''); - _managerAPI.setPatchesRepo(''); - _managerAPI.setIntegrationsRepo(''); - _managerAPI.setCurrentPatchesVersion('0.0.0'); - _managerAPI.setCurrentIntegrationsVersion('0.0.0'); - _toast.showBottom('settingsView.restartAppForChanges'); - Navigator.of(context) - ..pop() - ..pop(); - }, - ), - ], - ), - ); - } -} - -final sManageSources = SManageSources(); - -class SManageSourcesUI extends StatelessWidget { - const SManageSourcesUI({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsTileDialog( - padding: const EdgeInsets.symmetric(horizontal: 20.0), - title: 'settingsView.sourcesLabel', - subtitle: 'settingsView.sourcesLabelHint', - onTap: () => sManageSources.showSourcesDialog(context), - ); - } -} diff --git a/lib/ui/views/settings/settingsFragment/settings_update_language.dart b/lib/ui/views/settings/settingsFragment/settings_update_language.dart deleted file mode 100644 index 66bb2c3e7f..0000000000 --- a/lib/ui/views/settings/settingsFragment/settings_update_language.dart +++ /dev/null @@ -1,95 +0,0 @@ -// ignore_for_file: use_build_context_synchronously - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/main.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:stacked/stacked.dart'; -import 'package:timeago/timeago.dart' as timeago; - -final _settingViewModel = SettingsViewModel(); - -class SUpdateLanguage extends BaseViewModel { - final Toast _toast = locator(); - late SharedPreferences _prefs; - String selectedLanguage = 'English'; - String selectedLanguageLocale = prefs.getString('language') ?? 'en_US'; - List languages = []; - - Future initialize() async { - _prefs = await SharedPreferences.getInstance(); - selectedLanguageLocale = - _prefs.getString('language') ?? selectedLanguageLocale; - notifyListeners(); - } - - Future updateLanguage(BuildContext context, String? value) async { - if (value != null) { - selectedLanguageLocale = value; - _prefs = await SharedPreferences.getInstance(); - await _prefs.setString('language', value); - await FlutterI18n.refresh(context, Locale(value)); - timeago.setLocaleMessages(value, timeago.EnMessages()); - locator().notifyListeners(); - notifyListeners(); - } - } - - Future initLang() async { - languages.sort((a, b) => a['name'].compareTo(b['name'])); - notifyListeners(); - } - - Future showLanguagesDialog(BuildContext parentContext) { - initLang(); - return showDialog( - context: parentContext, - builder: (context) => SimpleDialog( - title: I18nText('settingsView.languageLabel'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - children: [ - SizedBox( - height: 500, - child: ListView.builder( - itemCount: languages.length, - itemBuilder: (context, index) { - return RadioListTile( - title: Text(languages[index]['name']), - subtitle: Text(languages[index]['locale']), - value: languages[index]['locale'], - groupValue: selectedLanguageLocale, - onChanged: (value) { - selectedLanguage = languages[index]['name']; - _toast.showBottom('settingsView.restartAppForChanges'); - updateLanguage(context, value); - Navigator.pop(context); - }, - ); - }, - ), - ), - ], - ), - ); - } -} - -class SUpdateLanguageUI extends StatelessWidget { - const SUpdateLanguageUI({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsTileDialog( - padding: const EdgeInsets.symmetric(horizontal: 20.0), - title: 'settingsView.languageLabel', - subtitle: _settingViewModel.sUpdateLanguage.selectedLanguage, - onTap: () => - _settingViewModel.sUpdateLanguage.showLanguagesDialog(context), - ); - } -} diff --git a/lib/ui/views/settings/settingsFragment/settings_update_theme.dart b/lib/ui/views/settings/settingsFragment/settings_update_theme.dart deleted file mode 100644 index 684abc961d..0000000000 --- a/lib/ui/views/settings/settingsFragment/settings_update_theme.dart +++ /dev/null @@ -1,116 +0,0 @@ -// ignore_for_file: use_build_context_synchronously - -import 'package:dynamic_themes/dynamic_themes.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart'; -import 'package:stacked/stacked.dart'; - -final _settingViewModel = SettingsViewModel(); - -// ignore: constant_identifier_names -const int ANDROID_12_SDK_VERSION = 31; - -class SUpdateTheme extends BaseViewModel { - final ManagerAPI _managerAPI = locator(); - - bool getDynamicThemeStatus() { - return _managerAPI.getUseDynamicTheme(); - } - - Future setUseDynamicTheme(BuildContext context, bool value) async { - await _managerAPI.setUseDynamicTheme(value); - final int currentTheme = DynamicTheme.of(context)!.themeId; - if (currentTheme.isEven) { - await DynamicTheme.of(context)!.setTheme(value ? 2 : 0); - } else { - await DynamicTheme.of(context)!.setTheme(value ? 3 : 1); - } - notifyListeners(); - } - - bool getDarkThemeStatus() { - return _managerAPI.getUseDarkTheme(); - } - - Future setUseDarkTheme(BuildContext context, bool value) async { - await _managerAPI.setUseDarkTheme(value); - final int currentTheme = DynamicTheme.of(context)!.themeId; - if (currentTheme < 2) { - await DynamicTheme.of(context)!.setTheme(value ? 1 : 0); - } else { - await DynamicTheme.of(context)!.setTheme(value ? 3 : 2); - } - SystemChrome.setSystemUIOverlayStyle( - SystemUiOverlayStyle( - systemNavigationBarIconBrightness: - value ? Brightness.light : Brightness.dark, - ), - ); - notifyListeners(); - } -} - -class SUpdateThemeUI extends StatelessWidget { - const SUpdateThemeUI({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsSection( - title: 'settingsView.appearanceSectionTitle', - children: [ - SwitchListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.darkThemeLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.darkThemeHint'), - value: SUpdateTheme().getDarkThemeStatus(), - onChanged: (value) => SUpdateTheme().setUseDarkTheme( - context, - value, - ), - ), - FutureBuilder( - future: _settingViewModel.getSdkVersion(), - builder: (context, snapshot) => Visibility( - visible: - snapshot.hasData && snapshot.data! >= ANDROID_12_SDK_VERSION, - child: SwitchListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.dynamicThemeLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.dynamicThemeHint'), - value: _settingViewModel.sUpdateTheme.getDynamicThemeStatus(), - onChanged: (value) => { - _settingViewModel.sUpdateTheme.setUseDynamicTheme( - context, - value, - ), - }, - ), - ), - ), - ], - ); - } -} diff --git a/lib/ui/views/settings/settings_view.dart b/lib/ui/views/settings/settings_view.dart deleted file mode 100644 index e1002b404a..0000000000 --- a/lib/ui/views/settings/settings_view.dart +++ /dev/null @@ -1,61 +0,0 @@ -// ignore_for_file: prefer_const_constructors - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_update_theme.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_advanced_section.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_export_section.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_info_section.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_team_section.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart'; -import 'package:stacked/stacked.dart'; - -class SettingsView extends StatelessWidget { - const SettingsView({Key? key}) : super(key: key); - - static const _settingsDivider = - Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0); - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - viewModelBuilder: () => SettingsViewModel(), - builder: (context, model, child) => Scaffold( - body: CustomScrollView( - slivers: [ - CustomSliverAppBar( - isMainView: true, - title: I18nText( - 'settingsView.widgetTitle', - child: Text( - '', - style: GoogleFonts.inter( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - ), - SliverList( - delegate: SliverChildListDelegate.fixed( - [ - SUpdateThemeUI(), - // SUpdateLanguageUI(), - // _settingsDivider, - STeamSection(), - _settingsDivider, - SAdvancedSection(), - _settingsDivider, - SExportSection(), - _settingsDivider, - SInfoSection(), - ], - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/views/settings/settings_viewmodel.dart b/lib/ui/views/settings/settings_viewmodel.dart deleted file mode 100644 index 2441b0a6bd..0000000000 --- a/lib/ui/views/settings/settings_viewmodel.dart +++ /dev/null @@ -1,284 +0,0 @@ -import 'dart:io'; -import 'package:cr_file_saver/file_saver.dart'; -import 'package:device_info_plus/device_info_plus.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:logcat/logcat.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/app/app.router.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/toast.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:revanced_manager/ui/views/settings/settingsFragment/settings_update_language.dart'; -import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_update_theme.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:share_extend/share_extend.dart'; -import 'package:stacked/stacked.dart'; -import 'package:stacked_services/stacked_services.dart'; - -class SettingsViewModel extends BaseViewModel { - final NavigationService _navigationService = locator(); - final ManagerAPI _managerAPI = locator(); - final PatchesSelectorViewModel _patchesSelectorViewModel = - PatchesSelectorViewModel(); - final PatcherViewModel _patcherViewModel = locator(); - final Toast _toast = locator(); - - final SUpdateLanguage sUpdateLanguage = SUpdateLanguage(); - final SUpdateTheme sUpdateTheme = SUpdateTheme(); - - void navigateToContributors() { - _navigationService.navigateTo(Routes.contributorsView); - } - - bool isPatchesAutoUpdate() { - return _managerAPI.isPatchesAutoUpdate(); - } - - void setPatchesAutoUpdate(bool value) { - _managerAPI.setPatchesAutoUpdate(value); - notifyListeners(); - } - - bool isPatchesChangeEnabled() { - return _managerAPI.isPatchesChangeEnabled(); - } - - Future showPatchesChangeEnableDialog( - bool value, - BuildContext context, - ) async { - if (value) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - title: I18nText('warning'), - content: I18nText( - 'settingsView.enablePatchesSelectionWarningText', - child: const Text( - '', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () { - _managerAPI.setChangingToggleModified(true); - _managerAPI.setPatchesChangeEnabled(true); - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } else { - return showDialog( - context: context, - builder: (context) => AlertDialog( - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - title: I18nText('warning'), - content: I18nText( - 'settingsView.disablePatchesSelectionWarningText', - child: const Text( - '', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () { - _managerAPI.setChangingToggleModified(true); - _patchesSelectorViewModel.selectDefaultPatches(); - _managerAPI.setPatchesChangeEnabled(false); - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } - } - - bool areUniversalPatchesEnabled() { - return _managerAPI.areUniversalPatchesEnabled(); - } - - void showUniversalPatches(bool value) { - _managerAPI.enableUniversalPatchesStatus(value); - notifyListeners(); - } - - bool areExperimentalPatchesEnabled() { - return _managerAPI.areExperimentalPatchesEnabled(); - } - - void useExperimentalPatches(bool value) { - _managerAPI.enableExperimentalPatchesStatus(value); - notifyListeners(); - } - - void deleteKeystore() { - _managerAPI.deleteKeystore(); - _toast.showBottom('settingsView.regeneratedKeystore'); - notifyListeners(); - } - - void deleteTempDir() { - _managerAPI.deleteTempFolder(); - _toast.showBottom('settingsView.deletedTempDir'); - notifyListeners(); - } - - Future exportPatches() async { - try { - final File outFile = File(_managerAPI.storedPatchesFile); - if (outFile.existsSync()) { - final String dateTime = - DateTime.now().toString().replaceAll(' ', '_').split('.').first; - await CRFileSaver.saveFileWithDialog( - SaveFileDialogParams( - sourceFilePath: outFile.path, - destinationFileName: 'selected_patches_$dateTime.json', - ), - ); - _toast.showBottom('settingsView.exportedPatches'); - } else { - _toast.showBottom('settingsView.noExportFileFound'); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future importPatches(BuildContext context) async { - if (isPatchesChangeEnabled()) { - try { - final FilePickerResult? result = await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['json'], - ); - if (result != null && result.files.single.path != null) { - final File inFile = File(result.files.single.path!); - inFile.copySync(_managerAPI.storedPatchesFile); - inFile.delete(); - if (_patcherViewModel.selectedApp != null) { - _patcherViewModel.loadLastSelectedPatches(); - } - _toast.showBottom('settingsView.importedPatches'); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - _toast.showBottom('settingsView.jsonSelectorErrorMessage'); - } - } else { - _managerAPI.showPatchesChangeWarningDialog(context); - } - } - - Future exportKeystore() async { - try { - final File outFile = File(_managerAPI.keystoreFile); - if (outFile.existsSync()) { - final String dateTime = - DateTime.now().toString().replaceAll(' ', '_').split('.').first; - await CRFileSaver.saveFileWithDialog( - SaveFileDialogParams( - sourceFilePath: outFile.path, - destinationFileName: 'keystore_$dateTime.keystore', - ), - ); - _toast.showBottom('settingsView.exportedKeystore'); - } else { - _toast.showBottom('settingsView.noKeystoreExportFileFound'); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - } - } - - Future importKeystore() async { - try { - final FilePickerResult? result = await FilePicker.platform.pickFiles(); - if (result != null && result.files.single.path != null) { - final File inFile = File(result.files.single.path!); - inFile.copySync(_managerAPI.keystoreFile); - - _toast.showBottom('settingsView.importedKeystore'); - } - } on Exception catch (e) { - if (kDebugMode) { - print(e); - } - _toast.showBottom('settingsView.keystoreSelectorErrorMessage'); - } - } - - void resetSelectedPatches() { - _managerAPI.resetLastSelectedPatches(); - _toast.showBottom('settingsView.resetStoredPatches'); - } - - Future getSdkVersion() async { - final AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo; - return info.version.sdkInt; - } - - Future deleteLogs() async { - final Directory appCacheDir = await getTemporaryDirectory(); - final Directory logsDir = Directory('${appCacheDir.path}/logs'); - if (logsDir.existsSync()) { - logsDir.deleteSync(recursive: true); - } - _toast.showBottom('settingsView.deletedLogs'); - } - - Future exportLogcatLogs() async { - final Directory appCache = await getTemporaryDirectory(); - final Directory logDir = Directory('${appCache.path}/logs'); - logDir.createSync(); - final String dateTime = DateTime.now() - .toIso8601String() - .replaceAll('-', '') - .replaceAll(':', '') - .replaceAll('T', '') - .replaceAll('.', ''); - final File logcat = - File('${logDir.path}/revanced-manager_logcat_$dateTime.log'); - final String logs = await Logcat.execute(); - logcat.writeAsStringSync(logs); - ShareExtend.share(logcat.path, 'file'); - } -} diff --git a/lib/ui/widgets/appInfoView/app_info_view.dart b/lib/ui/widgets/appInfoView/app_info_view.dart deleted file mode 100644 index 2d0f17e13e..0000000000 --- a/lib/ui/widgets/appInfoView/app_info_view.dart +++ /dev/null @@ -1,311 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/ui/widgets/appInfoView/app_info_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart'; -import 'package:stacked/stacked.dart'; - -class AppInfoView extends StatelessWidget { - const AppInfoView({ - Key? key, - required this.app, - }) : super(key: key); - final PatchedApplication app; - - @override - Widget build(BuildContext context) { - return ViewModelBuilder.reactive( - viewModelBuilder: () => AppInfoViewModel(), - builder: (context, model, child) => Scaffold( - body: CustomScrollView( - slivers: [ - CustomSliverAppBar( - title: I18nText( - 'appInfoView.widgetTitle', - child: Text( - '', - style: GoogleFonts.inter( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - ), - SliverPadding( - padding: const EdgeInsets.symmetric(vertical: 20.0), - sliver: SliverList( - delegate: SliverChildListDelegate.fixed( - [ - SizedBox( - height: 64.0, - child: CircleAvatar( - backgroundColor: Colors.transparent, - child: Image.memory( - app.icon, - fit: BoxFit.cover, - ), - ), - ), - const SizedBox(height: 20), - Text( - app.name, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.titleLarge, - ), - const SizedBox(height: 4), - Text( - app.version, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.titleLarge, - ), - const SizedBox(height: 20), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 20.0), - child: CustomCard( - padding: EdgeInsets.zero, - child: SizedBox( - height: 94.0, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Material( - type: MaterialType.transparency, - child: InkWell( - borderRadius: BorderRadius.circular(16.0), - onTap: () => model.openApp(app), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Icon( - Icons.open_in_new_outlined, - color: Theme.of(context) - .colorScheme - .primary, - ), - const SizedBox(height: 10), - I18nText( - 'appInfoView.openButton', - child: Text( - '', - style: TextStyle( - color: Theme.of(context) - .colorScheme - .primary, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ), - VerticalDivider( - color: Theme.of(context).canvasColor, - indent: 12.0, - endIndent: 12.0, - width: 1.0, - ), - Expanded( - child: Material( - type: MaterialType.transparency, - child: InkWell( - borderRadius: BorderRadius.circular(16.0), - onTap: () => model.showUninstallDialog( - context, - app, - false, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Icon( - Icons.delete_outline, - color: Theme.of(context) - .colorScheme - .primary, - ), - const SizedBox(height: 10), - I18nText( - 'appInfoView.uninstallButton', - child: Text( - '', - style: TextStyle( - color: Theme.of(context) - .colorScheme - .primary, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ), - VerticalDivider( - color: Theme.of(context).canvasColor, - indent: 12.0, - endIndent: 12.0, - width: 1.0, - ), - if (app.isRooted) - VerticalDivider( - color: Theme.of(context).canvasColor, - indent: 12.0, - endIndent: 12.0, - width: 1.0, - ), - if (app.isRooted) - Expanded( - child: Material( - type: MaterialType.transparency, - child: InkWell( - borderRadius: BorderRadius.circular(16.0), - onTap: () => model.showUninstallDialog( - context, - app, - true, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Icon( - Icons - .settings_backup_restore_outlined, - color: Theme.of(context) - .colorScheme - .primary, - ), - const SizedBox(height: 10), - I18nText( - 'appInfoView.unpatchButton', - child: Text( - '', - style: TextStyle( - color: Theme.of(context) - .colorScheme - .primary, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 20), - ListTile( - contentPadding: - const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'appInfoView.packageNameLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: Text(app.packageName), - ), - const SizedBox(height: 4), - ListTile( - contentPadding: - const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'appInfoView.originalPackageNameLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: Text(app.originalPackageName), - ), - const SizedBox(height: 4), - ListTile( - contentPadding: - const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'appInfoView.installTypeLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: app.isRooted - ? I18nText('appInfoView.rootTypeLabel') - : I18nText('appInfoView.nonRootTypeLabel'), - ), - const SizedBox(height: 4), - ListTile( - contentPadding: - const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'appInfoView.patchedDateLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText( - 'appInfoView.patchedDateHint', - translationParams: { - 'date': model.getPrettyDate(context, app.patchDate), - 'time': model.getPrettyTime(context, app.patchDate), - }, - ), - ), - const SizedBox(height: 4), - ListTile( - contentPadding: - const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'appInfoView.appliedPatchesLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText( - 'appInfoView.appliedPatchesHint', - translationParams: { - 'quantity': app.appliedPatches.length.toString(), - }, - ), - onTap: () => model.showAppliedPatchesDialog(context, app), - ), - ], - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/widgets/appInfoView/app_info_viewmodel.dart b/lib/ui/widgets/appInfoView/app_info_viewmodel.dart deleted file mode 100644 index dd364c7d6b..0000000000 --- a/lib/ui/widgets/appInfoView/app_info_viewmodel.dart +++ /dev/null @@ -1,166 +0,0 @@ -// ignore_for_file: use_build_context_synchronously -import 'package:device_apps/device_apps.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:intl/intl.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/patcher_api.dart'; -import 'package:revanced_manager/services/root_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; -import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:revanced_manager/utils/string.dart'; -import 'package:stacked/stacked.dart'; - -class AppInfoViewModel extends BaseViewModel { - final ManagerAPI _managerAPI = locator(); - final PatcherAPI _patcherAPI = locator(); - final RootAPI _rootAPI = RootAPI(); - final Toast _toast = locator(); - - Future uninstallApp( - BuildContext context, - PatchedApplication app, - bool onlyUnpatch, - ) async { - bool isUninstalled = true; - if (app.isRooted) { - final bool hasRootPermissions = await _rootAPI.hasRootPermissions(); - if (hasRootPermissions) { - await _rootAPI.deleteApp(app.packageName, app.apkFilePath); - if (!onlyUnpatch) { - await DeviceApps.uninstallApp(app.packageName); - } - } - } else { - isUninstalled = await DeviceApps.uninstallApp(app.packageName); - } - if (isUninstalled) { - await _managerAPI.deletePatchedApp(app); - locator().initialize(context); - } - } - - Future navigateToPatcher(PatchedApplication app) async { - locator().selectedApp = app; - locator().selectedPatches = - await _patcherAPI.getAppliedPatches(app.appliedPatches); - locator().notifyListeners(); - locator().setIndex(1); - } - - void updateNotImplemented(BuildContext context) { - _toast.showBottom('appInfoView.updateNotImplemented'); - } - - Future showUninstallDialog( - BuildContext context, - PatchedApplication app, - bool onlyUnpatch, - ) async { - final bool hasRootPermissions = await _rootAPI.hasRootPermissions(); - if (app.isRooted && !hasRootPermissions) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('appInfoView.rootDialogTitle'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText('appInfoView.rootDialogText'), - actions: [ - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ); - } else { - if (onlyUnpatch) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText( - 'appInfoView.unpatchButton', - ), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText( - 'appInfoView.unpatchDialogText', - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () { - uninstallApp(context, app, onlyUnpatch); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - }, - ), - ], - ), - ); - } else { - uninstallApp(context, app, onlyUnpatch); - Navigator.of(context).pop(); - } - } - } - - String getPrettyDate(BuildContext context, DateTime dateTime) { - return DateFormat.yMMMMd(Localizations.localeOf(context).languageCode) - .format(dateTime); - } - - String getPrettyTime(BuildContext context, DateTime dateTime) { - return DateFormat.jm(Localizations.localeOf(context).languageCode) - .format(dateTime); - } - - Future showAppliedPatchesDialog( - BuildContext context, - PatchedApplication app, - ) async { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('appInfoView.appliedPatchesLabel'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: SingleChildScrollView( - child: Text(getAppliedPatchesString(app.appliedPatches)), - ), - actions: [ - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ); - } - - String getAppliedPatchesString(List appliedPatches) { - final List names = appliedPatches - .map( - (p) => p - .replaceAll('-', ' ') - .split('-') - .join(' ') - .toTitleCase() - .replaceFirst('Microg', 'MicroG'), - ) - .toList(); - return '\u2022 ${names.join('\n\u2022 ')}'; - } - - void openApp(PatchedApplication app) { - DeviceApps.openApp(app.packageName); - } -} diff --git a/lib/ui/widgets/appSelectorView/app_skeleton_loader.dart b/lib/ui/widgets/appSelectorView/app_skeleton_loader.dart deleted file mode 100644 index 0cb80428a6..0000000000 --- a/lib/ui/widgets/appSelectorView/app_skeleton_loader.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -import 'package:skeletons/skeletons.dart'; - -class AppSkeletonLoader extends StatelessWidget { - const AppSkeletonLoader({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - final screenWidth = MediaQuery.sizeOf(context).width; - return ListView.builder( - shrinkWrap: true, - itemCount: 7, - padding: EdgeInsets.zero, - itemBuilder: (context, index) => Padding( - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12.0), - child: CustomCard( - child: Row( - children: [ - SkeletonAvatar( - style: SkeletonAvatarStyle( - width: screenWidth * 0.10, - height: screenWidth * 0.10, - borderRadius: const BorderRadius.all(Radius.circular(12)), - ), - ), - const SizedBox(width: 16), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: screenWidth * 0.4, - child: SkeletonLine( - style: SkeletonLineStyle( - height: 20, - width: screenWidth * 0.4, - borderRadius: - const BorderRadius.all(Radius.circular(10)), - ), - ), - ), - const SizedBox(height: 12), - SizedBox( - width: screenWidth * 0.6, - child: SkeletonLine( - style: SkeletonLineStyle( - height: 15, - width: screenWidth * 0.6, - borderRadius: - const BorderRadius.all(Radius.circular(10)), - ), - ), - ), - const SizedBox(height: 5), - SizedBox( - width: screenWidth * 0.5, - child: SkeletonLine( - style: SkeletonLineStyle( - height: 15, - width: screenWidth * 0.5, - borderRadius: - const BorderRadius.all(Radius.circular(10)), - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/ui/widgets/appSelectorView/installed_app_item.dart b/lib/ui/widgets/appSelectorView/installed_app_item.dart deleted file mode 100644 index ae129cbfdc..0000000000 --- a/lib/ui/widgets/appSelectorView/installed_app_item.dart +++ /dev/null @@ -1,107 +0,0 @@ -import 'dart:typed_data'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; - -class InstalledAppItem extends StatefulWidget { - const InstalledAppItem({ - Key? key, - required this.name, - required this.pkgName, - required this.icon, - required this.patchesCount, - required this.suggestedVersion, - required this.installedVersion, - this.onTap, - }) : super(key: key); - final String name; - final String pkgName; - final Uint8List icon; - final int patchesCount; - final String suggestedVersion; - final String installedVersion; - final Function()? onTap; - - @override - State createState() => _InstalledAppItemState(); -} - -class _InstalledAppItemState extends State { - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), - child: CustomCard( - onTap: widget.onTap, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 48, - height: 48, - padding: const EdgeInsets.symmetric(vertical: 4.0), - alignment: Alignment.center, - child: CircleAvatar( - backgroundColor: Colors.transparent, - child: Image.memory(widget.icon), - ), - ), - const SizedBox(width: 12), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.name, - maxLines: 2, - overflow: TextOverflow.visible, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - Text(widget.pkgName), - I18nText( - FlutterI18n.translate( - context, - 'installed', - translationParams: { - 'version': 'v${widget.installedVersion}', - }, - ), - ), - Wrap( - children: [ - I18nText( - 'suggested', - translationParams: { - 'version': widget.suggestedVersion.isEmpty - ? FlutterI18n.translate( - context, - 'appSelectorCard.allVersions', - ) - : 'v${widget.suggestedVersion}', - }, - ), - const SizedBox(width: 4), - Text( - widget.patchesCount == 1 - ? '• ${widget.patchesCount} patch' - : '• ${widget.patchesCount} patches', - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Theme.of(context).colorScheme.secondary, - ), - ), - ], - ), - ], - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/widgets/appSelectorView/not_installed_app_item.dart b/lib/ui/widgets/appSelectorView/not_installed_app_item.dart deleted file mode 100644 index c2f3f52e09..0000000000 --- a/lib/ui/widgets/appSelectorView/not_installed_app_item.dart +++ /dev/null @@ -1,101 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; - -class NotInstalledAppItem extends StatefulWidget { - const NotInstalledAppItem({ - Key? key, - required this.name, - required this.patchesCount, - required this.suggestedVersion, - this.onTap, - }) : super(key: key); - final String name; - final int patchesCount; - final String suggestedVersion; - final Function()? onTap; - - @override - State createState() => _NotInstalledAppItem(); -} - -class _NotInstalledAppItem extends State { - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), - child: CustomCard( - onTap: widget.onTap, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 48, - padding: const EdgeInsets.symmetric(vertical: 4.0), - alignment: Alignment.center, - child: const CircleAvatar( - backgroundColor: Colors.transparent, - child: Icon( - Icons.square_rounded, - color: Colors.grey, - size: 44, - ), - ), - ), - const SizedBox(width: 12), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.name, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - const SizedBox(height: 4), - I18nText( - 'appSelectorCard.notInstalled', - child: Text( - '', - style: TextStyle( - color: Theme.of(context).textTheme.titleLarge!.color, - ), - ), - ), - Wrap( - children: [ - I18nText( - 'suggested', - translationParams: { - 'version': widget.suggestedVersion.isEmpty - ? FlutterI18n.translate( - context, - 'appSelectorCard.allVersions', - ) - : 'v${widget.suggestedVersion}', - }, - ), - const SizedBox(width: 4), - Text( - widget.patchesCount == 1 - ? '• ${widget.patchesCount} patch' - : '• ${widget.patchesCount} patches', - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Theme.of(context).colorScheme.secondary, - ), - ), - ], - ), - ], - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/widgets/contributorsView/contributors_card.dart b/lib/ui/widgets/contributorsView/contributors_card.dart deleted file mode 100644 index 574699a84b..0000000000 --- a/lib/ui/widgets/contributorsView/contributors_card.dart +++ /dev/null @@ -1,77 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_cache_manager/file.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class ContributorsCard extends StatefulWidget { - const ContributorsCard({ - Key? key, - required this.title, - required this.contributors, - }) : super(key: key); - final String title; - final List contributors; - - @override - State createState() => _ContributorsCardState(); -} - -class _ContributorsCardState extends State { - @override - Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only(bottom: 8.0), - child: I18nText( - widget.title, - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - ), - CustomCard( - child: GridView.builder( - shrinkWrap: true, - padding: EdgeInsets.zero, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 6, - mainAxisSpacing: 8, - crossAxisSpacing: 8, - ), - itemCount: widget.contributors.length, - itemBuilder: (context, index) => ClipRRect( - borderRadius: BorderRadius.circular(100), - child: GestureDetector( - onTap: () => launchUrl( - Uri.parse( - widget.contributors[index]['html_url'], - ), - mode: LaunchMode.externalApplication, - ), - child: FutureBuilder( - future: DefaultCacheManager().getSingleFile( - widget.contributors[index]['avatar_url'], - ), - builder: (context, snapshot) => snapshot.hasData - ? Image.file(snapshot.data!) - : Image.network( - widget.contributors[index]['avatar_url'], - ), - ), - ), - ), - ), - ), - ], - ); - } -} diff --git a/lib/ui/widgets/homeView/installed_apps_card.dart b/lib/ui/widgets/homeView/installed_apps_card.dart deleted file mode 100644 index 7a98985641..0000000000 --- a/lib/ui/widgets/homeView/installed_apps_card.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:device_apps/device_apps.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/application_item.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; - -//ignore: must_be_immutable -class InstalledAppsCard extends StatelessWidget { - InstalledAppsCard({Key? key}) : super(key: key); - - List apps = locator().patchedInstalledApps; - final ManagerAPI _managerAPI = locator(); - List patchedApps = []; - - Future _getApps() async { - if (apps.isNotEmpty) { - patchedApps = [...apps]; - for (final element in apps) { - await DeviceApps.getApp(element.packageName).then((value) { - if (element.version != value?.versionName) { - patchedApps.remove(element); - } - }); - } - if (apps.length != patchedApps.length) { - await _managerAPI.setPatchedApps(patchedApps); - apps.clear(); - apps = [...patchedApps]; - } - } - } - - @override - Widget build(BuildContext context) { - return FutureBuilder( - future: _getApps(), - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - return apps.isEmpty - ? CustomCard( - child: Center( - child: Column( - children: [ - Icon( - size: 40, - Icons.file_download_off, - color: Theme.of(context).colorScheme.secondary, - ), - const SizedBox(height: 16), - I18nText( - 'homeView.noInstallations', - child: Text( - '', - textAlign: TextAlign.center, - style: Theme.of(context) - .textTheme - .titleMedium! - .copyWith( - color: - Theme.of(context).colorScheme.secondary, - ), - ), - ), - ], - ), - ), - ) - : ListView( - shrinkWrap: true, - padding: EdgeInsets.zero, - physics: const NeverScrollableScrollPhysics(), - children: apps - .map( - (app) => ApplicationItem( - icon: app.icon, - name: app.name, - patchDate: app.patchDate, - changelog: app.changelog, - isUpdatableApp: false, - onPressed: () => - locator().navigateToAppInfo(app), - ), - ) - .toList(), - ); - } else { - return const Center(child: CircularProgressIndicator()); - } - }, - ); - } -} diff --git a/lib/ui/widgets/homeView/latest_commit_card.dart b/lib/ui/widgets/homeView/latest_commit_card.dart deleted file mode 100644 index 2d62286f52..0000000000 --- a/lib/ui/widgets/homeView/latest_commit_card.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; - -class LatestCommitCard extends StatefulWidget { - const LatestCommitCard({ - Key? key, - required this.model, - required this.parentContext, - }) : super(key: key); - final HomeViewModel model; - final BuildContext parentContext; - - @override - State createState() => _LatestCommitCardState(); -} - -class _LatestCommitCardState extends State { - final HomeViewModel model = locator(); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - // ReVanced Manager - CustomCard( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('ReVanced Manager'), - const SizedBox(height: 4), - Row( - children: [ - FutureBuilder( - future: model.getLatestManagerReleaseTime(), - builder: (context, snapshot) => snapshot.hasData && - snapshot.data!.isNotEmpty - ? I18nText( - 'latestCommitCard.timeagoLabel', - translationParams: {'time': snapshot.data!}, - ) - : I18nText('latestCommitCard.loadingLabel'), - ), - ], - ), - ], - ), - ), - FutureBuilder( - future: model.hasManagerUpdates(), - initialData: false, - builder: (context, snapshot) => Opacity( - opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25, - child: CustomMaterialButton( - label: I18nText('updateButton'), - onPressed: snapshot.hasData && snapshot.data! - ? () => widget.model.showUpdateConfirmationDialog( - widget.parentContext, - false, - ) - : () => {}, - ), - ), - ), - ], - ), - ), - - const SizedBox(height: 16), - - // ReVanced Patches - CustomCard( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('ReVanced Patches'), - const SizedBox(height: 4), - Row( - children: [ - FutureBuilder( - future: model.getLatestPatchesReleaseTime(), - builder: (context, snapshot) => Text( - snapshot.hasData && snapshot.data!.isNotEmpty - ? FlutterI18n.translate( - context, - 'latestCommitCard.timeagoLabel', - translationParams: {'time': snapshot.data!}, - ) - : FlutterI18n.translate( - context, - 'latestCommitCard.loadingLabel', - ), - ), - ), - ], - ), - ], - ), - ), - FutureBuilder( - future: locator().hasPatchesUpdates(), - initialData: false, - builder: (context, snapshot) => Opacity( - opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25, - child: CustomMaterialButton( - label: I18nText('updateButton'), - onPressed: snapshot.hasData && snapshot.data! - ? () => widget.model.showUpdateConfirmationDialog( - widget.parentContext, - true, - ) - : () => {}, - ), - ), - ), - ], - ), - ), - ], - ); - } -} diff --git a/lib/ui/widgets/homeView/update_confirmation_dialog.dart b/lib/ui/widgets/homeView/update_confirmation_dialog.dart deleted file mode 100644 index 7839536ad5..0000000000 --- a/lib/ui/widgets/homeView/update_confirmation_dialog.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:flutter_markdown/flutter_markdown.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; - -class UpdateConfirmationDialog extends StatelessWidget { - const UpdateConfirmationDialog({super.key, required this.isPatches}); - - final bool isPatches; - @override - Widget build(BuildContext context) { - final HomeViewModel model = locator(); - - return DraggableScrollableSheet( - expand: false, - snap: true, - snapSizes: const [0.5], - builder: (_, scrollController) => SingleChildScrollView( - controller: scrollController, - child: SafeArea( - child: FutureBuilder?>( - future: !isPatches - ? model.getLatestManagerRelease() - : model.getLatestPatchesRelease(), - builder: (_, snapshot) { - if (!snapshot.hasData) { - return const SizedBox( - height: 300, - child: Center( - child: CircularProgressIndicator(), - ), - ); - } - - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only( - top: 40.0, - left: 24.0, - right: 24.0, - bottom: 32.0, - ), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - I18nText( - isPatches - ? 'homeView.updatePatchesDialogTitle' - : 'homeView.updateDialogTitle', - child: const Text( - '', - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - ), - ), - ), - const SizedBox(height: 4.0), - Row( - children: [ - Icon( - Icons.new_releases_outlined, - color: - Theme.of(context).colorScheme.secondary, - ), - const SizedBox(width: 8.0), - Text( - snapshot.data!['tag_name'] ?? 'Unknown', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .colorScheme - .secondary, - ), - ), - ], - ), - ], - ), - ), - CustomMaterialButton( - isExpanded: true, - label: I18nText('updateButton'), - onPressed: () { - Navigator.of(context).pop(); - isPatches - ? model.updatePatches(context) - : model.updateManager(context); - }, - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.only(left: 24.0, bottom: 12.0), - child: I18nText( - 'homeView.updateChangelogTitle', - child: Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .colorScheme - .onSecondaryContainer, - ), - ), - ), - ), - Container( - margin: const EdgeInsets.symmetric(horizontal: 24.0), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondaryContainer, - borderRadius: BorderRadius.circular(12.0), - ), - child: Markdown( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - padding: const EdgeInsets.all(20.0), - data: snapshot.data!['body'] ?? '', - ), - ), - ], - ); - }, - ), - ), - ), - ); - } -} diff --git a/lib/ui/widgets/installerView/gradient_progress_indicator.dart b/lib/ui/widgets/installerView/gradient_progress_indicator.dart deleted file mode 100644 index d403218436..0000000000 --- a/lib/ui/widgets/installerView/gradient_progress_indicator.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:flutter/material.dart'; - -class GradientProgressIndicator extends StatefulWidget { - const GradientProgressIndicator({required this.progress, super.key}); - final double? progress; - - @override - State createState() => - _GradientProgressIndicatorState(); -} - -class _GradientProgressIndicatorState extends State { - @override - Widget build(BuildContext context) { - return Align( - alignment: Alignment.centerLeft, - child: AnimatedContainer( - duration: const Duration(milliseconds: 500), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Theme.of(context).colorScheme.primary, - Theme.of(context).colorScheme.secondary, - ], - ), - ), - height: 5, - width: MediaQuery.sizeOf(context).width * widget.progress!, - ), - ); - } -} diff --git a/lib/ui/widgets/patcherView/app_selector_card.dart b/lib/ui/widgets/patcherView/app_selector_card.dart deleted file mode 100644 index e97a004d6e..0000000000 --- a/lib/ui/widgets/patcherView/app_selector_card.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'dart:typed_data'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; - -class AppSelectorCard extends StatelessWidget { - const AppSelectorCard({ - Key? key, - required this.onPressed, - }) : super(key: key); - final Function() onPressed; - - @override - Widget build(BuildContext context) { - return CustomCard( - onTap: onPressed, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - I18nText( - locator().selectedApp == null - ? 'appSelectorCard.widgetTitle' - : 'appSelectorCard.widgetTitleSelected', - child: const Text( - '', - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500, - ), - ), - ), - const SizedBox(height: 8), - if (locator().selectedApp == null) - I18nText('appSelectorCard.widgetSubtitle') - else - Row( - children: [ - SizedBox( - height: 18.0, - child: ClipOval( - child: Image.memory( - locator().selectedApp == null - ? Uint8List(0) - : locator().selectedApp!.icon, - fit: BoxFit.cover, - ), - ), - ), - const SizedBox(width: 6), - Flexible( - child: Text( - locator().getAppSelectionString(), - style: const TextStyle(fontWeight: FontWeight.w600), - ), - ), - ], - ), - if (locator().selectedApp == null) - Container() - else - Column( - children: [ - const SizedBox(height: 4), - Text( - locator() - .getSuggestedVersionString(context), - ), - ], - ), - ], - ), - ); - } -} diff --git a/lib/ui/widgets/patcherView/patch_selector_card.dart b/lib/ui/widgets/patcherView/patch_selector_card.dart deleted file mode 100644 index 1b8265de06..0000000000 --- a/lib/ui/widgets/patcherView/patch_selector_card.dart +++ /dev/null @@ -1,66 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; - -class PatchSelectorCard extends StatelessWidget { - const PatchSelectorCard({ - Key? key, - required this.onPressed, - }) : super(key: key); - final Function() onPressed; - - @override - Widget build(BuildContext context) { - return CustomCard( - onTap: onPressed, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - I18nText( - locator().selectedPatches.isEmpty - ? 'patchSelectorCard.widgetTitle' - : 'patchSelectorCard.widgetTitleSelected', - child: const Text( - '', - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500, - ), - ), - ), - Text( - locator().selectedPatches.isEmpty - ? '' - : ' (${locator().selectedPatches.length})', - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500, - ), - ), - ], - ), - const SizedBox(height: 4), - if (locator().selectedApp == null) - I18nText('patchSelectorCard.widgetSubtitle') - else - locator().selectedPatches.isEmpty - ? I18nText('patchSelectorCard.widgetEmptySubtitle') - : Text(_getPatchesSelection()), - ], - ), - ); - } - - String _getPatchesSelection() { - String text = ''; - for (final Patch p in locator().selectedPatches) { - text += '\u2022 ${p.getSimpleName()}\n'; - } - return text.substring(0, text.length - 1); - } -} diff --git a/lib/ui/widgets/patchesSelectorView/patch_item.dart b/lib/ui/widgets/patchesSelectorView/patch_item.dart deleted file mode 100644 index 78a92e3612..0000000000 --- a/lib/ui/widgets/patchesSelectorView/patch_item.dart +++ /dev/null @@ -1,248 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/services/manager_api.dart'; -import 'package:revanced_manager/services/toast.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; - -// ignore: must_be_immutable -class PatchItem extends StatefulWidget { - PatchItem({ - Key? key, - required this.name, - required this.simpleName, - required this.description, - required this.packageVersion, - required this.supportedPackageVersions, - required this.isUnsupported, - required this.isNew, - required this.isSelected, - required this.onChanged, - required this.isChangeEnabled, - this.child, - }) : super(key: key); - final String name; - final String simpleName; - final String description; - final String packageVersion; - final List supportedPackageVersions; - final bool isUnsupported; - final bool isNew; - bool isSelected; - final Function(bool) onChanged; - final bool isChangeEnabled; - final Widget? child; - final toast = locator(); - final _managerAPI = locator(); - - @override - State createState() => _PatchItemState(); -} - -class _PatchItemState extends State { - @override - Widget build(BuildContext context) { - widget.isSelected = widget.isSelected && - (!widget.isUnsupported || - widget._managerAPI.areExperimentalPatchesEnabled()); - return Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), - child: Opacity( - opacity: widget.isUnsupported && - widget._managerAPI.areExperimentalPatchesEnabled() == false - ? 0.5 - : 1, - child: CustomCard( - onTap: () { - setState(() { - if (widget.isUnsupported && - !widget._managerAPI.areExperimentalPatchesEnabled()) { - widget.isSelected = false; - widget.toast.showBottom('patchItem.unsupportedPatchVersion'); - } else if (widget.isChangeEnabled) { - widget.isSelected = !widget.isSelected; - } - }); - if (!widget.isUnsupported || widget._managerAPI.areExperimentalPatchesEnabled()) { - widget.onChanged(widget.isSelected); - } - }, - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: Text( - widget.simpleName, - maxLines: 2, - overflow: TextOverflow.visible, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - ), - ), - ), - ], - ), - const SizedBox(height: 4), - Text( - widget.description, - softWrap: true, - overflow: TextOverflow.visible, - style: TextStyle( - fontSize: 14, - color: Theme.of(context) - .colorScheme - .onSecondaryContainer, - ), - ), - ], - ), - ), - Transform.scale( - scale: 1.2, - child: Checkbox( - value: widget.isSelected, - activeColor: Theme.of(context).colorScheme.primary, - checkColor: - Theme.of(context).colorScheme.secondaryContainer, - side: BorderSide( - width: 2.0, - color: Theme.of(context).colorScheme.primary, - ), - onChanged: (newValue) { - setState(() { - if (widget.isUnsupported && - !widget._managerAPI - .areExperimentalPatchesEnabled()) { - widget.isSelected = false; - widget.toast.showBottom( - 'patchItem.unsupportedPatchVersion', - ); - } else if (widget.isChangeEnabled) { - widget.isSelected = newValue!; - } - }); - if (!widget.isUnsupported || widget._managerAPI.areExperimentalPatchesEnabled()) { - widget.onChanged(widget.isSelected); - } - }, - ), - ), - ], - ), - Row( - children: [ - if (widget.isUnsupported && - widget._managerAPI.areExperimentalPatchesEnabled()) - Padding( - padding: const EdgeInsets.only(top: 8, right: 8), - child: TextButton.icon( - label: I18nText('warning'), - icon: const Icon(Icons.warning, size: 20.0), - onPressed: () => _showUnsupportedWarningDialog(), - style: ButtonStyle( - shape: MaterialStateProperty.all( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide( - color: Theme.of(context).colorScheme.secondary, - ), - ), - ), - backgroundColor: MaterialStateProperty.all( - Colors.transparent, - ), - foregroundColor: MaterialStateProperty.all( - Theme.of(context).colorScheme.secondary, - ), - ), - ), - ), - if (widget.isNew) - Padding( - padding: const EdgeInsets.only(top: 8), - child: TextButton.icon( - label: I18nText('new'), - icon: const Icon(Icons.star, size: 20.0), - onPressed: () => _showNewPatchDialog(), - style: ButtonStyle( - shape: MaterialStateProperty.all( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide( - color: Theme.of(context).colorScheme.secondary, - ), - ), - ), - backgroundColor: MaterialStateProperty.all( - Colors.transparent, - ), - foregroundColor: MaterialStateProperty.all( - Theme.of(context).colorScheme.secondary, - ), - ), - ), - ), - ], - ), - widget.child ?? const SizedBox(), - ], - ), - ), - ), - ); - } - - Future _showUnsupportedWarningDialog() { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('warning'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText( - 'patchItem.unsupportedDialogText', - translationParams: { - 'packageVersion': widget.packageVersion, - 'supportedVersions': - '\u2022 ${widget.supportedPackageVersions.reversed.join('\n\u2022 ')}', - }, - ), - actions: [ - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ); - } - - Future _showNewPatchDialog() { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('patchItem.newPatch'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText( - 'patchItem.newPatchDialogText', - ), - actions: [ - CustomMaterialButton( - label: I18nText('okButton'), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ); - } -} diff --git a/lib/ui/widgets/patchesSelectorView/patch_options_fields.dart b/lib/ui/widgets/patchesSelectorView/patch_options_fields.dart deleted file mode 100644 index 45a138432a..0000000000 --- a/lib/ui/widgets/patchesSelectorView/patch_options_fields.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:google_fonts/google_fonts.dart'; - -class OptionsTextField extends StatelessWidget { - const OptionsTextField({Key? key, required this.hint}) : super(key: key); - final String hint; - - @override - Widget build(BuildContext context) { - final size = MediaQuery.sizeOf(context); - final sHeight = size.height; - final sWidth = size.width; - return Container( - margin: const EdgeInsets.only(top: 12, bottom: 6), - padding: EdgeInsets.zero, - child: TextField( - decoration: InputDecoration( - constraints: BoxConstraints( - maxHeight: sHeight * 0.05, - maxWidth: sWidth * 1, - ), - border: const OutlineInputBorder(), - labelText: hint, - ), - ), - ); - } -} - -class OptionsFilePicker extends StatelessWidget { - const OptionsFilePicker({Key? key, required this.optionName}) - : super(key: key); - final String optionName; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - I18nText( - optionName, - child: Text( - '', - style: GoogleFonts.inter( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - ElevatedButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - Theme.of(context).colorScheme.primary, - ), - ), - onPressed: () { - // pick files - }, - child: Text( - 'Select File', - style: TextStyle( - color: Theme.of(context).textTheme.bodyLarge?.color, - ), - ), - ), - ], - ), - ); - } -} diff --git a/lib/ui/widgets/settingsView/about_widget.dart b/lib/ui/widgets/settingsView/about_widget.dart deleted file mode 100644 index ebad5f92e8..0000000000 --- a/lib/ui/widgets/settingsView/about_widget.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/utils/about_info.dart'; - -class AboutWidget extends StatefulWidget { - const AboutWidget({Key? key, this.padding}) : super(key: key); - - final EdgeInsetsGeometry? padding; - - @override - State createState() => _AboutWidgetState(); -} - -class _AboutWidgetState extends State { - @override - Widget build(BuildContext context) { - return FutureBuilder>( - future: AboutInfo.getInfo(), - builder: (context, snapshot) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: ListTile( - contentPadding: widget.padding ?? EdgeInsets.zero, - onLongPress: snapshot.hasData - ? () { - Clipboard.setData( - ClipboardData( - text: 'Version: ${snapshot.data!['version']}\n' - 'Model: ${snapshot.data!['model']}\n' - 'Android Version: ${snapshot.data!['androidVersion']}\n' - '${snapshot.data!['supportedArch'].length > 1 ? 'Supported Archs' : 'Supported Arch'}: ${snapshot.data!['supportedArch'].join(", ")}\n', - ), - ); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: I18nText('settingsView.snackbarMessage'), - backgroundColor: - Theme.of(context).colorScheme.secondary, - ), - ); - } - : null, - title: I18nText( - 'settingsView.aboutLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: snapshot.hasData - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Version: ${snapshot.data!['version']}', - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - Text( - 'Build: ${snapshot.data!['flavor']}', - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - Text( - 'Model: ${snapshot.data!['model']}', - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - Text( - 'Android Version: ${snapshot.data!['androidVersion']}', - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - Text( - snapshot.data!['supportedArch'].length > 1 - ? 'Supported Archs: ${snapshot.data!['supportedArch'].join(", ")}' - : 'Supported Arch: ${snapshot.data!['supportedArch']}', - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - ], - ) - : const SizedBox(), - ), - ); - }, - ); - } -} diff --git a/lib/ui/widgets/settingsView/custom_switch.dart b/lib/ui/widgets/settingsView/custom_switch.dart deleted file mode 100644 index 8328c90b26..0000000000 --- a/lib/ui/widgets/settingsView/custom_switch.dart +++ /dev/null @@ -1,63 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomSwitch extends StatelessWidget { - const CustomSwitch({ - Key? key, - required this.onChanged, - required this.value, - }) : super(key: key); - final ValueChanged onChanged; - final bool value; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () => onChanged(!value), - child: SizedBox( - height: 25, - width: 50, - child: Stack( - children: [ - AnimatedContainer( - height: 25, - width: 50, - curve: Curves.ease, - duration: const Duration(milliseconds: 400), - decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(25.0), - ), - color: value - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - ), - ), - AnimatedAlign( - curve: Curves.ease, - duration: const Duration(milliseconds: 400), - alignment: !value ? Alignment.centerLeft : Alignment.centerRight, - child: Container( - height: 20, - width: 20, - margin: const EdgeInsets.symmetric(horizontal: 3), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: value - ? Theme.of(context).colorScheme.primaryContainer - : Theme.of(context).colorScheme.surface, - boxShadow: [ - BoxShadow( - color: Colors.black12.withOpacity(0.1), - spreadRadius: 0.5, - blurRadius: 1, - ), - ], - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/ui/widgets/settingsView/custom_switch_tile.dart b/lib/ui/widgets/settingsView/custom_switch_tile.dart deleted file mode 100644 index f17f967082..0000000000 --- a/lib/ui/widgets/settingsView/custom_switch_tile.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/custom_switch.dart'; - -class CustomSwitchTile extends StatelessWidget { - const CustomSwitchTile({ - Key? key, - required this.title, - required this.subtitle, - required this.value, - required this.onTap, - this.padding, - }) : super(key: key); - final Widget title; - final Widget subtitle; - final bool value; - final Function(bool) onTap; - final EdgeInsetsGeometry? padding; - - @override - Widget build(BuildContext context) { - return ListTile( - contentPadding: padding ?? EdgeInsets.zero, - title: title, - subtitle: subtitle, - onTap: () => onTap(!value), - trailing: CustomSwitch( - value: value, - onChanged: onTap, - ), - ); - } -} diff --git a/lib/ui/widgets/settingsView/custom_text_field.dart b/lib/ui/widgets/settingsView/custom_text_field.dart deleted file mode 100644 index 6f2b8a76a0..0000000000 --- a/lib/ui/widgets/settingsView/custom_text_field.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomTextField extends StatelessWidget { - const CustomTextField({ - Key? key, - required this.inputController, - required this.label, - required this.hint, - this.leadingIcon, - required this.onChanged, - }) : super(key: key); - final TextEditingController inputController; - final Widget label; - final String hint; - final Widget? leadingIcon; - final Function(String)? onChanged; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 4.0), - child: TextField( - controller: inputController, - onChanged: onChanged, - keyboardType: TextInputType.text, - decoration: InputDecoration( - icon: leadingIcon, - label: label, - filled: true, - fillColor: Theme.of(context).colorScheme.secondaryContainer, - hintText: hint, - hintStyle: TextStyle( - color: Theme.of(context).colorScheme.secondary, - ), - floatingLabelStyle: MaterialStateTextStyle.resolveWith( - (states) => states.contains(MaterialState.focused) - ? TextStyle(color: Theme.of(context).colorScheme.primary) - : TextStyle(color: Theme.of(context).colorScheme.secondary), - ), - contentPadding: const EdgeInsets.symmetric( - vertical: 8.0, - horizontal: 16.0, - ), - border: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).colorScheme.primary, - ), - borderRadius: BorderRadius.circular(10), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).colorScheme.primary, - width: 2.0, - ), - borderRadius: BorderRadius.circular(10), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).colorScheme.error, - ), - borderRadius: BorderRadius.circular(10), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).colorScheme.primary, - ), - borderRadius: BorderRadius.circular(10), - ), - ), - ), - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_advanced_section.dart b/lib/ui/widgets/settingsView/settings_advanced_section.dart deleted file mode 100644 index 2d9be3fcb7..0000000000 --- a/lib/ui/widgets/settingsView/settings_advanced_section.dart +++ /dev/null @@ -1,105 +0,0 @@ -// ignore_for_file: prefer_const_constructors - -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_manage_api_url.dart'; -import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_manage_sources.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_enable_patches_selection.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_auto_update_patches.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_experimental_patches.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_experimental_universal_patches.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; - -final _settingsViewModel = SettingsViewModel(); - -class SAdvancedSection extends StatelessWidget { - const SAdvancedSection({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsSection( - title: 'settingsView.advancedSectionTitle', - children: [ - SManageApiUrlUI(), - SManageSourcesUI(), - // SManageKeystorePasswordUI(), - SAutoUpdatePatches(), - SEnablePatchesSelection(), - SExperimentalUniversalPatches(), - SExperimentalPatches(), - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.regenerateKeystoreLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.regenerateKeystoreHint'), - onTap: () => _showDeleteKeystoreDialog(context), - ), - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.deleteTempDirLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.deleteTempDirHint'), - onTap: () => _settingsViewModel.deleteTempDir(), - ), - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.deleteLogsLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.deleteLogsHint'), - onTap: () => _settingsViewModel.deleteLogs(), - ), - ], - ); - } - - Future _showDeleteKeystoreDialog(context) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('settingsView.regenerateKeystoreDialogTitle'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText('settingsView.regenerateKeystoreDialogText'), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () => { - Navigator.of(context).pop(), - _settingsViewModel.deleteKeystore(), - }, - ), - ], - ), - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_auto_update_patches.dart b/lib/ui/widgets/settingsView/settings_auto_update_patches.dart deleted file mode 100644 index 2063d658e6..0000000000 --- a/lib/ui/widgets/settingsView/settings_auto_update_patches.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; - -class SAutoUpdatePatches extends StatefulWidget { - const SAutoUpdatePatches({super.key}); - - @override - State createState() => _SAutoUpdatePatchesState(); -} - -final _settingsViewModel = SettingsViewModel(); - -class _SAutoUpdatePatchesState extends State { - @override - Widget build(BuildContext context) { - return SwitchListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.autoUpdatePatchesLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.autoUpdatePatchesHint'), - value: _settingsViewModel.isPatchesAutoUpdate(), - onChanged: (value) { - setState(() { - _settingsViewModel.setPatchesAutoUpdate(value); - }); - }, - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_enable_patches_selection.dart b/lib/ui/widgets/settingsView/settings_enable_patches_selection.dart deleted file mode 100644 index a0c5b463ef..0000000000 --- a/lib/ui/widgets/settingsView/settings_enable_patches_selection.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; - -class SEnablePatchesSelection extends StatefulWidget { - const SEnablePatchesSelection({super.key}); - - @override - State createState() => _SEnablePatchesSelectionState(); -} - -final _settingsViewModel = SettingsViewModel(); - -class _SEnablePatchesSelectionState extends State { - @override - Widget build(BuildContext context) { - return SwitchListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.enablePatchesSelectionLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.enablePatchesSelectionHint'), - value: _settingsViewModel.isPatchesChangeEnabled(), - onChanged: (value) async { - await _settingsViewModel.showPatchesChangeEnableDialog(value, context); - setState(() {}); - }, - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_experimental_patches.dart b/lib/ui/widgets/settingsView/settings_experimental_patches.dart deleted file mode 100644 index be704c73f5..0000000000 --- a/lib/ui/widgets/settingsView/settings_experimental_patches.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.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:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/utils/check_for_supported_patch.dart'; - -class SExperimentalPatches extends StatefulWidget { - const SExperimentalPatches({super.key}); - - @override - State createState() => _SExperimentalPatchesState(); -} - -final _settingsViewModel = SettingsViewModel(); -final _patchesSelectorViewModel = PatchesSelectorViewModel(); -final _patcherViewModel = PatcherViewModel(); - -class _SExperimentalPatchesState extends State { - @override - Widget build(BuildContext context) { - return SwitchListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.experimentalPatchesLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.experimentalPatchesHint'), - value: _settingsViewModel.areExperimentalPatchesEnabled(), - onChanged: (value) { - setState(() { - _settingsViewModel.useExperimentalPatches(value); - }); - if (!value) { - _patcherViewModel.selectedPatches - .removeWhere((patch) => !isPatchSupported(patch)); - _patchesSelectorViewModel.selectedPatches - .removeWhere((patch) => !isPatchSupported(patch)); - } - }, - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_experimental_universal_patches.dart b/lib/ui/widgets/settingsView/settings_experimental_universal_patches.dart deleted file mode 100644 index b8a5841250..0000000000 --- a/lib/ui/widgets/settingsView/settings_experimental_universal_patches.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.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:revanced_manager/ui/views/settings/settings_viewmodel.dart'; - -class SExperimentalUniversalPatches extends StatefulWidget { - const SExperimentalUniversalPatches({super.key}); - - @override - State createState() => - _SExperimentalUniversalPatchesState(); -} - -final _settingsViewModel = SettingsViewModel(); -final _patchesSelectorViewModel = PatchesSelectorViewModel(); -final _patcherViewModel = PatcherViewModel(); - -class _SExperimentalUniversalPatchesState - extends State { - @override - Widget build(BuildContext context) { - return SwitchListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.experimentalUniversalPatchesLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.experimentalUniversalPatchesHint'), - value: _settingsViewModel.areUniversalPatchesEnabled(), - onChanged: (value) { - setState(() { - _settingsViewModel.showUniversalPatches(value); - }); - if (!value) { - _patcherViewModel.selectedPatches - .removeWhere((patch) => patch.compatiblePackages.isEmpty); - _patchesSelectorViewModel.selectedPatches - .removeWhere((patch) => patch.compatiblePackages.isEmpty); - } - }, - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_export_section.dart b/lib/ui/widgets/settingsView/settings_export_section.dart deleted file mode 100644 index bb69373989..0000000000 --- a/lib/ui/widgets/settingsView/settings_export_section.dart +++ /dev/null @@ -1,129 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_manage_keystore_password.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; - -final _settingsViewModel = SettingsViewModel(); - -class SExportSection extends StatelessWidget { - const SExportSection({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsSection( - title: 'settingsView.exportSectionTitle', - children: [ - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.exportPatchesLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.exportPatchesHint'), - onTap: () => _settingsViewModel.exportPatches(), - ), - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.importPatchesLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.importPatchesHint'), - onTap: () => _settingsViewModel.importPatches(context), - ), - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.exportKeystoreLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.exportKeystoreHint'), - onTap: () => _settingsViewModel.exportKeystore(), - ), - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.importKeystoreLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.importKeystoreHint'), - onTap: () async { - await _settingsViewModel.importKeystore(); - final sManageKeystorePassword = SManageKeystorePassword(); - if (context.mounted) { - sManageKeystorePassword.showKeystoreDialog(context); - } - }, - ), - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.resetStoredPatchesLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.resetStoredPatchesHint'), - onTap: () => _showResetStoredPatchesDialog(context), - ), - ], - ); - } - - Future _showResetStoredPatchesDialog(context) { - return showDialog( - context: context, - builder: (context) => AlertDialog( - title: I18nText('settingsView.resetStoredPatchesDialogTitle'), - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - content: I18nText( - 'settingsView.resetStoredPatchesDialogText', - ), - actions: [ - CustomMaterialButton( - isFilled: false, - label: I18nText('noButton'), - onPressed: () => Navigator.of(context).pop(), - ), - CustomMaterialButton( - label: I18nText('yesButton'), - onPressed: () => { - Navigator.of(context).pop(), - _settingsViewModel.resetSelectedPatches(), - }, - ), - ], - ), - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_info_section.dart b/lib/ui/widgets/settingsView/settings_info_section.dart deleted file mode 100644 index 0a71458101..0000000000 --- a/lib/ui/widgets/settingsView/settings_info_section.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/about_widget.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart'; - -final _settingsViewModel = SettingsViewModel(); - -class SInfoSection extends StatelessWidget { - const SInfoSection({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsSection( - title: 'settingsView.infoSectionTitle', - children: [ - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.logsLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.logsHint'), - onTap: () => _settingsViewModel.exportLogcatLogs(), - ), - const AboutWidget( - padding: EdgeInsets.symmetric(horizontal: 20.0), - ), - ], - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_section.dart b/lib/ui/widgets/settingsView/settings_section.dart deleted file mode 100644 index 74570a14af..0000000000 --- a/lib/ui/widgets/settingsView/settings_section.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; - -class SettingsSection extends StatelessWidget { - const SettingsSection({ - Key? key, - required this.title, - required this.children, - }) : super(key: key); - final String title; - final List children; - - @override - Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: const EdgeInsets.only(top: 16.0, bottom: 10.0, left: 20.0), - child: I18nText( - title, - child: Text( - '', - style: TextStyle( - color: Theme.of(context).colorScheme.primary, - ), - ), - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: children, - ), - ], - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_team_section.dart b/lib/ui/widgets/settingsView/settings_team_section.dart deleted file mode 100644 index aa2d81a6f3..0000000000 --- a/lib/ui/widgets/settingsView/settings_team_section.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/widgets/I18nText.dart'; -import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/social_media_widget.dart'; - -final _settingsViewModel = SettingsViewModel(); - -class STeamSection extends StatelessWidget { - const STeamSection({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsSection( - title: 'settingsView.teamSectionTitle', - children: [ - ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), - title: I18nText( - 'settingsView.contributorsLabel', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('settingsView.contributorsHint'), - onTap: () => _settingsViewModel.navigateToContributors(), - ), - const SocialMediaWidget( - padding: EdgeInsets.symmetric(horizontal: 20.0), - ), - ], - ); - } -} diff --git a/lib/ui/widgets/settingsView/settings_tile_dialog.dart b/lib/ui/widgets/settingsView/settings_tile_dialog.dart deleted file mode 100644 index ce3a817d70..0000000000 --- a/lib/ui/widgets/settingsView/settings_tile_dialog.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; - -class SettingsTileDialog extends StatelessWidget { - const SettingsTileDialog({ - Key? key, - required this.title, - required this.subtitle, - required this.onTap, - this.padding, - }) : super(key: key); - final String title; - final String subtitle; - final Function()? onTap; - final EdgeInsetsGeometry? padding; - - @override - Widget build(BuildContext context) { - return ListTile( - contentPadding: padding ?? EdgeInsets.zero, - title: I18nText( - title, - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText(subtitle), - onTap: onTap, - ); - } -} diff --git a/lib/ui/widgets/settingsView/social_media_item.dart b/lib/ui/widgets/settingsView/social_media_item.dart deleted file mode 100644 index 86971a2762..0000000000 --- a/lib/ui/widgets/settingsView/social_media_item.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class SocialMediaItem extends StatelessWidget { - const SocialMediaItem({ - Key? key, - this.icon, - required this.title, - this.subtitle, - this.url, - }) : super(key: key); - final Widget? icon; - final Widget title; - final Widget? subtitle; - final String? url; - - @override - Widget build(BuildContext context) { - return ListTile( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)), - contentPadding: EdgeInsets.zero, - leading: SizedBox( - width: 48.0, - child: Center( - child: icon, - ), - ), - title: DefaultTextStyle( - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: Theme.of(context).colorScheme.onSecondaryContainer, - ), - child: title, - ), - subtitle: subtitle != null - ? DefaultTextStyle( - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: Theme.of(context).colorScheme.primary, - ), - child: subtitle!, - ) - : null, - onTap: () => url != null - ? launchUrl( - Uri.parse(url!), - mode: LaunchMode.externalApplication, - ) - : null, - ); - } -} diff --git a/lib/ui/widgets/settingsView/social_media_widget.dart b/lib/ui/widgets/settingsView/social_media_widget.dart deleted file mode 100644 index 73a6a2eebe..0000000000 --- a/lib/ui/widgets/settingsView/social_media_widget.dart +++ /dev/null @@ -1,88 +0,0 @@ -import 'package:expandable/expandable.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:revanced_manager/ui/widgets/settingsView/social_media_item.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; - -class SocialMediaWidget extends StatelessWidget { - const SocialMediaWidget({ - Key? key, - this.padding, - }) : super(key: key); - final EdgeInsetsGeometry? padding; - - @override - Widget build(BuildContext context) { - return ExpandablePanel( - theme: ExpandableThemeData( - hasIcon: true, - iconColor: Theme.of(context).iconTheme.color, - iconPadding: const EdgeInsets.symmetric(vertical: 16.0) - .add(padding ?? EdgeInsets.zero) - .resolve(Directionality.of(context)), - animationDuration: const Duration(milliseconds: 400), - ), - header: ListTile( - contentPadding: padding ?? EdgeInsets.zero, - title: I18nText( - 'socialMediaCard.widgetTitle', - child: const Text( - '', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - ), - subtitle: I18nText('socialMediaCard.widgetSubtitle'), - ), - expanded: Padding( - padding: padding ?? EdgeInsets.zero, - child: const CustomCard( - child: Column( - children: [ - SocialMediaItem( - icon: FaIcon(FontAwesomeIcons.github), - title: Text('GitHub'), - subtitle: Text('github.com/revanced'), - url: 'https://github.com/revanced', - ), - SocialMediaItem( - icon: FaIcon(FontAwesomeIcons.discord), - title: Text('Discord'), - subtitle: Text('discord.gg/revanced'), - url: 'https://discord.gg/rF2YcEjcrT', - ), - SocialMediaItem( - icon: FaIcon(FontAwesomeIcons.telegram), - title: Text('Telegram'), - subtitle: Text('t.me/app_revanced'), - url: 'https://t.me/app_revanced', - ), - SocialMediaItem( - icon: FaIcon(FontAwesomeIcons.reddit), - title: Text('Reddit'), - subtitle: Text('r/revancedapp'), - url: 'https://reddit.com/r/revancedapp', - ), - SocialMediaItem( - icon: FaIcon(FontAwesomeIcons.twitter), - title: Text('Twitter'), - subtitle: Text('@revancedapp'), - url: 'https://twitter.com/revancedapp', - ), - SocialMediaItem( - icon: FaIcon(FontAwesomeIcons.youtube), - title: Text('YouTube'), - subtitle: Text('youtube.com/revanced'), - url: 'https://youtube.com/revanced', - ), - ], - ), - ), - ), - collapsed: const SizedBox(), - ); - } -} diff --git a/lib/ui/widgets/shared/application_item.dart b/lib/ui/widgets/shared/application_item.dart deleted file mode 100644 index 42eee351b5..0000000000 --- a/lib/ui/widgets/shared/application_item.dart +++ /dev/null @@ -1,165 +0,0 @@ -import 'dart:typed_data'; - -import 'package:expandable/expandable.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_i18n/flutter_i18n.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; -import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart'; -import 'package:timeago/timeago.dart'; - -class ApplicationItem extends StatefulWidget { - const ApplicationItem({ - Key? key, - required this.icon, - required this.name, - required this.patchDate, - required this.changelog, - required this.isUpdatableApp, - required this.onPressed, - }) : super(key: key); - final Uint8List icon; - final String name; - final DateTime patchDate; - final List changelog; - final bool isUpdatableApp; - final Function() onPressed; - - @override - State createState() => _ApplicationItemState(); -} - -class _ApplicationItemState extends State - with TickerProviderStateMixin { - late AnimationController _animationController; - - @override - void initState() { - super.initState(); - _animationController = AnimationController( - vsync: this, - duration: const Duration(milliseconds: 300), - ); - } - - @override - void dispose() { - _animationController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final ExpandableController expController = ExpandableController(); - return Container( - margin: const EdgeInsets.only(bottom: 16.0), - child: CustomCard( - onTap: () { - expController.toggle(); - _animationController.isCompleted - ? _animationController.reverse() - : _animationController.forward(); - }, - child: ExpandablePanel( - controller: expController, - theme: const ExpandableThemeData( - inkWellBorderRadius: BorderRadius.all(Radius.circular(16)), - tapBodyToCollapse: false, - tapBodyToExpand: false, - tapHeaderToExpand: false, - hasIcon: false, - animationDuration: Duration(milliseconds: 450), - ), - header: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Row( - children: [ - SizedBox( - width: 40, - child: Image.memory(widget.icon, height: 40, width: 40), - ), - const SizedBox(width: 19), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - Text( - format(widget.patchDate), - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ], - ), - ), - ], - ), - ), - Row( - children: [ - RotationTransition( - turns: Tween(begin: 0.0, end: 0.50) - .animate(_animationController), - child: const Padding( - padding: EdgeInsets.all(8.0), - child: Icon(Icons.arrow_drop_down), - ), - ), - const SizedBox(width: 8), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - CustomMaterialButton( - label: widget.isUpdatableApp - ? I18nText('applicationItem.patchButton') - : I18nText('applicationItem.infoButton'), - onPressed: widget.onPressed, - ), - ], - ), - ], - ), - ], - ), - collapsed: const SizedBox(), - expanded: Padding( - padding: const EdgeInsets.only( - top: 16.0, - left: 4.0, - right: 4.0, - bottom: 4.0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - I18nText( - 'applicationItem.changelogLabel', - child: const Text( - '', - style: TextStyle(fontWeight: FontWeight.w700), - ), - ), - const SizedBox(height: 4), - Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'), - ], - ), - ), - ), - ), - ); - } -} diff --git a/lib/ui/widgets/shared/custom_card.dart b/lib/ui/widgets/shared/custom_card.dart deleted file mode 100644 index 34b3c72860..0000000000 --- a/lib/ui/widgets/shared/custom_card.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomCard extends StatelessWidget { - const CustomCard({ - Key? key, - this.isFilled = true, - required this.child, - this.onTap, - this.padding, - this.backgroundColor, - }) : super(key: key); - final bool isFilled; - final Widget child; - final Function()? onTap; - final EdgeInsetsGeometry? padding; - final Color? backgroundColor; - - @override - Widget build(BuildContext context) { - return Material( - type: isFilled ? MaterialType.card : MaterialType.transparency, - color: isFilled - ? backgroundColor?.withOpacity(0.4) ?? - Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4) - : backgroundColor ?? Colors.transparent, - borderRadius: BorderRadius.circular(16), - child: InkWell( - onTap: onTap, - borderRadius: BorderRadius.circular(16), - child: Padding( - padding: padding ?? const EdgeInsets.all(20.0), - child: child, - ), - ), - ); - } -} diff --git a/lib/ui/widgets/shared/custom_chip.dart b/lib/ui/widgets/shared/custom_chip.dart deleted file mode 100644 index 8f3bb41831..0000000000 --- a/lib/ui/widgets/shared/custom_chip.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomChip extends StatelessWidget { - const CustomChip({ - Key? key, - required this.label, - this.isSelected = false, - this.onSelected, - }) : super(key: key); - final Widget label; - final bool isSelected; - final Function(bool)? onSelected; - - @override - Widget build(BuildContext context) { - return RawChip( - showCheckmark: false, - label: label, - selected: isSelected, - labelStyle: Theme.of(context).textTheme.titleSmall!.copyWith( - color: isSelected - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - fontWeight: FontWeight.w500, - ), - backgroundColor: Colors.transparent, - selectedColor: Theme.of(context).colorScheme.secondaryContainer, - padding: const EdgeInsets.all(10), - onSelected: onSelected, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - side: isSelected - ? BorderSide.none - : BorderSide( - width: 0.2, - color: Theme.of(context).colorScheme.secondary, - ), - ), - ); - } -} diff --git a/lib/ui/widgets/shared/custom_material_button.dart b/lib/ui/widgets/shared/custom_material_button.dart deleted file mode 100644 index 2ff80e4cf2..0000000000 --- a/lib/ui/widgets/shared/custom_material_button.dart +++ /dev/null @@ -1,126 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomMaterialButton extends StatelessWidget { - const CustomMaterialButton({ - Key? key, - required this.label, - this.isFilled = true, - this.isExpanded = false, - required this.onPressed, - }) : super(key: key); - final Widget label; - final bool isFilled; - final bool isExpanded; - final Function()? onPressed; - - @override - Widget build(BuildContext context) { - return TextButton( - style: ButtonStyle( - padding: MaterialStateProperty.all( - isExpanded - ? const EdgeInsets.symmetric(horizontal: 24, vertical: 12) - : const EdgeInsets.symmetric(horizontal: 20, vertical: 12), - ), - shape: MaterialStateProperty.all( - StadiumBorder( - side: isFilled - ? BorderSide.none - : BorderSide( - color: Theme.of(context).colorScheme.primary, - ), - ), - ), - backgroundColor: MaterialStateProperty.all( - isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent, - ), - foregroundColor: MaterialStateProperty.all( - isFilled - ? Theme.of(context).colorScheme.surface - : Theme.of(context).colorScheme.primary, - ), - ), - onPressed: onPressed, - child: label, - ); - } -} - -// ignore: must_be_immutable -class TimerButton extends StatefulWidget { - TimerButton({ - Key? key, - required this.seconds, - required this.isRunning, - required this.onTimerEnd, - this.label = const Text(''), - this.isFilled = true, - }) : super(key: key); - Widget label; - bool isFilled; - int seconds; - final bool isRunning; - final Function()? onTimerEnd; - - @override - State createState() => _TimerButtonState(); -} - -class _TimerButtonState extends State { - void timer(int seconds) { - Future.delayed(const Duration(seconds: 1), () { - if (seconds > 0) { - setState(() { - seconds--; - }); - timer(seconds); - } else { - widget.onTimerEnd!(); - } - }); - } - - @override - void initState() { - //decrement seconds - if (widget.isRunning) { - timer(widget.seconds); - } - super.initState(); - } - - @override - Widget build(BuildContext build) { - return TextButton( - style: ButtonStyle( - shape: MaterialStateProperty.all( - StadiumBorder( - side: widget.isFilled - ? BorderSide.none - : BorderSide( - color: Theme.of(context).colorScheme.primary, - ), - ), - ), - backgroundColor: MaterialStateProperty.all( - widget.isFilled - ? Theme.of(context).colorScheme.primary - : Colors.transparent, - ), - foregroundColor: MaterialStateProperty.all( - widget.isFilled - ? Theme.of(context).colorScheme.surface - : Theme.of(context).colorScheme.primary, - ), - ), - onPressed: widget.isRunning ? null : widget.onTimerEnd, - child: Text( - widget.isRunning ? '${widget.seconds}' : 'Install', - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - ), - ), - ); - } -} diff --git a/lib/ui/widgets/shared/custom_popup_menu.dart b/lib/ui/widgets/shared/custom_popup_menu.dart deleted file mode 100644 index aaf2412563..0000000000 --- a/lib/ui/widgets/shared/custom_popup_menu.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomPopupMenu extends StatelessWidget { - const CustomPopupMenu({ - Key? key, - required this.onSelected, - required this.children, - }) : super(key: key); - final Function(dynamic) onSelected; - final Map children; - - @override - Widget build(BuildContext context) { - return Theme( - data: Theme.of(context).copyWith(useMaterial3: false), - child: PopupMenuButton( - icon: Icon( - Icons.more_vert, - color: Theme.of(context).colorScheme.secondary, - ), - onSelected: onSelected, - itemBuilder: (context) => children.entries - .map( - (entry) => PopupMenuItem( - padding: const EdgeInsets.all(16.0).copyWith(right: 20), - value: entry.key, - child: entry.value, - ), - ) - .toList(), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(24), - ), - color: Theme.of(context).colorScheme.secondaryContainer, - position: PopupMenuPosition.under, - ), - ); - } -} diff --git a/lib/ui/widgets/shared/custom_sliver_app_bar.dart b/lib/ui/widgets/shared/custom_sliver_app_bar.dart deleted file mode 100644 index 144bd6ab8e..0000000000 --- a/lib/ui/widgets/shared/custom_sliver_app_bar.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomSliverAppBar extends StatelessWidget { - const CustomSliverAppBar({ - Key? key, - required this.title, - this.actions, - this.bottom, - this.isMainView = false, - this.onBackButtonPressed, - }) : super(key: key); - final Widget title; - final List? actions; - final PreferredSizeWidget? bottom; - final bool isMainView; - final Function()? onBackButtonPressed; - - @override - Widget build(BuildContext context) { - return SliverAppBar( - pinned: true, - expandedHeight: 100.0, - automaticallyImplyLeading: !isMainView, - flexibleSpace: FlexibleSpaceBar( - titlePadding: EdgeInsets.only( - bottom: bottom != null ? 16.0 : 14.0, - left: isMainView ? 20.0 : 55.0, - ), - title: title, - ), - leading: isMainView - ? null - : IconButton( - icon: Icon( - Icons.arrow_back, - color: Theme.of(context).textTheme.titleLarge!.color, - ), - onPressed: - onBackButtonPressed ?? () => Navigator.of(context).pop(), - ), - backgroundColor: MaterialStateColor.resolveWith( - (states) => states.contains(MaterialState.scrolledUnder) - ? Theme.of(context).colorScheme.surface - : Theme.of(context).canvasColor, - ), - actions: actions, - bottom: bottom, - ); - } -} diff --git a/lib/ui/widgets/shared/open_container_wrapper.dart b/lib/ui/widgets/shared/open_container_wrapper.dart deleted file mode 100644 index f5b1c642b9..0000000000 --- a/lib/ui/widgets/shared/open_container_wrapper.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:animations/animations.dart'; -import 'package:flutter/material.dart'; - -class OpenContainerWrapper extends StatelessWidget { - const OpenContainerWrapper({ - Key? key, - required this.openBuilder, - required this.closedBuilder, - }) : super(key: key); - final OpenContainerBuilder openBuilder; - final CloseContainerBuilder closedBuilder; - - @override - Widget build(BuildContext context) { - return OpenContainer( - openBuilder: openBuilder, - closedBuilder: closedBuilder, - transitionDuration: const Duration(milliseconds: 400), - openColor: Theme.of(context).colorScheme.primary, - closedColor: Colors.transparent, - closedShape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), - ), - ); - } -} diff --git a/lib/ui/widgets/shared/search_bar.dart b/lib/ui/widgets/shared/search_bar.dart deleted file mode 100644 index e48e3031f0..0000000000 --- a/lib/ui/widgets/shared/search_bar.dart +++ /dev/null @@ -1,84 +0,0 @@ -import 'package:flutter/material.dart'; - -class SearchBar extends StatefulWidget { - const SearchBar({ - Key? key, - required this.hintText, - this.showSelectIcon = false, - this.onSelectAll, - required this.onQueryChanged, - }) : super(key: key); - final String? hintText; - final bool showSelectIcon; - final Function(bool)? onSelectAll; - - final Function(String) onQueryChanged; - - @override - State createState() => _SearchBarState(); -} - -class _SearchBarState extends State { - final TextEditingController _textController = TextEditingController(); - bool _toggleSelectAll = false; - - @override - Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(48), - color: Theme.of(context).colorScheme.secondaryContainer, - ), - child: Row( - children: [ - Expanded( - child: TextFormField( - onChanged: widget.onQueryChanged, - controller: _textController, - style: TextStyle( - color: Theme.of(context).colorScheme.secondary, - ), - decoration: InputDecoration( - filled: true, - fillColor: Theme.of(context).colorScheme.secondaryContainer, - contentPadding: const EdgeInsets.all(12.0), - hintText: widget.hintText, - prefixIcon: Icon( - Icons.search, - color: Theme.of(context).colorScheme.secondary, - ), - suffixIcon: _textController.text.isNotEmpty - ? IconButton( - icon: const Icon(Icons.clear), - onPressed: () { - _textController.clear(); - widget.onQueryChanged(''); - }, - ) - : widget.showSelectIcon - ? IconButton( - icon: _toggleSelectAll - ? const Icon(Icons.deselect) - : const Icon(Icons.select_all), - onPressed: widget.onSelectAll != null - ? () { - setState(() { - _toggleSelectAll = !_toggleSelectAll; - }); - widget.onSelectAll!(_toggleSelectAll); - } - : () => {}, - ) - : null, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(100), - borderSide: BorderSide.none, - ), - ), - ), - ), - ], - ), - ); - } -} diff --git a/lib/utils/about_info.dart b/lib/utils/about_info.dart deleted file mode 100644 index 0b7dcffc47..0000000000 --- a/lib/utils/about_info.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:device_info_plus/device_info_plus.dart'; -import 'package:flutter/foundation.dart'; -import 'package:package_info_plus/package_info_plus.dart'; - -class AboutInfo { - static Future> getInfo() async { - final packageInfo = await PackageInfo.fromPlatform(); - final info = await DeviceInfoPlugin().androidInfo; - return { - 'version': packageInfo.version, - 'flavor': kReleaseMode ? 'release' : 'debug', - 'model': info.model, - 'androidVersion': info.version.release, - 'supportedArch': info.supportedAbis, - }; - } -} diff --git a/lib/utils/check_for_supported_patch.dart b/lib/utils/check_for_supported_patch.dart deleted file mode 100644 index 11c665d076..0000000000 --- a/lib/utils/check_for_supported_patch.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:revanced_manager/app/app.locator.dart'; -import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/models/patched_application.dart'; -import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; - -bool isPatchSupported(Patch patch) { - final PatchedApplication app = locator().selectedApp!; - return patch.compatiblePackages.isEmpty || - patch.compatiblePackages.any( - (pack) => - pack.name == app.packageName && - (pack.versions.isEmpty || pack.versions.contains(app.version)), - ); -} diff --git a/lib/utils/string.dart b/lib/utils/string.dart deleted file mode 100644 index 47e5426449..0000000000 --- a/lib/utils/string.dart +++ /dev/null @@ -1,8 +0,0 @@ -extension StringCasingExtension on String { - String toCapitalized() => - length > 0 ? '${this[0].toUpperCase()}${substring(1).toLowerCase()}' : ''; - String toTitleCase() => replaceAll(RegExp(' +'), ' ') - .split(' ') - .map((str) => str.toCapitalized()) - .join(' '); -} diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 04a34f64ca..0000000000 --- a/package-lock.json +++ /dev/null @@ -1,7179 +0,0 @@ -{ - "name": "revanced-manager", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "devDependencies": { - "@saithodev/semantic-release-backmerge": "^3.1.0", - "@semantic-release/changelog": "^6.0.3", - "@semantic-release/git": "^10.0.1", - "semantic-release": "^21.0.1", - "semantic-release-export-data": "^1.0.1", - "semantic-release-flutter-plugin": "^1.1.2" - } - }, - "node_modules/@actions/core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", - "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", - "dev": true, - "dependencies": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "node_modules/@actions/http-client": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz", - "integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==", - "dev": true, - "dependencies": { - "tunnel": "^0.0.6" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@colors/colors": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", - "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@octokit/auth-token": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.3.tgz", - "integrity": "sha512-/aFM2M4HVDBT/jjDBa84sJniv1t9Gm/rLkalaz9htOm+L+8JMj1k9w0CkUdcxNyNxZPlTxKPVko+m1VlM58ZVA==", - "dev": true, - "dependencies": { - "@octokit/types": "^9.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@octokit/core": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.0.tgz", - "integrity": "sha512-AgvDRUg3COpR82P7PBdGZF/NNqGmtMq2NiPqeSsDIeCfYFOZ9gddqWNQHnFdEUf+YwOj4aZYmJnlPp7OXmDIDg==", - "dev": true, - "dependencies": { - "@octokit/auth-token": "^3.0.0", - "@octokit/graphql": "^5.0.0", - "@octokit/request": "^6.0.0", - "@octokit/request-error": "^3.0.0", - "@octokit/types": "^9.0.0", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@octokit/endpoint": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.5.tgz", - "integrity": "sha512-LG4o4HMY1Xoaec87IqQ41TQ+glvIeTKqfjkCEmt5AIwDZJwQeVZFIEYXrYY6yLwK+pAScb9Gj4q+Nz2qSw1roA==", - "dev": true, - "dependencies": { - "@octokit/types": "^9.0.0", - "is-plain-object": "^5.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@octokit/graphql": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.5.tgz", - "integrity": "sha512-Qwfvh3xdqKtIznjX9lz2D458r7dJPP8l6r4GQkIdWQouZwHQK0mVT88uwiU2bdTU2OtT1uOlKpRciUWldpG0yQ==", - "dev": true, - "dependencies": { - "@octokit/request": "^6.0.0", - "@octokit/types": "^9.0.0", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@octokit/openapi-types": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-16.0.0.tgz", - "integrity": "sha512-JbFWOqTJVLHZSUUoF4FzAZKYtqdxWu9Z5m2QQnOyEa04fOFljvyh7D3GYKbfuaSWisqehImiVIMG4eyJeP5VEA==", - "dev": true - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.0.0.tgz", - "integrity": "sha512-Sq5VU1PfT6/JyuXPyt04KZNVsFOSBaYOAq2QRZUwzVlI10KFvcbUo8lR258AAQL1Et60b0WuVik+zOWKLuDZxw==", - "dev": true, - "dependencies": { - "@octokit/types": "^9.0.0" - }, - "engines": { - "node": ">= 14" - }, - "peerDependencies": { - "@octokit/core": ">=4" - } - }, - "node_modules/@octokit/plugin-request-log": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz", - "integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==", - "dev": true, - "peerDependencies": { - "@octokit/core": ">=3" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.0.1.tgz", - "integrity": "sha512-pnCaLwZBudK5xCdrR823xHGNgqOzRnJ/mpC/76YPpNP7DybdsJtP7mdOwh+wYZxK5jqeQuhu59ogMI4NRlBUvA==", - "dev": true, - "dependencies": { - "@octokit/types": "^9.0.0", - "deprecation": "^2.3.1" - }, - "engines": { - "node": ">= 14" - }, - "peerDependencies": { - "@octokit/core": ">=3" - } - }, - "node_modules/@octokit/request": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.3.tgz", - "integrity": "sha512-TNAodj5yNzrrZ/VxP+H5HiYaZep0H3GU0O7PaF+fhDrt8FPrnkei9Aal/txsN/1P7V3CPiThG0tIvpPDYUsyAA==", - "dev": true, - "dependencies": { - "@octokit/endpoint": "^7.0.0", - "@octokit/request-error": "^3.0.0", - "@octokit/types": "^9.0.0", - "is-plain-object": "^5.0.0", - "node-fetch": "^2.6.7", - "universal-user-agent": "^6.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@octokit/request-error": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz", - "integrity": "sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==", - "dev": true, - "dependencies": { - "@octokit/types": "^9.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@octokit/rest": { - "version": "19.0.7", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-19.0.7.tgz", - "integrity": "sha512-HRtSfjrWmWVNp2uAkEpQnuGMJsu/+dBr47dRc5QVgsCbnIc1+GFEaoKBWkYG+zjrsHpSqcAElMio+n10c0b5JA==", - "dev": true, - "dependencies": { - "@octokit/core": "^4.1.0", - "@octokit/plugin-paginate-rest": "^6.0.0", - "@octokit/plugin-request-log": "^1.0.4", - "@octokit/plugin-rest-endpoint-methods": "^7.0.0" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@octokit/types": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.0.0.tgz", - "integrity": "sha512-LUewfj94xCMH2rbD5YJ+6AQ4AVjFYTgpp6rboWM5T7N3IsIF65SBEOVcYMGAEzO/kKNiNaW4LoWtoThOhH06gw==", - "dev": true, - "dependencies": { - "@octokit/openapi-types": "^16.0.0" - } - }, - "node_modules/@pnpm/config.env-replace": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.0.0.tgz", - "integrity": "sha512-ZVPVDi1E8oeXlYqkGRtX0CkzLTwE2zt62bjWaWKaAvI8NZqHzlMvGeSNDpW+JB3+aKanYb4UETJOF1/CxGPemA==", - "dev": true, - "engines": { - "node": ">=12.22.0" - } - }, - "node_modules/@pnpm/network.ca-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz", - "integrity": "sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA==", - "dev": true, - "dependencies": { - "graceful-fs": "4.2.10" - }, - "engines": { - "node": ">=12.22.0" - } - }, - "node_modules/@pnpm/network.ca-file/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, - "node_modules/@pnpm/npm-conf": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-2.1.0.tgz", - "integrity": "sha512-Oe6ntvgsMTE3hDIqy6sajqHF+MnzJrOF06qC2QSiUEybLL7cp6tjoKUa32gpd9+KPVl4QyMs3E3nsXrx/Vdnlw==", - "dev": true, - "dependencies": { - "@pnpm/config.env-replace": "^1.0.0", - "@pnpm/network.ca-file": "^1.0.1", - "config-chain": "^1.1.11" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@saithodev/semantic-release-backmerge": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@saithodev/semantic-release-backmerge/-/semantic-release-backmerge-3.1.0.tgz", - "integrity": "sha512-92AN5eI8svpxeUD6cw2JjCrHHZVlWIxQ67SiSSwoI1UP4N5QohCOf9O/W3OUApxKg3C8Y0RpGt7TUpGEwGhXhw==", - "dev": true, - "dependencies": { - "@semantic-release/error": "^3.0.0", - "aggregate-error": "^3.1.0", - "debug": "^4.3.4", - "execa": "^5.1.1", - "lodash": "^4.17.21", - "semantic-release": ">=20.0.0" - } - }, - "node_modules/@semantic-release/changelog": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-6.0.3.tgz", - "integrity": "sha512-dZuR5qByyfe3Y03TpmCvAxCyTnp7r5XwtHRf/8vD9EAn4ZWbavUX8adMtXYzE86EVh0gyLA7lm5yW4IV30XUag==", - "dev": true, - "dependencies": { - "@semantic-release/error": "^3.0.0", - "aggregate-error": "^3.0.0", - "fs-extra": "^11.0.0", - "lodash": "^4.17.4" - }, - "engines": { - "node": ">=14.17" - }, - "peerDependencies": { - "semantic-release": ">=18.0.0" - } - }, - "node_modules/@semantic-release/commit-analyzer": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-9.0.2.tgz", - "integrity": "sha512-E+dr6L+xIHZkX4zNMe6Rnwg4YQrWNXK+rNsvwOPpdFppvZO1olE2fIgWhv89TkQErygevbjsZFSIxp+u6w2e5g==", - "dev": true, - "dependencies": { - "conventional-changelog-angular": "^5.0.0", - "conventional-commits-filter": "^2.0.0", - "conventional-commits-parser": "^3.2.3", - "debug": "^4.0.0", - "import-from": "^4.0.0", - "lodash": "^4.17.4", - "micromatch": "^4.0.2" - }, - "engines": { - "node": ">=14.17" - }, - "peerDependencies": { - "semantic-release": ">=18.0.0-beta.1" - } - }, - "node_modules/@semantic-release/error": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-3.0.0.tgz", - "integrity": "sha512-5hiM4Un+tpl4cKw3lV4UgzJj+SmfNIDCLLw0TepzQxz9ZGV5ixnqkzIVF+3tp0ZHgcMKE+VNGHJjEeyFG2dcSw==", - "dev": true, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/@semantic-release/git": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/@semantic-release/git/-/git-10.0.1.tgz", - "integrity": "sha512-eWrx5KguUcU2wUPaO6sfvZI0wPafUKAMNC18aXY4EnNcrZL86dEmpNVnC9uMpGZkmZJ9EfCVJBQx4pV4EMGT1w==", - "dev": true, - "dependencies": { - "@semantic-release/error": "^3.0.0", - "aggregate-error": "^3.0.0", - "debug": "^4.0.0", - "dir-glob": "^3.0.0", - "execa": "^5.0.0", - "lodash": "^4.17.4", - "micromatch": "^4.0.0", - "p-reduce": "^2.0.0" - }, - "engines": { - "node": ">=14.17" - }, - "peerDependencies": { - "semantic-release": ">=18.0.0" - } - }, - "node_modules/@semantic-release/github": { - "version": "8.0.7", - "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-8.0.7.tgz", - "integrity": "sha512-VtgicRIKGvmTHwm//iqTh/5NGQwsncOMR5vQK9pMT92Aem7dv37JFKKRuulUsAnUOIlO4G8wH3gPiBAA0iW0ww==", - "dev": true, - "dependencies": { - "@octokit/rest": "^19.0.0", - "@semantic-release/error": "^3.0.0", - "aggregate-error": "^3.0.0", - "bottleneck": "^2.18.1", - "debug": "^4.0.0", - "dir-glob": "^3.0.0", - "fs-extra": "^11.0.0", - "globby": "^11.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "issue-parser": "^6.0.0", - "lodash": "^4.17.4", - "mime": "^3.0.0", - "p-filter": "^2.0.0", - "p-retry": "^4.0.0", - "url-join": "^4.0.0" - }, - "engines": { - "node": ">=14.17" - }, - "peerDependencies": { - "semantic-release": ">=18.0.0-beta.1" - } - }, - "node_modules/@semantic-release/npm": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-10.0.2.tgz", - "integrity": "sha512-Mo0XoBza4pUapxiBhLLYXeSZ9tkuHDUd/WvMbpilwuPRfJDnQXMqx5tBVon8d2mBk8JXmXpqB+ExhlWJmVT40A==", - "dev": true, - "dependencies": { - "@semantic-release/error": "^3.0.0", - "aggregate-error": "^4.0.1", - "execa": "^7.0.0", - "fs-extra": "^11.0.0", - "lodash-es": "^4.17.21", - "nerf-dart": "^1.0.0", - "normalize-url": "^8.0.0", - "npm": "^9.5.0", - "rc": "^1.2.8", - "read-pkg": "^7.0.0", - "registry-auth-token": "^5.0.0", - "semver": "^7.1.2", - "tempy": "^3.0.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "semantic-release": ">=20.1.0" - } - }, - "node_modules/@semantic-release/npm/node_modules/aggregate-error": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", - "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", - "dev": true, - "dependencies": { - "clean-stack": "^4.0.0", - "indent-string": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/clean-stack": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", - "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", - "dev": true, - "dependencies": { - "escape-string-regexp": "5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/crypto-random-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", - "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", - "dev": true, - "dependencies": { - "type-fest": "^1.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/crypto-random-string/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/execa": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", - "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^14.18.0 || ^16.14.0 || >=18.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@semantic-release/npm/node_modules/human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", - "dev": true, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/@semantic-release/npm/node_modules/indent-string": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", - "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/normalize-url": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", - "integrity": "sha512-uVFpKhj5MheNBJRTiMZ9pE/7hD1QTeEvugSJW/OmLzAp78PB5O6adfMNTvmfKhXBkvCzC+rqifWcVYpGFwTjnw==", - "dev": true, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - }, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/tempy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.0.0.tgz", - "integrity": "sha512-B2I9X7+o2wOaW4r/CWMkpOO9mdiTRCxXNgob6iGvPmfPWgH/KyUD6Uy5crtWBxIBe3YrNZKR2lSzv1JJKWD4vA==", - "dev": true, - "dependencies": { - "is-stream": "^3.0.0", - "temp-dir": "^2.0.0", - "type-fest": "^2.12.2", - "unique-string": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/type-fest": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", - "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/npm/node_modules/unique-string": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", - "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", - "dev": true, - "dependencies": { - "crypto-random-string": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/release-notes-generator": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-10.0.3.tgz", - "integrity": "sha512-k4x4VhIKneOWoBGHkx0qZogNjCldLPRiAjnIpMnlUh6PtaWXp/T+C9U7/TaNDDtgDa5HMbHl4WlREdxHio6/3w==", - "dev": true, - "dependencies": { - "conventional-changelog-angular": "^5.0.0", - "conventional-changelog-writer": "^5.0.0", - "conventional-commits-filter": "^2.0.0", - "conventional-commits-parser": "^3.2.3", - "debug": "^4.0.0", - "get-stream": "^6.0.0", - "import-from": "^4.0.0", - "into-stream": "^6.0.0", - "lodash": "^4.17.4", - "read-pkg-up": "^7.0.0" - }, - "engines": { - "node": ">=14.17" - }, - "peerDependencies": { - "semantic-release": ">=18.0.0-beta.1" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@semantic-release/release-notes-generator/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/@types/minimist": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true - }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true - }, - "node_modules/@types/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", - "dev": true - }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-escapes": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", - "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", - "dev": true, - "dependencies": { - "type-fest": "^1.0.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/ansicolors": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", - "integrity": "sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==", - "dev": true - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/argv-formatter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/argv-formatter/-/argv-formatter-1.0.0.tgz", - "integrity": "sha512-F2+Hkm9xFaRg+GkaNnbwXNDV5O6pnCFEmqyhvfC/Ic5LbgOWjJh3L+mN/s91rxVL3znE7DYVpW0GJFT+4YBgWw==", - "dev": true - }, - "node_modules/array-ify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", - "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", - "dev": true - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/before-after-hook": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", - "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", - "dev": true - }, - "node_modules/bottleneck": { - "version": "2.19.5", - "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", - "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", - "dev": true - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "dependencies": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cardinal": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", - "integrity": "sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==", - "dev": true, - "dependencies": { - "ansicolors": "~0.3.2", - "redeyed": "~2.1.0" - }, - "bin": { - "cdl": "bin/cdl.js" - } - }, - "node_modules/chalk": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", - "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/cli-table3": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0" - }, - "engines": { - "node": "10.* || >= 12.*" - }, - "optionalDependencies": { - "@colors/colors": "1.5.0" - } - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/compare-func": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", - "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", - "dev": true, - "dependencies": { - "array-ify": "^1.0.0", - "dot-prop": "^5.1.0" - } - }, - "node_modules/config-chain": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", - "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", - "dev": true, - "dependencies": { - "ini": "^1.3.4", - "proto-list": "~1.2.1" - } - }, - "node_modules/conventional-changelog-angular": { - "version": "5.0.13", - "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz", - "integrity": "sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA==", - "dev": true, - "dependencies": { - "compare-func": "^2.0.0", - "q": "^1.5.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-changelog-writer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz", - "integrity": "sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ==", - "dev": true, - "dependencies": { - "conventional-commits-filter": "^2.0.7", - "dateformat": "^3.0.0", - "handlebars": "^4.7.7", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "semver": "^6.0.0", - "split": "^1.0.0", - "through2": "^4.0.0" - }, - "bin": { - "conventional-changelog-writer": "cli.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-changelog-writer/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/conventional-commits-filter": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz", - "integrity": "sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA==", - "dev": true, - "dependencies": { - "lodash.ismatch": "^4.4.0", - "modify-values": "^1.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-commits-parser": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz", - "integrity": "sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q==", - "dev": true, - "dependencies": { - "is-text-path": "^1.0.1", - "JSONStream": "^1.0.4", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "split2": "^3.0.0", - "through2": "^4.0.0" - }, - "bin": { - "conventional-commits-parser": "cli.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true - }, - "node_modules/cosmiconfig": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.1.2.tgz", - "integrity": "sha512-rmpUFKMZiawLfug8sP4NbpBSOpWftZB6UACOLEiNbnRAYM1TzgQuTWlMYFRuPgmoTCkcOxSMwQJQpJmiXv/eHw==", - "dev": true, - "dependencies": { - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/d-fischer" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decamelize-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", - "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", - "dev": true, - "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", - "dev": true, - "dependencies": { - "readable-stream": "^2.0.2" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/env-ci": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-9.0.0.tgz", - "integrity": "sha512-Q3cjr1tX9xwigprw4G8M3o7PIOO/1LYji6TyGsbD1WfMmD23etZvhgmPXJqkP788yH4dgSSK7oaIMuaayUJIfg==", - "dev": true, - "dependencies": { - "execa": "^7.0.0", - "java-properties": "^1.0.2" - }, - "engines": { - "node": "^16.14 || >=18" - } - }, - "node_modules/env-ci/node_modules/execa": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", - "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^14.18.0 || ^16.14.0 || >=18.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/env-ci/node_modules/human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", - "dev": true, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/env-ci/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/env-ci/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/figures": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", - "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^5.0.0", - "is-unicode-supported": "^1.2.0" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-versions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-5.1.0.tgz", - "integrity": "sha512-+iwzCJ7C5v5KgcBuueqVoNiHVoQpwiUK5XFLjf0affFTep+Wcw93tPvmb8tqujDNmzhBDPddnWV/qgWSXgq+Hg==", - "dev": true, - "dependencies": { - "semver-regex": "^4.0.5" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/from2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "node_modules/fs-extra": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.0.tgz", - "integrity": "sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/git-log-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/git-log-parser/-/git-log-parser-1.2.0.tgz", - "integrity": "sha512-rnCVNfkTL8tdNryFuaY0fYiBWEBcgF748O6ZI61rslBvr2o7U65c2/6npCRqH40vuAhtgtDiqLTJjBVdrejCzA==", - "dev": true, - "dependencies": { - "argv-formatter": "~1.0.0", - "spawn-error-forwarder": "~1.0.0", - "split2": "~1.0.0", - "stream-combiner2": "~1.1.1", - "through2": "~2.0.0", - "traverse": "~0.6.6" - } - }, - "node_modules/git-log-parser/node_modules/split2": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-1.0.0.tgz", - "integrity": "sha512-NKywug4u4pX/AZBB1FCPzZ6/7O+Xhz1qMVbzTvvKvikjO99oPN87SkK08mEY9P63/5lWjK+wgOOgApnTg5r6qg==", - "dev": true, - "dependencies": { - "through2": "~2.0.0" - } - }, - "node_modules/git-log-parser/node_modules/through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "dev": true, - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/hook-std": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-3.0.0.tgz", - "integrity": "sha512-jHRQzjSDzMtFy34AGj1DN+vq54WVuhSvKgrHf0OMiFQTwDD4L/qqofVEWjLOBMTn5+lCD3fPg32W9yOfnEJTTw==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/hosted-git-info": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz", - "integrity": "sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==", - "dev": true, - "dependencies": { - "lru-cache": "^7.5.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dev": true, - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-fresh/node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/import-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-from/-/import-from-4.0.0.tgz", - "integrity": "sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ==", - "dev": true, - "engines": { - "node": ">=12.2" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - }, - "node_modules/into-stream": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-6.0.0.tgz", - "integrity": "sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA==", - "dev": true, - "dependencies": { - "from2": "^2.3.0", - "p-is-promise": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-text-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", - "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==", - "dev": true, - "dependencies": { - "text-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-unicode-supported": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", - "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/issue-parser": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz", - "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==", - "dev": true, - "dependencies": { - "lodash.capitalize": "^4.2.1", - "lodash.escaperegexp": "^4.1.2", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.uniqby": "^4.7.0" - }, - "engines": { - "node": ">=10.13" - } - }, - "node_modules/java-properties": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", - "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", - "dev": true, - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", - "dev": true, - "engines": [ - "node >= 0.2.0" - ] - }, - "node_modules/JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", - "dev": true, - "dependencies": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - }, - "bin": { - "JSONStream": "bin.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", - "dev": true - }, - "node_modules/lodash.capitalize": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", - "integrity": "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==", - "dev": true - }, - "node_modules/lodash.escaperegexp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", - "integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==", - "dev": true - }, - "node_modules/lodash.ismatch": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", - "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", - "dev": true - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", - "dev": true - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", - "dev": true - }, - "node_modules/lodash.uniqby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", - "integrity": "sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==", - "dev": true - }, - "node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/marked": { - "version": "4.2.12", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz", - "integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==", - "dev": true, - "bin": { - "marked": "bin/marked.js" - }, - "engines": { - "node": ">= 12" - } - }, - "node_modules/marked-terminal": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-5.1.1.tgz", - "integrity": "sha512-+cKTOx9P4l7HwINYhzbrBSyzgxO2HaHKGZGuB1orZsMIgXYaJyfidT81VXRdpelW/PcHEWxywscePVgI/oUF6g==", - "dev": true, - "dependencies": { - "ansi-escapes": "^5.0.0", - "cardinal": "^2.1.1", - "chalk": "^5.0.0", - "cli-table3": "^0.6.1", - "node-emoji": "^1.11.0", - "supports-hyperlinks": "^2.2.0" - }, - "engines": { - "node": ">=14.13.1 || >=16.0.0" - }, - "peerDependencies": { - "marked": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" - } - }, - "node_modules/meow": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", - "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", - "dev": true, - "dependencies": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/min-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/modify-values": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", - "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node_modules/nerf-dart": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/nerf-dart/-/nerf-dart-1.0.0.tgz", - "integrity": "sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==", - "dev": true - }, - "node_modules/node-emoji": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", - "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", - "dev": true, - "dependencies": { - "lodash": "^4.17.21" - } - }, - "node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/normalize-package-data/node_modules/hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/normalize-package-data/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm": { - "version": "9.6.2", - "resolved": "https://registry.npmjs.org/npm/-/npm-9.6.2.tgz", - "integrity": "sha512-TnXoXhlFkH/9wI4+aXSq0aPLwKG7Ge17t1ME4/rQt+0DZWQCRk9PwhBuX/shqdUiHeKicSLSkzWx+QZgTRE+/A==", - "bundleDependencies": [ - "@isaacs/string-locale-compare", - "@npmcli/arborist", - "@npmcli/config", - "@npmcli/map-workspaces", - "@npmcli/package-json", - "@npmcli/run-script", - "abbrev", - "archy", - "cacache", - "chalk", - "ci-info", - "cli-columns", - "cli-table3", - "columnify", - "fastest-levenshtein", - "fs-minipass", - "glob", - "graceful-fs", - "hosted-git-info", - "ini", - "init-package-json", - "is-cidr", - "json-parse-even-better-errors", - "libnpmaccess", - "libnpmdiff", - "libnpmexec", - "libnpmfund", - "libnpmhook", - "libnpmorg", - "libnpmpack", - "libnpmpublish", - "libnpmsearch", - "libnpmteam", - "libnpmversion", - "make-fetch-happen", - "minimatch", - "minipass", - "minipass-pipeline", - "ms", - "node-gyp", - "nopt", - "npm-audit-report", - "npm-install-checks", - "npm-package-arg", - "npm-pick-manifest", - "npm-profile", - "npm-registry-fetch", - "npm-user-validate", - "npmlog", - "p-map", - "pacote", - "parse-conflict-json", - "proc-log", - "qrcode-terminal", - "read", - "read-package-json", - "read-package-json-fast", - "semver", - "ssri", - "tar", - "text-table", - "tiny-relative-date", - "treeverse", - "validate-npm-package-name", - "which", - "write-file-atomic" - ], - "dev": true, - "dependencies": { - "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^6.2.5", - "@npmcli/config": "^6.1.4", - "@npmcli/map-workspaces": "^3.0.2", - "@npmcli/package-json": "^3.0.0", - "@npmcli/run-script": "^6.0.0", - "abbrev": "^2.0.0", - "archy": "~1.0.0", - "cacache": "^17.0.4", - "chalk": "^4.1.2", - "ci-info": "^3.8.0", - "cli-columns": "^4.0.0", - "cli-table3": "^0.6.3", - "columnify": "^1.6.0", - "fastest-levenshtein": "^1.0.16", - "fs-minipass": "^3.0.1", - "glob": "^8.1.0", - "graceful-fs": "^4.2.10", - "hosted-git-info": "^6.1.1", - "ini": "^3.0.1", - "init-package-json": "^5.0.0", - "is-cidr": "^4.0.2", - "json-parse-even-better-errors": "^3.0.0", - "libnpmaccess": "^7.0.2", - "libnpmdiff": "^5.0.13", - "libnpmexec": "^5.0.13", - "libnpmfund": "^4.0.13", - "libnpmhook": "^9.0.3", - "libnpmorg": "^5.0.3", - "libnpmpack": "^5.0.13", - "libnpmpublish": "^7.1.2", - "libnpmsearch": "^6.0.2", - "libnpmteam": "^5.0.3", - "libnpmversion": "^4.0.2", - "make-fetch-happen": "^11.0.3", - "minimatch": "^6.2.0", - "minipass": "^4.2.4", - "minipass-pipeline": "^1.2.4", - "ms": "^2.1.2", - "node-gyp": "^9.3.1", - "nopt": "^7.0.0", - "npm-audit-report": "^4.0.0", - "npm-install-checks": "^6.0.0", - "npm-package-arg": "^10.1.0", - "npm-pick-manifest": "^8.0.1", - "npm-profile": "^7.0.1", - "npm-registry-fetch": "^14.0.3", - "npm-user-validate": "^2.0.0", - "npmlog": "^7.0.1", - "p-map": "^4.0.0", - "pacote": "^15.1.1", - "parse-conflict-json": "^3.0.0", - "proc-log": "^3.0.0", - "qrcode-terminal": "^0.12.0", - "read": "^2.0.0", - "read-package-json": "^6.0.0", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.8", - "ssri": "^10.0.1", - "tar": "^6.1.13", - "text-table": "~0.2.0", - "tiny-relative-date": "^1.3.0", - "treeverse": "^3.0.0", - "validate-npm-package-name": "^5.0.0", - "which": "^3.0.0", - "write-file-atomic": "^5.0.0" - }, - "bin": { - "npm": "bin/npm-cli.js", - "npx": "bin/npx-cli.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/@colors/colors": { - "version": "1.5.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/npm/node_modules/@gar/promisify": { - "version": "1.1.3", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/@isaacs/string-locale-compare": { - "version": "1.1.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/@npmcli/arborist": { - "version": "6.2.5", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/fs": "^3.1.0", - "@npmcli/installed-package-contents": "^2.0.2", - "@npmcli/map-workspaces": "^3.0.2", - "@npmcli/metavuln-calculator": "^5.0.0", - "@npmcli/name-from-folder": "^2.0.0", - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^3.0.0", - "@npmcli/query": "^3.0.0", - "@npmcli/run-script": "^6.0.0", - "bin-links": "^4.0.1", - "cacache": "^17.0.4", - "common-ancestor-path": "^1.0.1", - "hosted-git-info": "^6.1.1", - "json-parse-even-better-errors": "^3.0.0", - "json-stringify-nice": "^1.1.4", - "minimatch": "^6.1.6", - "nopt": "^7.0.0", - "npm-install-checks": "^6.0.0", - "npm-package-arg": "^10.1.0", - "npm-pick-manifest": "^8.0.1", - "npm-registry-fetch": "^14.0.3", - "npmlog": "^7.0.1", - "pacote": "^15.0.8", - "parse-conflict-json": "^3.0.0", - "proc-log": "^3.0.0", - "promise-all-reject-late": "^1.0.0", - "promise-call-limit": "^1.0.1", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.7", - "ssri": "^10.0.1", - "treeverse": "^3.0.0", - "walk-up-path": "^1.0.0" - }, - "bin": { - "arborist": "bin/index.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/config": { - "version": "6.1.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/map-workspaces": "^3.0.2", - "ini": "^3.0.0", - "nopt": "^7.0.0", - "proc-log": "^3.0.0", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.5", - "walk-up-path": "^1.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/disparity-colors": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "ansi-styles": "^4.3.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/fs": { - "version": "3.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/git": { - "version": "4.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/promise-spawn": "^6.0.0", - "lru-cache": "^7.4.4", - "mkdirp": "^1.0.4", - "npm-pick-manifest": "^8.0.0", - "proc-log": "^3.0.0", - "promise-inflight": "^1.0.1", - "promise-retry": "^2.0.1", - "semver": "^7.3.5", - "which": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/installed-package-contents": { - "version": "2.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-bundled": "^3.0.0", - "npm-normalize-package-bin": "^3.0.0" - }, - "bin": { - "installed-package-contents": "lib/index.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/map-workspaces": { - "version": "3.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/name-from-folder": "^2.0.0", - "glob": "^8.0.1", - "minimatch": "^6.1.6", - "read-package-json-fast": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "cacache": "^17.0.0", - "json-parse-even-better-errors": "^3.0.0", - "pacote": "^15.0.0", - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/move-file": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "mkdirp": "^1.0.4", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/name-from-folder": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/node-gyp": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/package-json": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "json-parse-even-better-errors": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/promise-spawn": { - "version": "6.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "which": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/query": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "postcss-selector-parser": "^6.0.10" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@npmcli/run-script": { - "version": "6.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/promise-spawn": "^6.0.0", - "node-gyp": "^9.0.0", - "read-package-json-fast": "^3.0.0", - "which": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@sigstore/protobuf-specs": { - "version": "0.1.0", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/@tootallnate/once": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 10" - } - }, - "node_modules/npm/node_modules/@tufjs/models": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "minimatch": "^6.1.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/abbrev": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/abort-controller": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/npm/node_modules/agent-base": { - "version": "6.0.2", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/npm/node_modules/agentkeepalive": { - "version": "4.3.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "debug": "^4.1.0", - "depd": "^2.0.0", - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/npm/node_modules/aggregate-error": { - "version": "3.1.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/ansi-regex": { - "version": "5.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/npm/node_modules/aproba": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/archy": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/are-we-there-yet": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^4.1.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/balanced-match": { - "version": "1.0.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/base64-js": { - "version": "1.5.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/bin-links": { - "version": "4.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "cmd-shim": "^6.0.0", - "npm-normalize-package-bin": "^3.0.0", - "read-cmd-shim": "^4.0.0", - "write-file-atomic": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/binary-extensions": { - "version": "2.2.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/brace-expansion": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/npm/node_modules/buffer": { - "version": "6.0.3", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/npm/node_modules/builtins": { - "version": "5.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "semver": "^7.0.0" - } - }, - "node_modules/npm/node_modules/cacache": { - "version": "17.0.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/fs": "^3.1.0", - "fs-minipass": "^3.0.0", - "glob": "^8.0.1", - "lru-cache": "^7.7.1", - "minipass": "^4.0.0", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "ssri": "^10.0.0", - "tar": "^6.1.11", - "unique-filename": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/npm/node_modules/chownr": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/ci-info": { - "version": "3.8.0", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/cidr-regex": { - "version": "3.1.1", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause", - "dependencies": { - "ip-regex": "^4.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/clean-stack": { - "version": "2.2.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/npm/node_modules/cli-columns": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/npm/node_modules/cli-table3": { - "version": "0.6.3", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "string-width": "^4.2.0" - }, - "engines": { - "node": "10.* || >= 12.*" - }, - "optionalDependencies": { - "@colors/colors": "1.5.0" - } - }, - "node_modules/npm/node_modules/clone": { - "version": "1.0.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/npm/node_modules/cmd-shim": { - "version": "6.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/npm/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/color-support": { - "version": "1.1.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "bin": { - "color-support": "bin.js" - } - }, - "node_modules/npm/node_modules/columnify": { - "version": "1.6.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "strip-ansi": "^6.0.1", - "wcwidth": "^1.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/npm/node_modules/common-ancestor-path": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/concat-map": { - "version": "0.0.1", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/console-control-strings": { - "version": "1.1.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/cssesc": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm/node_modules/debug": { - "version": "4.3.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/npm/node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/defaults": { - "version": "1.0.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "clone": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm/node_modules/delegates": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/depd": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/npm/node_modules/diff": { - "version": "5.1.0", - "dev": true, - "inBundle": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/npm/node_modules/emoji-regex": { - "version": "8.0.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/encoding": { - "version": "0.1.13", - "dev": true, - "inBundle": true, - "license": "MIT", - "optional": true, - "dependencies": { - "iconv-lite": "^0.6.2" - } - }, - "node_modules/npm/node_modules/env-paths": { - "version": "2.2.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/npm/node_modules/err-code": { - "version": "2.0.3", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/event-target-shim": { - "version": "5.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/npm/node_modules/events": { - "version": "3.3.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.8.x" - } - }, - "node_modules/npm/node_modules/fastest-levenshtein": { - "version": "1.0.16", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 4.9.1" - } - }, - "node_modules/npm/node_modules/fs-minipass": { - "version": "3.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^4.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/fs.realpath": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/function-bind": { - "version": "1.1.1", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/gauge": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/glob": { - "version": "8.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/glob/node_modules/minimatch": { - "version": "5.1.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/graceful-fs": { - "version": "4.2.10", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/has": { - "version": "1.0.3", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/npm/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/has-unicode": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/hosted-git-info": { - "version": "6.1.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^7.5.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/http-cache-semantics": { - "version": "4.1.1", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause" - }, - "node_modules/npm/node_modules/http-proxy-agent": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/npm/node_modules/https-proxy-agent": { - "version": "5.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/npm/node_modules/humanize-ms": { - "version": "1.2.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "ms": "^2.0.0" - } - }, - "node_modules/npm/node_modules/iconv-lite": { - "version": "0.6.3", - "dev": true, - "inBundle": true, - "license": "MIT", - "optional": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm/node_modules/ieee754": { - "version": "1.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "BSD-3-Clause" - }, - "node_modules/npm/node_modules/ignore-walk": { - "version": "6.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minimatch": "^6.1.6" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/imurmurhash": { - "version": "0.1.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/npm/node_modules/indent-string": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/infer-owner": { - "version": "1.0.4", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/inflight": { - "version": "1.0.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/npm/node_modules/inherits": { - "version": "2.0.4", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/ini": { - "version": "3.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/init-package-json": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-package-arg": "^10.0.0", - "promzard": "^1.0.0", - "read": "^2.0.0", - "read-package-json": "^6.0.0", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4", - "validate-npm-package-name": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/ip": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/ip-regex": { - "version": "4.3.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/is-cidr": { - "version": "4.0.2", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause", - "dependencies": { - "cidr-regex": "^3.1.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/is-core-module": { - "version": "2.11.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/npm/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/is-lambda": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/isexe": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/json-parse-even-better-errors": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/json-stringify-nice": { - "version": "1.1.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/jsonparse": { - "version": "1.3.1", - "dev": true, - "engines": [ - "node >= 0.2.0" - ], - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/just-diff": { - "version": "5.2.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/just-diff-apply": { - "version": "5.5.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/libnpmaccess": { - "version": "7.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-package-arg": "^10.1.0", - "npm-registry-fetch": "^14.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmdiff": { - "version": "5.0.13", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/arborist": "^6.2.5", - "@npmcli/disparity-colors": "^3.0.0", - "@npmcli/installed-package-contents": "^2.0.2", - "binary-extensions": "^2.2.0", - "diff": "^5.1.0", - "minimatch": "^6.1.6", - "npm-package-arg": "^10.1.0", - "pacote": "^15.0.8", - "tar": "^6.1.13" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmexec": { - "version": "5.0.13", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/arborist": "^6.2.5", - "@npmcli/run-script": "^6.0.0", - "chalk": "^4.1.0", - "ci-info": "^3.7.1", - "npm-package-arg": "^10.1.0", - "npmlog": "^7.0.1", - "pacote": "^15.0.8", - "proc-log": "^3.0.0", - "read": "^2.0.0", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.7", - "walk-up-path": "^1.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmfund": { - "version": "4.0.13", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/arborist": "^6.2.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmhook": { - "version": "9.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^14.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmorg": { - "version": "5.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^14.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmpack": { - "version": "5.0.13", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/arborist": "^6.2.5", - "@npmcli/run-script": "^6.0.0", - "npm-package-arg": "^10.1.0", - "pacote": "^15.0.8" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmpublish": { - "version": "7.1.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "ci-info": "^3.6.1", - "normalize-package-data": "^5.0.0", - "npm-package-arg": "^10.1.0", - "npm-registry-fetch": "^14.0.3", - "proc-log": "^3.0.0", - "semver": "^7.3.7", - "sigstore": "^1.0.0", - "ssri": "^10.0.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmsearch": { - "version": "6.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-registry-fetch": "^14.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmteam": { - "version": "5.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "aproba": "^2.0.0", - "npm-registry-fetch": "^14.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/libnpmversion": { - "version": "4.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/git": "^4.0.1", - "@npmcli/run-script": "^6.0.0", - "json-parse-even-better-errors": "^3.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.7" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/lru-cache": { - "version": "7.18.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/npm/node_modules/make-fetch-happen": { - "version": "11.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^17.0.0", - "http-cache-semantics": "^4.1.1", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^4.0.0", - "minipass-fetch": "^3.0.0", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^10.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/minimatch": { - "version": "6.2.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/minipass": { - "version": "4.2.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minipass-collect": { - "version": "1.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/minipass-collect/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minipass-fetch": { - "version": "3.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "minipass": "^4.0.0", - "minipass-sized": "^1.0.3", - "minizlib": "^2.1.2" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - }, - "optionalDependencies": { - "encoding": "^0.1.13" - } - }, - "node_modules/npm/node_modules/minipass-flush": { - "version": "1.0.5", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minipass-json-stream": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "jsonparse": "^1.3.1", - "minipass": "^3.0.0" - } - }, - "node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minipass-pipeline": { - "version": "1.2.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minipass-sized": { - "version": "1.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/minizlib": { - "version": "2.1.2", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/mkdirp": { - "version": "1.0.4", - "dev": true, - "inBundle": true, - "license": "MIT", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/ms": { - "version": "2.1.3", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/mute-stream": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/negotiator": { - "version": "0.6.3", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/npm/node_modules/node-gyp": { - "version": "9.3.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "env-paths": "^2.2.0", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^10.0.3", - "nopt": "^6.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": "^12.13 || ^14.13 || >=16" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/@npmcli/fs": { - "version": "2.1.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@gar/promisify": "^1.1.3", - "semver": "^7.3.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/abbrev": { - "version": "1.1.1", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/node-gyp/node_modules/are-we-there-yet": { - "version": "3.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/brace-expansion": { - "version": "1.1.11", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/cacache": { - "version": "16.1.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/fs": "^2.1.0", - "@npmcli/move-file": "^2.0.0", - "chownr": "^2.0.0", - "fs-minipass": "^2.1.0", - "glob": "^8.0.1", - "infer-owner": "^1.0.4", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "mkdirp": "^1.0.4", - "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^3.0.2", - "ssri": "^9.0.0", - "tar": "^6.1.11", - "unique-filename": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/glob": { - "version": "8.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch": { - "version": "5.1.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/fs-minipass": { - "version": "2.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/gauge": { - "version": "4.0.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/glob": { - "version": "7.2.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/make-fetch-happen": { - "version": "10.2.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^16.1.0", - "http-cache-semantics": "^4.1.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^2.0.3", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^9.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/minimatch": { - "version": "3.1.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/minipass-fetch": { - "version": "2.1.2", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.1.6", - "minipass-sized": "^1.0.3", - "minizlib": "^2.1.2" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "optionalDependencies": { - "encoding": "^0.1.13" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/nopt": { - "version": "6.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.0" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/npmlog": { - "version": "6.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "are-we-there-yet": "^3.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.3", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/readable-stream": { - "version": "3.6.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/ssri": { - "version": "9.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.1.1" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/unique-filename": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "unique-slug": "^3.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/unique-slug": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/node-gyp/node_modules/which": { - "version": "2.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/nopt": { - "version": "7.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "abbrev": "^2.0.0" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/normalize-package-data": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^6.0.0", - "is-core-module": "^2.8.1", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-audit-report": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-bundled": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-normalize-package-bin": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-install-checks": { - "version": "6.0.0", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause", - "dependencies": { - "semver": "^7.1.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-normalize-package-bin": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-package-arg": { - "version": "10.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "hosted-git-info": "^6.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.5", - "validate-npm-package-name": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-packlist": { - "version": "7.0.4", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "ignore-walk": "^6.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-pick-manifest": { - "version": "8.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-install-checks": "^6.0.0", - "npm-normalize-package-bin": "^3.0.0", - "npm-package-arg": "^10.0.0", - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-profile": { - "version": "7.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "npm-registry-fetch": "^14.0.0", - "proc-log": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-registry-fetch": { - "version": "14.0.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "make-fetch-happen": "^11.0.0", - "minipass": "^4.0.0", - "minipass-fetch": "^3.0.0", - "minipass-json-stream": "^1.0.1", - "minizlib": "^2.1.2", - "npm-package-arg": "^10.0.0", - "proc-log": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npm-user-validate": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "BSD-2-Clause", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/npmlog": { - "version": "7.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "are-we-there-yet": "^4.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^5.0.0", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/once": { - "version": "1.4.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/npm/node_modules/p-map": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm/node_modules/pacote": { - "version": "15.1.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "@npmcli/git": "^4.0.0", - "@npmcli/installed-package-contents": "^2.0.1", - "@npmcli/promise-spawn": "^6.0.1", - "@npmcli/run-script": "^6.0.0", - "cacache": "^17.0.0", - "fs-minipass": "^3.0.0", - "minipass": "^4.0.0", - "npm-package-arg": "^10.0.0", - "npm-packlist": "^7.0.0", - "npm-pick-manifest": "^8.0.0", - "npm-registry-fetch": "^14.0.0", - "proc-log": "^3.0.0", - "promise-retry": "^2.0.1", - "read-package-json": "^6.0.0", - "read-package-json-fast": "^3.0.0", - "sigstore": "^1.0.0", - "ssri": "^10.0.0", - "tar": "^6.1.11" - }, - "bin": { - "pacote": "lib/bin.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/parse-conflict-json": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "json-parse-even-better-errors": "^3.0.0", - "just-diff": "^5.0.1", - "just-diff-apply": "^5.2.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/path-is-absolute": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm/node_modules/postcss-selector-parser": { - "version": "6.0.11", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm/node_modules/proc-log": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/process": { - "version": "0.11.10", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/npm/node_modules/promise-all-reject-late": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/promise-call-limit": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/promise-inflight": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/promise-retry": { - "version": "2.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "err-code": "^2.0.2", - "retry": "^0.12.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/promzard": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "read": "^2.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/qrcode-terminal": { - "version": "0.12.0", - "dev": true, - "inBundle": true, - "bin": { - "qrcode-terminal": "bin/qrcode-terminal.js" - } - }, - "node_modules/npm/node_modules/read": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "mute-stream": "~1.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/read-cmd-shim": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/read-package-json": { - "version": "6.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "glob": "^8.0.1", - "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^5.0.0", - "npm-normalize-package-bin": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/read-package-json-fast": { - "version": "3.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "json-parse-even-better-errors": "^3.0.0", - "npm-normalize-package-bin": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/readable-stream": { - "version": "4.3.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/npm/node_modules/retry": { - "version": "0.12.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/npm/node_modules/rimraf": { - "version": "3.0.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/rimraf/node_modules/brace-expansion": { - "version": "1.1.11", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/npm/node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/npm/node_modules/rimraf/node_modules/minimatch": { - "version": "3.1.2", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/npm/node_modules/safe-buffer": { - "version": "5.1.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/safer-buffer": { - "version": "2.1.2", - "dev": true, - "inBundle": true, - "license": "MIT", - "optional": true - }, - "node_modules/npm/node_modules/semver": { - "version": "7.3.8", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/set-blocking": { - "version": "2.0.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/signal-exit": { - "version": "3.0.7", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/sigstore": { - "version": "1.1.1", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "dependencies": { - "@sigstore/protobuf-specs": "^0.1.0", - "make-fetch-happen": "^11.0.1", - "tuf-js": "^1.0.0" - }, - "bin": { - "sigstore": "bin/sigstore.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/smart-buffer": { - "version": "4.2.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/npm/node_modules/socks": { - "version": "2.7.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "ip": "^2.0.0", - "smart-buffer": "^4.2.0" - }, - "engines": { - "node": ">= 10.13.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/npm/node_modules/socks-proxy-agent": { - "version": "7.0.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "agent-base": "^6.0.2", - "debug": "^4.3.3", - "socks": "^2.6.2" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/npm/node_modules/spdx-correct": { - "version": "3.2.0", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/npm/node_modules/spdx-exceptions": { - "version": "2.3.0", - "dev": true, - "inBundle": true, - "license": "CC-BY-3.0" - }, - "node_modules/npm/node_modules/spdx-expression-parse": { - "version": "3.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/npm/node_modules/spdx-license-ids": { - "version": "3.0.12", - "dev": true, - "inBundle": true, - "license": "CC0-1.0" - }, - "node_modules/npm/node_modules/ssri": { - "version": "10.0.1", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^4.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/npm/node_modules/string-width": { - "version": "4.2.3", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/tar": { - "version": "6.1.13", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^4.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { - "version": "2.1.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm/node_modules/text-table": { - "version": "0.2.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/tiny-relative-date": { - "version": "1.3.0", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/treeverse": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/tuf-js": { - "version": "1.1.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "@tufjs/models": "1.0.0", - "make-fetch-happen": "^11.0.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/unique-filename": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "unique-slug": "^4.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/unique-slug": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/util-deprecate": { - "version": "1.0.2", - "dev": true, - "inBundle": true, - "license": "MIT" - }, - "node_modules/npm/node_modules/validate-npm-package-license": { - "version": "3.0.4", - "dev": true, - "inBundle": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/npm/node_modules/validate-npm-package-name": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "builtins": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/walk-up-path": { - "version": "1.0.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/wcwidth": { - "version": "1.0.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "dependencies": { - "defaults": "^1.0.3" - } - }, - "node_modules/npm/node_modules/which": { - "version": "3.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/which.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/wide-align": { - "version": "1.1.5", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, - "node_modules/npm/node_modules/wrappy": { - "version": "1.0.2", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/npm/node_modules/write-file-atomic": { - "version": "5.0.0", - "dev": true, - "inBundle": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/npm/node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "inBundle": true, - "license": "ISC" - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-each-series": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-3.0.0.tgz", - "integrity": "sha512-lastgtAdoH9YaLyDa5i5z64q+kzOcQHsQ5SsZJD3q0VEyI8mq872S3geuNbRUQLVAE9siMfgKrpj7MloKFHruw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-filter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", - "integrity": "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==", - "dev": true, - "dependencies": { - "p-map": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-is-promise": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", - "integrity": "sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-map": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", - "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/p-reduce": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", - "integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-retry": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", - "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", - "dev": true, - "dependencies": { - "@types/retry": "0.12.0", - "retry": "^0.13.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", - "integrity": "sha512-C+VUP+8jis7EsQZIhDYmS5qlNtjv2yP4SNtjXK9AP1ZcTRlnSfuumaTnRfYZnYgUUYVIKqL0fRvmUGDV2fmp6g==", - "dev": true, - "dependencies": { - "find-up": "^2.0.0", - "load-json-file": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf/node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf/node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf/node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/pkg-conf/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "node_modules/proto-list": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", - "dev": true - }, - "node_modules/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", - "dev": true, - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "dependencies": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - }, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", - "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg/node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "node_modules/read-pkg/node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/read-pkg/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/redent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", - "dev": true, - "dependencies": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/redeyed": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz", - "integrity": "sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==", - "dev": true, - "dependencies": { - "esprima": "~4.0.0" - } - }, - "node_modules/registry-auth-token": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", - "integrity": "sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==", - "dev": true, - "dependencies": { - "@pnpm/npm-conf": "^2.1.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/semantic-release": { - "version": "21.0.1", - "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-21.0.1.tgz", - "integrity": "sha512-UhGxTUXHJQCBFgEQRZszLOHDpMduDSHGq3Q+30Bu+g0GbXh/EW508+kuFHezP5m0mN8xINW8hooiR3dzSV5ZLA==", - "dev": true, - "dependencies": { - "@semantic-release/commit-analyzer": "^9.0.2", - "@semantic-release/error": "^3.0.0", - "@semantic-release/github": "^8.0.0", - "@semantic-release/npm": "^10.0.2", - "@semantic-release/release-notes-generator": "^10.0.0", - "aggregate-error": "^4.0.1", - "cosmiconfig": "^8.0.0", - "debug": "^4.0.0", - "env-ci": "^9.0.0", - "execa": "^7.0.0", - "figures": "^5.0.0", - "find-versions": "^5.1.0", - "get-stream": "^6.0.0", - "git-log-parser": "^1.2.0", - "hook-std": "^3.0.0", - "hosted-git-info": "^6.0.0", - "lodash-es": "^4.17.21", - "marked": "^4.1.0", - "marked-terminal": "^5.1.1", - "micromatch": "^4.0.2", - "p-each-series": "^3.0.0", - "p-reduce": "^3.0.0", - "read-pkg-up": "^9.1.0", - "resolve-from": "^5.0.0", - "semver": "^7.3.2", - "semver-diff": "^4.0.0", - "signale": "^1.2.1", - "yargs": "^17.5.1" - }, - "bin": { - "semantic-release": "bin/semantic-release.js" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/semantic-release-export-data": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/semantic-release-export-data/-/semantic-release-export-data-1.0.1.tgz", - "integrity": "sha512-6vlgrrzzcMi/REhQd65Bh4dfSKmgwXOJ/Q2RVlT9WsU4Ya1T2qGpkSrMfG/n6oFRrqBdbDlyZgxNd94ziW+vSg==", - "dev": true, - "dependencies": { - "@actions/core": "^1.10.0" - }, - "peerDependencies": { - "semantic-release": ">=18" - } - }, - "node_modules/semantic-release-flutter-plugin": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/semantic-release-flutter-plugin/-/semantic-release-flutter-plugin-1.1.2.tgz", - "integrity": "sha512-z0TcuNwaF9kzPXHIxGNFm/aasRJr5th1e6mf33xxAMnD2mBT55JIohguP7o01mGJEVFoc2ftbfvdtcE1+esSEA==", - "dev": true, - "dependencies": { - "semantic-release": "^21.0.1", - "semver": "^7.5.0", - "yaml": "^2.2.1" - } - }, - "node_modules/semantic-release-flutter-plugin/node_modules/yaml": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.2.tgz", - "integrity": "sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA==", - "dev": true, - "engines": { - "node": ">= 14" - } - }, - "node_modules/semantic-release/node_modules/aggregate-error": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", - "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", - "dev": true, - "dependencies": { - "clean-stack": "^4.0.0", - "indent-string": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/clean-stack": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", - "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", - "dev": true, - "dependencies": { - "escape-string-regexp": "5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/execa": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", - "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^14.18.0 || ^16.14.0 || >=18.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/semantic-release/node_modules/human-signals": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.0.tgz", - "integrity": "sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ==", - "dev": true, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/semantic-release/node_modules/indent-string": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", - "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/p-reduce": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", - "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semantic-release/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-4.0.0.tgz", - "integrity": "sha512-0Ju4+6A8iOnpL/Thra7dZsSlOHYAHIeMxfhWQRI1/VLcT3WDBZKKtQt/QkBOsiIN9ZpuvHE6cGZ0x4glCMmfiA==", - "dev": true, - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semver-regex": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", - "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/signale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", - "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", - "dev": true, - "dependencies": { - "chalk": "^2.3.2", - "figures": "^2.0.0", - "pkg-conf": "^2.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/signale/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/signale/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/signale/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/signale/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/signale/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/signale/node_modules/figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/signale/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/signale/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/spawn-error-forwarder": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/spawn-error-forwarder/-/spawn-error-forwarder-1.0.0.tgz", - "integrity": "sha512-gRjMgK5uFjbCvdibeGJuy3I5OYz6VLoVdsOJdA6wV0WlfQVLFueoqMxwwYD9RODdgb6oUIvlRlsyFSiQkMKu0g==", - "dev": true - }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", - "dev": true, - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.13", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz", - "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==", - "dev": true - }, - "node_modules/split": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", - "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", - "dev": true, - "dependencies": { - "through": "2" - }, - "engines": { - "node": "*" - } - }, - "node_modules/split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", - "dev": true, - "dependencies": { - "readable-stream": "^3.0.0" - } - }, - "node_modules/split2/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/stream-combiner2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", - "integrity": "sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==", - "dev": true, - "dependencies": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" - } - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-indent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", - "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", - "dev": true, - "dependencies": { - "min-indent": "^1.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-hyperlinks": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", - "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/temp-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz", - "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-extensions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", - "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", - "dev": true, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true - }, - "node_modules/through2": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", - "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", - "dev": true, - "dependencies": { - "readable-stream": "3" - } - }, - "node_modules/through2/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, - "node_modules/traverse": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.7.tgz", - "integrity": "sha512-/y956gpUo9ZNCb99YjxG7OaslxZWHfCHAUUfshwqOXmxUIvqLjVO581BT+gM59+QV9tFe6/CGG53tsA1Y7RSdg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/trim-newlines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", - "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "dev": true, - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "dev": true, - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/universal-user-agent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", - "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==", - "dev": true - }, - "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/url-join": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", - "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", - "dev": true - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true, - "engines": { - "node": ">=0.4" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yargs": { - "version": "17.7.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", - "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", - "dev": true, - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 9641fca8e1..0000000000 --- a/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "devDependencies": { - "@saithodev/semantic-release-backmerge": "^3.1.0", - "@semantic-release/changelog": "^6.0.3", - "@semantic-release/git": "^10.0.1", - "semantic-release": "^21.0.1", - "semantic-release-export-data": "^1.0.1", - "semantic-release-flutter-plugin": "^1.1.2" - } -} diff --git a/pubspec.yaml b/pubspec.yaml deleted file mode 100644 index d902b20658..0000000000 --- a/pubspec.yaml +++ /dev/null @@ -1,93 +0,0 @@ -name: revanced_manager -description: Patch your favorite apps, right on your device. -homepage: https://github.com/revanced/revanced-manager - -publish_to: 'none' - -version: 1.8.0+100800000 - -environment: - sdk: '>=3.0.0 <4.0.0' - -dependencies: - animations: ^2.0.7 - collection: ^1.17.0 - cross_connectivity: ^3.0.5 - cr_file_saver: - git: - url: https://github.com/dhruvanbhalara/cr_file_saver - ref: "fix/incorrect_file_name" - device_apps: - git: - url: https://github.com/ponces/flutter_plugin_device_apps - ref: revanced-manager - device_info_plus: ^8.1.0 - dynamic_color: ^1.6.3 - dio: ^5.0.0 - dynamic_themes: ^1.1.0 - expandable: ^5.0.1 - file_picker: - git: - url: https://github.com/alexmercerind/flutter_file_picker - ref: master - flex_color_scheme: ^7.0.1 - flutter: - sdk: flutter - flutter_background: ^1.2.0 - flutter_cache_manager: ^3.3.0 - flutter_i18n: ^0.33.0 - flutter_local_notifications: ^13.0.0 - flutter_localizations: - sdk: flutter - flutter_svg: ^2.0.4 - fluttertoast: ^8.2.1 - font_awesome_flutter: ^10.4.0 - get_it: 7.2.0 - google_fonts: ^4.0.3 - http: ^0.13.5 - injectable: ^2.1.1 - intl: ^0.18.0 - json_annotation: ^4.8.0 - logcat: - git: - url: https://github.com/SuaMusica/logcat - ref: feature/nullSafe - package_info_plus: ^3.0.3 - path_provider: ^2.0.14 - permission_handler: ^10.2.0 - pull_to_refresh: ^2.0.0 - root: - git: - url: https://github.com/EvadeMaster/root - ref: 82803aa40f63cddff81c3e4d27ce8ce3e7c83f60 - share_extend: ^2.0.0 - shared_preferences: ^2.1.0 - skeletons: ^0.0.3 - stacked: ^3.2.0 - stacked_generator: ^1.1.0 - stacked_services: ^1.0.0 - stacked_themes: ^0.3.10 - timeago: ^3.3.0 - timezone: ^0.9.0 - url_launcher: ^6.1.10 - wakelock: ^0.6.2 - flutter_dotenv: ^5.0.2 - flutter_markdown: ^0.6.14 - dio_cache_interceptor: ^3.4.0 - install_plugin: ^2.1.0 - -dev_dependencies: - json_serializable: ^6.6.1 - build_runner: any - flutter_launcher_icons: ^0.13.0 - flutter_lints: ^2.0.1 - flutter_test: - sdk: flutter - injectable_generator: ^2.1.5 - - - -flutter: - uses-material-design: true - assets: - - assets/i18n/ diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000000..89a5a62e83 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,32 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + maven("https://jitpack.io") + maven { + url = uri("https://maven.pkg.github.com/revanced/revanced-patcher") + credentials { + username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR") + password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN") + } + } + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven("https://jitpack.io") + maven { + url = uri("https://maven.pkg.github.com/revanced/revanced-patcher") + credentials { + username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR") + password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN") + } + } + } +} +rootProject.name = "ReVanced Manager" +include(":app")