add cancel button in update notification dialog
This commit is contained in:
parent
06058cd4ee
commit
18d0272cf0
2 changed files with 26 additions and 28 deletions
|
@ -6,6 +6,8 @@ import 'package:photos/ente_theme_data.dart';
|
|||
import "package:photos/generated/l10n.dart";
|
||||
import 'package:photos/services/update_service.dart';
|
||||
import 'package:photos/theme/ente_theme.dart';
|
||||
import "package:photos/ui/components/buttons/button_widget.dart";
|
||||
import "package:photos/ui/components/models/button_type.dart";
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
class AppUpdateDialog extends StatefulWidget {
|
||||
|
@ -62,32 +64,28 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
|
|||
children: changelog,
|
||||
),
|
||||
const Padding(padding: EdgeInsets.all(8)),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 56,
|
||||
child: OutlinedButton(
|
||||
style: Theme.of(context).outlinedButtonTheme.style!.copyWith(
|
||||
textStyle: MaterialStateProperty.resolveWith<TextStyle>(
|
||||
(Set<MaterialState> states) {
|
||||
return enteTextTheme.bodyBold;
|
||||
},
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
// ignore: unawaited_futures
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ApkDownloaderDialog(widget.latestVersionInfo);
|
||||
},
|
||||
barrierDismissible: false,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
S.of(context).update,
|
||||
),
|
||||
),
|
||||
ButtonWidget(
|
||||
buttonType: ButtonType.primary,
|
||||
labelText: S.of(context).update,
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
// ignore: unawaited_futures
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ApkDownloaderDialog(widget.latestVersionInfo);
|
||||
},
|
||||
barrierDismissible: false,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
ButtonWidget(
|
||||
buttonType: ButtonType.secondary,
|
||||
labelText: S.of(context).cancel,
|
||||
onTap: () async {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
const Padding(padding: EdgeInsets.all(8)),
|
||||
Center(
|
||||
|
|
|
@ -205,10 +205,10 @@ class _HomeWidgetState extends State<HomeWidget> {
|
|||
final lastDialogShownTime =
|
||||
value.getInt(kUpdateAvailableDialogShownTimeKey) ?? 0;
|
||||
final now = DateTime.now().microsecondsSinceEpoch;
|
||||
final hasBeen3DaysSinceLastNotification =
|
||||
final hasBeen3DaysSinceLastShown =
|
||||
(now - lastDialogShownTime) > (3 * microSecondsInDay);
|
||||
|
||||
if (hasBeen3DaysSinceLastNotification) {
|
||||
if (hasBeen3DaysSinceLastShown) {
|
||||
value.setInt(
|
||||
kUpdateAvailableDialogShownTimeKey,
|
||||
DateTime.now().microsecondsSinceEpoch,
|
||||
|
|
Loading…
Add table
Reference in a new issue