diff --git a/Signal/src/Signal-Bridging-Header.h b/Signal/src/Signal-Bridging-Header.h
index 80c2e5818..91f3d71b7 100644
--- a/Signal/src/Signal-Bridging-Header.h
+++ b/Signal/src/Signal-Bridging-Header.h
@@ -22,6 +22,7 @@
#import "PropertyListPreferences.h"
#import "PushManager.h"
#import "SettingsTableViewController.h"
+#import "SignalsViewController.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIUtil.h"
diff --git a/Signal/src/Storyboard/Main.storyboard b/Signal/src/Storyboard/Main.storyboard
index bcf158ee1..7f49e10e0 100644
--- a/Signal/src/Storyboard/Main.storyboard
+++ b/Signal/src/Storyboard/Main.storyboard
@@ -95,7 +95,6 @@
-
@@ -150,23 +149,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Signal/src/ViewControllers/CallViewController.swift b/Signal/src/ViewControllers/CallViewController.swift
index 51d489501..e6169dfef 100644
--- a/Signal/src/ViewControllers/CallViewController.swift
+++ b/Signal/src/ViewControllers/CallViewController.swift
@@ -8,7 +8,6 @@ import PromiseKit
// TODO: Add category so that button handlers can be defined where button is created.
// TODO: Ensure buttons enabled & disabled as necessary.
-@objc(OWSCallViewController)
class CallViewController: UIViewController, CallObserver, CallServiceObserver, RTCEAGLVideoViewDelegate {
let TAG = "[CallViewController]"
diff --git a/Signal/src/ViewControllers/SignalsViewController.m b/Signal/src/ViewControllers/SignalsViewController.m
index b2a085c2d..fa155946a 100644
--- a/Signal/src/ViewControllers/SignalsViewController.m
+++ b/Signal/src/ViewControllers/SignalsViewController.m
@@ -31,7 +31,7 @@
#define CELL_HEIGHT 72.0f
#define HEADER_HEIGHT 44.0f
-NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallSegue";
+// NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallSegue";
@interface SignalsViewController ()
@@ -195,12 +195,12 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS
(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) {
[self registerForPreviewingWithDelegate:self sourceView:self.tableView];
}
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(handleActiveCallNotification:)
- name:[CallService callServiceActiveCallNotificationName]
- object:nil];
-
+
+ // [[NSNotificationCenter defaultCenter] addObserver:self
+ // selector:@selector(handleActiveCallNotification:)
+ // name:[CallService callServiceActiveCallNotificationName]
+ // object:nil];
+ //
[self updateBarButtonItems];
}
@@ -260,29 +260,30 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS
}
}
-- (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,
- notification.object);
- return;
- }
-
- SignalCall *call = (SignalCall *)notification.object;
-
- // Dismiss any other modals so we can present call modal.
- if (self.presentedViewController) {
- [self dismissViewControllerAnimated:YES
- completion:^{
- [self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call];
- }];
- } else {
- [self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call];
- }
-}
+//- (void)handleActiveCallNotification:(NSNotification *)notification
+//{
+// // TODO insteead at the callsite lets present as topmost VC
+// AssertIsOnMainThread();
+//
+// if (![notification.object isKindOfClass:[SignalCall class]]) {
+// DDLogError(@"%@ expected presentCall observer to be notified with a SignalCall, but found %@",
+// self.tag,
+// notification.object);
+// return;
+// }
+//
+// SignalCall *call = (SignalCall *)notification.object;
+//
+// // Dismiss any other modals so we can present call modal.
+// if (self.presentedViewController) {
+// [self dismissViewControllerAnimated:YES
+// completion:^{
+// [self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call];
+// }];
+// } else {
+// [self performSegueWithIdentifier:SignalsViewControllerSegueShowIncomingCall sender:call];
+// }
+//}
- (void)previewingContext:(id)previewingContext
commitViewController:(UIViewController *)viewControllerToCommit {
@@ -727,25 +728,25 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS
#pragma mark - Navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- if ([segue.identifier isEqualToString:SignalsViewControllerSegueShowIncomingCall]) {
- DDLogDebug(@"%@ preparing for incoming call segue", self.tag);
- if (![segue.destinationViewController isKindOfClass:[OWSCallViewController class]]) {
- DDLogError(@"%@ Received unexpected destination view controller: %@", self.tag, segue.destinationViewController);
- return;
- }
- OWSCallViewController *callViewController = (OWSCallViewController *)segue.destinationViewController;
-
- if (![sender isKindOfClass:[SignalCall class]]) {
- DDLogError(@"%@ expecting call segueu to be sent by a SignalCall, but found: %@", self.tag, sender);
- return;
- }
- SignalCall *call = (SignalCall *)sender;
- TSContactThread *thread = [TSContactThread getOrCreateThreadWithContactId:call.remotePhoneNumber];
- callViewController.thread = thread;
- callViewController.call = call;
- }
-}
+//- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+// if ([segue.identifier isEqualToString:SignalsViewControllerSegueShowIncomingCall]) {
+// DDLogDebug(@"%@ preparing for incoming call segue", self.tag);
+// if (![segue.destinationViewController isKindOfClass:[OWSCallViewController class]]) {
+// DDLogError(@"%@ Received unexpected destination view controller: %@", self.tag,
+// segue.destinationViewController); return;
+// }
+// OWSCallViewController *callViewController = (OWSCallViewController *)segue.destinationViewController;
+//
+// if (![sender isKindOfClass:[SignalCall class]]) {
+// DDLogError(@"%@ expecting call segueu to be sent by a SignalCall, but found: %@", self.tag, sender);
+// return;
+// }
+// SignalCall *call = (SignalCall *)sender;
+// TSContactThread *thread = [TSContactThread getOrCreateThreadWithContactId:call.remotePhoneNumber];
+// callViewController.thread = thread;
+// callViewController.call = call;
+// }
+//}
#pragma mark - IBAction
diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift
index e9a61740c..9aabcf360 100644
--- a/Signal/src/call/CallService.swift
+++ b/Signal/src/call/CallService.swift
@@ -253,9 +253,9 @@ protocol CallServiceObserver: class {
// MARK: Notifications
// Wrapping these class constants in a method to make it accessible to objc
- class func callServiceActiveCallNotificationName() -> String {
- return "CallServiceActiveCallNotification"
- }
+// class func callServiceActiveCallNotificationName() -> String {
+// return "CallServiceActiveCallNotification"
+// }
// MARK: - Service Actions
diff --git a/Signal/src/call/NonCallKitCallUIAdaptee.swift b/Signal/src/call/NonCallKitCallUIAdaptee.swift
index b2e1c501e..40a6e1864 100644
--- a/Signal/src/call/NonCallKitCallUIAdaptee.swift
+++ b/Signal/src/call/NonCallKitCallUIAdaptee.swift
@@ -42,8 +42,9 @@ class NonCallKitCallUIAdaptee: CallUIAdaptee {
Logger.debug("\(TAG) \(#function)")
// present Call View controller
- let callNotificationName = CallService.callServiceActiveCallNotificationName()
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: callNotificationName), object: call)
+// let callNotificationName = CallService.callServiceActiveCallNotificationName()
+// NotificationCenter.default.post(name: NSNotification.Name(rawValue: callNotificationName), object: call)
+ self.showCall(call)
// present lock screen notification
if UIApplication.shared.applicationState == .active {
diff --git a/Signal/src/call/UserInterface/CallUIAdapter.swift b/Signal/src/call/UserInterface/CallUIAdapter.swift
index 125c68b5a..3b493bf13 100644
--- a/Signal/src/call/UserInterface/CallUIAdapter.swift
+++ b/Signal/src/call/UserInterface/CallUIAdapter.swift
@@ -34,8 +34,30 @@ extension CallUIAdaptee {
internal func showCall(_ call: SignalCall) {
AssertIsOnMainThread()
- let callNotificationName = CallService.callServiceActiveCallNotificationName()
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: callNotificationName), object: call)
+// let callNotificationName = CallService.callServiceActiveCallNotificationName()
+// NotificationCenter.default.post(name: NSNotification.Name(rawValue: callNotificationName), object: call)
+
+ let callViewController = CallViewController()
+ let thread = TSContactThread.getOrCreateThread(contactId: call.remotePhoneNumber)
+ callViewController.call = call
+ callViewController.thread = thread
+ callViewController.modalTransitionStyle = .crossDissolve
+
+ //Environment.getCurrent().signalsViewController
+ // TODO dismiss any modal, can/should we present from frontmost?
+// let presentingViewController = UIApplication.shared.frontmostViewController
+// presentingViewController?.present(callViewController, animated: true)
+
+ guard let presentingViewController = Environment.getCurrent().signalsViewController else {
+ Logger.error("in \(#function) signals view controller unexpectedly nil")
+ assertionFailure("in \(#function) signals view controller unexpectedly nil")
+ return
+ }
+
+ if let presentedViewController = presentingViewController.presentedViewController {
+ presentedViewController.dismiss(animated: false)
+ }
+ presentingViewController.present(callViewController, animated: true)
}
internal func reportMissedCall(_ call: SignalCall, callerName: String) {