From 5d0d1b725b82ebdfe06fc6077c49ccfe1519537b Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 2 Feb 2017 17:22:36 -0500 Subject: [PATCH] Already on the main thread * simplify code * fix typo // FREEBIE --- .../view controllers/SignalsViewController.m | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Signal/src/view controllers/SignalsViewController.m b/Signal/src/view controllers/SignalsViewController.m index 8ccab3f3e..5c59e2b93 100644 --- a/Signal/src/view controllers/SignalsViewController.m +++ b/Signal/src/view controllers/SignalsViewController.m @@ -1,9 +1,5 @@ // -// SignalsViewController.m -// Signal -// -// Created by Dylan Bourgeois on 27/10/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // #import "SignalsViewController.h" @@ -131,7 +127,7 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS } [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleActiveCallNotifciation:) + selector:@selector(handleActiveCallNotification:) name:[CallService callServiceActiveCallNotificationName] object:nil]; } @@ -154,8 +150,10 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS } } -- (void)handleActiveCallNotifciation:(NSNotification *)notification +- (void)handleActiveCallNotification:(NSNotification *)notification { + AssertIsOnMainThread(); + if (![notification.object isKindOfClass:[SignalCall class]]) { DDLogError(@"%@ expected presentCall observer to be notified with a SignalCall, but found %@", self.tag, @@ -163,10 +161,9 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS return; } - dispatch_async(dispatch_get_main_queue(), ^{ - SignalCall *call = (SignalCall *)notification.object; - [self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call]; - }); + + SignalCall *call = (SignalCall *)notification.object; + [self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call]; } - (void)previewingContext:(id)previewingContext