chore: merge dev to main (#881)

This commit is contained in:
Ushie 2023-05-20 02:28:58 +03:00 committed by GitHub
commit 8d2f778dfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 64 additions and 50 deletions

3
.gitignore vendored
View File

@ -139,3 +139,6 @@ app.*.map.json
# Dependency directories # Dependency directories
node_modules/ node_modules/
# FVM
.fvm

View File

@ -98,7 +98,6 @@ linter:
- prefer_const_declarations - prefer_const_declarations
- prefer_const_literals_to_create_immutables - prefer_const_literals_to_create_immutables
- prefer_contains - prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields - prefer_final_fields
- prefer_final_in_for_each - prefer_final_in_for_each
- prefer_final_locals - prefer_final_locals

View File

@ -30,7 +30,6 @@ android {
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
compileOptions { compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11
} }
@ -49,7 +48,6 @@ android {
targetSdkVersion 33 targetSdkVersion 33
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
multiDexEnabled true
} }
buildTypes { buildTypes {
@ -79,11 +77,4 @@ dependencies {
implementation("org.bouncycastle:bcpkix-jdk15on:1.70") implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
implementation("com.android.tools.build:apksig:7.2.2") implementation("com.android.tools.build:apksig:7.2.2")
// Core libraries
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
// Window
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
} }

View File

@ -31,6 +31,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@ -78,7 +78,7 @@
"errorMessage": "Unable to use selected application", "errorMessage": "Unable to use selected application",
"downloadToast": "Download function is not available yet", "downloadToast": "Download function is not available yet",
"featureNotAvailable": "Feature not implemented", "featureNotAvailable": "Feature not implemented",
"featureNotAvailableText": "This feature has not been added yet for non-root. You'll need to select APK files from storage for now." "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": { "patchesSelectorView": {
"viewTitle": "Select patches", "viewTitle": "Select patches",

View File

@ -90,7 +90,7 @@ class GithubAPI {
final List<dynamic> commits = response.data; final List<dynamic> commits = response.data;
return commits return commits
.map( .map(
(commit) => (commit['commit']['message']).split('\n')[0] + (commit) => commit['commit']['message'].split('\n')[0] +
' - ' + ' - ' +
commit['commit']['author']['name'] + commit['commit']['author']['name'] +
'\n' as String, '\n' as String,

View File

@ -1,5 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';

View File

@ -1,4 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart' hide SearchBar;
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.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/app_skeleton_loader.dart';
@ -92,7 +92,10 @@ class _AppSelectorViewState extends State<AppSelectorView> {
? const AppSkeletonLoader() ? const AppSkeletonLoader()
: Padding( : Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0) padding: const EdgeInsets.symmetric(horizontal: 12.0)
.copyWith(bottom: 80), .copyWith(
bottom:
MediaQuery.of(context).viewPadding.bottom + 8.0,
),
child: Column( child: Column(
children: [ children: [
...model ...model
@ -108,16 +111,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
model.getSuggestedVersion( model.getSuggestedVersion(
app.packageName, app.packageName,
), ),
onTap: () { onTap: () => model.canSelectInstalled(context, app.packageName),
model.isRooted
? model.selectApp(app).then(
(_) => Navigator.of(context)
.pop(),
)
: model.showSelectFromStorageDialog(
context,
);
},
), ),
) )
.toList(), .toList(),

View File

@ -65,6 +65,14 @@ class AppSelectorViewModel extends BaseViewModel {
return _patcherAPI.getSuggestedVersion(packageName); return _patcherAPI.getSuggestedVersion(packageName);
} }
Future<bool> checkSplitApk(String packageName) async {
final app = await DeviceApps.getApp(packageName);
if (app != null) {
return app.isSplit;
}
return true;
}
Future<void> selectApp(ApplicationWithIcon application) async { Future<void> selectApp(ApplicationWithIcon application) async {
locator<PatcherViewModel>().selectedApp = PatchedApplication( locator<PatcherViewModel>().selectedApp = PatchedApplication(
name: application.appName, name: application.appName,
@ -78,6 +86,22 @@ class AppSelectorViewModel extends BaseViewModel {
locator<PatcherViewModel>().loadLastSelectedPatches(); locator<PatcherViewModel>().loadLastSelectedPatches();
} }
Future<void> 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 { Future showSelectFromStorageDialog(BuildContext context) async {
return showDialog( return showDialog(
context: context, context: context,

View File

@ -57,6 +57,7 @@ class ContributorsView extends StatelessWidget {
title: 'contributorsView.managerContributors', title: 'contributorsView.managerContributors',
contributors: model.managerContributors, contributors: model.managerContributors,
), ),
SizedBox(height: MediaQuery.of(context).viewPadding.bottom)
], ],
), ),
), ),

View File

@ -39,13 +39,10 @@ class HomeViewModel extends BaseViewModel {
bool showUpdatableApps = false; bool showUpdatableApps = false;
List<PatchedApplication> patchedInstalledApps = []; List<PatchedApplication> patchedInstalledApps = [];
List<PatchedApplication> patchedUpdatableApps = []; List<PatchedApplication> patchedUpdatableApps = [];
String _managerVersion = ''; String? _latestManagerVersion = '';
Future<void> initialize(BuildContext context) async { Future<void> initialize(BuildContext context) async {
_managerVersion = await AboutInfo.getInfo().then( _latestManagerVersion = await _managerAPI.getLatestManagerVersion();
(value) => value.keys.contains('version') ? value['version']! : '',
);
_managerVersion = await _managerAPI.getCurrentManagerVersion();
await flutterLocalNotificationsPlugin.initialize( await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings( const InitializationSettings(
android: AndroidInitializationSettings('ic_notification'), android: AndroidInitializationSettings('ic_notification'),
@ -115,7 +112,6 @@ class HomeViewModel extends BaseViewModel {
} }
Future<bool> hasManagerUpdates() async { Future<bool> hasManagerUpdates() async {
final String? latestVersion = await _managerAPI.getLatestManagerVersion();
String currentVersion = await _managerAPI.getCurrentManagerVersion(); String currentVersion = await _managerAPI.getCurrentManagerVersion();
// add v to current version // add v to current version
@ -123,7 +119,7 @@ class HomeViewModel extends BaseViewModel {
currentVersion = 'v$currentVersion'; currentVersion = 'v$currentVersion';
} }
if (latestVersion != currentVersion) { if (_latestManagerVersion != currentVersion) {
return true; return true;
} }
return false; return false;
@ -194,7 +190,7 @@ class HomeViewModel extends BaseViewModel {
), ),
const SizedBox(width: 8.0), const SizedBox(width: 8.0),
Text( Text(
'v$_managerVersion', 'v$_latestManagerVersion',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,

View File

@ -20,6 +20,7 @@ class InstallerView extends StatelessWidget {
builder: (context, model, child) => WillPopScope( builder: (context, model, child) => WillPopScope(
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: false,
child: Scaffold( child: Scaffold(
body: CustomScrollView( body: CustomScrollView(
controller: model.scrollController, controller: model.scrollController,
@ -153,6 +154,11 @@ class InstallerView extends StatelessWidget {
), ),
), ),
), ),
SliverFillRemaining(
hasScrollBody: false,
child: SizedBox(
height: MediaQuery.of(context).viewPadding.bottom),
),
], ],
), ),
), ),

View File

@ -1,4 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart' hide SearchBar;
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.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/patchesSelectorView/patch_item.dart';
@ -129,8 +129,10 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
), ),
) )
: Padding( : Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0) padding:
.copyWith(bottom: 80), const EdgeInsets.symmetric(horizontal: 12.0).copyWith(
bottom: MediaQuery.of(context).viewPadding.bottom + 8.0,
),
child: Column( child: Column(
children: [ children: [
Row( Row(

View File

@ -33,8 +33,8 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( const Row(
children: const <Widget>[ children: <Widget>[
Text('ReVanced Manager'), Text('ReVanced Manager'),
], ],
), ),
@ -82,8 +82,8 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( const Row(
children: const <Widget>[ children: <Widget>[
Text('ReVanced Patches'), Text('ReVanced Patches'),
], ],
), ),

View File

@ -39,9 +39,9 @@ class SocialMediaWidget extends StatelessWidget {
), ),
expanded: Padding( expanded: Padding(
padding: padding ?? EdgeInsets.zero, padding: padding ?? EdgeInsets.zero,
child: CustomCard( child: const CustomCard(
child: Column( child: Column(
children: const <Widget>[ children: <Widget>[
SocialMediaItem( SocialMediaItem(
icon: FaIcon(FontAwesomeIcons.github), icon: FaIcon(FontAwesomeIcons.github),
title: Text('GitHub'), title: Text('GitHub'),

View File

@ -7,7 +7,7 @@ publish_to: 'none'
version: 1.1.0+100100000 version: 1.1.0+100100000
environment: environment:
sdk: ">=2.17.5 <3.0.0" sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
animations: ^2.0.7 animations: ^2.0.7
@ -16,8 +16,8 @@ dependencies:
cross_connectivity: ^3.0.5 cross_connectivity: ^3.0.5
cr_file_saver: cr_file_saver:
git: git:
url: https://github.com/dhruvanbhalara/cr_file_saver.git url: https://github.com/dhruvanbhalara/cr_file_saver
ref: a08326ecb48f581b4b09e2e2665d31ed1704c7af ref: "fix/incorrect_file_name"
device_apps: device_apps:
git: git:
url: https://github.com/ponces/flutter_plugin_device_apps url: https://github.com/ponces/flutter_plugin_device_apps
@ -36,7 +36,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter_background: ^1.2.0 flutter_background: ^1.2.0
flutter_cache_manager: ^3.3.0 flutter_cache_manager: ^3.3.0
flutter_i18n: ^0.32.4 flutter_i18n: ^0.33.0
flutter_local_notifications: ^13.0.0 flutter_local_notifications: ^13.0.0
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter
@ -47,7 +47,7 @@ dependencies:
google_fonts: ^4.0.3 google_fonts: ^4.0.3
http: ^0.13.5 http: ^0.13.5
injectable: ^2.1.1 injectable: ^2.1.1
intl: ^0.17.0 intl: ^0.18.0
json_annotation: ^4.8.0 json_annotation: ^4.8.0
logcat: logcat:
git: git:
@ -74,7 +74,6 @@ dependencies:
wakelock: ^0.6.2 wakelock: ^0.6.2
flutter_dotenv: ^5.0.2 flutter_dotenv: ^5.0.2
flutter_markdown: ^0.6.14 flutter_markdown: ^0.6.14
pub_release: ^8.0.3
dio_cache_interceptor: ^3.4.0 dio_cache_interceptor: ^3.4.0
dev_dependencies: dev_dependencies: