1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 08:41:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

improve cleanup and rollout

This commit is contained in:
sunnylqm
2024-10-03 21:41:47 +08:00
parent 2467b0c119
commit 94431ee6f7
6 changed files with 36 additions and 10 deletions

View File

@@ -536,7 +536,15 @@ RCT_EXPORT_METHOD(markSuccess:(RCTPromiseResolveBlock)resolve
for(NSString *fileName in list) {
if (![fileName isEqualToString:curVersion]) {
[_fileManager removeFile:[downloadDir stringByAppendingPathComponent:fileName] completionHandler:nil];
NSString *filePath = [downloadDir stringByAppendingPathComponent:fileName];
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error];
if (error) {
continue;
}
NSDate *modificationDate = [attributes fileModificationDate];
if ([[NSDate date] timeIntervalSinceDate:modificationDate] > 7 * 24 * 60 * 60) {
[_fileManager removeFile:filePath completionHandler:nil];
}
}
}
}