-
Notifications
You must be signed in to change notification settings - Fork 205
Open
Description
这里这行代码应该去掉,否则队列显示仍然会有问题。
shouldCleanup = YES; // 没有队列时直接显示并清理
- (nonnull instancetype)init
{
self = [super init];
if (self) {
self.isShowing = NO;
__block typeof(self) strongSelf = self;
self.config.modelFinishConfig = ^{
__block BOOL shouldCleanup = NO;
__attribute__((cleanup(lee_cleanupFunc), unused)) __auto_type x = ^{
// 只有标记为需要清理的才清理,避免影响队列机制
if (shouldCleanup) {
strongSelf = nil;
}
};
if (!strongSelf) {
return;
}
if ([LEEAlert shareManager].queueArray.count) {
LEEBaseConfig *last = [LEEAlert shareManager].queueArray.lastObject;
// 当前未加入队列 同时 已显示的优先级高于当前 跳过
if (!strongSelf.config.modelIsQueue && last.config.modelQueuePriority > strongSelf.config.modelQueuePriority) {
return;
}
// 已显示的未加入队列 同时已显示的优先级小于等于当前 关闭已显示的并移除
if (!last.config.modelIsQueue && last.config.modelQueuePriority <= strongSelf.config.modelQueuePriority) {
[last close];
[[LEEAlert shareManager].queueArray removeObject:last];
}
// 已显示的已加入队列 同时已显示的优先级小于等于当前 关闭已显示的不移除
if (last.config.modelIsQueue && last.config.modelQueuePriority <= strongSelf.config.modelQueuePriority) {
[last close];
}
if (![[LEEAlert shareManager].queueArray containsObject:strongSelf]) {
[[LEEAlert shareManager].queueArray addObject:strongSelf];
[[LEEAlert shareManager].queueArray sortUsingComparator:^NSComparisonResult(LEEBaseConfig *configA, LEEBaseConfig *configB) {
return configA.config.modelQueuePriority > configB.config.modelQueuePriority ? NSOrderedDescending
: configA.config.modelQueuePriority == configB.config.modelQueuePriority ? NSOrderedSame : NSOrderedAscending;
}];
}
if ([LEEAlert shareManager].queueArray.lastObject == strongSelf) {
shouldCleanup = YES; // 标记当前要显示的需要清理
[strongSelf show];
}
} else {
/// shouldCleanup = YES; // 没有队列时直接显示并清理
[strongSelf show];
[[LEEAlert shareManager].queueArray addObject:strongSelf];
}
};
}
return self;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels