diff --git a/LSUnusedResources/Info.plist b/LSUnusedResources/Info.plist
index 2ba9aa2..07f6cf5 100644
--- a/LSUnusedResources/Info.plist
+++ b/LSUnusedResources/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.0
+ 1.1
CFBundleSignature
????
CFBundleVersion
diff --git a/LSUnusedResources/Recourse/Base.lproj/Main.storyboard b/LSUnusedResources/Recourse/Base.lproj/Main.storyboard
index 8be8bdf..04233f9 100644
--- a/LSUnusedResources/Recourse/Base.lproj/Main.storyboard
+++ b/LSUnusedResources/Recourse/Base.lproj/Main.storyboard
@@ -1000,7 +1000,7 @@
-
+
-
+
diff --git a/LSUnusedResources/ViewController/MainViewController.m b/LSUnusedResources/ViewController/MainViewController.m
index bbb26df..2671e2f 100644
--- a/LSUnusedResources/ViewController/MainViewController.m
+++ b/LSUnusedResources/ViewController/MainViewController.m
@@ -168,25 +168,24 @@ - (IBAction)onExportButtonClicked:(id)sender {
- (IBAction)onDeleteButtonClicked:(id)sender {
if (self.resultsTableView.numberOfSelectedRows > 0) {
- NSLog(@"selected rows count:%ld", self.resultsTableView.numberOfSelectedRows);
-
- __block NSError *error;
-
- __block NSArray *results = [self.unusedResults copy];
- [self.resultsTableView.selectedRowIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
- ResourceFileInfo *info = [results objectAtIndex:idx];
- [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:info.path] error:&error];
- if (error) {
- NSLog(@"File deletion error:%@", [error description]);
- *stop = YES;
- }else{
- [self.resultsTableView beginUpdates];
- NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:idx];
- [self.resultsTableView removeRowsAtIndexes:indexSet withAnimation:NSTableViewAnimationSlideUp];
- [self.unusedResults removeObject:info];
- [self.resultsTableView endUpdates];
+ NSArray *results = [self.unusedResults copy];
+ NSIndexSet *selectedIndexSet = self.resultsTableView.selectedRowIndexes;
+ NSUInteger index = [selectedIndexSet firstIndex];
+ while (index != NSNotFound) {
+ if (index < results.count) {
+ ResourceFileInfo *info = [results objectAtIndex:index];
+ [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:info.path] error:nil];
}
- }];
+ index = [selectedIndexSet indexGreaterThanIndex:index];
+ }
+
+ [self.unusedResults removeObjectsAtIndexes:selectedIndexSet];
+ [self.resultsTableView reloadData];
+ [self updateUnusedResultsCount];
+ } else {
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert setMessageText:@"Please select first."];
+ [alert runModal];
}
}
@@ -278,7 +277,7 @@ - (NSArray *)includeFileSuffixs {
[suffixs addObject:@"plist"];
}
if ([self.cssCheckbox state]) {
- [suffixs addObject:@"plist"];
+ [suffixs addObject:@"css"];
}
if ([self.xibCheckbox state]) {
[suffixs addObject:@"xib"];
@@ -296,10 +295,7 @@ - (NSArray *)includeFileSuffixs {
- (void)setUIEnabled:(BOOL)state {
// Individual
if (state) {
- [self.processIndicator stopAnimation:self];
- NSUInteger count = self.unusedResults.count;
- NSString *tips = count > 2 ? @"resources" : @"resource";
- self.statusLabel.stringValue = [NSString stringWithFormat:@"%d unsued %@.", (int)count, tips];
+ [self updateUnusedResultsCount];
} else {
[self.processIndicator startAnimation:self];
self.statusLabel.stringValue = @"Searching...";
@@ -332,6 +328,13 @@ - (void)setUIEnabled:(BOOL)state {
[_processIndicator setHidden:state];
}
+- (void)updateUnusedResultsCount {
+ [self.processIndicator stopAnimation:self];
+ NSUInteger count = self.unusedResults.count;
+ NSString *tips = count > 2 ? @"resources" : @"resource";
+ self.statusLabel.stringValue = [NSString stringWithFormat:@"%d unsued %@.", (int)count, tips];
+}
+
- (void)searchUnusedResources {
if (self.isFileDone && self.isStringDone) {
NSArray *resNames = [[[ResourceFileSearcher sharedObject].resNameInfoDict allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
diff --git a/LSUnusedResourcesExample.gif b/LSUnusedResourcesExample.gif
index 60dd396..cf3e026 100644
Binary files a/LSUnusedResourcesExample.gif and b/LSUnusedResourcesExample.gif differ
diff --git a/Release/LSUnusedResources.app.zip b/Release/LSUnusedResources.app.zip
index bcb9032..38d2cd1 100644
Binary files a/Release/LSUnusedResources.app.zip and b/Release/LSUnusedResources.app.zip differ