Compare commits

...

15 Commits

Author SHA1 Message Date
Aunali321
4dfa0dada6 build: bump version to v0.0.30 2022-10-08 22:08:03 +05:30
Aunali321
857a523f84 fix: changelog for youtube. 2022-10-08 22:06:45 +05:30
Aunali321
ceac838706 feat: use new api url. 2022-10-08 19:03:45 +05:30
Aunali321
e8cb6d27fc Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-10-07 18:23:49 +05:30
Aunali321
78428f6bd3 feat: HTTP/3 Support. 2022-10-07 18:23:43 +05:30
Ushie
da94dfba70 build: Android Studio project build config 2022-10-06 12:40:25 +03:00
oSumAtrIX
8275792f45 chore: bump patcher dependency version to v6.0.0 (#355) 2022-10-06 11:26:20 +02:00
j4k0xb
a90923011a feat: allow searching for displayed patch names (#348) 2022-10-03 21:06:12 +03:00
oSumAtrIX
1aa24e2871 fix: print stack trace of patch exceptions (#314) 2022-10-03 22:34:46 +05:30
oSumAtrIX
68ce751745 build: bump version to v0.0.27 2022-10-01 02:15:47 +02:00
oSumAtrIX
74ff64d41a chore: bump patcher dependency version to v5.1.2 2022-10-01 02:15:08 +02:00
Ushie
6d45ccecc2 build: Bump version to v0.0.27 2022-09-30 21:38:15 +03:00
Ushie
5418c36716 feat: use patcher for resourcePatch detection (#337)
Co-authored-by: Aunali321 <aunvakil.aa@gmail.com>
2022-09-30 21:36:39 +03:00
Aunali321
ca0657e8f9 feat: decrease cache duration of patches and integrations. 2022-09-28 22:26:54 +05:30
Canny
a5511c2a2c feat: update unsupported button title 2022-09-26 23:36:17 +03:00
10 changed files with 48 additions and 50 deletions

6
.run/main.dart.run.xml Normal file
View File

@@ -0,0 +1,6 @@
<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>

View File

@@ -71,7 +71,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// ReVanced // ReVanced
implementation "app.revanced:revanced-patcher:5.1.0" implementation "app.revanced:revanced-patcher:6.0.0"
// Signing & aligning // Signing & aligning
implementation("org.bouncycastle:bcpkix-jdk15on:1.70") implementation("org.bouncycastle:bcpkix-jdk15on:1.70")

View File

@@ -1,5 +1,6 @@
package app.revanced.manager.flutter package app.revanced.manager.flutter
import android.os.Build
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import androidx.annotation.NonNull import androidx.annotation.NonNull
@@ -12,7 +13,7 @@ import app.revanced.patcher.Patcher
import app.revanced.patcher.PatcherOptions import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.logging.Logger import app.revanced.patcher.logging.Logger
import app.revanced.patcher.util.patch.impl.DexPatchBundle import app.revanced.patcher.util.patch.PatchBundle
import dalvik.system.DexClassLoader import dalvik.system.DexClassLoader
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.FlutterEngine
@@ -42,7 +43,6 @@ class MainActivity : FlutterActivity() {
val selectedPatches = call.argument<List<String>>("selectedPatches") val selectedPatches = call.argument<List<String>>("selectedPatches")
val cacheDirPath = call.argument<String>("cacheDirPath") val cacheDirPath = call.argument<String>("cacheDirPath")
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations") val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
val resourcePatching = call.argument<Boolean>("resourcePatching")
val keyStoreFilePath = call.argument<String>("keyStoreFilePath") val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
if (patchBundleFilePath != null && if (patchBundleFilePath != null &&
originalFilePath != null && originalFilePath != null &&
@@ -53,7 +53,6 @@ class MainActivity : FlutterActivity() {
selectedPatches != null && selectedPatches != null &&
cacheDirPath != null && cacheDirPath != null &&
mergeIntegrations != null && mergeIntegrations != null &&
resourcePatching != null &&
keyStoreFilePath != null keyStoreFilePath != null
) { ) {
runPatcher( runPatcher(
@@ -67,7 +66,6 @@ class MainActivity : FlutterActivity() {
selectedPatches, selectedPatches,
cacheDirPath, cacheDirPath,
mergeIntegrations, mergeIntegrations,
resourcePatching,
keyStoreFilePath keyStoreFilePath
) )
} else { } else {
@@ -90,7 +88,6 @@ class MainActivity : FlutterActivity() {
selectedPatches: List<String>, selectedPatches: List<String>,
cacheDirPath: String, cacheDirPath: String,
mergeIntegrations: Boolean, mergeIntegrations: Boolean,
resourcePatching: Boolean,
keyStoreFilePath: String keyStoreFilePath: String
) { ) {
val originalFile = File(originalFilePath) val originalFile = File(originalFilePath)
@@ -102,15 +99,19 @@ class MainActivity : FlutterActivity() {
Thread { Thread {
try { try {
val patches = DexPatchBundle( val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
patchBundleFilePath, PatchBundle.Dex(
DexClassLoader(
patchBundleFilePath, patchBundleFilePath,
cacheDirPath, DexClassLoader(
null, patchBundleFilePath,
javaClass.classLoader cacheDirPath,
) null,
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } } javaClass.classLoader
)
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
} else {
TODO("VERSION.SDK_INT < CUPCAKE")
}
handler.post { handler.post {
installerChannel.invokeMethod( installerChannel.invokeMethod(
@@ -139,7 +140,6 @@ class MainActivity : FlutterActivity() {
PatcherOptions( PatcherOptions(
inputFile, inputFile,
cacheDirPath, cacheDirPath,
resourcePatching,
Aapt.binary(applicationContext).absolutePath, Aapt.binary(applicationContext).absolutePath,
cacheDirPath, cacheDirPath,
logger = ManagerLogger() logger = ManagerLogger()
@@ -178,7 +178,7 @@ class MainActivity : FlutterActivity() {
} }
patcher.addPatches(patches) patcher.addPatches(patches)
patcher.applyPatches().forEach { (patch, res) -> patcher.executePatches().forEach { (patch, res) ->
if (res.isSuccess) { if (res.isSuccess) {
val msg = "[success] $patch" val msg = "[success] $patch"
handler.post { handler.post {
@@ -193,7 +193,7 @@ class MainActivity : FlutterActivity() {
} }
return@forEach return@forEach
} }
val msg = "[error] $patch:" + res.exceptionOrNull()!! val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
handler.post { handler.post {
installerChannel.invokeMethod( installerChannel.invokeMethod(
"update", "update",

View File

@@ -80,7 +80,7 @@
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior." "selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
}, },
"patchItem": { "patchItem": {
"unsupportedWarningButton": "Unsupported version", "unsupportedWarningButton": "Warning",
"unsupportedDialogTitle": "Warning", "unsupportedDialogTitle": "Warning",
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}" "unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
}, },

View File

@@ -5,26 +5,22 @@ import 'package:dio/dio.dart';
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart'; import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart'; import 'package:injectable/injectable.dart';
import 'package:native_dio_client/native_dio_client.dart';
import 'package:revanced_manager/models/patch.dart'; import 'package:revanced_manager/models/patch.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
@lazySingleton @lazySingleton
class GithubAPI { class GithubAPI {
final Dio _dio = Dio( final Dio _dio = Dio(
BaseOptions(baseUrl: 'https://api.github.com'), BaseOptions(baseUrl: 'https://api.github.com'),
)..httpClientAdapter = Http2Adapter( )..httpClientAdapter = NativeAdapter();
ConnectionManager(
idleTimeout: 10000,
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
),
);
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig()); final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions( final Options _cacheOptions = buildCacheOptions(
const Duration(days: 1), const Duration(hours: 6),
maxStale: const Duration(days: 7), maxStale: const Duration(days: 1),
); );
final Map<String, String> repoAppPath = { final Map<String, String> repoAppPath = {
'com.google.android.youtube': 'youtube', 'com.google.android.youtube': 'youtube',
'app.revanced.android.youtube': 'youtube',
'com.google.android.apps.youtube.music': 'music', 'com.google.android.apps.youtube.music': 'music',
'com.twitter.android': 'twitter', 'com.twitter.android': 'twitter',
'com.reddit.frontpage': 'reddit', 'com.reddit.frontpage': 'reddit',
@@ -65,17 +61,20 @@ class GithubAPI {
'/repos/$repoName/commits', '/repos/$repoName/commits',
queryParameters: { queryParameters: {
'path': path, 'path': path,
'per_page': 3,
'since': since.toIso8601String(), 'since': since.toIso8601String(),
}, },
options: _cacheOptions, options: _cacheOptions,
); );
List<dynamic> commits = response.data; List<dynamic> commits = response.data;
return commits return commits
.map((commit) => .map(
(commit['commit']['message'] as String).split('\n')[0]) (commit) => (commit['commit']['message']).split('\n')[0] +
' - ' +
commit['commit']['author']['name'] +
'\n' as String,
)
.toList(); .toList();
} on Exception { } catch (e) {
return List.empty(); return List.empty();
} }
} }

View File

@@ -19,7 +19,7 @@ class ManagerAPI {
final String patcherRepo = 'revanced-patcher'; final String patcherRepo = 'revanced-patcher';
final String cliRepo = 'revanced-cli'; final String cliRepo = 'revanced-cli';
late SharedPreferences _prefs; late SharedPreferences _prefs;
String defaultApiUrl = 'https://revanced-releases-api.afterst0rm.xyz'; String defaultApiUrl = 'https://releases.rvcd.win/';
String defaultPatcherRepo = 'revanced/revanced-patcher'; String defaultPatcherRepo = 'revanced/revanced-patcher';
String defaultPatchesRepo = 'revanced/revanced-patches'; String defaultPatchesRepo = 'revanced/revanced-patches';
String defaultIntegrationsRepo = 'revanced/revanced-integrations'; String defaultIntegrationsRepo = 'revanced/revanced-integrations';
@@ -314,7 +314,7 @@ class ManagerAPI {
newCommits = await _githubAPI.getCommits( newCommits = await _githubAPI.getCommits(
packageName, packageName,
getPatchesRepo(), getPatchesRepo(),
DateTime(2022, 3, 20, 21, 06, 01), patchDate,
); );
} }
return newCommits; return newCommits;

View File

@@ -142,7 +142,6 @@ class PatcherAPI {
List<Patch> selectedPatches, List<Patch> selectedPatches,
) async { ) async {
bool mergeIntegrations = await needsIntegrations(selectedPatches); bool mergeIntegrations = await needsIntegrations(selectedPatches);
bool resourcePatching = await needsResourcePatching(selectedPatches);
bool includeSettings = await needsSettingsPatch(selectedPatches); bool includeSettings = await needsSettingsPatch(selectedPatches);
if (includeSettings) { if (includeSettings) {
try { try {
@@ -186,7 +185,6 @@ class PatcherAPI {
'selectedPatches': selectedPatches.map((p) => p.name).toList(), 'selectedPatches': selectedPatches.map((p) => p.name).toList(),
'cacheDirPath': cacheDir.path, 'cacheDirPath': cacheDir.path,
'mergeIntegrations': mergeIntegrations, 'mergeIntegrations': mergeIntegrations,
'resourcePatching': resourcePatching,
'keyStoreFilePath': _keyStoreFile.path, 'keyStoreFilePath': _keyStoreFile.path,
}, },
); );

View File

@@ -1,32 +1,27 @@
import 'dart:io'; import 'dart:io';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:native_dio_client/native_dio_client.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart'; import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart'; import 'package:injectable/injectable.dart';
import 'package:revanced_manager/models/patch.dart'; import 'package:revanced_manager/models/patch.dart';
import 'package:timeago/timeago.dart'; import 'package:timeago/timeago.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
@lazySingleton @lazySingleton
class RevancedAPI { class RevancedAPI {
late Dio _dio = Dio(); late Dio _dio = Dio();
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig()); final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions( final Options _cacheOptions = buildCacheOptions(
const Duration(days: 1), const Duration(hours: 6),
maxStale: const Duration(days: 7), maxStale: const Duration(days: 1),
); );
Future<void> initialize(String apiUrl) async { Future<void> initialize(String apiUrl) async {
_dio = Dio(BaseOptions( _dio = Dio(BaseOptions(
baseUrl: apiUrl, baseUrl: apiUrl,
)) ))
..httpClientAdapter = Http2Adapter( ..httpClientAdapter = NativeAdapter();
ConnectionManager(
idleTimeout: 10000,
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
),
);
_dio.interceptors.add(_dioCacheManager.interceptor); _dio.interceptors.add(_dioCacheManager.interceptor);
} }

View File

@@ -73,9 +73,9 @@ class PatchesSelectorViewModel extends BaseViewModel {
.where((patch) => .where((patch) =>
query.isEmpty || query.isEmpty ||
query.length < 2 || query.length < 2 ||
patch.name.toLowerCase().contains( patch.name.toLowerCase().contains(query.toLowerCase()) ||
query.toLowerCase(), patch.getSimpleName().toLowerCase().contains(query.toLowerCase())
)) )
.toList(); .toList();
} }

View File

@@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
publish_to: 'none' publish_to: 'none'
version: 0.0.26+26 version: 0.0.30+30
environment: environment:
sdk: ">=2.17.5 <3.0.0" sdk: ">=2.17.5 <3.0.0"
@@ -20,7 +20,6 @@ dependencies:
ref: revanced-manager ref: revanced-manager
device_info_plus: ^4.1.2 device_info_plus: ^4.1.2
dio: ^4.0.6 dio: ^4.0.6
dio_http2_adapter: ^2.0.0
dio_http_cache_lts: ^0.4.1 dio_http_cache_lts: ^0.4.1
dynamic_color: ^1.5.4 dynamic_color: ^1.5.4
dynamic_themes: ^1.1.0 dynamic_themes: ^1.1.0
@@ -51,6 +50,7 @@ dependencies:
git: git:
url: https://github.com/SuaMusica/logcat url: https://github.com/SuaMusica/logcat
ref: feature/nullSafe ref: feature/nullSafe
native_dio_client: ^0.0.1-dev+1
package_info_plus: ^1.4.3+1 package_info_plus: ^1.4.3+1
path_provider: ^2.0.11 path_provider: ^2.0.11
permission_handler: ^10.0.0 permission_handler: ^10.0.0