Skip to content

Commit

Permalink
Merge pull request #49 from MixinMessenger/feature/audio
Browse files Browse the repository at this point in the history
Center align cancel button
  • Loading branch information
over140 authored Jun 21, 2018
2 parents 1991b73 + d9b1d6b commit f414fda
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Mixin/Core/Audio/MXNAudioPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ - (void)audioSessionRouteChange:(NSNotification *)notification {
AVAudioSessionRouteChangeReason reason = [notification.userInfo[AVAudioSessionRouteChangeReasonKey] unsignedIntegerValue];
switch (reason) {
case AVAudioSessionRouteChangeReasonOverride:
case AVAudioSessionRouteChangeReasonNewDeviceAvailable: {
case AVAudioSessionRouteChangeReasonNewDeviceAvailable:
case AVAudioSessionRouteChangeReasonRouteConfigurationChange: {
break;
}
case AVAudioSessionRouteChangeReasonCategoryChange: {
Expand All @@ -264,8 +265,7 @@ - (void)audioSessionRouteChange:(NSNotification *)notification {
case AVAudioSessionRouteChangeReasonUnknown:
case AVAudioSessionRouteChangeReasonOldDeviceUnavailable:
case AVAudioSessionRouteChangeReasonWakeFromSleep:
case AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory:
case AVAudioSessionRouteChangeReasonRouteConfigurationChange: {
case AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory: {
[self stopWithAudioSessionDeactivated:YES];
break;
}
Expand Down
6 changes: 3 additions & 3 deletions Mixin/Core/Audio/MXNAudioRecorder.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ - (void)audioSessionRouteChange:(NSNotification *)notification {
AVAudioSessionRouteChangeReason reason = [notification.userInfo[AVAudioSessionRouteChangeReasonKey] unsignedIntegerValue];
switch (reason) {
case AVAudioSessionRouteChangeReasonOverride:
case AVAudioSessionRouteChangeReasonNewDeviceAvailable: {
case AVAudioSessionRouteChangeReasonNewDeviceAvailable:
case AVAudioSessionRouteChangeReasonRouteConfigurationChange: {
break;
}
case AVAudioSessionRouteChangeReasonCategoryChange: {
Expand All @@ -175,8 +176,7 @@ - (void)audioSessionRouteChange:(NSNotification *)notification {
case AVAudioSessionRouteChangeReasonUnknown:
case AVAudioSessionRouteChangeReasonOldDeviceUnavailable:
case AVAudioSessionRouteChangeReasonWakeFromSleep:
case AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory:
case AVAudioSessionRouteChangeReasonRouteConfigurationChange: {
case AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory: {
[self cancel];
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class AudioInputViewController: UIViewController {
startRecordingIfGranted()
recordGestureBeganPoint = recordGestureRecognizer.location(in: view)
slideToCancelContentView.alpha = 1
animateShowLockView()
case .changed:
let location = recordGestureRecognizer.location(in: view)
let horizontalDistance = max(0, recordGestureBeganPoint.x - location.x)
Expand Down Expand Up @@ -229,6 +228,7 @@ extension AudioInputViewController {
if isShowingLongPressHint {
animateHideLongPressHint()
}
animateShowLockView()
conversationViewController?.setInputWrapperHidden(true)
slideViewCenterXConstraint.constant = 0
preferredContentSize.width = UIScreen.main.bounds.width
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class WaveformView: UIView {
}

static func estimatedWidth(forDurationInSeconds duration: Int) -> CGFloat {
let duration = max(Waveform.minDuration, min(Waveform.maxDuration, duration))
let numberOfBars = Waveform.numberOfValues(forDurationInSeconds: duration)
return 1.5 * barWidth * CGFloat(numberOfBars)
}
Expand Down
16 changes: 12 additions & 4 deletions Mixin/UserInterface/Storyboard/Chat.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,10 @@
<rect key="frame" x="327.5" y="55" width="40" height="200"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="V0W-Cr-zFF">
<rect key="frame" x="0.0" y="55" width="375" height="200"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="r1K-Cs-6xD">
<rect key="frame" x="0.0" y="0.0" width="320" height="54.5"/>
<subviews>
Expand Down Expand Up @@ -2202,11 +2206,11 @@
<outletCollection property="gestureRecognizers" destination="lPA-XX-rls" appends="YES" id="zGa-Fh-AgB"/>
</connections>
</imageView>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="unk-Os-zQq">
<view hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="unk-Os-zQq">
<rect key="frame" x="65.5" y="0.0" width="309.5" height="55"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eyz-oe-6bw">
<rect key="frame" x="0.0" y="0.0" width="254.5" height="55"/>
<rect key="frame" x="-65.5" y="0.0" width="375" height="55"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Cancel"/>
<userDefinedRuntimeAttributes>
Expand Down Expand Up @@ -2234,26 +2238,30 @@
<constraint firstAttribute="trailing" secondItem="FST-iG-OaY" secondAttribute="trailing" id="cJA-BW-teO"/>
<constraint firstAttribute="bottom" secondItem="eyz-oe-6bw" secondAttribute="bottom" id="ekJ-uF-yb2"/>
<constraint firstAttribute="bottom" secondItem="FST-iG-OaY" secondAttribute="bottom" id="mMQ-rx-8IJ"/>
<constraint firstItem="FST-iG-OaY" firstAttribute="leading" secondItem="eyz-oe-6bw" secondAttribute="trailing" id="pbT-8Y-viN"/>
<constraint firstItem="eyz-oe-6bw" firstAttribute="leading" secondItem="unk-Os-zQq" secondAttribute="leading" id="wCB-0A-mXx"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Zt0-eZ-yAA" firstAttribute="leading" secondItem="r1K-Cs-6xD" secondAttribute="trailing" id="7Js-H5-6dp"/>
<constraint firstAttribute="trailing" secondItem="eyz-oe-6bw" secondAttribute="trailing" id="7t7-Ze-lf0"/>
<constraint firstItem="V0W-Cr-zFF" firstAttribute="height" secondItem="I2m-Ir-vYO" secondAttribute="height" id="BW7-db-mZM"/>
<constraint firstAttribute="bottom" secondItem="r1K-Cs-6xD" secondAttribute="bottom" id="GgV-v1-zuM"/>
<constraint firstItem="U7v-cP-WyC" firstAttribute="trailing" secondItem="Zt0-eZ-yAA" secondAttribute="trailing" id="Jhk-3k-9hK"/>
<constraint firstAttribute="bottom" secondItem="I2m-Ir-vYO" secondAttribute="bottom" priority="250" id="Ku2-hA-4b7"/>
<constraint firstAttribute="bottom" secondItem="unk-Os-zQq" secondAttribute="bottom" id="Nbv-RO-X3d"/>
<constraint firstAttribute="trailing" secondItem="V0W-Cr-zFF" secondAttribute="trailing" id="PSt-to-yGY"/>
<constraint firstItem="U7v-cP-WyC" firstAttribute="bottom" secondItem="Zt0-eZ-yAA" secondAttribute="bottom" id="QIF-Qi-QJP"/>
<constraint firstItem="unk-Os-zQq" firstAttribute="leading" secondItem="tMG-4F-9D7" secondAttribute="trailing" id="X6Z-01-Grt"/>
<constraint firstItem="V0W-Cr-zFF" firstAttribute="top" secondItem="GGT-9f-mbQ" secondAttribute="bottom" id="XM3-2c-w0q"/>
<constraint firstItem="I2m-Ir-vYO" firstAttribute="centerX" secondItem="Zt0-eZ-yAA" secondAttribute="centerX" id="aOj-LW-bhN"/>
<constraint firstItem="V0W-Cr-zFF" firstAttribute="leading" secondItem="GGT-9f-mbQ" secondAttribute="leading" id="bEL-CW-7XG"/>
<constraint firstAttribute="trailing" secondItem="unk-Os-zQq" secondAttribute="trailing" id="bgw-NH-NKQ"/>
<constraint firstItem="I2m-Ir-vYO" firstAttribute="top" secondItem="GGT-9f-mbQ" secondAttribute="bottom" priority="750" id="cqr-Wv-g09"/>
<constraint firstItem="Zt0-eZ-yAA" firstAttribute="top" secondItem="U7v-cP-WyC" secondAttribute="top" id="dnM-U3-j4W"/>
<constraint firstItem="r1K-Cs-6xD" firstAttribute="top" secondItem="GGT-9f-mbQ" secondAttribute="top" id="fab-Wv-38p"/>
<constraint firstItem="unk-Os-zQq" firstAttribute="top" secondItem="GGT-9f-mbQ" secondAttribute="top" id="oNk-Mi-7Ht"/>
<constraint firstItem="eyz-oe-6bw" firstAttribute="leading" secondItem="GGT-9f-mbQ" secondAttribute="leading" id="u0H-8k-7ef"/>
<constraint firstItem="r1K-Cs-6xD" firstAttribute="leading" secondItem="U7v-cP-WyC" secondAttribute="leading" id="xoI-WU-klJ"/>
</constraints>
<viewLayoutGuide key="safeArea" id="U7v-cP-WyC"/>
Expand Down

0 comments on commit f414fda

Please sign in to comment.