Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge remote-tracking branch 'origin/main' into widget-superpowered

Prateek Sunala1c180485da0
diff --cc mobile/.fvm/flutter_sdk
index 0000000000,0000000000..87f422a1ad
new file mode 120000
--- /dev/null
+++ b/mobile/.fvm/flutter_sdk
@@@ -1,0 -1,0 +1,1 @@@
++/Users/prateeksunal/fvm/versions/3.27.4
diff --cc mobile/.fvm/fvm_config.json
index 0000000000,0000000000..046557157e
new file mode 100644
--- /dev/null
+++ b/mobile/.fvm/fvm_config.json
@@@ -1,0 -1,0 +1,3 @@@
++{
++ "flutterSdkVersion": "3.27.4"
++}
diff --cc mobile/.fvm/release
index 0000000000,0000000000..7587f94927
new file mode 100644
--- /dev/null
+++ b/mobile/.fvm/release
@@@ -1,0 -1,0 +1,1 @@@
++3.27.4
diff --cc mobile/.fvm/version
index 0000000000,0000000000..7587f94927
new file mode 100644
--- /dev/null
+++ b/mobile/.fvm/version
@@@ -1,0 -1,0 +1,1 @@@
++3.27.4
diff --cc mobile/.fvm/versions/3.27.4
index 0000000000,0000000000..87f422a1ad
new file mode 120000
--- /dev/null
+++ b/mobile/.fvm/versions/3.27.4
@@@ -1,0 -1,0 +1,1 @@@
++/Users/prateeksunal/fvm/versions/3.27.4
diff --cc mobile/lib/services/memories_cache_service.dart
index 971222a880,005146f8c7..17fd486f33
--- a/mobile/lib/services/memories_cache_service.dart
+++ b/mobile/lib/services/memories_cache_service.dart
@@@ -297,20 -275,17 +297,21 @@@ class MemoriesCacheService
);
continue;
}
+ final s = await LanguageService.s;
await NotificationService.instance.scheduleNotification(
- "On this day",
- "Look back on $numberOfMemories memories πŸŒ„",
+ s.onThisDay,
+ s.lookBackOnYourMemories,
id: memory.id.hashCode,
channelID: "onThisDay",
- channelName: "On this day",
+ channelName: s.onThisDay,
payload: memory.id,
dateTime: scheduleTime,
+ timeoutDurationAndroid: const Duration(hours: 16),
);
scheduledDates.add(scheduleTime);
+ _logger.info(
+ "Scheduled notification for memory ${memory.id} on $scheduleTime",
+ );
}
}
diff --cc mobile/lib/services/notification_service.dart
index 8d9fe3e3f7,f6153651b4..69802058d2
--- a/mobile/lib/services/notification_service.dart
+++ b/mobile/lib/services/notification_service.dart
@@@ -150,63 -150,58 +150,101 @@@ class NotificationService
String channelName = "ente",
String payload = "ente://home",
required DateTime dateTime,
+ Duration? timeoutDurationAndroid,
}) async {
- _logger.info(
- "Scheduling notification with: $title, $message, $channelID, $channelName, $payload",
- );
- await initTimezones();
- if (!hasGrantedPermissions()) {
- _logger.warning("Notification permissions not granted");
- await requestPermissions();
+ try {
+ _logger.info(
+ "Scheduling notification with: $title, $message, $channelID, $channelName, $payload",
+ );
+ await initTimezones();
if (!hasGrantedPermissions()) {
- _logger.severe("Failed to get notification permissions");
- return;
+ _logger.warning("Notification permissions not granted");
+ await requestPermissions();
+ if (!hasGrantedPermissions()) {
+ _logger.severe("Failed to get notification permissions");
+ return;
+ }
+ } else {
+ _logger.info("Notification permissions already granted");
}
- } else {
- _logger.info("Notification permissions already granted");
+ final androidSpecs = AndroidNotificationDetails(
+ channelID,
+ channelName,
+ channelDescription: 'ente alerts',
+ importance: Importance.max,
+ priority: Priority.high,
+ category: AndroidNotificationCategory.reminder,
+ showWhen: false,
+ );
+ final iosSpecs = DarwinNotificationDetails(threadIdentifier: channelID);
+ final platformChannelSpecs =
+ NotificationDetails(android: androidSpecs, iOS: iosSpecs);
+ final scheduledDate = tz.TZDateTime.local(
+ dateTime.year,
+ dateTime.month,
+ dateTime.day,
+ dateTime.hour,
+ dateTime.minute,
+ dateTime.second,
+ );
+ // final tz.TZDateTime scheduledDate = tz.TZDateTime.now(tz.local).add(delay);
+ await _notificationsPlugin.zonedSchedule(
+ id,
+ title,
+ message,
+ scheduledDate,
+ platformChannelSpecs,
+ androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle,
+ payload: payload,
+ );
+ _logger.info(
+ "Scheduled notification with: $title, $message, $channelID, $channelName, $payload for $dateTime",
+ );
+ } catch (e, s) {
+ // For now we're swallowing any exceptions here because we don't want the memories logic to get disturbed
+ _logger.severe(
+ "Something went wrong while scheduling notification",
+ e,
+ s,
+ );
}
+ final androidSpecs = AndroidNotificationDetails(
+ channelID,
+ channelName,
+ channelDescription: 'ente alerts',
+ importance: Importance.max,
+ priority: Priority.high,
+ category: AndroidNotificationCategory.reminder,
+ showWhen: false,
+ timeoutAfter: timeoutDurationAndroid?.inMilliseconds,
+ );
+ final iosSpecs = DarwinNotificationDetails(threadIdentifier: channelID);
+ final platformChannelSpecs =
+ NotificationDetails(android: androidSpecs, iOS: iosSpecs);
+ final scheduledDate = tz.TZDateTime.local(
+ dateTime.year,
+ dateTime.month,
+ dateTime.day,
+ dateTime.hour,
+ dateTime.minute,
+ dateTime.second,
+ );
+ // final tz.TZDateTime scheduledDate = tz.TZDateTime.now(tz.local).add(delay);
+ await _notificationsPlugin.zonedSchedule(
+ id,
+ title,
+ message,
+ scheduledDate,
+ platformChannelSpecs,
- uiLocalNotificationDateInterpretation:
- UILocalNotificationDateInterpretation.wallClockTime,
++ // TODO(prateek): check if this is needed, app won't compile with this
++ // uiLocalNotificationDateInterpretation:
++ // UILocalNotificationDateInterpretation.wallClockTime,
+ androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle,
+ payload: payload,
+ );
+ _logger.info(
+ "Scheduled notification with: $title, $message, $channelID, $channelName, $payload",
+ );
}
Future<void> clearAllScheduledNotifications({
diff --cc mobile/lib/services/sync/remote_sync_service.dart
index 1706e35bee,7846120337..61000fdc0b
--- a/mobile/lib/services/sync/remote_sync_service.dart
+++ b/mobile/lib/services/sync/remote_sync_service.dart
@@@ -25,9 -25,7 +25,8 @@@ import 'package:photos/models/upload_st
import "package:photos/service_locator.dart";
import 'package:photos/services/app_lifecycle_service.dart';
import 'package:photos/services/collections_service.dart';
- import "package:photos/services/filedata/filedata_service.dart";
import 'package:photos/services/ignored_files_service.dart';
+import "package:photos/services/language_service.dart";
import 'package:photos/services/local_file_update_service.dart';
import "package:photos/services/notification_service.dart";
import "package:photos/services/preview_video_store.dart";
diff --cc mobile/lib/ui/collections/collection_action_sheet.dart
index f056dc9732,a827e166bb..b0441c21d3
--- a/mobile/lib/ui/collections/collection_action_sheet.dart
+++ b/mobile/lib/ui/collections/collection_action_sheet.dart
@@@ -57,12 -52,8 +56,9 @@@ String _actionName
case CollectionActionType.shareCollection:
text = S.of(context).share;
break;
- case CollectionActionType.collectPhotos:
- text = S.of(context).share;
- break;
case CollectionActionType.addToHiddenAlbum:
text = S.of(context).addToHiddenAlbum;
+ break;
case CollectionActionType.moveToHiddenCollection:
text = S.of(context).moveToHiddenAlbum;
break;
diff --cc mobile/lib/utils/local_settings.dart
index da7fabb312,b51c367d6d..ab63e2ab81
--- a/mobile/lib/utils/local_settings.dart
+++ b/mobile/lib/utils/local_settings.dart
@@@ -121,28 -119,8 +121,16 @@@ class LocalSettings
return value;
}
+ bool get isOnThisDayNotificationsEnabled =>
+ _prefs.getBool(kOnThisDayNotificationsEnabled) ?? true;
+
+ Future<bool> setOnThisDayNotificationsEnabled(bool value) async {
+ await _prefs.setBool(kOnThisDayNotificationsEnabled, value);
+ return value;
+ }
+
bool get userEnabledMultiplePart =>
- _prefs.getBool(kEnableMultiplePart) ?? false;
-
- Future<void> autoEnableMultiplePart(int rolloutPercentage) async {
- if (_prefs.containsKey(kEnableMultiplePart)) {
- return;
- }
- rolloutPercentage = rolloutPercentage.clamp(0, 100);
- final randomValue = DateTime.now().millisecondsSinceEpoch % 100;
- await _prefs.setBool(
- kEnableMultiplePart,
- randomValue < rolloutPercentage,
- );
- }
+ _prefs.getBool(kEnableMultiplePart) ?? true;
Future<bool> setUserEnabledMultiplePart(bool value) async {
await _prefs.setBool(kEnableMultiplePart, value);
diff --cc mobile/plugins/ente_cast/pubspec.lock
index 7c17037ed2,7c17037ed2..47c6c55c56
--- a/mobile/plugins/ente_cast/pubspec.lock
+++ b/mobile/plugins/ente_cast/pubspec.lock
@@@ -21,10 -21,10 +21,10 @@@ packages
dependency: "direct main"
description:
name: collection
-- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
++ sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
-- version: "1.18.0"
++ version: "1.19.0"
dio:
dependency: "direct main"
description:
@@@ -215,7 -215,7 +215,7 @@@
dependency: transitive
description: flutter
source: sdk
-- version: "0.0.99"
++ version: "0.0.0"
source_span:
dependency: transitive
description:
diff --cc mobile/plugins/ente_cast_none/pubspec.lock
index aeb3c20955,aeb3c20955..9fa1deda28
--- a/mobile/plugins/ente_cast_none/pubspec.lock
+++ b/mobile/plugins/ente_cast_none/pubspec.lock
@@@ -21,10 -21,10 +21,10 @@@ packages
dependency: transitive
description:
name: collection
-- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
++ sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
-- version: "1.18.0"
++ version: "1.19.0"
dio:
dependency: transitive
description:
@@@ -222,7 -222,7 +222,7 @@@
dependency: transitive
description: flutter
source: sdk
-- version: "0.0.99"
++ version: "0.0.0"
source_span:
dependency: transitive
description:
diff --cc mobile/plugins/ente_cast_normal/pubspec.lock
index e1786a9a8f,e1786a9a8f..05344c3dac
--- a/mobile/plugins/ente_cast_normal/pubspec.lock
+++ b/mobile/plugins/ente_cast_normal/pubspec.lock
@@@ -30,10 -30,10 +30,10 @@@ packages
dependency: transitive
description:
name: collection
-- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
++ sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
-- version: "1.18.0"
++ version: "1.19.0"
dio:
dependency: transitive
description:
@@@ -263,7 -263,7 +263,7 @@@
dependency: transitive
description: flutter
source: sdk
-- version: "0.0.99"
++ version: "0.0.0"
source_span:
dependency: transitive
description:
@@@ -337,5 -337,5 +337,5 @@@
source: hosted
version: "1.0.4"
sdks:
-- dart: ">=3.3.0 <4.0.0"
++ dart: ">=3.4.0 <4.0.0"
flutter: ">=3.19.0"
diff --cc mobile/plugins/ente_crypto/pubspec.lock
index 0807ae8a31,0807ae8a31..7574c76da8
--- a/mobile/plugins/ente_crypto/pubspec.lock
+++ b/mobile/plugins/ente_crypto/pubspec.lock
@@@ -13,10 -13,10 +13,10 @@@ packages
dependency: "direct main"
description:
name: collection
-- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
++ sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
-- version: "1.18.0"
++ version: "1.19.0"
computer:
dependency: "direct main"
description:
@@@ -91,7 -91,7 +91,7 @@@
dependency: transitive
description: flutter
source: sdk
-- version: "0.0.99"
++ version: "0.0.0"
vector_math:
dependency: transitive
description:
diff --cc mobile/plugins/ente_feature_flag/pubspec.lock
index e58ff1231c,e58ff1231c..608654b2e8
--- a/mobile/plugins/ente_feature_flag/pubspec.lock
+++ b/mobile/plugins/ente_feature_flag/pubspec.lock
@@@ -21,10 -21,10 +21,10 @@@ packages
dependency: "direct main"
description:
name: collection
-- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
++ sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
-- version: "1.18.0"
++ version: "1.19.0"
dio:
dependency: "direct main"
description:
@@@ -215,7 -215,7 +215,7 @@@
dependency: transitive
description: flutter
source: sdk
-- version: "0.0.99"
++ version: "0.0.0"
source_span:
dependency: transitive
description:
diff --cc mobile/plugins/onnx_dart/pubspec.lock
index 72000bb8f1,72000bb8f1..ec8eccea6e
--- a/mobile/plugins/onnx_dart/pubspec.lock
+++ b/mobile/plugins/onnx_dart/pubspec.lock
@@@ -37,10 -37,10 +37,10 @@@ packages
dependency: transitive
description:
name: collection
-- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
++ sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
-- version: "1.18.0"
++ version: "1.19.0"
fake_async:
dependency: transitive
description:
@@@ -71,18 -71,18 +71,18 @@@
dependency: transitive
description:
name: leak_tracker
-- sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
++ sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
url: "https://pub.dev"
source: hosted
-- version: "10.0.5"
++ version: "10.0.7"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
-- sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
++ sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
url: "https://pub.dev"
source: hosted
-- version: "3.0.5"
++ version: "3.0.8"
leak_tracker_testing:
dependency: transitive
description:
@@@ -143,7 -143,7 +143,7 @@@
dependency: transitive
description: flutter
source: sdk
-- version: "0.0.99"
++ version: "0.0.0"
source_span:
dependency: transitive
description:
@@@ -156,10 -156,10 +156,10 @@@
dependency: transitive
description:
name: stack_trace
-- sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
++ sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
-- version: "1.11.1"
++ version: "1.12.0"
stream_channel:
dependency: transitive
description:
@@@ -172,10 -172,10 +172,10 @@@
dependency: transitive
description:
name: string_scanner
-- sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
++ sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
-- version: "1.2.0"
++ version: "1.3.0"
term_glyph:
dependency: transitive
description:
@@@ -188,10 -188,10 +188,10 @@@
dependency: transitive
description:
name: test_api
-- sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
++ sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.dev"
source: hosted
-- version: "0.7.2"
++ version: "0.7.3"
vector_math:
dependency: transitive
description:
@@@ -204,10 -204,10 +204,10 @@@
dependency: transitive
description:
name: vm_service
-- sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
++ sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
url: "https://pub.dev"
source: hosted
-- version: "14.2.5"
++ version: "14.3.0"
sdks:
dart: ">=3.4.3 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"