|
@@ -11,7 +11,6 @@ import 'package:media_extension/media_extension_action_types.dart';
|
|
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
|
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
|
import 'package:move_to_background/move_to_background.dart';
|
|
import 'package:move_to_background/move_to_background.dart';
|
|
import 'package:photos/core/configuration.dart';
|
|
import 'package:photos/core/configuration.dart';
|
|
-import "package:photos/core/constants.dart";
|
|
|
|
import 'package:photos/core/event_bus.dart';
|
|
import 'package:photos/core/event_bus.dart';
|
|
import 'package:photos/ente_theme_data.dart';
|
|
import 'package:photos/ente_theme_data.dart';
|
|
import 'package:photos/events/account_configured_event.dart';
|
|
import 'package:photos/events/account_configured_event.dart';
|
|
@@ -104,8 +103,6 @@ class _HomeWidgetState extends State<HomeWidget> {
|
|
late StreamSubscription<BackupFoldersUpdatedEvent> _backupFoldersUpdatedEvent;
|
|
late StreamSubscription<BackupFoldersUpdatedEvent> _backupFoldersUpdatedEvent;
|
|
late StreamSubscription<AccountConfiguredEvent> _accountConfiguredEvent;
|
|
late StreamSubscription<AccountConfiguredEvent> _accountConfiguredEvent;
|
|
late StreamSubscription<CollectionUpdatedEvent> _collectionUpdatedEvent;
|
|
late StreamSubscription<CollectionUpdatedEvent> _collectionUpdatedEvent;
|
|
- static const kUpdateAvailableDialogShownTimeKey =
|
|
|
|
- "update_available_dialog_shown_time_key";
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
void initState() {
|
|
void initState() {
|
|
@@ -197,37 +194,23 @@ class _HomeWidgetState extends State<HomeWidget> {
|
|
},
|
|
},
|
|
);
|
|
);
|
|
_initDeepLinks();
|
|
_initDeepLinks();
|
|
- UpdateService.instance.shouldUpdate().then((shouldUpdate) {
|
|
|
|
- if (shouldUpdate) {
|
|
|
|
- Future.delayed(Duration.zero, () {
|
|
|
|
- SharedPreferences.getInstance().then(
|
|
|
|
- (value) {
|
|
|
|
- final lastDialogShownTime =
|
|
|
|
- value.getInt(kUpdateAvailableDialogShownTimeKey) ?? 0;
|
|
|
|
- final now = DateTime.now().microsecondsSinceEpoch;
|
|
|
|
- final hasBeen3DaysSinceLastShown =
|
|
|
|
- (now - lastDialogShownTime) > (3 * microSecondsInDay);
|
|
|
|
-
|
|
|
|
- if (hasBeen3DaysSinceLastShown) {
|
|
|
|
- value.setInt(
|
|
|
|
- kUpdateAvailableDialogShownTimeKey,
|
|
|
|
- DateTime.now().microsecondsSinceEpoch,
|
|
|
|
- );
|
|
|
|
- showDialog(
|
|
|
|
- context: context,
|
|
|
|
- builder: (BuildContext context) {
|
|
|
|
- return AppUpdateDialog(
|
|
|
|
- UpdateService.instance.getLatestVersionInfo(),
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
- barrierColor: Colors.black.withOpacity(0.85),
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
+ UpdateService.instance.canShowUpdateNoification().then((value) {
|
|
|
|
+ Future.delayed(Duration.zero, () {
|
|
|
|
+ if (value) {
|
|
|
|
+ showDialog(
|
|
|
|
+ context: context,
|
|
|
|
+ builder: (BuildContext context) {
|
|
|
|
+ return AppUpdateDialog(
|
|
|
|
+ UpdateService.instance.getLatestVersionInfo(),
|
|
|
|
+ );
|
|
},
|
|
},
|
|
|
|
+ barrierColor: Colors.black.withOpacity(0.85),
|
|
);
|
|
);
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ UpdateService.instance.resetUpdateAvailableShownTime();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
+
|
|
// For sharing images coming from outside the app
|
|
// For sharing images coming from outside the app
|
|
_initMediaShareSubscription();
|
|
_initMediaShareSubscription();
|
|
WidgetsBinding.instance.addPostFrameCallback(
|
|
WidgetsBinding.instance.addPostFrameCallback(
|