chore: delete file async

oneRain 2021-04-08 12:04:28 +08:00
parent 2bc247f3df
commit 3f79a28bc1
2 changed files with 7 additions and 6 deletions

View File

@ -50,13 +50,15 @@ namespace LeanCloud.Storage.Internal.Storage {
return null; return null;
} }
public void Delete(string filename) { public Task Delete(string filename) {
if (storage == null) { if (storage == null) {
return; return Task.CompletedTask;
} }
string path = GetFileFullPath(filename); string path = GetFileFullPath(filename);
IOFile.Delete(path); return Task.Run(() => {
IOFile.Delete(path);
});
} }
private string GetFileFullPath(string filename) { private string GetFileFullPath(string filename) {

View File

@ -89,7 +89,7 @@ namespace LeanCloud.Storage {
currentUser = ParseObject(data) as LCUser; currentUser = ParseObject(data) as LCUser;
} catch (Exception e) { } catch (Exception e) {
LCLogger.Error(e); LCLogger.Error(e);
LCInternalApplication.StorageController.Delete(USER_DATA); await LCInternalApplication.StorageController.Delete(USER_DATA);
} }
} }
return currentUser; return currentUser;
@ -513,8 +513,7 @@ namespace LeanCloud.Storage {
public static Task Logout() { public static Task Logout() {
currentUser = null; currentUser = null;
// 清理持久化数据 // 清理持久化数据
LCInternalApplication.StorageController.Delete(USER_DATA); return LCInternalApplication.StorageController.Delete(USER_DATA);
return Task.FromResult<object>(null);
} }
/// <summary> /// <summary>