mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
feat: get changelog from app's specific github path (ugly)
This commit is contained in:
@ -17,7 +17,6 @@ class HomeView extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<HomeViewModel>.reactive(
|
||||
disposeViewModel: false,
|
||||
fireOnModelReadyOnce: true,
|
||||
onModelReady: (model) => model.initialize(),
|
||||
viewModelBuilder: () => locator<HomeViewModel>(),
|
||||
builder: (context, model, child) => Scaffold(
|
||||
@ -111,8 +110,8 @@ class HomeView extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
model.showUpdatableApps
|
||||
? const AvailableUpdatesCard()
|
||||
: const InstalledAppsCard()
|
||||
? AvailableUpdatesCard()
|
||||
: InstalledAppsCard(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -26,14 +26,14 @@ class HomeViewModel extends BaseViewModel {
|
||||
List<PatchedApplication> patchedUpdatableApps = [];
|
||||
|
||||
Future<void> initialize() async {
|
||||
await _getPatchedApps();
|
||||
await flutterLocalNotificationsPlugin.initialize(
|
||||
const InitializationSettings(
|
||||
android: AndroidInitializationSettings('ic_notification'),
|
||||
),
|
||||
onSelectNotification: (p) => DeviceApps.openApp('app.revanced.manager'),
|
||||
);
|
||||
_managerAPI.reAssessSavedApps().then((_) => notifyListeners());
|
||||
_getPatchedApps();
|
||||
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
||||
}
|
||||
|
||||
void toggleUpdatableApps(bool value) {
|
||||
@ -49,11 +49,8 @@ class HomeViewModel extends BaseViewModel {
|
||||
locator<MainViewModel>().setIndex(1);
|
||||
}
|
||||
|
||||
Future<void> _getPatchedApps() async {
|
||||
patchedInstalledApps = _managerAPI
|
||||
.getPatchedApps()
|
||||
.where((app) => app.hasUpdates == false)
|
||||
.toList();
|
||||
void _getPatchedApps() {
|
||||
patchedInstalledApps = _managerAPI.getPatchedApps().toList();
|
||||
patchedUpdatableApps = _managerAPI
|
||||
.getPatchedApps()
|
||||
.where((app) => app.hasUpdates == true)
|
||||
|
@ -136,7 +136,7 @@ class InstallerViewModel extends BaseViewModel {
|
||||
update(1.0, 'Installed!', 'Installed!');
|
||||
_app!.patchDate = DateTime.now();
|
||||
_app!.appliedPatches = _patches.map((p) => p.name).toList();
|
||||
_managerAPI.savePatchedApp(_app!);
|
||||
await _managerAPI.savePatchedApp(_app!);
|
||||
} else {
|
||||
update(1.0, 'Aborting...', 'An error occurred! Aborting');
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class RootCheckerViewModel extends BaseViewModel {
|
||||
|
||||
Future<void> navigateToHome() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
prefs.setBool('isRooted', isRooted);
|
||||
await prefs.setBool('isRooted', isRooted);
|
||||
_navigationService.navigateTo(Routes.navigation);
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -1,21 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/application_item.dart';
|
||||
|
||||
class AvailableUpdatesCard extends StatelessWidget {
|
||||
const AvailableUpdatesCard({
|
||||
AvailableUpdatesCard({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<PatchedApplication> apps =
|
||||
locator<HomeViewModel>().patchedUpdatableApps;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: locator<HomeViewModel>()
|
||||
.patchedUpdatableApps
|
||||
children: apps
|
||||
.map((app) => ApplicationItem(
|
||||
icon: app.icon,
|
||||
name: app.name,
|
||||
|
@ -1,22 +1,25 @@
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/application_item.dart';
|
||||
|
||||
class InstalledAppsCard extends StatelessWidget {
|
||||
const InstalledAppsCard({
|
||||
InstalledAppsCard({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<PatchedApplication> apps =
|
||||
locator<HomeViewModel>().patchedInstalledApps;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: locator<HomeViewModel>()
|
||||
.patchedInstalledApps
|
||||
children: apps
|
||||
.map((app) => ApplicationItem(
|
||||
icon: app.icon,
|
||||
name: app.name,
|
||||
|
@ -105,7 +105,7 @@ class ApplicationItem extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
' - ${changelog.join('\n- ')}',
|
||||
'\u2022 ${changelog.join('\n\u2022 ')}',
|
||||
style: kRobotoTextStyle,
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user