feat: allow control over patches update (#1063)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
aAbed 2023-08-04 02:08:56 +05:45 committed by GitHub
parent e55f427b05
commit f905a52988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 322 additions and 103 deletions

View file

@ -8,11 +8,11 @@ import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
class LatestCommitCard extends StatefulWidget {
const LatestCommitCard({
Key? key,
required this.onPressedManager,
required this.onPressedPatches,
required this.model,
required this.parentContext,
}) : super(key: key);
final Function() onPressedManager;
final Function() onPressedPatches;
final HomeViewModel model;
final BuildContext parentContext;
@override
State<LatestCommitCard> createState() => _LatestCommitCardState();
@ -63,7 +63,10 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
child: CustomMaterialButton(
label: I18nText('updateButton'),
onPressed: snapshot.hasData && snapshot.data!
? widget.onPressedManager
? () => widget.model.showUpdateConfirmationDialog(
widget.parentContext,
false,
)
: () => {},
),
),
@ -91,7 +94,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
Row(
children: <Widget>[
FutureBuilder<String?>(
future: model.getLatestPatcherReleaseTime(),
future: model.getLatestPatchesReleaseTime(),
builder: (context, snapshot) => Text(
snapshot.hasData && snapshot.data!.isNotEmpty
? FlutterI18n.translate(
@ -117,7 +120,10 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
child: CustomMaterialButton(
label: I18nText('updateButton'),
onPressed: snapshot.hasData && snapshot.data!
? widget.onPressedPatches
? () => widget.model.showUpdateConfirmationDialog(
widget.parentContext,
true,
)
: () => {},
),
),