Revision ab248f1b ChatSecure/Classes/OTRAppDelegate.m

View differences:

ChatSecure/Classes/OTRAppDelegate.m
260 260

  
261 261
- (NSString *)activeThreadYapKey
262 262
{
263
    __block NSString *threadOwnerYapKey = nil;
264
    NSArray <UIViewController *>*viewControllers = [self.splitViewCoordinator.splitViewController viewControllers];
265
    [viewControllers enumerateObjectsUsingBlock:^(UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
266
        NSArray <UIViewController *>*result = nil;
267
        if ([obj isKindOfClass:[UINavigationController class] ]) {
268
            result = [((UINavigationController *)obj) otr_baseViewContorllers];
269
        } else {
270
            result = @[obj];
271
        }
272
        
273
        [result enumerateObjectsUsingBlock:^(UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
274
            if([obj isKindOfClass:[OTRMessagesViewController class]] && [obj otr_isVisible])
275
            {
276
                OTRMessagesViewController *messagesViewController = (OTRMessagesViewController *)obj;
277
                threadOwnerYapKey = messagesViewController.threadKey;
278
                
279
                *stop = YES;
280
            }
281
        }];
282
        
283
        if (threadOwnerYapKey) {
284
            *stop = YES;
285
        }
286
    }];
263
    NSString *threadOwnerYapKey = nil;
264
    if (self.messagesViewController && [self.messagesViewController otr_isVisible]) {
265
        threadOwnerYapKey = self.messagesViewController.threadKey;
266
    }
287 267
    return threadOwnerYapKey;
288 268
}
289 269

  

Also available in: Unified diff