remove prefix letter 'k' from constants in constants.dart
This commit is contained in:
parent
05fab4c072
commit
c9bbb80c05
24 changed files with 76 additions and 78 deletions
8
lib/core/cache/thumbnail_cache.dart
vendored
8
lib/core/cache/thumbnail_cache.dart
vendored
|
@ -13,7 +13,7 @@ class ThumbnailLruCache {
|
|||
return _map.get(
|
||||
enteFile.cacheKey() +
|
||||
"_" +
|
||||
(size != null ? size.toString() : kThumbnailLargeSize.toString()),
|
||||
(size != null ? size.toString() : thumbnailLargeSize.toString()),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -25,17 +25,17 @@ class ThumbnailLruCache {
|
|||
_map.put(
|
||||
enteFile.cacheKey() +
|
||||
"_" +
|
||||
(size != null ? size.toString() : kThumbnailLargeSize.toString()),
|
||||
(size != null ? size.toString() : thumbnailLargeSize.toString()),
|
||||
imageData,
|
||||
);
|
||||
}
|
||||
|
||||
static void clearCache(EnteFile enteFile) {
|
||||
_map.remove(
|
||||
enteFile.cacheKey() + "_" + kThumbnailLargeSize.toString(),
|
||||
enteFile.cacheKey() + "_" + thumbnailLargeSize.toString(),
|
||||
);
|
||||
_map.remove(
|
||||
enteFile.cacheKey() + "_" + kThumbnailSmallSize.toString(),
|
||||
enteFile.cacheKey() + "_" + thumbnailSmallSize.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,9 +334,9 @@ class Configuration {
|
|||
Future<void> recover(String recoveryKey) async {
|
||||
// check if user has entered mnemonic code
|
||||
if (recoveryKey.contains(' ')) {
|
||||
if (recoveryKey.split(' ').length != kMnemonicKeyWordCount) {
|
||||
if (recoveryKey.split(' ').length != mnemonicKeyWordCount) {
|
||||
throw AssertionError(
|
||||
'recovery code should have $kMnemonicKeyWordCount words',
|
||||
'recovery code should have $mnemonicKeyWordCount words',
|
||||
);
|
||||
}
|
||||
recoveryKey = bip39.mnemonicToEntropy(recoveryKey);
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
// @dart = 2.7
|
||||
|
||||
const int kThumbnailSmallSize = 256;
|
||||
const int kThumbnailQuality = 50;
|
||||
const int kThumbnailLargeSize = 512;
|
||||
const int kCompressedThumbnailResolution = 1080;
|
||||
const int kThumbnailDataLimit = 100 * 1024;
|
||||
const String kSentryDSN =
|
||||
const int thumbnailSmallSize = 256;
|
||||
const int thumbnailQuality = 50;
|
||||
const int thumbnailLargeSize = 512;
|
||||
const int compressedThumbnailResolution = 1080;
|
||||
const int thumbnailDataLimit = 100 * 1024;
|
||||
const String sentryDSN =
|
||||
"https://2235e5c99219488ea93da34b9ac1cb68@sentry.ente.io/4";
|
||||
const String kSentryDebugDSN =
|
||||
const String sentryDebugDSN =
|
||||
"https://ca5e686dd7f149d9bf94e620564cceba@sentry.ente.io/3";
|
||||
const String kSentryTunnel = "https://sentry-reporter.ente.io";
|
||||
const String kRoadmapURL = "https://roadmap.ente.io";
|
||||
const int kMicroSecondsInDay = 86400000000;
|
||||
const int kAndroid11SDKINT = 30;
|
||||
const int kGalleryLoadStartTime = -8000000000000000; // Wednesday, March 6, 1748
|
||||
const int kGalleryLoadEndTime = 9223372036854775807; // 2^63 -1
|
||||
const String sentryTunnel = "https://sentry-reporter.ente.io";
|
||||
const String roadmapURL = "https://roadmap.ente.io";
|
||||
const int microSecondsInDay = 86400000000;
|
||||
const int android11SDKINT = 30;
|
||||
const int galleryLoadStartTime = -8000000000000000; // Wednesday, March 6, 1748
|
||||
const int galleryLoadEndTime = 9223372036854775807; // 2^63 -1
|
||||
|
||||
// used to identify which ente file are available in app cache
|
||||
// todo: 6Jun22: delete old media identifier after 3 months
|
||||
const String kOldSharedMediaIdentifier = 'ente-shared://';
|
||||
const String kSharedMediaIdentifier = 'ente-shared-media://';
|
||||
const String oldSharedMediaIdentifier = 'ente-shared://';
|
||||
const String sharedMediaIdentifier = 'ente-shared-media://';
|
||||
|
||||
const int kMaxLivePhotoToastCount = 2;
|
||||
const String kLivePhotoToastCounterKey = "show_live_photo_toast";
|
||||
const int maxLivePhotoToastCount = 2;
|
||||
const String livePhotoToastCounterKey = "show_live_photo_toast";
|
||||
|
||||
const kThumbnailDiskLoadDeferDuration = Duration(milliseconds: 40);
|
||||
const kThumbnailServerLoadDeferDuration = Duration(milliseconds: 80);
|
||||
const thumbnailDiskLoadDeferDuration = Duration(milliseconds: 40);
|
||||
const thumbnailServerLoadDeferDuration = Duration(milliseconds: 80);
|
||||
|
||||
// 256 bit key maps to 24 words
|
||||
// https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#Generating_the_mnemonic
|
||||
const kMnemonicKeyWordCount = 24;
|
||||
const mnemonicKeyWordCount = 24;
|
||||
|
||||
// https://stackoverflow.com/a/61162219
|
||||
const kDragSensitivity = 8;
|
||||
const dragSensitivity = 8;
|
||||
|
||||
const kSupportEmail = 'support@ente.io';
|
||||
const supportEmail = 'support@ente.io';
|
||||
|
||||
// Default values for various feature flags
|
||||
class FFDefault {
|
||||
|
|
|
@ -175,8 +175,8 @@ Future _runWithLogs(Function() function, {String prefix = ""}) async {
|
|||
body: function,
|
||||
logDirPath: (await getApplicationSupportDirectory()).path + "/logs",
|
||||
maxLogFiles: 5,
|
||||
sentryDsn: kDebugMode ? kSentryDebugDSN : kSentryDSN,
|
||||
tunnel: kSentryTunnel,
|
||||
sentryDsn: kDebugMode ? sentryDebugDSN : sentryDSN,
|
||||
tunnel: sentryTunnel,
|
||||
enableInDebugMode: true,
|
||||
prefix: prefix,
|
||||
),
|
||||
|
|
|
@ -234,8 +234,8 @@ class File extends EnteFile {
|
|||
|
||||
bool isSharedMediaToAppSandbox() {
|
||||
return localID != null &&
|
||||
(localID.startsWith(kOldSharedMediaIdentifier) ||
|
||||
localID.startsWith(kSharedMediaIdentifier));
|
||||
(localID.startsWith(oldSharedMediaIdentifier) ||
|
||||
localID.startsWith(sharedMediaIdentifier));
|
||||
}
|
||||
|
||||
bool hasLocation() {
|
||||
|
|
|
@ -33,7 +33,7 @@ class MemoriesService extends ChangeNotifier {
|
|||
// Intention of delay is to give more CPU cycles to other tasks
|
||||
Future.delayed(const Duration(seconds: 5), () {
|
||||
_memoriesDB.clearMemoriesSeenBeforeTime(
|
||||
DateTime.now().microsecondsSinceEpoch - (7 * kMicroSecondsInDay),
|
||||
DateTime.now().microsecondsSinceEpoch - (7 * microSecondsInDay),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||
class PushService {
|
||||
static const kFCMPushToken = "fcm_push_token";
|
||||
static const kLastFCMTokenUpdationTime = "fcm_push_token_updation_time";
|
||||
static const kFCMTokenUpdationIntervalInMicroSeconds =
|
||||
30 * kMicroSecondsInDay;
|
||||
static const kFCMTokenUpdationIntervalInMicroSeconds = 30 * microSecondsInDay;
|
||||
static const kPushAction = "action";
|
||||
static const kSync = "sync";
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ class SyncService {
|
|||
final lastNotificationShownTime =
|
||||
_prefs.getInt(kLastStorageLimitExceededNotificationPushTime) ?? 0;
|
||||
final now = DateTime.now().microsecondsSinceEpoch;
|
||||
if ((now - lastNotificationShownTime) > kMicroSecondsInDay) {
|
||||
if ((now - lastNotificationShownTime) > microSecondsInDay) {
|
||||
await _prefs.setInt(kLastStorageLimitExceededNotificationPushTime, now);
|
||||
NotificationService.instance.showNotification(
|
||||
"storage limit exceeded",
|
||||
|
|
|
@ -66,7 +66,7 @@ class UpdateService {
|
|||
_prefs.getInt(kUpdateAvailableShownTimeKey) ?? 0;
|
||||
final now = DateTime.now().microsecondsSinceEpoch;
|
||||
final hasBeen3DaysSinceLastNotification =
|
||||
(now - lastNotificationShownTime) > (3 * kMicroSecondsInDay);
|
||||
(now - lastNotificationShownTime) > (3 * microSecondsInDay);
|
||||
if (shouldUpdate &&
|
||||
hasBeen3DaysSinceLastNotification &&
|
||||
_latestVersion.shouldNotify) {
|
||||
|
|
|
@ -51,9 +51,9 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String recoveryKey = bip39.entropyToMnemonic(widget.recoveryKey);
|
||||
if (recoveryKey.split(' ').length != kMnemonicKeyWordCount) {
|
||||
if (recoveryKey.split(' ').length != mnemonicKeyWordCount) {
|
||||
throw AssertionError(
|
||||
'recovery code should have $kMnemonicKeyWordCount words',
|
||||
'recovery code should have $mnemonicKeyWordCount words',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
|||
DateTime(galleryDate.year, galleryDate.month, galleryDate.day);
|
||||
final result = await widget.asyncLoader(
|
||||
dayStartTime.microsecondsSinceEpoch,
|
||||
dayStartTime.microsecondsSinceEpoch + kMicroSecondsInDay - 1,
|
||||
dayStartTime.microsecondsSinceEpoch + microSecondsInDay - 1,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
|
@ -331,8 +331,8 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|||
),
|
||||
child: ThumbnailWidget(
|
||||
file,
|
||||
diskLoadDeferDuration: kThumbnailDiskLoadDeferDuration,
|
||||
serverLoadDeferDuration: kThumbnailServerLoadDeferDuration,
|
||||
diskLoadDeferDuration: thumbnailDiskLoadDeferDuration,
|
||||
serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
|
||||
shouldShowLivePhotoOverlay: true,
|
||||
key: Key(widget.tag + file.tag()),
|
||||
),
|
||||
|
|
|
@ -33,7 +33,7 @@ class SupportSectionWidget extends StatelessWidget {
|
|||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () async {
|
||||
await sendEmail(context, to: kSupportEmail);
|
||||
await sendEmail(context, to: supportEmail);
|
||||
},
|
||||
child:
|
||||
const SettingsTextItem(text: "Email", icon: Icons.navigate_next),
|
||||
|
@ -50,7 +50,7 @@ class SupportSectionWidget extends StatelessWidget {
|
|||
final isLoggedIn = Configuration.instance.getToken() != null;
|
||||
final url = isLoggedIn
|
||||
? endpoint + "?token=" + Configuration.instance.getToken()
|
||||
: kRoadmapURL;
|
||||
: roadmapURL;
|
||||
return WebPage("Roadmap", url);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -450,9 +450,8 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
|
|||
borderRadius: BorderRadius.circular(4),
|
||||
child: ThumbnailWidget(
|
||||
file,
|
||||
diskLoadDeferDuration: kThumbnailDiskLoadDeferDuration,
|
||||
serverLoadDeferDuration:
|
||||
kThumbnailServerLoadDeferDuration,
|
||||
diskLoadDeferDuration: thumbnailDiskLoadDeferDuration,
|
||||
serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
|
||||
shouldShowLivePhotoOverlay: true,
|
||||
key: Key("deduplicate_" + file.tag()),
|
||||
),
|
||||
|
|
|
@ -229,7 +229,7 @@ class _DetailPageState extends State<DetailPage> {
|
|||
}
|
||||
if (_selectedIndex == _files.length - 1 && !_hasLoadedTillEnd) {
|
||||
final result = await widget.config.asyncLoader(
|
||||
kGalleryLoadStartTime,
|
||||
galleryLoadStartTime,
|
||||
_files[_selectedIndex].creationTime - 1,
|
||||
limit: kLoadLimit,
|
||||
);
|
||||
|
|
|
@ -138,7 +138,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
|||
!_isLoadingLocalThumbnail) {
|
||||
_isLoadingLocalThumbnail = true;
|
||||
final cachedSmallThumbnail =
|
||||
ThumbnailLruCache.get(widget.file, kThumbnailSmallSize);
|
||||
ThumbnailLruCache.get(widget.file, thumbnailSmallSize);
|
||||
if (cachedSmallThumbnail != null) {
|
||||
_imageProvider = Image.memory(cachedSmallThumbnail).image;
|
||||
_hasLoadedThumbnail = true;
|
||||
|
@ -187,7 +187,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
|||
final imageProvider = Image.memory(thumbData).image;
|
||||
_cacheAndRender(imageProvider);
|
||||
}
|
||||
ThumbnailLruCache.put(widget.file, thumbData, kThumbnailSmallSize);
|
||||
ThumbnailLruCache.put(widget.file, thumbData, thumbnailSmallSize);
|
||||
}).catchError((e) {
|
||||
_logger.warning("Could not load image: ", e);
|
||||
_errorLoadingLocalThumbnail = true;
|
||||
|
|
|
@ -123,7 +123,7 @@ class _VideoWidgetState extends State<VideoWidget> {
|
|||
final contentWithDetector = GestureDetector(
|
||||
child: content,
|
||||
onVerticalDragUpdate: (d) => {
|
||||
if (d.delta.dy > kDragSensitivity) {Navigator.of(context).pop()}
|
||||
if (d.delta.dy > dragSensitivity) {Navigator.of(context).pop()}
|
||||
},
|
||||
);
|
||||
return VisibilityDetector(
|
||||
|
|
|
@ -93,7 +93,7 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
final GestureDragUpdateCallback verticalDragCallback = _isZooming
|
||||
? null
|
||||
: (d) => {
|
||||
if (!_isZooming && d.delta.dy > kDragSensitivity)
|
||||
if (!_isZooming && d.delta.dy > dragSensitivity)
|
||||
{Navigator.of(context).pop()}
|
||||
};
|
||||
return GestureDetector(
|
||||
|
@ -143,8 +143,7 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
if (!_loadedSmallThumbnail &&
|
||||
!_loadedLargeThumbnail &&
|
||||
!_loadedFinalImage) {
|
||||
final cachedThumbnail =
|
||||
ThumbnailLruCache.get(_photo, kThumbnailSmallSize);
|
||||
final cachedThumbnail = ThumbnailLruCache.get(_photo, thumbnailSmallSize);
|
||||
if (cachedThumbnail != null) {
|
||||
_imageProvider = Image.memory(cachedThumbnail).image;
|
||||
_loadedSmallThumbnail = true;
|
||||
|
@ -155,7 +154,7 @@ class _ZoomableImageState extends State<ZoomableImage>
|
|||
!_loadedLargeThumbnail &&
|
||||
!_loadedFinalImage) {
|
||||
_loadingLargeThumbnail = true;
|
||||
getThumbnailFromLocal(_photo, size: kThumbnailLargeSize, quality: 100)
|
||||
getThumbnailFromLocal(_photo, size: thumbnailLargeSize, quality: 100)
|
||||
.then((cachedThumbnail) {
|
||||
if (cachedThumbnail != null) {
|
||||
_onLargeThumbnailLoaded(Image.memory(cachedThumbnail).image, context);
|
||||
|
|
|
@ -167,10 +167,10 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
|
|||
|
||||
void _showLivePhotoToast() async {
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
final int promptTillNow = preferences.getInt(kLivePhotoToastCounterKey) ?? 0;
|
||||
if (promptTillNow < kMaxLivePhotoToastCount && mounted) {
|
||||
final int promptTillNow = preferences.getInt(livePhotoToastCounterKey) ?? 0;
|
||||
if (promptTillNow < maxLivePhotoToastCount && mounted) {
|
||||
showToast(context, "Press and hold to play video");
|
||||
preferences.setInt(kLivePhotoToastCounterKey, promptTillNow + 1);
|
||||
preferences.setInt(livePhotoToastCounterKey, promptTillNow + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ class _GalleryState extends State<Gallery> {
|
|||
try {
|
||||
final startTime = DateTime.now().microsecondsSinceEpoch;
|
||||
final result = await widget.asyncLoader(
|
||||
kGalleryLoadStartTime,
|
||||
kGalleryLoadEndTime,
|
||||
galleryLoadStartTime,
|
||||
galleryLoadEndTime,
|
||||
limit: limit,
|
||||
);
|
||||
final endTime = DateTime.now().microsecondsSinceEpoch;
|
||||
|
|
|
@ -311,8 +311,8 @@ Future<bool> deleteLocalFiles(
|
|||
final List<String> localAssetIDs = [];
|
||||
final List<String> localSharedMediaIDs = [];
|
||||
for (String id in localIDs) {
|
||||
if (id.startsWith(kOldSharedMediaIdentifier) ||
|
||||
id.startsWith(kSharedMediaIdentifier)) {
|
||||
if (id.startsWith(oldSharedMediaIdentifier) ||
|
||||
id.startsWith(sharedMediaIdentifier)) {
|
||||
localSharedMediaIDs.add(id);
|
||||
} else {
|
||||
localAssetIDs.add(id);
|
||||
|
@ -322,7 +322,7 @@ Future<bool> deleteLocalFiles(
|
|||
|
||||
if (Platform.isAndroid) {
|
||||
final androidInfo = await DeviceInfoPlugin().androidInfo;
|
||||
if (androidInfo.version.sdkInt < kAndroid11SDKINT) {
|
||||
if (androidInfo.version.sdkInt < android11SDKINT) {
|
||||
deletedIDs
|
||||
.addAll(await _deleteLocalFilesInBatches(context, localAssetIDs));
|
||||
} else {
|
||||
|
|
|
@ -128,14 +128,14 @@ Future<MediaUploadData> _getMediaUploadDataFromAssetFile(ente.File file) async {
|
|||
}
|
||||
|
||||
thumbnailData = await asset.thumbnailDataWithSize(
|
||||
const ThumbnailSize(kThumbnailLargeSize, kThumbnailLargeSize),
|
||||
quality: kThumbnailQuality,
|
||||
const ThumbnailSize(thumbnailLargeSize, thumbnailLargeSize),
|
||||
quality: thumbnailQuality,
|
||||
);
|
||||
if (thumbnailData == null) {
|
||||
throw InvalidFileError("unable to get asset thumbData");
|
||||
}
|
||||
int compressionAttempts = 0;
|
||||
while (thumbnailData.length > kThumbnailDataLimit &&
|
||||
while (thumbnailData.length > thumbnailDataLimit &&
|
||||
compressionAttempts < kMaximumThumbnailCompressionAttempts) {
|
||||
_logger.info("Thumbnail size " + thumbnailData.length.toString());
|
||||
thumbnailData = await compressThumbnail(thumbnailData);
|
||||
|
@ -204,14 +204,14 @@ Future<Uint8List> getThumbnailFromInAppCacheFile(ente.File file) async {
|
|||
video: localFile.path,
|
||||
imageFormat: ImageFormat.JPEG,
|
||||
thumbnailPath: (await getTemporaryDirectory()).path,
|
||||
maxWidth: kThumbnailLargeSize,
|
||||
maxWidth: thumbnailLargeSize,
|
||||
quality: 80,
|
||||
);
|
||||
localFile = io.File(thumbnailFilePath);
|
||||
}
|
||||
var thumbnailData = await localFile.readAsBytes();
|
||||
int compressionAttempts = 0;
|
||||
while (thumbnailData.length > kThumbnailDataLimit &&
|
||||
while (thumbnailData.length > thumbnailDataLimit &&
|
||||
compressionAttempts < kMaximumThumbnailCompressionAttempts) {
|
||||
_logger.info("Thumbnail size " + thumbnailData.length.toString());
|
||||
thumbnailData = await compressThumbnail(thumbnailData);
|
||||
|
|
|
@ -92,14 +92,14 @@ String getSharedMediaFilePath(ente.File file) {
|
|||
}
|
||||
|
||||
String getSharedMediaPathFromLocalID(String localID) {
|
||||
if (localID.startsWith(kOldSharedMediaIdentifier)) {
|
||||
if (localID.startsWith(oldSharedMediaIdentifier)) {
|
||||
return Configuration.instance.getOldSharedMediaCacheDirectory() +
|
||||
"/" +
|
||||
localID.replaceAll(kOldSharedMediaIdentifier, '');
|
||||
localID.replaceAll(oldSharedMediaIdentifier, '');
|
||||
} else {
|
||||
return Configuration.instance.getSharedMediaDirectory() +
|
||||
"/" +
|
||||
localID.replaceAll(kSharedMediaIdentifier, '');
|
||||
localID.replaceAll(sharedMediaIdentifier, '');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,8 +301,8 @@ String getExtension(String nameOrPath) {
|
|||
Future<Uint8List> compressThumbnail(Uint8List thumbnail) {
|
||||
return FlutterImageCompress.compressWithList(
|
||||
thumbnail,
|
||||
minHeight: kCompressedThumbnailResolution,
|
||||
minWidth: kCompressedThumbnailResolution,
|
||||
minHeight: compressedThumbnailResolution,
|
||||
minWidth: compressedThumbnailResolution,
|
||||
quality: 25,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ Future<void> share(
|
|||
|
||||
Rect shareButtonRect(BuildContext context, GlobalKey shareButtonKey) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
final RenderBox renderBox = shareButtonKey?.currentContext?.findRenderObject();
|
||||
final RenderBox renderBox =
|
||||
shareButtonKey?.currentContext?.findRenderObject();
|
||||
if (renderBox == null) {
|
||||
return Rect.fromLTWH(0, 0, size.width, size.height / 2);
|
||||
}
|
||||
|
@ -83,7 +84,7 @@ Future<List<File>> convertIncomingSharedMediaToFile(
|
|||
ioFile = ioFile.renameSync(
|
||||
Configuration.instance.getSharedMediaDirectory() + "/" + enteFile.title,
|
||||
);
|
||||
enteFile.localID = kSharedMediaIdentifier + enteFile.title;
|
||||
enteFile.localID = sharedMediaIdentifier + enteFile.title;
|
||||
enteFile.collectionID = collectionID;
|
||||
enteFile.fileType =
|
||||
media.type == SharedMediaType.IMAGE ? FileType.image : FileType.video;
|
||||
|
|
|
@ -62,8 +62,8 @@ Future<Uint8List> getThumbnailFromServer(File file) async {
|
|||
|
||||
Future<Uint8List> getThumbnailFromLocal(
|
||||
File file, {
|
||||
int size = kThumbnailSmallSize,
|
||||
int quality = kThumbnailQuality,
|
||||
int size = thumbnailSmallSize,
|
||||
int quality = thumbnailQuality,
|
||||
}) async {
|
||||
final lruCachedThumbnail = ThumbnailLruCache.get(file, size);
|
||||
if (lruCachedThumbnail != null) {
|
||||
|
@ -154,7 +154,7 @@ Future<void> _downloadAndDecryptThumbnail(FileDownloadItem item) async {
|
|||
Sodium.base642bin(file.thumbnailDecryptionHeader),
|
||||
);
|
||||
final thumbnailSize = data.length;
|
||||
if (thumbnailSize > kThumbnailDataLimit) {
|
||||
if (thumbnailSize > thumbnailDataLimit) {
|
||||
data = await compressThumbnail(data);
|
||||
}
|
||||
ThumbnailLruCache.put(item.file, data);
|
||||
|
|
Loading…
Reference in a new issue