Commit graph

224 commits

Author SHA1 Message Date
Matthew Chen
4d8c764789 Migrate to Swift 4. 2018-05-30 15:05:02 -04:00
Matthew Chen
b2b62880c0 Migrate to Swift 4. 2018-05-30 15:05:02 -04:00
Matthew Chen
77b72b6b06 Migrate to Swift 4. 2018-05-30 15:05:02 -04:00
Matthew Chen
916d55c55d Migrate to Swift 4. 2018-05-30 15:05:02 -04:00
Matthew Chen
28f7142a59 Auto-migration to Swift 4. 2018-05-30 15:05:02 -04:00
Michael Kirk
caa9e3ca67 Show missed call when call times out
// FREEBIE
2018-05-25 09:19:45 -04:00
Matthew Chen
a722bcde72 Fix call termination reference. 2018-05-24 12:18:39 -04:00
Matthew Chen
7eab0569b6 PeerConnectionClient thread safety. 2018-05-22 15:44:08 -04:00
Matthew Chen
078da69ee0 PeerConnectionClient thread safety. 2018-05-22 15:44:08 -04:00
Matthew Chen
1d8c642346 Respond to CR. 2018-05-22 09:39:46 -04:00
Matthew Chen
f68f3cc53d Call lifecycle edge cases. 2018-05-22 09:22:40 -04:00
Matthew Chen
3967a5ab05 Call lifecycle edge cases. 2018-05-22 09:22:40 -04:00
Michael Kirk
1967b5d29e "Reconnecting..." fixup
// FREEBIE
2018-04-25 10:19:59 -04:00
Michael Kirk
e5b535ccf1 Implement camera direction toggle
// FREEBIE
2018-04-25 10:19:59 -04:00
Matthew Chen
6a8796ad04 Present calls using window manager. 2018-04-25 09:56:53 -04:00
Michael Kirk
0f46834e8d Show "Reconnecting..." on call screen
// FREEBIE
2018-04-19 09:56:09 -04:00
Michael Kirk
830ed884cf Only log timeout when call actually times out
// FREEBIE
2018-04-19 07:47:30 -04:00
Matthew Chen
6caa5b87b6 Add more asserts around thread in SAE. 2018-04-13 14:59:38 -04:00
Michael Kirk
319e0d808f Merge tag '2.21.0.14' into release/2.22.0 2018-03-08 10:40:56 -05:00
Michael Kirk
bbdcd0c768 Call connection fixups
callUIAdapter is not a singleton (for better or for worse)

No one should hold a reference directly to it, but rather via the
CallService, which is a singleton

Wait a bit longer for initial call screen before terminating. Especially
first call can hit this limit.

When call *does* take too long to show, terminate properly to ensure
we're not left with a phantom call

// FREEBIE
2018-03-07 18:09:07 -05:00
Matthew Chen
d6f4db1523 Rename TSStorageManager to OWSPrimaryStorage. 2018-03-06 17:12:13 -03:00
Matthew Chen
9db9409561 Share background tasks. 2018-03-05 17:08:58 -03:00
Michael Kirk
1d3831eccd Registration Lock reminder view
Also fixed: Don't lose PIN across registrations

// FREEBIE
2018-03-05 09:53:09 -05:00
Michael Kirk
5f305f844f Send ICE updates immediately after sending CallOffer for faster call
connection.

For legacy reasons, the call sender used to wait until after receiving
the call answer before sending the ICE updates. The primary motivation
was that if the receiving user hadn't accepted a new identity change,
rather than just seeing one "Tap to Accept New Safety Number" messages
for a call, they'd see one for the call offer and then a dozen more as
ICE updates trickled in.

We changed that behavior long ago, and effectively all clients will
avoid that case, while sending ICE updates immediately will allow calls
to connect without having to wait for an additional serialized round
trip between the caller and call recipient.

// FREEBIE
2018-02-23 17:36:07 -05:00
Michael Kirk
8dfe06e3f2 Ensure audio session is default after call is terminated.
Previously, we were enabling PlayAndRecord when a call ended due to the
CallService observer's "updateVideoTrack" callbacks.

// FREEBIE
2018-02-18 15:35:37 -05:00
Michael Kirk
707ab5f5a8 Minimize changes around call audio activity
// FREEBIE
2018-02-16 14:00:15 -08:00
Michael Kirk
4dd1c7813a Instrument calls to ensure audio session is maintained
// FREEBIE
2018-02-16 14:00:15 -08:00
Michael Kirk
c646f76335 Garther audio concerns, clean up session when done
- sync speakerphone state manipulated from system call screen
  - Revert audio session after call failure, ensures media plays out of
    speaker after placing a failing call.
  - Replace notification with delegate pattern since we're already using
    delegate pattern here.
- Fixes voiceover accessibility after voice memo
- Avoid audio blip after pressing hangup
- Rename CallAudioSession -> OWSAudioSession
  Going to start using it for other non-call things since we want to
  gather all our audio session concerns.
- Resume background audio when done playing video
  - Extract OWSVideoPlayer which ensures audio is in proper state before
    playback
  - Move recording session logic to shared OWSAudioSession
  - Deactivate audio session when complete

// FREEBIE
2018-02-06 18:45:51 -08:00
Michael Kirk
e3469649f7 Fix receiving calls
// FREEBIE
2018-02-02 11:13:57 -08:00
Matthew Chen
e77c3e6717 Retain changes from session database branch. 2018-01-10 12:18:23 -05:00
Matthew Chen
f9ce34f553 Improve background task logic. 2017-12-19 11:05:17 -05:00
Matthew Chen
7a1e47cd26 Add asserts around Swift singletons. 2017-12-07 13:57:45 -05:00
Matthew Chen
9da165b846 Continue conversion of app setup. 2017-12-05 11:19:11 -05:00
Matthew Chen
b4e8df79da Migrate environment to SignalMessaging. 2017-12-05 10:29:29 -05:00
Matthew Chen
8cc33b3de1 Refine loading view of share extension. 2017-12-01 10:48:18 -05:00
Michael Kirk
a11d83187b WIP: Framework-friendly - compiles but crashes on launch
// FREEBIE
2017-11-29 13:58:27 -08:00
Michael Kirk
81f097c1f5 Don't drop critical data messages
Assigning dataChannel sometimes happens after iceConnect.

Fixes symptom where Alice calls Bob.
Bob answers and sees the call UI as normal
but Alice sees call as continuing to ring

// FREEBIE
2017-11-20 14:35:16 -05:00
Michael Kirk
91f25bec3c Remove overzealous assert
// FREEBIE
2017-11-20 14:35:16 -05:00
Matthew Chen
fc07c7c04f Respond to CR.
// FREEBIE
2017-11-09 03:14:58 -05:00
Matthew Chen
5cc292fb6c Don't ask for camera permissions if app is not active.
// FREEBIE
2017-11-09 03:02:05 -05:00
Matthew Chen
f86882b5ff Don't ask for camera permissions if app is not active.
// FREEBIE
2017-11-09 02:57:15 -05:00
Michael Kirk
b77e331732 Unify Mute/Hold audio handling
// FREEBIE
2017-11-02 08:49:46 -04:00
Michael Kirk
c7642cc628 Fix volume burst when call connects
By centralizing AudioSession management onto the AudioService, we can
avoid enabling the RTCAudioSession while we're mid-ring.

Also allows us to centralize and remove redundant audio session logic.

// FREEBIE
2017-11-02 08:49:46 -04:00
Michael Kirk
36a39caad6 Remove overzealous assert
// FREEBIE
2017-11-02 08:49:46 -04:00
Michael Kirk
dd5a19d1fd Suspend while answering shows "Missed Call"
When awakened by a voip push, we get some arbitrary amount of background
time to connect the call (in practice this is ~30s) before the app is
suspended.

Though we were properly terminating the call upon being suspended, we
were not notifying the user that they had missed a call.

// FREEBIE
2017-10-12 14:34:36 -04:00
Michael Kirk
39e5875a36 remove overzealous assert 2017-10-05 13:02:38 -04:00
Michael Kirk
f171c56488 Video calls use MetalKit when available
Taking advantage of the new RTCMTLVideoView where available
(64bit && >=iOS9), should help performance (battery and rendering
quality).

// FREEBIE
2017-10-05 13:02:38 -04:00
Matthew Chen
7b1b532b19 Respond to CR.
// FREEBIE
2017-09-18 16:05:01 -04:00
Matthew Chen
43370ffc3f Fix assert during calls without camera permission.
// FREEBIE
2017-09-18 16:03:03 -04:00
Michael Kirk
3d9796db77 Debug actions for calling
For testing stale hangup/busy messages

Extracted MessageSender promise API
Moved call debug actions to their own page

// FREEBIE
2017-08-11 09:21:11 -04:00
Michael Kirk
8da3108b53 Drop stale EndCall/BusyCall messages
// FREEBIE
2017-08-11 07:35:48 -04:00
Matthew Chen
d9bc3ac806 Respond to CR.
// FREEBIE
2017-08-03 10:49:37 -04:00
Matthew Chen
791e270578 Terminate call if call view presentation is delayed.
// FREEBIE
2017-08-03 10:29:40 -04:00
Matthew Chen
634617b7d4 Terminate call if call view presentation is delayed.
// FREEBIE
2017-08-03 10:26:22 -04:00
Michael Kirk
81d7f28253 Timer to ensure call screen shown
// FREEBIE
2017-08-02 19:13:46 -04:00
Matthew Chen
dd13119f12 Add more instrumentation to CallService.
// FREEBIE
2017-07-27 13:57:29 -04:00
Matthew Chen
904515994f Add more instrumentation to CallService.
// FREEBIE
2017-07-27 13:28:05 -04:00
Matthew Chen
465711c2cb Add script to extract and gather analytics event names.
// FREEBIE
2017-07-27 12:45:29 -04:00
Matthew Chen
0cf9c01af2 Add script to extract and gather analytics event names.
// FREEBIE
2017-07-27 12:27:48 -04:00
Matthew Chen
8aff95c44e Add script to extract and gather analytics event names.
// FREEBIE
2017-07-27 12:26:02 -04:00
Matthew Chen
b4f348ad14 Add script to extract and gather analytics event names.
// FREEBIE
2017-07-27 12:26:02 -04:00
Matthew Chen
31ab9a00da Add script to extract and gather analytics event names.
// FREEBIE
2017-07-27 12:26:02 -04:00
Matthew Chen
863fd27abe Respond to CR.
// FREEBIE
2017-07-26 10:52:15 -04:00
Matthew Chen
8e51b5ade1 Clean up ahead of PR.
// FREEBIE
2017-07-26 10:01:43 -04:00
Matthew Chen
958a8b4c80 Instrument CallService.
// FREEBIE
2017-07-26 10:01:43 -04:00
Michael Kirk
03f1bbca62 Move state from CallViewController -> Call
I think whenever reasonable we prefer to consodlidate state on the call

// FREEBIE
2017-07-13 17:08:42 -04:00
Matthew Chen
ac616d6936 Reject the “call connected” promise immediately when clearing a call.
// FREEBIE
2017-07-12 18:12:27 -04:00
Michael Kirk
b82aedc3a0 Assertion failures for unexpected promise state
These don't currently result in failed calls, but we should at least
know about it in debug.

// FREEBIE
2017-07-12 16:15:22 -04:00
Michael Kirk
438635393b Don't send ICE updates until after the CallOffer has been sent.
This ensures message ordering for clients that can't handle out of order
call messages (legacy iOS and Android).

Even when we revert the previous commit, to send ICE Updates sooner,
we'll want to keep this (until we're confident all clients can receive
out of order call messages)

// FREEBIE
2017-07-12 16:15:22 -04:00
Michael Kirk
d910da0157 Partial revert of: Send ICE updates immediately - 2dcfb4e3b8
That change makes it more likely that the remote client will receive an
ICE update before their peer connection client is set.

We want to ship the robustness fix (waitForPeerConnection in
handleRemoteAddedIceCandidate) before we have the caller start sending
ICE updates immediately, in a future release.

At that time, we can simply revert this commit.

// FREEBIE
2017-07-12 16:15:22 -04:00
Matthew Chen
d639d6557e Add owsFail free function for swift.
// FREEBIE
2017-07-11 16:20:20 -04:00
Michael Kirk
2dcfb4e3b8 Send ICE updates immediately.
Now that SN changes do not block incoming messages, the caller does not
need to enqueue outgoing ICE updates.

However this introduces the possibility that the call recipient could
recieve an ICE update before their peerConnectionClient is set up - so
now we ensure that call service waits for it's peerConnectionClient
before processing incoming ICE updates.

// FREEBIE
2017-07-10 11:49:38 -05:00
Matthew Chen
1a400f8414 Respond to CR.
// FREEBIE
2017-07-10 12:39:44 -04:00
Matthew Chen
b6531a8b5d If two users call each other at the same time, ensure they both see “busy”.
// FREEBIE
2017-07-10 12:25:22 -04:00
Michael Kirk
f681712ea0 Code Cleanup
- make some logging clearer
- remove noisy unhelpful logging
- clearer method names

// FREEBIE
2017-07-10 11:09:39 -05:00
Matthew Chen
0244e134f5 Block device from sleeping during certain activities.
// FREEBIE
2017-07-06 17:35:47 -04:00
Michael Kirk
1f9f066fa9 print call record when declining a call
// FREEBIE
2017-07-05 12:45:34 -05:00
Michael Kirk
8abde1dff8 Non-Callkit adapter plays audio from notification when app is in
background

// FREEBIE
2017-07-05 11:53:16 -05:00
Matthew Chen
3d0811c03f Respond to CR.
// FREEBIE
2017-06-21 18:06:29 -04:00
Matthew Chen
029da7e0ce Hang up current call if we receive a call offer from the same user.
// FREEBIE
2017-06-21 17:47:42 -04:00
Matthew Chen
9fc92990f5 Improve logging in CallService.
// FREEBIE
2017-06-21 17:47:42 -04:00
Michael Kirk
36c09aeb84 cleanup ahead of PR
// FREEBIE
2017-06-20 16:24:59 -04:00
Michael Kirk
ff93732ed7 WIP: fix call from contacts when signal hasn't been launched yet 2017-06-20 16:17:37 -04:00
Matthew Chen
bd440f0878 Respond to post-holiday code reviews.
// FREEBIE
2017-06-17 13:38:19 -04:00
Matthew Chen
3bc73bea25 Don't return busy signal to untrusted callers.
// FREEBIE
2017-06-15 15:46:56 -04:00
Matthew Chen
f5f506d06f Investigate “call stuck on connecting” issue.
// FREEBIE
2017-06-13 11:18:27 -04:00
Michael Kirk
1a3204bf46 create interaction in thread when missing call due to changed identity
// FREEBIE
2017-06-07 15:04:21 -04:00
Michael Kirk
8c592a373a log error on assertion failure
// FREEBIE
2017-06-07 10:30:08 -04:00
Michael Kirk
c8d547a08f Only allow callback for identities that were not previously verified
// FREEBIE
2017-06-07 10:29:45 -04:00
Michael Kirk
1127553041 restore "confirm and callback" functionality
// FREEBIE
2017-06-07 10:29:01 -04:00
Michael Kirk
41a34e572b Update Safety Number alerts to work with verification
// FREEBIE
2017-06-07 10:18:16 -04:00
Matthew Chen
ceb210748e Sketch out OWSIdentityManager.
// FREEBIE
2017-06-07 10:18:16 -04:00
Michael Kirk
5b12f4afae Prevent outgoing calls started from various places unless have been seen
e.g. from contacts app

// FREEBIE
2017-06-01 12:59:34 -07:00
Michael Kirk
130aa132a0 Reject incoming calls from an unseen changed identity
// FREEBIE
2017-06-01 12:59:34 -07:00
Michael Kirk
20fc733bdf Clearer call logging
// FREEBIE
2017-05-10 13:03:45 -04:00
Matthew Chen
716aa772f6 Always sync and log push tokens. Apply OWSAlerts in more places.
// FREEBIE
2017-05-09 10:04:48 -04:00
Matthew Chen
ad3a1a671a Merge remote-tracking branch 'origin/hotfix/2.11.3' 2017-05-08 16:47:20 -04:00
Michael Kirk
d7c7fff679 Fix some compiler warnings
* explicit optional usage in strings
* remove some unused StringUtil code
* swiftlint affected files
* more concise optional casting (and avoid a `!`)

Compiler warnings: 343 -> 318

(Actually most of these are in external libs, but 115 remain in Signal/SSK)

// FREEBIE
2017-05-05 14:26:29 -04:00
Michael Kirk
6beee7c012 verify peerconnection at proper time
// FREEBIE
2017-05-04 15:15:14 -04:00
Michael Kirk
2ec893d315 Ensure we're retaining all promises to completion
// FREEBIE
2017-05-04 15:15:14 -04:00