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 #881

Merged
merged 8 commits into from
May 19, 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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ app.*.map.json
.firebase

# Dependency directories
node_modules/
node_modules/

# FVM
.fvm
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ linter:
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
Expand Down
9 changes: 0 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ android {
ndkVersion flutter.ndkVersion

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
Expand All @@ -49,7 +48,6 @@ android {
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

buildTypes {
Expand Down Expand Up @@ -79,11 +77,4 @@ dependencies {
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
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'

}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"errorMessage": "Unable to use selected application",
"downloadToast": "Download function is not available yet",
"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": {
"viewTitle": "Select patches",
Expand Down
2 changes: 1 addition & 1 deletion lib/services/github_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class GithubAPI {
final List<dynamic> commits = response.data;
return commits
.map(
(commit) => (commit['commit']['message']).split('\n')[0] +
(commit) => commit['commit']['message'].split('\n')[0] +
' - ' +
commit['commit']['author']['name'] +
'\n' as String,
Expand Down
1 change: 0 additions & 1 deletion lib/services/revanced_api.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:developer';
import 'dart:io';

import 'package:collection/collection.dart';
Expand Down
18 changes: 6 additions & 12 deletions lib/ui/views/app_selector/app_selector_view.dart
Original file line number Diff line number Diff line change
@@ -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:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/app_skeleton_loader.dart';
Expand Down Expand Up @@ -92,7 +92,10 @@ class _AppSelectorViewState extends State<AppSelectorView> {
? const AppSkeletonLoader()
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0)
.copyWith(bottom: 80),
.copyWith(
bottom:
MediaQuery.of(context).viewPadding.bottom + 8.0,
),
child: Column(
children: [
...model
Expand All @@ -108,16 +111,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
model.getSuggestedVersion(
app.packageName,
),
onTap: () {
model.isRooted
? model.selectApp(app).then(
(_) => Navigator.of(context)
.pop(),
)
: model.showSelectFromStorageDialog(
context,
);
},
onTap: () => model.canSelectInstalled(context, app.packageName),
),
)
.toList(),
Expand Down
24 changes: 24 additions & 0 deletions lib/ui/views/app_selector/app_selector_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ class AppSelectorViewModel extends BaseViewModel {
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 {
locator<PatcherViewModel>().selectedApp = PatchedApplication(
name: application.appName,
Expand All @@ -78,6 +86,22 @@ class AppSelectorViewModel extends BaseViewModel {
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 {
return showDialog(
context: context,
Expand Down
1 change: 1 addition & 0 deletions lib/ui/views/contributors/contributors_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ContributorsView extends StatelessWidget {
title: 'contributorsView.managerContributors',
contributors: model.managerContributors,
),
SizedBox(height: MediaQuery.of(context).viewPadding.bottom)
],
),
),
Expand Down
12 changes: 4 additions & 8 deletions lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ class HomeViewModel extends BaseViewModel {
bool showUpdatableApps = false;
List<PatchedApplication> patchedInstalledApps = [];
List<PatchedApplication> patchedUpdatableApps = [];
String _managerVersion = '';
String? _latestManagerVersion = '';

Future<void> initialize(BuildContext context) async {
_managerVersion = await AboutInfo.getInfo().then(
(value) => value.keys.contains('version') ? value['version']! : '',
);
_managerVersion = await _managerAPI.getCurrentManagerVersion();
_latestManagerVersion = await _managerAPI.getLatestManagerVersion();
await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings(
android: AndroidInitializationSettings('ic_notification'),
Expand Down Expand Up @@ -115,15 +112,14 @@ class HomeViewModel extends BaseViewModel {
}

Future<bool> hasManagerUpdates() async {
final String? latestVersion = await _managerAPI.getLatestManagerVersion();
String currentVersion = await _managerAPI.getCurrentManagerVersion();

// add v to current version
if (!currentVersion.startsWith('v')) {
currentVersion = 'v$currentVersion';
}

if (latestVersion != currentVersion) {
if (_latestManagerVersion != currentVersion) {
return true;
}
return false;
Expand Down Expand Up @@ -194,7 +190,7 @@ class HomeViewModel extends BaseViewModel {
),
const SizedBox(width: 8.0),
Text(
'v$_managerVersion',
'v$_latestManagerVersion',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
Expand Down
6 changes: 6 additions & 0 deletions lib/ui/views/installer/installer_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class InstallerView extends StatelessWidget {
builder: (context, model, child) => WillPopScope(
child: SafeArea(
top: false,
bottom: false,
child: Scaffold(
body: CustomScrollView(
controller: model.scrollController,
Expand Down Expand Up @@ -153,6 +154,11 @@ class InstallerView extends StatelessWidget {
),
),
),
SliverFillRemaining(
hasScrollBody: false,
child: SizedBox(
height: MediaQuery.of(context).viewPadding.bottom),
),
],
),
),
Expand Down
8 changes: 5 additions & 3 deletions lib/ui/views/patches_selector/patches_selector_view.dart
Original file line number Diff line number Diff line change
@@ -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:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
Expand Down Expand Up @@ -129,8 +129,10 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
),
)
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0)
.copyWith(bottom: 80),
padding:
const EdgeInsets.symmetric(horizontal: 12.0).copyWith(
bottom: MediaQuery.of(context).viewPadding.bottom + 8.0,
),
child: Column(
children: [
Row(
Expand Down
8 changes: 4 additions & 4 deletions lib/ui/widgets/homeView/latest_commit_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: const <Widget>[
const Row(
children: <Widget>[
Text('ReVanced Manager'),
],
),
Expand Down Expand Up @@ -82,8 +82,8 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: const <Widget>[
const Row(
children: <Widget>[
Text('ReVanced Patches'),
],
),
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/widgets/settingsView/social_media_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class SocialMediaWidget extends StatelessWidget {
),
expanded: Padding(
padding: padding ?? EdgeInsets.zero,
child: CustomCard(
child: const CustomCard(
child: Column(
children: const <Widget>[
children: <Widget>[
SocialMediaItem(
icon: FaIcon(FontAwesomeIcons.github),
title: Text('GitHub'),
Expand Down
11 changes: 5 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish_to: 'none'
version: 1.1.0+100100000

environment:
sdk: ">=2.17.5 <3.0.0"
sdk: '>=3.0.0 <4.0.0'

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

dev_dependencies:
Expand Down