Skip to content

armgit / ente

Public Imported from GitHub
0

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

strict_top_level_inference tranche 3: usage-analysis params and cleanups

Manav Rathi0a2e5ff56341
diff --git a/mobile/apps/auth/lib/locale.dart b/mobile/apps/auth/lib/locale.dart
index d71bc1f4ea..8e7ac1b931 100644
--- a/mobile/apps/auth/lib/locale.dart
+++ b/mobile/apps/auth/lib/locale.dart
@@ -41,12 +41,15 @@ Locale? autoDetectedLocale;
// This function takes device locales and supported locales as input
// and returns the best matching locale.
// The device locales are sorted by priority, so the first one is the most preferred.
-Locale localResolutionCallBack(onDeviceLocales, supportedLocales) {
+Locale localResolutionCallBack(
+ List<Locale>? onDeviceLocales,
+ Iterable<Locale> supportedLocales,
+) {
final Set<String> languageSupport = {};
for (Locale supportedLocale in appSupportedLocales) {
languageSupport.add(supportedLocale.languageCode);
}
- for (Locale locale in onDeviceLocales) {
+ for (Locale locale in onDeviceLocales ?? const []) {
// check if exact local is supported, if yes, return it
if (appSupportedLocales.contains(locale)) {
autoDetectedLocale = locale;
diff --git a/mobile/apps/auth/lib/services/billing_service.dart b/mobile/apps/auth/lib/services/billing_service.dart
index 49683893ec..3cbd9c5725 100644
--- a/mobile/apps/auth/lib/services/billing_service.dart
+++ b/mobile/apps/auth/lib/services/billing_service.dart
@@ -61,9 +61,9 @@ class BillingService {
}
Future<Subscription> verifySubscription(
- final productID,
- final verificationData, {
- final paymentProvider,
+ final String productID,
+ final String verificationData, {
+ final String? paymentProvider,
}) async {
try {
final response = await _dio.post(
diff --git a/mobile/apps/locker/lib/core/locale.dart b/mobile/apps/locker/lib/core/locale.dart
index 92b4744d7f..b6e50c23dd 100644
--- a/mobile/apps/locker/lib/core/locale.dart
+++ b/mobile/apps/locker/lib/core/locale.dart
@@ -26,12 +26,15 @@ Locale? autoDetectedLocale;
// This function takes device locales and supported locales as input
// and returns the best matching locale.
// The device locales are sorted by priority, so the first one is the most preferred.
-Locale localResolutionCallBack(onDeviceLocales, supportedLocales) {
+Locale localResolutionCallBack(
+ List<Locale>? onDeviceLocales,
+ Iterable<Locale> supportedLocales,
+) {
final Set<String> languageSupport = {};
for (Locale supportedLocale in appSupportedLocales) {
languageSupport.add(supportedLocale.languageCode);
}
- for (Locale locale in onDeviceLocales) {
+ for (Locale locale in onDeviceLocales ?? const []) {
// check if exact local is supported, if yes, return it
if (appSupportedLocales.contains(locale)) {
autoDetectedLocale = locale;
diff --git a/mobile/apps/locker/lib/services/db/locker_db.dart b/mobile/apps/locker/lib/services/db/locker_db.dart
index 2548f513e9..b2084489ff 100644
--- a/mobile/apps/locker/lib/services/db/locker_db.dart
+++ b/mobile/apps/locker/lib/services/db/locker_db.dart
@@ -697,15 +697,11 @@ class LockerDB extends EnteBaseDatabase {
final shareesData = payload['sharees'] as List<dynamic>? ?? const [];
final sharees = shareesData
.map((shareeeMap) => User.fromMap(shareeeMap as Map<String, dynamic>))
- .where((user) => user != null)
- .cast<User>()
.toList();
final publicURLsData = payload['public_urls'] as List<dynamic>? ?? const [];
final publicURLs = publicURLsData
.map((urlMap) => PublicURL.fromMap(urlMap as Map<String, dynamic>))
- .where((url) => url != null)
- .cast<PublicURL>()
.toList();
final collection = Collection(
diff --git a/mobile/apps/photos/lib/l10n/l10n.dart b/mobile/apps/photos/lib/l10n/l10n.dart
index 7929371918..d16d6ad73d 100644
--- a/mobile/apps/photos/lib/l10n/l10n.dart
+++ b/mobile/apps/photos/lib/l10n/l10n.dart
@@ -34,13 +34,16 @@ extension AppLocalizationsX on BuildContext {
List<Locale> _onDeviceLocales = [];
Locale? autoDetectedLocale;
-Locale localResolutionCallBack(deviceLocales, supportedLocales) {
- _onDeviceLocales = deviceLocales;
+Locale localResolutionCallBack(
+ List<Locale>? deviceLocales,
+ Iterable<Locale> supportedLocales,
+) {
+ _onDeviceLocales = deviceLocales ?? [];
final Set<String> languageSupport = {};
for (Locale supportedLocale in appSupportedLocales) {
languageSupport.add(supportedLocale.languageCode);
}
- for (Locale locale in deviceLocales) {
+ for (Locale locale in _onDeviceLocales) {
// check if exact local is supported, if yes, return it
if (appSupportedLocales.contains(locale)) {
autoDetectedLocale = locale;
diff --git a/mobile/apps/photos/lib/services/account/billing_service.dart b/mobile/apps/photos/lib/services/account/billing_service.dart
index 6171e4c867..ef409d6657 100644
--- a/mobile/apps/photos/lib/services/account/billing_service.dart
+++ b/mobile/apps/photos/lib/services/account/billing_service.dart
@@ -59,9 +59,9 @@ class BillingService {
}
Future<Subscription> verifySubscription(
- final productID,
- final verificationData, {
- final paymentProvider,
+ final String productID,
+ final String verificationData, {
+ final String? paymentProvider,
}) async {
try {
return await _gateway.verifySubscription(
diff --git a/mobile/apps/photos/lib/services/machine_learning/face_ml/face_alignment/similarity_transform.dart b/mobile/apps/photos/lib/services/machine_learning/face_ml/face_alignment/similarity_transform.dart
index 1a5b723ecf..e6eb7469be 100644
--- a/mobile/apps/photos/lib/services/machine_learning/face_ml/face_alignment/similarity_transform.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/face_ml/face_alignment/similarity_transform.dart
@@ -21,12 +21,14 @@ class SimilarityTransform {
<double>[41.5493, 92.3655],
<double>[70.7299, 92.2041],
];
- static List<List<double>> get mobilefacenetIdealNormalized4 => _mobilefacenetIdeal4Landmarks
- .map((list) => list.map((value) => value / 112.0).toList())
- .toList();
- static List<List<double>> get mobilefacenetIdealNormalized5 => _mobilefacenetIdeal5Landmarks
- .map((list) => list.map((value) => value / 112.0).toList())
- .toList();
+ static List<List<double>> get mobilefacenetIdealNormalized4 =>
+ _mobilefacenetIdeal4Landmarks
+ .map((list) => list.map((value) => value / 112.0).toList())
+ .toList();
+ static List<List<double>> get mobilefacenetIdealNormalized5 =>
+ _mobilefacenetIdeal5Landmarks
+ .map((list) => list.map((value) => value / 112.0).toList())
+ .toList();
SimilarityTransform();
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_result.dart b/mobile/apps/photos/lib/services/machine_learning/ml_result.dart
index 907557956a..4c0928e268 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_result.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_result.dart
@@ -36,7 +36,7 @@ class MLResult {
});
MLResult.fromEnteFileID(
- fileID, {
+ int fileID, {
this.decodedImageSize = const Dimensions(width: -1, height: -1),
}) : fileId = fileID;
diff --git a/mobile/apps/photos/lib/ui/payment/payment_web_page.dart b/mobile/apps/photos/lib/ui/payment/payment_web_page.dart
index 2230cec847..1b1c2e3f29 100644
--- a/mobile/apps/photos/lib/ui/payment/payment_web_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/payment_web_page.dart
@@ -16,10 +16,10 @@ import 'package:photos/utils/dialog_util.dart';
import "package:photos/utils/email_util.dart";
class PaymentWebPage extends StatefulWidget {
- final String? planId;
+ final String planId;
final String? actionType;
- const PaymentWebPage({super.key, this.planId, this.actionType});
+ const PaymentWebPage({super.key, required this.planId, this.actionType});
@override
State<StatefulWidget> createState() => _PaymentWebPageState();
diff --git a/mobile/apps/photos/lib/utils/exif_util.dart b/mobile/apps/photos/lib/utils/exif_util.dart
index 4ff26d158f..f4bbda400d 100644
--- a/mobile/apps/photos/lib/utils/exif_util.dart
+++ b/mobile/apps/photos/lib/utils/exif_util.dart
@@ -84,7 +84,7 @@ Future<FFProbeProps?> getVideoPropsAsync(File originalFile) async {
return null;
}
- final properties = await FFProbeProps.parseData(mediaInfo);
+ final properties = FFProbeProps.parseData(mediaInfo);
_logger.info("getVideoPropsAsync took ${stopwatch.elapsedMilliseconds}ms");
stopwatch.stop();
diff --git a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
index 664bad83f3..f915a434ff 100644
--- a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
+++ b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
@@ -276,8 +276,8 @@ Future<Map<String, Uint8List>?> getCachedFaceCrops(
}
Future<Uint8List?> precomputeClusterFaceCrop(
- file,
- clusterID, {
+ EnteFile file,
+ String clusterID, {
required bool useFullFile,
}) async {
try {
diff --git a/mobile/apps/photos/lib/utils/magic_util.dart b/mobile/apps/photos/lib/utils/magic_util.dart
index 1c8863aa92..f4b22abcbd 100644
--- a/mobile/apps/photos/lib/utils/magic_util.dart
+++ b/mobile/apps/photos/lib/utils/magic_util.dart
@@ -350,7 +350,10 @@ bool _shouldReloadGallery(String key) {
return key == editTimeKey;
}
-String _visActionProgressDialogText(BuildContext context, _VisibilityAction action) {
+String _visActionProgressDialogText(
+ BuildContext context,
+ _VisibilityAction action,
+) {
switch (action) {
case _VisibilityAction.archive:
return AppLocalizations.of(context).archiving;
@@ -363,7 +366,10 @@ String _visActionProgressDialogText(BuildContext context, _VisibilityAction acti
}
}
-String _visActionSuccessfulText(BuildContext context, _VisibilityAction action) {
+String _visActionSuccessfulText(
+ BuildContext context,
+ _VisibilityAction action,
+) {
switch (action) {
case _VisibilityAction.archive:
return AppLocalizations.of(context).successfullyArchived;
@@ -377,7 +383,7 @@ String _visActionSuccessfulText(BuildContext context, _VisibilityAction action)
}
_VisibilityAction _getVisibilityAction(
- context,
+ BuildContext context,
int newVisibility,
int prevVisibility,
) {
diff --git a/mobile/packages/ui/lib/utils/dialog_util.dart b/mobile/packages/ui/lib/utils/dialog_util.dart
index 4831863a7b..cadd65be0f 100644
--- a/mobile/packages/ui/lib/utils/dialog_util.dart
+++ b/mobile/packages/ui/lib/utils/dialog_util.dart
@@ -146,7 +146,7 @@ Future<ButtonResult?> showGenericErrorDialog({
buttonAction: ButtonAction.third,
isInAlert: true,
onTap: () async {
- PlatformUtil.openWebView(
+ await PlatformUtil.openWebView(
context,
context.strings.faq,
"https://ente.com/help/auth/troubleshooting/windows-login",
diff --git a/mobile/packages/utils/lib/platform_util.dart b/mobile/packages/utils/lib/platform_util.dart
index a87e856f9b..f6875d7ed6 100644
--- a/mobile/packages/utils/lib/platform_util.dart
+++ b/mobile/packages/utils/lib/platform_util.dart
@@ -12,7 +12,11 @@ class PlatformUtil {
? cupertinoTextSelectionControls
: desktopTextSelectionControls;
- static Future<void> openWebView(BuildContext context, String title, String url) async {
+ static Future<void> openWebView(
+ BuildContext context,
+ String title,
+ String url,
+ ) async {
// For desktop, always open in external browser
// For mobile, open in external browser (apps can override this if they have web view)
await launchUrlString(url);