Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merge dev to main #1608

Merged
merged 5 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/services/manager_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class ManagerAPI {
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 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 = '';

Expand Down Expand Up @@ -632,7 +632,7 @@ class ManagerAPI {
);
}

Future<void> reAssessSavedApps() async {
Future<void> rePatchedSavedApps() async {
final List<PatchedApplication> patchedApps = getPatchedApps();

// Remove apps that are not installed anymore.
Expand Down
10 changes: 9 additions & 1 deletion lib/services/root_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ class RootAPI {
stock_path=\$(pm path $packageName | grep base | sed "s/package://g" )

chcon u:object_r:apk_data_file:s0 \$base_path

# Mount using Magisk mirror, if available.
MAGISKTMP="$( magisk --path )" || MAGISKTMP=/sbin
MIRROR="${'$'}MAGISKTMP/.magisk/mirror"
if [ ! -f ${'$'}MIRROR ]; then
MIRROR=""
fi

mount -o bind \$MIRROR\$base_path \$stock_path

# Kill the app to force it to restart the mounted APK in case it is already running
Expand All @@ -171,7 +179,7 @@ class RootAPI {
}

Future<void> installPatchedApk(
String packageName, String patchedFilePath) async {
String packageName, String patchedFilePath,) async {
final String newPatchedFilePath = '$_revancedDirPath/$packageName/base.apk';
await Root.exec(
cmd: '''
Expand Down
11 changes: 8 additions & 3 deletions lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ class HomeViewModel extends BaseViewModel {
File? downloadedApk;

Future<void> initialize(BuildContext context) async {
_latestManagerVersion = await _managerAPI.getLatestManagerVersion();
_managerAPI.rePatchedSavedApps().then((_) => _getPatchedApps());

if (!_managerAPI.getPatchesConsent()) {
await showPatchesConsent(context);
}

_latestManagerVersion = await _managerAPI.getLatestManagerVersion();

await _patcherAPI.initialize();

await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings(
android: AndroidInitializationSettings('ic_notification'),
Expand All @@ -63,11 +68,13 @@ class HomeViewModel extends BaseViewModel {
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.requestNotificationsPermission();

final bool isConnected =
await Connectivity().checkConnectivity() != ConnectivityResult.none;
if (!isConnected) {
_toast.showBottom('homeView.noConnection');
}

final NotificationAppLaunchDetails? notificationAppLaunchDetails =
await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();
if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) {
Expand All @@ -79,8 +86,6 @@ class HomeViewModel extends BaseViewModel {
_toast.showBottom('homeView.errorDownloadMessage');
}
}

_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
}

void navigateToAppInfo(PatchedApplication app) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ 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:stacked/stacked.dart';

Expand Down Expand Up @@ -35,15 +34,19 @@ class SManageApiUrl extends BaseViewModel {
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
leadingIcon: Icon(
Icons.api_outlined,
color: Theme.of(context).colorScheme.secondary,
),
inputController: _apiUrlController,
label: I18nText('settingsView.selectApiURL'),
hint: apiUrl,
TextField(
controller: _apiUrlController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: Icon(
Icons.api_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText('settingsView.selectApiURL').toString(),
hintText: apiUrl,
),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ 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:stacked/stacked.dart';

Expand Down Expand Up @@ -35,11 +34,17 @@ class SManageKeystorePassword extends BaseViewModel {
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
inputController: _keystorePasswordController,
label: I18nText('settingsView.selectKeystorePassword'),
hint: '',
TextField(
controller: _keystorePasswordController,
autocorrect: false,
obscureText: true,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.selectKeystorePassword',
).toString(),
),
),
],
),
Expand Down
123 changes: 80 additions & 43 deletions lib/ui/views/settings/settingsFragment/settings_manage_sources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ 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:stacked/stacked.dart';

Expand Down Expand Up @@ -45,59 +44,97 @@ class SManageSources extends BaseViewModel {
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
leadingIcon: const Icon(
Icons.extension_outlined,
color: Colors.transparent,
),
inputController: _hostSourceController,
label: I18nText('settingsView.hostRepositoryLabel'),
hint: hostRepository,
/*
API for accessing the specified repositories
If default is used, will use the ReVanced API
*/
TextField(
controller: _hostSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 20),
CustomTextField(
leadingIcon: Icon(
Icons.extension_outlined,
color: Theme.of(context).colorScheme.secondary,
decoration: InputDecoration(
icon: Icon(
Icons.rocket_launch_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.hostRepositoryLabel',
).toString(),
hintText: hostRepository,
),
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],
// Patches owner's name
TextField(
controller: _orgPatSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 20),
CustomTextField(
leadingIcon: Icon(
Icons.merge_outlined,
color: Theme.of(context).colorScheme.secondary,
decoration: InputDecoration(
icon: Icon(
Icons.extension_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.orgPatchesLabel',
).toString(),
hintText: patchesRepo.split('/')[0],
),
inputController: _orgIntSourceController,
label: I18nText('settingsView.orgIntegrationsLabel'),
hint: integrationsRepo.split('/')[0],
),
const SizedBox(height: 8),
// Patches repository's name
TextField(
controller: _patSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: const Icon(
Icons.extension_outlined,
color: Colors.transparent,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.sourcesPatchesLabel',
).toString(),
hintText: patchesRepo.split('/')[1],
),
),
const SizedBox(height: 8),
CustomTextField(
leadingIcon: const Icon(
Icons.merge_outlined,
color: Colors.transparent,
// Integrations owner's name
TextField(
controller: _orgIntSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: Icon(
Icons.merge_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.orgIntegrationsLabel',
).toString(),
hintText: integrationsRepo.split('/')[0],
),
inputController: _intSourceController,
label: I18nText('settingsView.sourcesIntegrationsLabel'),
hint: integrationsRepo.split('/')[1],
),
const SizedBox(height: 8),
// Integrations repository's name
TextField(
controller: _intSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: const Icon(
Icons.merge_outlined,
color: Colors.transparent,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.sourcesIntegrationsLabel',
).toString(),
hintText: integrationsRepo.split('/')[1],
),
),
const SizedBox(height: 20),
I18nText('settingsView.sourcesUpdateNote'),
Expand Down
63 changes: 0 additions & 63 deletions lib/ui/widgets/settingsView/custom_switch.dart

This file was deleted.

Loading
Loading