Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

add cancel button in update notification dialog

ashilkn18d0272cf0eb
diff --git a/lib/ui/settings/app_update_dialog.dart b/lib/ui/settings/app_update_dialog.dart
index 0f739627ef..124b87927c 100644
--- a/lib/ui/settings/app_update_dialog.dart
+++ b/lib/ui/settings/app_update_dialog.dart
@@ -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(
diff --git a/lib/ui/tabs/home_widget.dart b/lib/ui/tabs/home_widget.dart
index ff657b6125..cd62677849 100644
--- a/lib/ui/tabs/home_widget.dart
+++ b/lib/ui/tabs/home_widget.dart
@@ -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,