Skip to content

An open-source cross-platform alternative to AirDrop

feat: apply greedy cache clean only on ios and android

Tien Do Nam1082742a4354
diff --git a/README.md b/README.md
index 5a155c1d..6ddfac49 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Links: [Homepage](https://localsend.org)
- [About](#about)
- [Screenshots](#screenshots)
-- [Installation](#installation)
+- [Download](#download)
- [How it Works](#how-it-works)
- [Getting Started](#getting-started)
- [Contributing](#contributing)
@@ -29,7 +29,7 @@ LocalSend is a cross-platform app that enables secure communication between devi
<img src="https://localsend.org/img/screenshot-iphone.png" alt="iPhone screenshot" height="300"/> <img src="https://localsend.org/img/screenshot-pc.png" alt="PC screenshot" height="300"/>
-## Installation
+## Download
It is recommended to download the app either from an app store or from a package manager because the app does not have auto-update.
diff --git a/lib/util/cache_helper.dart b/lib/util/cache_helper.dart
index f21f6c33..58000003 100644
--- a/lib/util/cache_helper.dart
+++ b/lib/util/cache_helper.dart
@@ -1,6 +1,8 @@
import 'dart:io';
import 'package:file_picker/file_picker.dart';
+import 'package:flutter/foundation.dart';
+import 'package:localsend_app/util/platform_check.dart';
import 'package:path_provider/path_provider.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
@@ -12,15 +14,17 @@ void clearCache() {
});
PhotoManager.clearFileCache().catchError((error) => print(error));
- getTemporaryDirectory().then((cacheDir) {
- cacheDir.list().listen((event) {
- if (event is File) {
- event.delete().then((_) {}).catchError((error) {
- print(error);
- });
- }
+ if (checkPlatform([TargetPlatform.iOS, TargetPlatform.android])) {
+ getTemporaryDirectory().then((cacheDir) {
+ cacheDir.list().listen((event) {
+ if (event is File) {
+ event.delete().then((_) {}).catchError((error) {
+ print(error);
+ });
+ }
+ });
+ }).catchError((error) {
+ print(error);
});
- }).catchError((error) {
- print(error);
- });
+ }
}