Skip to content

Commit

Permalink
Update: BaseItem 支持系统版本判断
Browse files Browse the repository at this point in the history
  • Loading branch information
dawnightillight committed Feb 8, 2023
1 parent 6e70208 commit 527c345
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Lemon/Info.plist
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.1.0</string>
<string>5.1.1</string>
<key>CFBundleVersion</key>
<string>10000001</string>
<key>LSMinimumSystemVersion</key>
Expand Down
3 changes: 0 additions & 3 deletions LemonClener/LemonClener/libcleaner/QMXMLItem/QMActionItem.h
Expand Up @@ -48,8 +48,6 @@ typedef NS_ENUM(NSUInteger, SandboxType) {
@property (nonatomic, strong) NSString * actionID;
// 清理种类
@property (nonatomic, assign) QMActionType type;
// 对应的系统,默认为nil,全部系统
@property (nonatomic, strong) NSString * os;

@property (nonatomic, assign) BOOL recommend;
@property (nonatomic, assign) BOOL showResult;
Expand Down Expand Up @@ -82,7 +80,6 @@ typedef NS_ENUM(NSUInteger, SandboxType) {

- (void)addActionPathItem:(QMActionPathItem *)item;

- (BOOL)checkVersion:(NSString *)curSysVersion;
- (BOOL)checkAppVersion;

- (void)resetItemState;
Expand Down
15 changes: 0 additions & 15 deletions LemonClener/LemonClener/libcleaner/QMXMLItem/QMActionItem.m
Expand Up @@ -216,21 +216,6 @@ - (void)setRecommend:(BOOL)value
self.m_stateValue = (recommend ? NSOnState : NSOffState);
}

// 检查系统版本
- (BOOL)checkVersion:(NSString *)curSysVersion
{
BOOL retValue = NO;
NSString * regexStr = self.os;
if (regexStr
&& ![@"" isEqualToString:regexStr])
{
retValue = [QMCleanUtils assertRegex:regexStr matchStr:curSysVersion];
if (!retValue) return NO;

}
return YES;
}

// 检查软件版本
- (BOOL)checkAppVersion:(NSBundle *)bundle
{
Expand Down
5 changes: 5 additions & 0 deletions LemonClener/LemonClener/libcleaner/QMXMLItem/QMBaseItem.h
Expand Up @@ -22,6 +22,11 @@

@property(nonatomic, assign) NSCellStateValue m_stateValue;

// 对应的系统,默认为nil,全部系统
@property (nonatomic, strong) NSString * os;

- (BOOL)checkVersion:(NSString *)curSysVersion;

// 扫描结果
- (NSArray *)resultItemArray;
// 移除所有结果
Expand Down
16 changes: 16 additions & 0 deletions LemonClener/LemonClener/libcleaner/QMXMLItem/QMBaseItem.m
Expand Up @@ -9,6 +9,7 @@
#import "QMBaseItem.h"
#import "QMResultItem.h"
#import "QMCategoryItem.h"
#import "QMCleanUtils.h"

@implementation QMBaseItem
@synthesize progressValue;
Expand Down Expand Up @@ -38,6 +39,21 @@ -(id)mutableCopyWithZone:(NSZone *)zone{
return copy;
}

// 检查系统版本
- (BOOL)checkVersion:(NSString *)curSysVersion
{
BOOL retValue = NO;
NSString * regexStr = self.os;
if (regexStr
&& ![@"" isEqualToString:regexStr])
{
retValue = [QMCleanUtils assertRegex:regexStr matchStr:curSysVersion];
if (!retValue) return NO;

}
return YES;
}

- (NSArray *)resultItemArray
{
return [self subItemArray];
Expand Down
6 changes: 6 additions & 0 deletions LemonClener/LemonClener/libcleaner/QMXMLParse.m
Expand Up @@ -206,6 +206,12 @@ - (void)createCategorySubItem:(NSDictionary *)attributeDict
if (![allKeys containsObject:kXMLKeyID])
return;
m_curCategorySubItem = [[QMCategorySubItem alloc] init];
if ([allKeys containsObject:kXMLKeyOS]) {
m_curCategorySubItem.os = [attributeDict objectForKey:kXMLKeyOS];
}
if (![m_curCategorySubItem checkVersion:m_curSysVersion]) {
return;
}
m_curCategorySubItem.subCategoryID = [attributeDict objectForKey:kXMLKeyID];
if ([allKeys containsObject:kXMLKeyRecommend]){
m_curCategorySubItem.recommend = [[attributeDict objectForKey:kXMLKeyRecommend] boolValue];
Expand Down

0 comments on commit 527c345

Please sign in to comment.