Commit Graph

418 Commits (d4d9be9f0cd68d42837096cf5a23290d9a8ad577)

Author SHA1 Message Date
Matthew Chen 9075a12ac6 PeerConnectionClient thread safety. 8 years ago
Matthew Chen c2f1a12d9f PeerConnectionClient thread safety. 8 years ago
Matthew Chen 88c2ff26e7 PeerConnectionClient thread safety. 8 years ago
Matthew Chen e63a7f8fb0 PeerConnectionClient thread safety. 8 years ago
Matthew Chen c3e8fde24c PeerConnectionClient thread safety. 8 years ago
Matthew Chen 1a0347b782 PeerConnectionClient thread safety. 8 years ago
Matthew Chen 729769afa7 PeerConnectionClient thread safety. 8 years ago
Matthew Chen a4a5e99534 PeerConnectionClient thread safety. 8 years ago
Matthew Chen 1d8c642346 Respond to CR. 8 years ago
Matthew Chen a5c42ecca8 Clean up ahead of CR. 8 years ago
Matthew Chen f68f3cc53d Call lifecycle edge cases. 8 years ago
Matthew Chen 3967a5ab05 Call lifecycle edge cases. 8 years ago
Matthew Chen 157f7617ca Respond to CR. 8 years ago
Matthew Chen 3d5cbb73fb Rework cleanup of peer connection client delegates. 8 years ago
Matthew Chen 91d54360ba Add contact view. 8 years ago
Matthew Chen 28063574d3 Fix call hangup crashes. 8 years ago
Michael Kirk 1967b5d29e "Reconnecting..." fixup
// FREEBIE
8 years ago
Michael Kirk e5b535ccf1 Implement camera direction toggle
// FREEBIE
8 years ago
Matthew Chen 6a8796ad04 Present calls using window manager. 8 years ago
Matthew Chen 7345ab2e4e Add window manager. Move call view to a separate window. 8 years ago
Michael Kirk 0f46834e8d Show "Reconnecting..." on call screen
// FREEBIE
8 years ago
Michael Kirk 830ed884cf Only log timeout when call actually times out
// FREEBIE
8 years ago
Matthew Chen 6caa5b87b6 Add more asserts around thread in SAE. 8 years ago
Michael Kirk b8485b19bd Merge tag '2.21.0.15' into release/2.22.0 8 years ago
Michael Kirk c5fc671c31 Fix lost call transactions after rebuilding callUIAdapter
// FREEBIE
8 years ago
Michael Kirk 319e0d808f Merge tag '2.21.0.14' into release/2.22.0 8 years ago
Michael Kirk 3aebaefc31 A lighter touch for the fix-call connect.
Though it should be fine, reloading the callUIAdapter is a bit heavy
handed. And the current implementation is prone to being broken, since
we sometimes forget not to treat callUIAdapter as a singleton.

Longer term we can find a way to either: make callUIAdapter a true
singleton or possibly make callUIAdapter a private member of something
which *is* a true singleton.

Since we only *need* it to be reloaded the one time the migration runs
(or when a user changes settings which should be rare) it makes sense to
remove it from the happy path.

// FREEBIE
8 years ago
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
8 years ago
Michael Kirk ec9538a3e4 Fix 2fa registration screen layout
Don't obscure message text on smaller form factors

Also, disable overzealous assert with non-callkit adapters. The adapter
is not a singleton, it gets rebuilt whenever call related privacy
settings are triggered.

// FREEBIE
8 years ago
Matthew Chen d6f4db1523 Rename TSStorageManager to OWSPrimaryStorage. 8 years ago
Matthew Chen 9db9409561 Share background tasks. 8 years ago
Michael Kirk 07ee3ea843 Merge tag '2.21.0.5' 8 years ago
Michael Kirk 1d3831eccd Registration Lock reminder view
Also fixed: Don't lose PIN across registrations

// FREEBIE
8 years ago
Michael Kirk 6077367e66 Notification sounds should respect silent switch
// FREEBIE
8 years ago
Michael Kirk 658b8c3223 CR: typos and doc changes
// FREEBIE
8 years ago
Michael Kirk 5959cdf070 Simplify call privacy settings
We've long allowed users to configure what shows up in message
notifications:

- name: content (by default)
- just name (no content)
- generic notification (no name nor content)

Now we're dual purposing that setting to apply to calls. If someone
doesn't want to show names in the message notifications, presumably also
don't want that name showing up in the call log.

Also, since the earlier CallKit/iCloud issues had been addressed before
iOS11, we upgrade all iOS11 users to the more intuitive CallKit
interface.

Also: introduce "use system call logs" toggle when available. It will be
enabled by default, but we disable it for legacy users who'd explicitly
opted *out* of CallKit.

// FREEBIE
8 years ago
Matthew Chen 5b9ab0cf5d Auto-disable CallKit privacy in iOS 11 and later. 8 years ago
Matthew Chen 38ff82ab97 Rebrand OWSAudioPlayer. 8 years ago
Matthew Chen 32b87d0e58 Remove custom ringtones. 8 years ago
Matthew Chen 99aedca45f Strip out special casing for pre-iOS 9 users. 8 years ago
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
8 years ago
Michael Kirk e8c5509f3a Respect system contact ringtones
If CallKit privacy is enabled, we'll always use the system default
ringer.

If CallKit privacy is *not* enabled we'll use any ringtone specified in
the for that contact in the address book, else fall back to the default

// FREEBIE
8 years ago
Matthew Chen 5e8f3086de Update call sounds. 8 years ago
Matthew Chen a0f4723fa2 Update call sounds. 8 years ago
Michael Kirk d7f8c3e9d3 Ensure inputAccessory doesn't obscure the SN alert
This affects iOS 8, 9, and to a lesser degree iOS10.
On iOS11, presenting an alert causes the keyboard/inputAccessoryView to
temporarily dismiss.

// FREEBIE
8 years ago
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
8 years ago
Michael Kirk 6eb1951ee6 Don't stop audio until after CallKit audio session is deactivated
// FREEBIE
8 years ago
Michael Kirk 707ab5f5a8 Minimize changes around call audio activity
// FREEBIE
8 years ago
Michael Kirk 4dd1c7813a Instrument calls to ensure audio session is maintained
// FREEBIE
8 years ago
Michael Kirk abb51b565a Don't de-activate audio sesion when other audio activities are happening
// FREEBIE
8 years ago
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
8 years ago
Michael Kirk e3469649f7 Fix receiving calls
// FREEBIE
8 years ago
Matthew Chen e77c3e6717 Retain changes from session database branch. 8 years ago
Matthew Chen f9ce34f553 Improve background task logic. 8 years ago
Matthew Chen 7a1e47cd26 Add asserts around Swift singletons. 8 years ago
Matthew Chen 9da165b846 Continue conversion of app setup. 8 years ago
Matthew Chen b4e8df79da Migrate environment to SignalMessaging. 8 years ago
Matthew Chen 8cc33b3de1 Refine loading view of share extension. 8 years ago
Michael Kirk a11d83187b WIP: Framework-friendly - compiles but crashes on launch
// FREEBIE
8 years ago
Michael Kirk 86c1a3d08a CR: use weak capture
// FREEBIE
8 years ago
Michael Kirk 30b50e1489 Activate audio at the proper time
// FREEBIE
8 years ago
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
8 years ago
Michael Kirk 2e75e9df55 Don't ignore critical errors
// FREEBIE
8 years ago
Michael Kirk 91f25bec3c Remove overzealous assert
// FREEBIE
8 years ago
Michael Kirk abb57f2a15 App icon for system call screen
On iOS10 there was a default "..." button, but now we need our own.

// FREEBIE
8 years ago
Matthew Chen fc07c7c04f Respond to CR.
// FREEBIE
8 years ago
Matthew Chen 5cc292fb6c Don't ask for camera permissions if app is not active.
// FREEBIE
8 years ago
Matthew Chen 5e61307ce3 Don't ask for microphone permissions if app is not active.
// FREEBIE
8 years ago
Matthew Chen f86882b5ff Don't ask for camera permissions if app is not active.
// FREEBIE
8 years ago
Michael Kirk b77e331732 Unify Mute/Hold audio handling
// FREEBIE
8 years ago
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
8 years ago
Michael Kirk 402d4157c8 Uniform volume when ringing on speakerphone vs video
// FREEBIE
8 years ago
Michael Kirk 36a39caad6 Remove overzealous assert
// FREEBIE
8 years ago
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
8 years ago
Michael Kirk 3d3af21792 CR: clarify comment, proper linewrap
// FREEBIE
8 years ago
Michael Kirk c3dc8508ab pre-PR cleanup
// FREEBIE
8 years ago
Michael Kirk 39e5875a36 remove overzealous assert 8 years ago
Michael Kirk ff2f9ebaf0 fix compiling on 32bit.
// FREEBIE
8 years ago
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
8 years ago
Matthew Chen 445f6dc6f8 Respond to CR.
// FREEBIE
8 years ago
Matthew Chen 35a2470cb7 Post notifications asynchronously.
// FREEBIE
8 years ago
Matthew Chen 3367292ba0 Merge branch 'hotfix/2.16.1' 8 years ago
Matthew Chen b6d782046a Normalize conversation presentation logic.
// FREEBIE
8 years ago
Matthew Chen 7b1b532b19 Respond to CR.
// FREEBIE
8 years ago
Matthew Chen 43370ffc3f Fix assert during calls without camera permission.
// FREEBIE
8 years ago
Matthew Chen e8daf9a8d3 Fix assert when missing camera permission during calls.
// FREEBIE
8 years ago
Michael Kirk c4139b0f3e Callkit ringer uses profile name
Also presents formatted number instead of e164

// FREEBIE
8 years ago
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
8 years ago
Michael Kirk 8da3108b53 Drop stale EndCall/BusyCall messages
// FREEBIE
8 years ago
Matthew Chen d9bc3ac806 Respond to CR.
// FREEBIE
8 years ago
Matthew Chen 791e270578 Terminate call if call view presentation is delayed.
// FREEBIE
8 years ago
Matthew Chen 634617b7d4 Terminate call if call view presentation is delayed.
// FREEBIE
8 years ago
Michael Kirk 81d7f28253 Timer to ensure call screen shown
// FREEBIE
8 years ago
Michael Kirk c6069376d8 more logging
// FREEBIE
8 years ago
Matthew Chen dd13119f12 Add more instrumentation to CallService.
// FREEBIE
8 years ago
Matthew Chen 904515994f Add more instrumentation to CallService.
// FREEBIE
8 years ago
Matthew Chen 465711c2cb Add script to extract and gather analytics event names.
// FREEBIE
8 years ago
Matthew Chen 0cf9c01af2 Add script to extract and gather analytics event names.
// FREEBIE
8 years ago
Matthew Chen 8aff95c44e Add script to extract and gather analytics event names.
// FREEBIE
8 years ago
Matthew Chen b4f348ad14 Add script to extract and gather analytics event names.
// FREEBIE
8 years ago
Matthew Chen 31ab9a00da Add script to extract and gather analytics event names.
// FREEBIE
8 years ago
Matthew Chen 863fd27abe Respond to CR.
// FREEBIE
8 years ago
Matthew Chen 8e51b5ade1 Clean up ahead of PR.
// FREEBIE
8 years ago
Matthew Chen 958a8b4c80 Instrument CallService.
// FREEBIE
8 years ago
Matthew Chen 03aacbd682 [SSK] Try applying national prefixes when parsing phone numbers.
// FREEBIE
8 years ago
Matthew Chen a9ce1cde2f Simplify CallViewController.
// FREEBIE
8 years ago
Matthew Chen 149c64ce49 Refine call service.
// FREEBIE
8 years ago
Michael Kirk 9287b8560c clean up comments per code review
// FREEBIE
8 years ago
Michael Kirk fb5c17a6b4 minimize sound overlap
Because there is some asynchrony involved, there may be a blip during
the switch between sounds/audio sessions

// FREEBIE
8 years ago
Michael Kirk e3faddedbc Disallow bluetooth when user has opted for local receiver
// FREEBIE
8 years ago
Michael Kirk 524ba80b75 WIP: have ensureAudioSession set preferred input
Call it all the time, but only mutate the AVAudioSession when necessary

TODO

Can't switch to iPhone

// FREEBIE
8 years ago
Michael Kirk 220cd345f6 add comments
// FREEBIE
8 years ago
Michael Kirk ba97ff3f5f Label tweaks for device listing
// FREEBIE
8 years ago
Michael Kirk b8ec353d77 Use recommended approach for speakerphone mode
From: https://developer.apple.com/library/content/qa/qa1754/_index.html

Q:  Can you explain the difference between calling the AVAudioSession method overrideOutputAudioPort: with the value AVAudioSessionPortOverrideSpeaker and using the category option AVAudioSessionCategoryOptionDefaultToSpeaker with setCategory:withOptions:error:.

A: The difference is that setting the AVAudioSessionPortOverride by calling overrideOutputAudioPort: is more transient than using the category option AVAudioSessionCategoryOptionDefaultToSpeaker.

Important: The use of both AVAudioSessionPortOverrideSpeaker and AVAudioSessionCategoryOptionDefaultToSpeaker are only applicable to the AVAudioSessionCategoryPlayAndRecord category.
Calling overrideOutputAudioPort: and setting the AVAudioSessionPortOverride to AVAudioSessionPortOverrideSpeaker is a way of temporarily overriding the output to play to the speaker. Any route change or interruption will cause the audio to be routed back to its normal route, following the last-in wins rule. Think of using overrideOutputAudioPort: in terms of what you might use to implement a Speakerphone button where you want to be able to toggle between the speaker (AVAudioSessionPortOverrideSpeaker) and the normal output route (AVAudioSessionPortOverrideNone).

Note: This property is intended to allow 3rd party applications to mimic the behavior of a Speakerphone button and therefore may change the input route as well as output route. For example, setting the AVAudioSessionPortOverride to AVAudioSessionPortOverrideSpeaker while a headset is plugged in will cause the route to change to built-in mic / built-in speaker.

// FREEBIE
8 years ago
Michael Kirk b495b23420 more cleanup and commenting
// FREEBIE
8 years ago
Michael Kirk 03f1bbca62 Move state from CallViewController -> Call
I think whenever reasonable we prefer to consodlidate state on the call

// FREEBIE
8 years ago
Michael Kirk 4e11e90ebb cleanup
- remove dead code
- rename vars
- add coments

// FREEBIE
8 years ago
Michael Kirk 9bd68ed490 WIP: bluetooth shows audio route button instead of speakerphone
// FREEBIE

TODO

NEED
-[ ] icon in route picker
-[ ] commit cleanup

NICE
-[ ] present action sheet automatically when making outgoing bluetooth call
-[ ] left align icons
-[ ] audio is paused when switching between video mode (maybe existing behavior, not sure)
-[ ] Copy: iPhone/iPad/iPod instead of "iPhone Microphone"

DONE
-[x] remove "receiver" from options while in video mode
-[x] show available audio routes
-[x] select available audio routes
-[x] notification if availabe inputs change so we can update call screen
     mid call with available BT route
-[x] include speakerphone in choices
-[x] Enabled button shows active speakerphone. Should still show
     bluetooth picker.
-[x] toggle back and forth between audio devices
-[x] hide audio route button in video mode if no BT available
-[x] Fixed: When on speakerphone - switching to video mode goes back to bluetooth.
-[x] Fixed: When switching to video w/ bluetooth device connected there is no
     audio picker.
-[x] respect speakerphone/BT selection when in or toggling to/from video
-[x] do not hide audio route button when in video mode and bluetooth
     connected
-[x] Show which is currently selected audio route
-[x] switching to speakerphone no longer works
-[x] switching *back* to bluetooth no longer works
-[x] add proper bluetooth button for audio calls
-[x] add proper bluetooth button for video calls
8 years ago
Matthew Chen ac616d6936 Reject the “call connected” promise immediately when clearing a call.
// FREEBIE
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
Matthew Chen d639d6557e Add owsFail free function for swift.
// FREEBIE
8 years ago
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
8 years ago
Matthew Chen 1a400f8414 Respond to CR.
// FREEBIE
8 years ago
Matthew Chen b6531a8b5d If two users call each other at the same time, ensure they both see “busy”.
// FREEBIE
8 years ago
Michael Kirk f681712ea0 Code Cleanup
- make some logging clearer
- remove noisy unhelpful logging
- clearer method names

// FREEBIE
8 years ago
Michael Kirk d8330a2c4f Fix bluetooth audio for calls
Allow bluetooth in all call speaking modes. This was much simpler to fix
now that all call AudioSession mgmt happens in one method.

// FREEBIE
8 years ago
Matthew Chen 0244e134f5 Block device from sleeping during certain activities.
// FREEBIE
8 years ago
Michael Kirk 1f9f066fa9 print call record when declining a call
// FREEBIE
8 years ago
Michael Kirk 1e0cf89f7a Explanatory comment
// FREEBIE
8 years ago
Michael Kirk 43a3a4afaf play *after* stop
In theory this shouldn't make a difference, since we're not playing the
ringer twice, but in practice I fail to here ringer audio 50% of the
time (in DEBUG builds) while app is in the foreground.

// FREEBIE
8 years ago
Michael Kirk 8abde1dff8 Non-Callkit adapter plays audio from notification when app is in
background

// FREEBIE
8 years ago
Matthew Chen 3d0811c03f Respond to CR.
// FREEBIE
8 years ago
Matthew Chen 029da7e0ce Hang up current call if we receive a call offer from the same user.
// FREEBIE
8 years ago
Matthew Chen 9fc92990f5 Improve logging in CallService.
// FREEBIE
8 years ago
Michael Kirk 39563ab8c2 present from signalsViewController so users don't get confused by being
dropped into a different thread when the call is over.

e.g. chatting with Alice, but Bob calls. When I end the call with Bob It
would be too easy to fire off a message assuming it's going to Bob.

// FREEBIE
8 years ago
Michael Kirk 36c09aeb84 cleanup ahead of PR
// FREEBIE
8 years ago
Michael Kirk ff93732ed7 WIP: fix call from contacts when signal hasn't been launched yet 8 years ago
Matthew Chen bd440f0878 Respond to post-holiday code reviews.
// FREEBIE
8 years ago
Matthew Chen 3bc73bea25 Don't return busy signal to untrusted callers.
// FREEBIE
9 years ago
Matthew Chen f5f506d06f Investigate “call stuck on connecting” issue.
// FREEBIE
9 years ago
Michael Kirk 1a3204bf46 create interaction in thread when missing call due to changed identity
// FREEBIE
9 years ago
Michael Kirk 8c592a373a log error on assertion failure
// FREEBIE
9 years ago
Michael Kirk c8d547a08f Only allow callback for identities that were not previously verified
// FREEBIE
9 years ago
Michael Kirk 1127553041 restore "confirm and callback" functionality
// FREEBIE
9 years ago
Michael Kirk 146031e4d5 update copy / remove some unused "unseen" tracking
// FREEBIE
9 years ago
Michael Kirk 41a34e572b Update Safety Number alerts to work with verification
// FREEBIE
9 years ago
Matthew Chen ceb210748e Sketch out OWSIdentityManager.
// FREEBIE
9 years ago
Michael Kirk 5b12f4afae Prevent outgoing calls started from various places unless have been seen
e.g. from contacts app

// FREEBIE
9 years ago