Already on the main thread

* simplify code
* fix typo

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 947d345837
commit 5d0d1b725b

@ -1,9 +1,5 @@
// //
// SignalsViewController.m // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Signal
//
// Created by Dylan Bourgeois on 27/10/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// //
#import "SignalsViewController.h" #import "SignalsViewController.h"
@ -131,7 +127,7 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS
} }
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleActiveCallNotifciation:) selector:@selector(handleActiveCallNotification:)
name:[CallService callServiceActiveCallNotificationName] name:[CallService callServiceActiveCallNotificationName]
object:nil]; 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]]) { if (![notification.object isKindOfClass:[SignalCall class]]) {
DDLogError(@"%@ expected presentCall observer to be notified with a SignalCall, but found %@", DDLogError(@"%@ expected presentCall observer to be notified with a SignalCall, but found %@",
self.tag, self.tag,
@ -163,10 +161,9 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS
return; return;
} }
dispatch_async(dispatch_get_main_queue(), ^{
SignalCall *call = (SignalCall *)notification.object; SignalCall *call = (SignalCall *)notification.object;
[self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call]; [self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call];
});
} }
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext - (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext

Loading…
Cancel
Save