Commit graph

66 commits

Author SHA1 Message Date
Michael Kirk 64a0c4bfaa auto-migrate to Swift5 2019-04-04 13:44:42 -06:00
Michael Kirk ce9ca1bdaa audio player type 2018-10-24 07:46:27 -06:00
Michael Kirk 3b4188f34b hoist audio session singleton to Environment 2018-10-24 07:46:25 -06:00
Michael Kirk d6a6024f37 Update PromiseKit 2018-10-13 16:04:20 -06:00
Matthew Chen 5b50e81b4f Rename fail macros in Swift. 2018-08-27 10:27:48 -04:00
Matthew Chen cf6f3841a8 Apply new Swift logging. 2018-08-27 10:02:28 -04:00
Michael Kirk 82e559d11b Use swift macros for main thread assert 2018-08-23 10:29:49 -06:00
Michael Kirk 0f46834e8d Show "Reconnecting..." on call screen
// FREEBIE
2018-04-19 09:56:09 -04:00
Matthew Chen 6caa5b87b6 Add more asserts around thread in SAE. 2018-04-13 14:59:38 -04:00
Michael Kirk 6077367e66 Notification sounds should respect silent switch
// FREEBIE
2018-03-03 11:33:31 -05:00
Michael Kirk 658b8c3223 CR: typos and doc changes
// FREEBIE
2018-02-26 15:19:52 -05:00
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
2018-02-26 15:19:52 -05:00
Matthew Chen 38ff82ab97 Rebrand OWSAudioPlayer. 2018-02-26 14:47:57 -05:00
Matthew Chen 32b87d0e58 Remove custom ringtones. 2018-02-26 14:47:57 -05:00
Matthew Chen 99aedca45f Strip out special casing for pre-iOS 9 users. 2018-02-26 14:13:38 -05:00
Matthew Chen a0f4723fa2 Update call sounds. 2018-02-23 12:53:43 -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 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
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 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 30b50e1489 Activate audio at the proper time
// FREEBIE
2017-11-20 14:35:16 -05: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 402d4157c8 Uniform volume when ringing on speakerphone vs video
// FREEBIE
2017-11-02 08:49:46 -04:00
Michael Kirk 3d3af21792 CR: clarify comment, proper linewrap
// FREEBIE
2017-10-05 13:02:39 -04:00
Michael Kirk c3dc8508ab pre-PR cleanup
// FREEBIE
2017-10-05 13:02:38 -04:00
Michael Kirk ff2f9ebaf0 fix compiling on 32bit.
// FREEBIE
2017-10-05 13:02:38 -04:00
Matthew Chen 445f6dc6f8 Respond to CR.
// FREEBIE
2017-09-21 17:03:57 -04:00
Matthew Chen 35a2470cb7 Post notifications asynchronously.
// FREEBIE
2017-09-21 17:03:57 -04:00
Michael Kirk 9287b8560c clean up comments per code review
// FREEBIE
2017-07-15 17:11:41 -04:00
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
2017-07-15 17:11:41 -04:00
Michael Kirk e3faddedbc Disallow bluetooth when user has opted for local receiver
// FREEBIE
2017-07-15 17:11:41 -04:00
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
2017-07-15 17:11:41 -04:00
Michael Kirk 220cd345f6 add comments
// FREEBIE
2017-07-15 17:11:41 -04:00
Michael Kirk ba97ff3f5f Label tweaks for device listing
// FREEBIE
2017-07-15 17:11:41 -04:00
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
2017-07-14 09:49:48 -04:00
Michael Kirk b495b23420 more cleanup and commenting
// FREEBIE
2017-07-13 17:08:42 -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
Michael Kirk 4e11e90ebb cleanup
- remove dead code
- rename vars
- add coments

// FREEBIE
2017-07-13 17:08:41 -04:00
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
2017-07-13 17:08:41 -04:00
Matthew Chen d639d6557e Add owsFail free function for swift.
// FREEBIE
2017-07-11 16:20:20 -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
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
2017-07-06 17:54:14 -05:00
Michael Kirk 1e0cf89f7a Explanatory comment
// FREEBIE
2017-07-05 11:55:00 -05:00
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
2017-07-05 11:53:16 -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
Michael Kirk 17cff1a26d Revert "Merge branch 'charlesmchen/bluetoothAudio'"
This reverts commit 48a2005aa2, reversing
changes made to de1332479c.

// FREEBIE
2017-05-15 18:14:51 -04:00
Matthew Chen 6c9f44b99d Clean up ahead of PR.
// FREEBIE
2017-05-15 17:23:53 -04:00
Matthew Chen 7e18052c45 Fix Bluetooth audio in calls.
// FREEBIE
2017-05-15 17:23:53 -04:00