mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-18 23:16:50 +08:00
Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
caa9694543 | |||
ac79765372 | |||
39500f054d | |||
f2d5cc91db | |||
84a788fd9e | |||
3778bfe1b5 | |||
63b2d8e0bd | |||
e7490b8d75 | |||
2e050d06e8 | |||
5fd1154039 | |||
39401a78ec | |||
273aa42b17 | |||
603917d21e | |||
e55cd6a938 | |||
2aaed14a3a | |||
511c25163d | |||
c24e50f3a0 | |||
2d732288a7 | |||
56e715cd3c | |||
074d8005bc | |||
5b38c9442a | |||
3b8dc66da6 | |||
f5ebfc92fc | |||
9de063aced | |||
331691cc9d | |||
1a97cdf91d | |||
fbd4359d61 | |||
f31a60d9bb | |||
79aca0e579 | |||
6d35c47b6b | |||
f1261398e9 |
@ -9,6 +9,10 @@
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
- lib/utils/env_class.g.dart
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
|
@ -241,7 +241,16 @@ class MainActivity : FlutterActivity() {
|
||||
)
|
||||
)
|
||||
}
|
||||
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||
|
||||
// Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||
|
||||
try {
|
||||
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||
} catch (e: Exception) {
|
||||
//log to console
|
||||
print("Error signing apk: ${e.message}")
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
handler.post {
|
||||
installerChannel.invokeMethod(
|
||||
|
@ -16,6 +16,7 @@
|
||||
"patchedSubtitle": "Patched Applications",
|
||||
"updatesAvailable": "Updates available",
|
||||
"noUpdates": "No updates available",
|
||||
"WIP": "Work In Progress",
|
||||
"noInstallations": "No patched applications installed",
|
||||
"installed": "Installed",
|
||||
"updateDialogTitle": "Update Manager",
|
||||
@ -26,7 +27,8 @@
|
||||
"installingMessage": "Installing update...",
|
||||
"errorDownloadMessage": "Unable to download update",
|
||||
"errorInstallMessage": "Unable to install update",
|
||||
"noConnection": "No internet connection"
|
||||
"noConnection": "No internet connection",
|
||||
"updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again."
|
||||
},
|
||||
"applicationItem": {
|
||||
"patchButton": "Patch",
|
||||
@ -106,6 +108,7 @@
|
||||
"teamSectionTitle": "Team",
|
||||
"infoSectionTitle": "Info",
|
||||
"advancedSectionTitle": "Advanced",
|
||||
"logsSectionTitle": "Logs",
|
||||
"darkThemeLabel": "Dark Mode",
|
||||
"darkThemeHint": "Welcome to the Dark Side",
|
||||
"dynamicThemeLabel": "Material You",
|
||||
@ -130,7 +133,19 @@
|
||||
"apiURLHint": "Configure your custom API URL",
|
||||
"selectApiURL": "Select URL",
|
||||
"aboutLabel": "About",
|
||||
"snackbarMessage": "Copied to clipboard"
|
||||
"snackbarMessage": "Copied to clipboard",
|
||||
"sentryLabel": "Sentry Logging",
|
||||
"sentryHint": "Send anonymous logs to help us improve ReVanced Manager",
|
||||
"restartAppForChanges": "Restart the app to apply changes",
|
||||
"deleteKeystoreLabel": "Delete keystore",
|
||||
"deleteKeystoreHint": "Delete the keystore used to sign the app",
|
||||
"deletedKeystore": "Keystore deleted",
|
||||
"deleteTempDirLabel": "Delete temp directory",
|
||||
"deleteTempDirHint": "Delete the temporary directory used to store temporary files",
|
||||
"deletedTempDir": "Temp directory deleted",
|
||||
"deleteLogsLabel": "Delete logs",
|
||||
"deleteLogsHint": "Delete collected manager logs",
|
||||
"deletedLogs": "Logs deleted"
|
||||
},
|
||||
"appInfoView": {
|
||||
"widgetTitle": "App Info",
|
||||
|
@ -9,6 +9,7 @@ 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:stacked_themes/stacked_themes.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:timezone/data/latest.dart' as tz;
|
||||
|
||||
Future main() async {
|
||||
@ -18,9 +19,34 @@ Future main() async {
|
||||
await locator<ManagerAPI>().initialize();
|
||||
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||
await locator<RevancedAPI>().initialize(apiUrl);
|
||||
// bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
||||
locator<GithubAPI>().initialize();
|
||||
await locator<PatcherAPI>().initialize();
|
||||
tz.initializeTimeZones();
|
||||
|
||||
// Remove this section if you are building from source and don't have sentry configured
|
||||
// await SentryFlutter.init(
|
||||
// (options) {
|
||||
// options
|
||||
// ..dsn = isSentryEnabled ? '' : ''
|
||||
// ..environment = 'alpha'
|
||||
// ..release = '0.1'
|
||||
// ..tracesSampleRate = 1.0
|
||||
// ..anrEnabled = true
|
||||
// ..enableOutOfMemoryTracking = true
|
||||
// ..sampleRate = isSentryEnabled ? 1.0 : 0.0
|
||||
// ..beforeSend = (event, hint) {
|
||||
// if (isSentryEnabled) {
|
||||
// return event;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// } as BeforeSendCallback?;
|
||||
// },
|
||||
// appRunner: () {
|
||||
// runApp(const MyApp());
|
||||
// },
|
||||
// );
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,8 @@ 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/utils/check_for_gms.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:sentry_dio/sentry_dio.dart';
|
||||
|
||||
@lazySingleton
|
||||
class GithubAPI {
|
||||
@ -29,25 +31,36 @@ class GithubAPI {
|
||||
};
|
||||
|
||||
void initialize() async {
|
||||
bool isGMSInstalled = await checkForGMS();
|
||||
try {
|
||||
bool isGMSInstalled = await checkForGMS();
|
||||
|
||||
if (!isGMSInstalled) {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://api.github.com',
|
||||
));
|
||||
print('GitHub API: Using default engine + $isGMSInstalled');
|
||||
} else {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://api.github.com',
|
||||
))
|
||||
..httpClientAdapter = NativeAdapter();
|
||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
||||
if (!isGMSInstalled) {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://api.github.com',
|
||||
));
|
||||
print('GitHub API: Using default engine + $isGMSInstalled');
|
||||
} else {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://api.github.com',
|
||||
))
|
||||
..httpClientAdapter = NativeAdapter();
|
||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
||||
}
|
||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||
_dio.addSentry(
|
||||
captureFailedRequests: true,
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||
}
|
||||
|
||||
Future<void> clearAllCache() async {
|
||||
await _dioCacheManager.clearAll();
|
||||
try {
|
||||
await _dioCacheManager.clearAll();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>?> _getLatestRelease(String repoName) async {
|
||||
@ -57,7 +70,8 @@ class GithubAPI {
|
||||
options: _cacheOptions,
|
||||
);
|
||||
return response.data;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -87,7 +101,8 @@ class GithubAPI {
|
||||
'\n' as String,
|
||||
)
|
||||
.toList();
|
||||
} catch (e) {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
}
|
||||
@ -106,7 +121,8 @@ class GithubAPI {
|
||||
);
|
||||
}
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -120,7 +136,8 @@ class GithubAPI {
|
||||
List<dynamic> list = jsonDecode(f.readAsStringSync());
|
||||
patches = list.map((patch) => Patch.fromJson(patch)).toList();
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
return patches;
|
||||
|
@ -9,6 +9,7 @@ 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:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@lazySingleton
|
||||
@ -81,6 +82,29 @@ class ManagerAPI {
|
||||
await _prefs.setBool('useDarkTheme', value);
|
||||
}
|
||||
|
||||
// bool isSentryEnabled() {
|
||||
// return _prefs.getBool('sentryEnabled') ?? true;
|
||||
// }
|
||||
|
||||
// Future<void> setSentryStatus(bool value) async {
|
||||
// await _prefs.setBool('sentryEnabled', value);
|
||||
// }
|
||||
|
||||
Future<void> deleteTempFolder() async {
|
||||
final Directory dir = Directory('/data/local/tmp/revanced-manager');
|
||||
if (await dir.exists()) {
|
||||
await dir.delete(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteKeystore() async {
|
||||
final File keystore = File(
|
||||
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-manager.keystore');
|
||||
if (await keystore.exists()) {
|
||||
await keystore.delete();
|
||||
}
|
||||
}
|
||||
|
||||
List<PatchedApplication> getPatchedApps() {
|
||||
List<String> apps = _prefs.getStringList('patchedApps') ?? [];
|
||||
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();
|
||||
@ -116,9 +140,13 @@ class ManagerAPI {
|
||||
await setPatchedApps(patchedApps);
|
||||
}
|
||||
|
||||
void clearAllData() {
|
||||
_revancedAPI.clearAllCache();
|
||||
_githubAPI.clearAllCache();
|
||||
void clearAllData() async {
|
||||
try {
|
||||
_revancedAPI.clearAllCache();
|
||||
_githubAPI.clearAllCache();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||
@ -126,35 +154,50 @@ class ManagerAPI {
|
||||
}
|
||||
|
||||
Future<List<Patch>> getPatches() async {
|
||||
String repoName = getPatchesRepo();
|
||||
if (repoName == defaultPatchesRepo) {
|
||||
return await _revancedAPI.getPatches();
|
||||
} else {
|
||||
return await _githubAPI.getPatches(repoName);
|
||||
try {
|
||||
String repoName = getPatchesRepo();
|
||||
if (repoName == defaultPatchesRepo) {
|
||||
return await _revancedAPI.getPatches();
|
||||
} else {
|
||||
return await _githubAPI.getPatches(repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Future<File?> downloadPatches() async {
|
||||
String repoName = getPatchesRepo();
|
||||
if (repoName == defaultPatchesRepo) {
|
||||
return await _revancedAPI.getLatestReleaseFile(
|
||||
'.jar',
|
||||
defaultPatchesRepo,
|
||||
);
|
||||
} else {
|
||||
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
||||
try {
|
||||
String repoName = getPatchesRepo();
|
||||
if (repoName == defaultPatchesRepo) {
|
||||
return await _revancedAPI.getLatestReleaseFile(
|
||||
'.jar',
|
||||
defaultPatchesRepo,
|
||||
);
|
||||
} else {
|
||||
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<File?> downloadIntegrations() async {
|
||||
String repoName = getIntegrationsRepo();
|
||||
if (repoName == defaultIntegrationsRepo) {
|
||||
return await _revancedAPI.getLatestReleaseFile(
|
||||
'.apk',
|
||||
defaultIntegrationsRepo,
|
||||
);
|
||||
} else {
|
||||
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
||||
try {
|
||||
String repoName = getIntegrationsRepo();
|
||||
if (repoName == defaultIntegrationsRepo) {
|
||||
return await _revancedAPI.getLatestReleaseFile(
|
||||
'.apk',
|
||||
defaultIntegrationsRepo,
|
||||
);
|
||||
} else {
|
||||
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,6 +220,13 @@ class ManagerAPI {
|
||||
);
|
||||
}
|
||||
|
||||
Future<String?> getLatestPatchesVersion() async {
|
||||
return await _revancedAPI.getLatestReleaseVersion(
|
||||
'.json',
|
||||
defaultPatchesRepo,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> getCurrentManagerVersion() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
return packageInfo.version;
|
||||
|
@ -10,6 +10,7 @@ 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:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:share_extend/share_extend.dart';
|
||||
|
||||
@lazySingleton
|
||||
@ -44,7 +45,8 @@ class PatcherAPI {
|
||||
if (_patches.isEmpty) {
|
||||
_patches = await _managerAPI.getPatches();
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
_patches = List.empty();
|
||||
}
|
||||
}
|
||||
@ -63,7 +65,8 @@ class PatcherAPI {
|
||||
filteredApps.add(app);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -124,14 +127,19 @@ class PatcherAPI {
|
||||
String packageName,
|
||||
String originalFilePath,
|
||||
) async {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (hasRootPermissions) {
|
||||
originalFilePath = await _rootAPI.getOriginalFilePath(
|
||||
packageName,
|
||||
originalFilePath,
|
||||
);
|
||||
try {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (hasRootPermissions) {
|
||||
originalFilePath = await _rootAPI.getOriginalFilePath(
|
||||
packageName,
|
||||
originalFilePath,
|
||||
);
|
||||
}
|
||||
return originalFilePath;
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return originalFilePath;
|
||||
}
|
||||
return originalFilePath;
|
||||
}
|
||||
|
||||
Future<void> runPatcher(
|
||||
@ -151,7 +159,8 @@ class PatcherAPI {
|
||||
if (settingsPatch != null) {
|
||||
selectedPatches.add(settingsPatch);
|
||||
}
|
||||
} catch (e) {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@ -169,24 +178,29 @@ class PatcherAPI {
|
||||
_outFile = File('${workDir.path}/out.apk');
|
||||
Directory cacheDir = Directory('${workDir.path}/cache');
|
||||
cacheDir.createSync();
|
||||
await patcherChannel.invokeMethod(
|
||||
'runPatcher',
|
||||
{
|
||||
'patchBundleFilePath': patchBundleFile.path,
|
||||
'originalFilePath': await getOriginalFilePath(
|
||||
packageName,
|
||||
originalFilePath,
|
||||
),
|
||||
'inputFilePath': inputFile.path,
|
||||
'patchedFilePath': patchedFile.path,
|
||||
'outFilePath': _outFile!.path,
|
||||
'integrationsPath': mergeIntegrations ? integrationsFile!.path : '',
|
||||
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
|
||||
'cacheDirPath': cacheDir.path,
|
||||
'mergeIntegrations': mergeIntegrations,
|
||||
'keyStoreFilePath': _keyStoreFile.path,
|
||||
},
|
||||
);
|
||||
try {
|
||||
await patcherChannel.invokeMethod(
|
||||
'runPatcher',
|
||||
{
|
||||
'patchBundleFilePath': patchBundleFile.path,
|
||||
'originalFilePath': await getOriginalFilePath(
|
||||
packageName,
|
||||
originalFilePath,
|
||||
),
|
||||
'inputFilePath': inputFile.path,
|
||||
'patchedFilePath': patchedFile.path,
|
||||
'outFilePath': _outFile!.path,
|
||||
'integrationsPath': mergeIntegrations ? integrationsFile!.path : '',
|
||||
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
|
||||
'cacheDirPath': cacheDir.path,
|
||||
'mergeIntegrations': mergeIntegrations,
|
||||
'keyStoreFilePath': _keyStoreFile.path,
|
||||
},
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
print(e);
|
||||
throw await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +220,8 @@ class PatcherAPI {
|
||||
await AppInstaller.installApk(_outFile!.path);
|
||||
return await DeviceApps.isAppInstalled(patchedApp.packageName);
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -214,13 +229,18 @@ class PatcherAPI {
|
||||
}
|
||||
|
||||
void sharePatchedFile(String appName, String version) {
|
||||
if (_outFile != null) {
|
||||
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
||||
String newName = '$prefix-revanced_v$version.apk';
|
||||
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||
String newPath = _outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||
File shareFile = _outFile!.copySync(newPath);
|
||||
ShareExtend.share(shareFile.path, 'file');
|
||||
try {
|
||||
if (_outFile != null) {
|
||||
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
||||
String newName = '$prefix-revanced_v$version.apk';
|
||||
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||
String newPath =
|
||||
_outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||
File shareFile = _outFile!.copySync(newPath);
|
||||
ShareExtend.share(shareFile.path, 'file');
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,8 @@ import 'package:injectable/injectable.dart';
|
||||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/utils/check_for_gms.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:sentry_dio/sentry_dio.dart';
|
||||
|
||||
@lazySingleton
|
||||
class RevancedAPI {
|
||||
@ -19,25 +21,36 @@ class RevancedAPI {
|
||||
);
|
||||
|
||||
Future<void> initialize(String apiUrl) async {
|
||||
bool isGMSInstalled = await checkForGMS();
|
||||
try {
|
||||
bool isGMSInstalled = await checkForGMS();
|
||||
|
||||
if (!isGMSInstalled) {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: apiUrl,
|
||||
));
|
||||
print('ReVanced API: Using default engine + $isGMSInstalled');
|
||||
} else {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: apiUrl,
|
||||
))
|
||||
..httpClientAdapter = NativeAdapter();
|
||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
||||
if (!isGMSInstalled) {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: apiUrl,
|
||||
));
|
||||
print('ReVanced API: Using default engine + $isGMSInstalled');
|
||||
} else {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: apiUrl,
|
||||
))
|
||||
..httpClientAdapter = NativeAdapter();
|
||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
||||
}
|
||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||
_dio.addSentry(
|
||||
captureFailedRequests: true,
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||
}
|
||||
|
||||
Future<void> clearAllCache() async {
|
||||
await _dioCacheManager.clearAll();
|
||||
try {
|
||||
await _dioCacheManager.clearAll();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||
@ -49,7 +62,8 @@ class RevancedAPI {
|
||||
String name = repo['name'];
|
||||
contributors[name] = repo['contributors'];
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return {};
|
||||
}
|
||||
return contributors;
|
||||
@ -60,7 +74,8 @@ class RevancedAPI {
|
||||
var response = await _dio.get('/patches', options: _cacheOptions);
|
||||
List<dynamic> patches = response.data;
|
||||
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
}
|
||||
@ -77,7 +92,8 @@ class RevancedAPI {
|
||||
t['repository'] == repoName &&
|
||||
(t['name'] as String).endsWith(extension),
|
||||
);
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -94,7 +110,8 @@ class RevancedAPI {
|
||||
if (release != null) {
|
||||
return release['version'];
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -110,7 +127,8 @@ class RevancedAPI {
|
||||
String url = release['browser_download_url'];
|
||||
return await DefaultCacheManager().getSingleFile(url);
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -129,7 +147,8 @@ class RevancedAPI {
|
||||
DateTime timestamp = DateTime.parse(release['timestamp'] as String);
|
||||
return format(timestamp, locale: 'en_short');
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:root/root.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
class RootAPI {
|
||||
final String _managerDirPath = '/data/local/tmp/revanced-manager';
|
||||
@ -9,7 +10,8 @@ class RootAPI {
|
||||
try {
|
||||
bool? isRooted = await Root.isRootAvailable();
|
||||
return isRooted != null && isRooted;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -22,7 +24,8 @@ class RootAPI {
|
||||
return isRooted != null && isRooted;
|
||||
}
|
||||
return false;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -75,7 +78,8 @@ class RootAPI {
|
||||
apps.removeWhere((pack) => pack.isEmpty);
|
||||
return apps.map((pack) => pack.trim()).toList();
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
return List.empty();
|
||||
@ -121,14 +125,15 @@ class RootAPI {
|
||||
await installApk(packageName, patchedFilePath);
|
||||
await mountApk(packageName, originalFilePath);
|
||||
return true;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> installServiceDScript(String packageName) async {
|
||||
String content = '#!/system/bin/sh\n'
|
||||
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 1; done\n'
|
||||
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 3; done\n'
|
||||
'base_path=$_managerDirPath/$packageName/base.apk\n'
|
||||
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
|
||||
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
|
||||
|
@ -20,4 +20,15 @@ class Toast {
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import 'package:revanced_manager/models/patched_application.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:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class AppSelectorViewModel extends BaseViewModel {
|
||||
@ -63,7 +64,8 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
_toast.show('appSelectorView.errorMessage');
|
||||
}
|
||||
}
|
||||
|
@ -67,20 +67,20 @@ class HomeView extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
DashboardChip(
|
||||
label: I18nText('homeView.updatesAvailable'),
|
||||
isSelected: model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(true);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
DashboardChip(
|
||||
label: I18nText('homeView.installed'),
|
||||
isSelected: !model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(false);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
DashboardChip(
|
||||
label: I18nText('homeView.updatesAvailable'),
|
||||
isSelected: model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(true);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -16,6 +16,7 @@ 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/shared/custom_material_button.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
@ -28,7 +29,7 @@ class HomeViewModel extends BaseViewModel {
|
||||
final Toast _toast = locator<Toast>();
|
||||
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||
DateTime? _lastUpdate;
|
||||
bool showUpdatableApps = true;
|
||||
bool showUpdatableApps = false;
|
||||
List<PatchedApplication> patchedInstalledApps = [];
|
||||
List<PatchedApplication> patchedUpdatableApps = [];
|
||||
|
||||
@ -94,7 +95,8 @@ class HomeViewModel extends BaseViewModel {
|
||||
int currentVersionInt =
|
||||
int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||
return latestVersionInt > currentVersionInt;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -135,11 +137,16 @@ class HomeViewModel extends BaseViewModel {
|
||||
} else {
|
||||
_toast.show('homeView.errorDownloadMessage');
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
_toast.show('homeView.errorInstallMessage');
|
||||
}
|
||||
}
|
||||
|
||||
void updatesAreDisabled() {
|
||||
_toast.show('homeView.updatesDisabled');
|
||||
}
|
||||
|
||||
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
||||
return showDialog(
|
||||
context: parentContext,
|
||||
@ -176,7 +183,7 @@ class HomeViewModel extends BaseViewModel {
|
||||
Future<void> forceRefresh(BuildContext context) async {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
if (_lastUpdate == null ||
|
||||
_lastUpdate!.difference(DateTime.now()).inSeconds > 60) {
|
||||
_lastUpdate!.difference(DateTime.now()).inSeconds > 2) {
|
||||
_managerAPI.clearAllData();
|
||||
}
|
||||
initialize(context);
|
||||
|
@ -14,6 +14,7 @@ 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:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
|
||||
@ -57,7 +58,8 @@ class InstallerViewModel extends BaseViewModel {
|
||||
),
|
||||
),
|
||||
).then((value) => FlutterBackground.enableBackgroundExecution());
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@ -121,91 +123,106 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
Future<void> runPatcher() async {
|
||||
update(0.0, 'Initializing...', 'Initializing installer');
|
||||
if (_patches.isNotEmpty) {
|
||||
try {
|
||||
update(0.1, '', 'Creating working directory');
|
||||
await _patcherAPI.runPatcher(
|
||||
_app.packageName,
|
||||
_app.apkFilePath,
|
||||
_patches,
|
||||
);
|
||||
} catch (e) {
|
||||
update(
|
||||
-100.0,
|
||||
'Aborting...',
|
||||
'An error occurred! Aborting\nError:\n$e',
|
||||
);
|
||||
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, s) {
|
||||
update(
|
||||
-100.0,
|
||||
'Aborting...',
|
||||
'An error occurred! Aborting\nError:\n$e',
|
||||
);
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
throw await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
} else {
|
||||
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||
}
|
||||
} else {
|
||||
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||
}
|
||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||
try {
|
||||
FlutterBackground.disableBackgroundExecution();
|
||||
} on Exception {
|
||||
// ignore
|
||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||
try {
|
||||
FlutterBackground.disableBackgroundExecution();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
await Wakelock.disable();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
await Wakelock.disable();
|
||||
}
|
||||
|
||||
void installResult(BuildContext context, bool installAsRoot) async {
|
||||
_app.isRooted = installAsRoot;
|
||||
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||
bool rootMicroG = installAsRoot && hasMicroG;
|
||||
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
||||
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',
|
||||
try {
|
||||
_app.isRooted = installAsRoot;
|
||||
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||
bool rootMicroG = installAsRoot && hasMicroG;
|
||||
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
||||
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: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
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.',
|
||||
);
|
||||
);
|
||||
} 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);
|
||||
}
|
||||
await _managerAPI.savePatchedApp(_app);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
void shareResult() {
|
||||
_patcherAPI.sharePatchedFile(_app.name, _app.version);
|
||||
try {
|
||||
_patcherAPI.sharePatchedFile(_app.name, _app.version);
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
void shareLog() {
|
||||
@ -213,10 +230,14 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
Future<void> cleanPatcher() async {
|
||||
_patcherAPI.cleanPatcher();
|
||||
locator<PatcherViewModel>().selectedApp = null;
|
||||
locator<PatcherViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
try {
|
||||
_patcherAPI.cleanPatcher();
|
||||
locator<PatcherViewModel>().selectedApp = null;
|
||||
locator<PatcherViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
void openApp() {
|
||||
|
@ -55,6 +55,25 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
actions: [
|
||||
Container(
|
||||
height: 2,
|
||||
margin: const EdgeInsets.only(right: 16, 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.headline6!.color,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(64.0),
|
||||
child: Padding(
|
||||
|
@ -3,6 +3,7 @@ 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/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
@ -11,11 +12,14 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class PatchesSelectorViewModel extends BaseViewModel {
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final List<Patch> patches = [];
|
||||
final List<Patch> selectedPatches =
|
||||
locator<PatcherViewModel>().selectedPatches;
|
||||
String? patchesVersion = '';
|
||||
|
||||
Future<void> initialize() async {
|
||||
getPatchesVersion();
|
||||
patches.addAll(await _patcherAPI.getFilteredPatches(
|
||||
locator<PatcherViewModel>().selectedApp!.originalPackageName,
|
||||
));
|
||||
@ -68,6 +72,12 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
|
||||
Future<String?> getPatchesVersion() async {
|
||||
patchesVersion = await _managerAPI.getLatestPatchesVersion();
|
||||
// print('Patches version: $patchesVersion');
|
||||
return patchesVersion ?? '0.0.0';
|
||||
}
|
||||
|
||||
List<Patch> getQueriedPatches(String query) {
|
||||
return patches
|
||||
.where((patch) =>
|
||||
|
@ -136,9 +136,79 @@ class SettingsView extends StatelessWidget {
|
||||
subtitle: 'settingsView.sourcesLabelHint',
|
||||
onTap: () => model.showSourcesDialog(context),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.deleteKeystoreLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.deleteKeystoreHint'),
|
||||
onTap: () => model.deleteKeystore,
|
||||
),
|
||||
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: () => model.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: () => model.deleteLogs(),
|
||||
),
|
||||
],
|
||||
),
|
||||
_settingsDivider,
|
||||
// SettingsSection(
|
||||
// title: 'settingsView.logsSectionTitle',
|
||||
// children: <Widget>[
|
||||
// CustomSwitchTile(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
// title: I18nText(
|
||||
// 'settingsView.sentryLabel',
|
||||
// child: const Text(
|
||||
// '',
|
||||
// style: TextStyle(
|
||||
// fontSize: 20,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// subtitle: I18nText('settingsView.sentryHint'),
|
||||
// value: model.isSentryEnabled(),
|
||||
// onTap: (value) => model.useSentry(value),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// _settingsDivider,
|
||||
SettingsSection(
|
||||
title: 'settingsView.infoSectionTitle',
|
||||
children: <Widget>[
|
||||
|
@ -10,6 +10,7 @@ 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/widgets/shared/custom_material_button.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||
import 'package:share_extend/share_extend.dart';
|
||||
@ -23,6 +24,7 @@ const int ANDROID_12_SDK_VERSION = 31;
|
||||
class SettingsViewModel extends BaseViewModel {
|
||||
final NavigationService _navigationService = locator<NavigationService>();
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final Toast _toast = locator<Toast>();
|
||||
final TextEditingController _orgPatSourceController = TextEditingController();
|
||||
final TextEditingController _patSourceController = TextEditingController();
|
||||
final TextEditingController _orgIntSourceController = TextEditingController();
|
||||
@ -313,11 +315,42 @@ class SettingsViewModel extends BaseViewModel {
|
||||
);
|
||||
}
|
||||
|
||||
// bool isSentryEnabled() {
|
||||
// return _managerAPI.isSentryEnabled();
|
||||
// }
|
||||
|
||||
// void useSentry(bool value) {
|
||||
// _managerAPI.setSentryStatus(value);
|
||||
// _toast.showBottom('settingsView.restartAppForChanges');
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
void deleteKeystore() {
|
||||
_managerAPI.deleteKeystore();
|
||||
_toast.showBottom('settingsView.deletedKeystore');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void deleteTempDir() {
|
||||
_managerAPI.deleteTempFolder();
|
||||
_toast.showBottom('settingsView.deletedTempDir');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<int> getSdkVersion() async {
|
||||
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
|
||||
return info.version.sdkInt ?? -1;
|
||||
}
|
||||
|
||||
Future<void> deleteLogs() async {
|
||||
Directory appCacheDir = await getTemporaryDirectory();
|
||||
Directory logsDir = Directory('${appCacheDir.path}/logs');
|
||||
if (logsDir.existsSync()) {
|
||||
logsDir.deleteSync(recursive: true);
|
||||
}
|
||||
_toast.showBottom('settingsView.deletedLogs');
|
||||
}
|
||||
|
||||
Future<void> exportLogcatLogs() async {
|
||||
Directory appCache = await getTemporaryDirectory();
|
||||
Directory logDir = Directory('${appCache.path}/logs');
|
||||
|
@ -14,50 +14,74 @@ class AvailableUpdatesCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return apps.isEmpty
|
||||
? CustomCard(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
size: 40,
|
||||
Icons.update_disabled,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
I18nText(
|
||||
'homeView.noUpdates',
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
return CustomCard(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
size: 40,
|
||||
Icons.update_disabled,
|
||||
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: true,
|
||||
//TODO: Find a better way to do update functionality
|
||||
onPressed: () {}
|
||||
// () =>
|
||||
// locator<HomeViewModel>().navigateToPatcher(
|
||||
// app,
|
||||
// ),
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
const SizedBox(height: 16),
|
||||
I18nText(
|
||||
'homeView.WIP',
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
// return apps.isEmpty
|
||||
// ? CustomCard(
|
||||
// child: Center(
|
||||
// child: Column(
|
||||
// children: <Widget>[
|
||||
// Icon(
|
||||
// size: 40,
|
||||
// Icons.update_disabled,
|
||||
// color: Theme.of(context).colorScheme.secondary,
|
||||
// ),
|
||||
// const SizedBox(height: 16),
|
||||
// I18nText(
|
||||
// 'homeView.noUpdates',
|
||||
// child: Text(
|
||||
// '',
|
||||
// textAlign: TextAlign.center,
|
||||
// style: Theme.of(context).textTheme.subtitle1!.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: true,
|
||||
// //TODO: Find a better way to do update functionality
|
||||
// onPressed: () {}
|
||||
// // () =>
|
||||
// // locator<HomeViewModel>().navigateToPatcher(
|
||||
// // app,
|
||||
// // ),
|
||||
// ))
|
||||
// .toList(),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
children: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: widget.isUpdatableApp
|
||||
? I18nText('applicationItem.infoButton')
|
||||
? I18nText('applicationItem.patchButton')
|
||||
: I18nText('applicationItem.infoButton'),
|
||||
onPressed: widget.onPressed,
|
||||
),
|
||||
|
12
pubspec.yaml
12
pubspec.yaml
@ -4,12 +4,13 @@ homepage: https://github.com/revanced/revanced-manager
|
||||
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.0.32+32
|
||||
version: 0.0.34+34
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.5 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
sentry_flutter: ^6.12.2
|
||||
animations: ^2.0.4
|
||||
app_installer: ^1.1.0
|
||||
collection: ^1.16.0
|
||||
@ -71,17 +72,22 @@ dependencies:
|
||||
timezone: ^0.8.0
|
||||
url_launcher: ^6.1.5
|
||||
wakelock: ^0.6.2
|
||||
sentry_dio: ^6.12.2
|
||||
flutter_dotenv: ^5.0.2
|
||||
|
||||
dev_dependencies:
|
||||
json_serializable: ^6.3.1
|
||||
build_runner: any
|
||||
flutter_launcher_icons: ^0.10.0
|
||||
flutter_lints: ^2.0.1
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
injectable_generator: ^1.5.4
|
||||
json_serializable: ^6.3.1
|
||||
injectable_generator: ^1.5.4
|
||||
|
||||
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
assets:
|
||||
- assets/i18n/
|
||||
- .env
|
||||
|
Reference in New Issue
Block a user