提交 8af84a60 编写于 作者: L LY

feat: H5 任意门历史记录倒序显示(最近地址显示前面)

上级 e97d2525
......@@ -218,16 +218,20 @@ static NSString * const kDoraemonHealthStartKey = @"doraemon_health_start_key";
if (!text || text.length <= 0) { return; }
NSArray *records = [self h5historicalRecord];
/// 去重
if ([records containsObject:text]) { return; }
NSMutableArray *muarr = [NSMutableArray array];
if (records && records.count > 0) { [muarr addObjectsFromArray:records]; }
NSMutableArray *muarr = [NSMutableArray arrayWithArray:records];
[muarr addObject:text];
/// 去重
if ([muarr containsObject:text]) {
if ([muarr.firstObject isEqualToString:text]) {
return;
}
[muarr removeObject:text];
}
[muarr insertObject:text atIndex:0];
/// 限制数量
if (muarr.count > 10) { [muarr removeObjectAtIndex:0]; }
if (muarr.count > 10) { [muarr removeLastObject]; }
[_defaults setObject:muarr.copy forKey:kDoraemonH5historicalRecord];
[_defaults synchronize];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册