@@ -81,18 +81,6 @@ - (void)dealloc
8181 [_nagLimitTimer invalidate ];
8282 _nagLimitTimer = nil ;
8383#endif
84-
85- // Just in case consumers retained their toasts and need status updates...
86-
87- for (SLToast *toast in _store)
88- {
89- if (toast.status != SLToastStatusQueued
90- && toast.status != SLToastStatusFinished
91- && toast.status != SLToastStatusSkipped)
92- {
93- toast.status = SLToastStatusUnknown;
94- }
95- }
9684}
9785
9886- (NSUInteger )totalToastCount
@@ -207,22 +195,28 @@ - (nullable SLToast *)pullNext
207195
208196 if (self.store .count )
209197 {
210- NSMutableIndexSet *toastsToRemove = [NSMutableIndexSet indexSet ];
198+ NSMutableArray <SLToast *> *toastsToRemove = [[NSMutableArray alloc ] init ];
199+
200+ // NSMutableIndexSet *toastsToRemove = [NSMutableIndexSet indexSet];
211201 [self .store enumerateObjectsUsingBlock: ^(SLToast * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
212- if (toast.status != SLToastStatusSkipped)
202+ if (toast.status == SLToastStatusSkipped)
203+ {
204+ [toastsToRemove addObject: obj];
205+ return ; // keep iterating until we find one that isn't skipped
206+ }
207+ else
213208 {
214- toast = obj;
215- [toastsToRemove addIndex: idx]; // popping this (unskipped) toast from the queue
209+ toast = [ obj copy ] ;
210+ [toastsToRemove addObject: obj];
216211 *stop = YES ;
217212 return ;
218213 }
219- [toastsToRemove addIndex: idx];
220214 }];
221215
222216 if (!toastsToRemove.count )
223217 return toast;
224218
225- [self .store removeObjectsAtIndexes : toastsToRemove];
219+ [self .store removeObjectsInArray : toastsToRemove];
226220 }
227221
228222 return toast;
0 commit comments