Skip to content

Commit

Permalink
chore: Merge branch dev to main (#1340)
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX authored Oct 7, 2023
2 parents b1c9aed + a9ae45f commit 657ba11
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 12 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// ReVanced
implementation "app.revanced:revanced-patcher:16.0.1"
implementation "app.revanced:revanced-patcher:16.0.2"

// Signing & aligning
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ class ExportSettingsActivity : Activity() {
val sharedPreferences = getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE)
val allEntries: Map<String, *> = sharedPreferences.getAll()
for ((key, value) in allEntries.entries) {
json.put(
key.replace("flutter.", ""),
if (value is Boolean) if (value) 1 else 0 else value
)
json.put(key.replace("flutter.", ""), value)
}

// Load keystore
Expand Down
3 changes: 3 additions & 0 deletions assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@
"exportApkButtonTooltip": "Export patched APK",
"exportLogButtonTooltip": "Export log",

"screenshotDetected": "A screenshot has been detected. If you are trying to share the log, please share a text copy instead.\n\nCopy log to clipboard?",
"copiedToClipboard": "Copied log to clipboard",

"noExit": "Installer is still running, cannot exit..."
},
"settingsView": {
Expand Down
2 changes: 1 addition & 1 deletion lib/services/patcher_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class PatcherAPI {
.replaceAll(':', '')
.replaceAll('T', '')
.replaceAll('.', '');
final String fileName = 'revanced-manager_patcher_$dateTime.log';
final String fileName = 'revanced-manager_patcher_$dateTime.txt';
final File log = File('${logDir.path}/$fileName');
log.writeAsStringSync(logs);
CRFileSaver.saveFileWithDialog(
Expand Down
83 changes: 78 additions & 5 deletions lib/ui/views/installer/installer_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ 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:revanced_manager/utils/about_info.dart';
import 'package:screenshot_callback/screenshot_callback.dart';
import 'package:stacked/stacked.dart';
import 'package:wakelock/wakelock.dart';

Expand All @@ -29,6 +31,7 @@ class InstallerViewModel extends BaseViewModel {
'app.revanced.manager.flutter/installer',
);
final ScrollController scrollController = ScrollController();
final ScreenshotCallback screenshotCallback = ScreenshotCallback();
double? progress = 0.0;
String logs = '';
String headerLogs = '';
Expand All @@ -38,6 +41,7 @@ class InstallerViewModel extends BaseViewModel {
bool hasErrors = false;
bool isCanceled = false;
bool cancel = false;
bool showPopupScreenshotWarning = true;

Future<void> initialize(BuildContext context) async {
isRooted = await _rootAPI.isRooted();
Expand All @@ -64,6 +68,12 @@ class InstallerViewModel extends BaseViewModel {
} // ignore
}
}
screenshotCallback.addListener(() {
if (showPopupScreenshotWarning) {
showPopupScreenshotWarning = false;
screenshotDetected(context);
}
});
await Wakelock.enable();
await handlePlatformChannelMethods();
await runPatcher();
Expand Down Expand Up @@ -169,6 +179,72 @@ class InstallerViewModel extends BaseViewModel {
}
}

Future<void> copyLogs() async {
final info = await AboutInfo.getInfo();

final formattedLogs = [
'```',
'~ Device Info',
'ReVanced Manager: ${info['version']}',
'Build: ${info['flavor']}',
'Model: ${info['model']}',
'Android version: ${info['androidVersion']}',
'Supported architectures: ${info['supportedArch'].join(", ")}',

'\n~ Patch Info',
'App: ${_app.packageName} v${_app.version}',
'Patches version: ${_managerAPI.patchesVersion}',
'Patches: ${_patches.map((p) => p.name).toList().join(", ")}',

'\n~ Settings',
'Enabled changing patches: ${_managerAPI.isPatchesChangeEnabled()}',
'Enabled universal patches: ${_managerAPI.areUniversalPatchesEnabled()}',
'Enabled experimental patches: ${_managerAPI.areExperimentalPatchesEnabled()}',
'Patches source: ${_managerAPI.getPatchesRepo()}',
'Integration source: ${_managerAPI.getIntegrationsRepo()}',

'\n~ Logs',
logs,
'```',
];

Clipboard.setData(ClipboardData(text: formattedLogs.join('\n')));
_toast.showBottom('installerView.copiedToClipboard');
}

Future<void> screenshotDetected(BuildContext context) async {
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText(
'warning',
),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
icon: const Icon(Icons.warning),
content: SingleChildScrollView(
child: I18nText('installerView.screenshotDetected'),
),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () {
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('yesButton'),
onPressed: () {
copyLogs();
showPopupScreenshotWarning = true;
Navigator.of(context).pop();
},
),
],
),
);
}

Future<void> installTypeDialog(BuildContext context) async {
final ValueNotifier<int> installType = ValueNotifier(0);
if (isRooted) {
Expand Down Expand Up @@ -316,10 +392,6 @@ class InstallerViewModel extends BaseViewModel {
}
}

void exportLog() {
_patcherAPI.exportPatcherLog(logs);
}

Future<void> cleanPatcher() async {
try {
_patcherAPI.cleanPatcher();
Expand All @@ -343,7 +415,7 @@ class InstallerViewModel extends BaseViewModel {
exportResult();
break;
case 1:
exportLog();
copyLogs();
break;
}
}
Expand All @@ -365,6 +437,7 @@ class InstallerViewModel extends BaseViewModel {
} else {
_patcherAPI.cleanPatcher();
}
screenshotCallback.dispose();
Navigator.of(context).pop();
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager

publish_to: 'none'

version: 1.11.1+101100100
version: 1.11.2+101100200

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down Expand Up @@ -75,6 +75,7 @@ dependencies:
flutter_markdown: ^0.6.14
dio_cache_interceptor: ^3.4.0
install_plugin: ^2.1.0
screenshot_callback: ^3.0.1
synchronized: ^3.1.0

dev_dependencies:
Expand Down

0 comments on commit 657ba11

Please sign in to comment.