Przeglądaj źródła

remove old audio control

Marino Faggiana 1 rok temu
rodzic
commit
b1259d27e9

+ 0 - 3
iOSClient/Utility/CCUtility.h

@@ -166,9 +166,6 @@
 + (NSInteger)getLogLevel;
 + (void)setLogLevel:(NSInteger)value;
 
-+ (NSInteger)getAudioVolume;
-+ (void)setAudioVolume:(NSInteger)volume;
-
 + (BOOL)getAccountRequest;
 + (void)setAccountRequest:(BOOL)set;
 

+ 0 - 17
iOSClient/Utility/CCUtility.m

@@ -656,23 +656,6 @@
     [UICKeyChainStore setString:valueString forKey:@"logLevel" service:NCGlobal.shared.serviceShareKeyChain];
 }
 
-+ (NSInteger)getAudioVolume
-{
-    NSString *volume = [UICKeyChainStore stringForKey:@"audioVolume" service:NCGlobal.shared.serviceShareKeyChain];
-
-    if (volume == nil) {
-        return 100;
-    } else {
-        return [volume integerValue];
-    }
-}
-
-+ (void)setAudioVolume:(NSInteger)volume
-{
-    NSString *volumeString = [@(volume) stringValue];
-    [UICKeyChainStore setString:volumeString forKey:@"audioVolume" service:NCGlobal.shared.serviceShareKeyChain];
-}
-
 + (BOOL)getAccountRequest
 {
     return [[UICKeyChainStore stringForKey:@"accountRequest" service:NCGlobal.shared.serviceShareKeyChain] boolValue];

+ 0 - 76
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -45,11 +45,6 @@ class NCPlayerToolBar: UIView {
     @IBOutlet weak var labelLeftTime: UILabel!
     @IBOutlet weak var labelCurrentTime: UILabel!
 
-    @IBOutlet weak var volumeView: UIView!
-    @IBOutlet weak var volumeSlider: UISlider!
-    @IBOutlet weak var volumeSliderConstraintWidth: NSLayoutConstraint!
-    @IBOutlet weak var volumeSliderConstraintTrailing: NSLayoutConstraint!
-
     enum sliderEventType {
         case began
         case ended
@@ -107,45 +102,17 @@ class NCPlayerToolBar: UIView {
 
         forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white), for: .normal)
 
-        do {
-            try audioSession.setActive(true, options: [])
-            audioSession.addObserver(self, forKeyPath: "outputVolume", options: [.new], context: nil)
-        } catch {
-            print("error")
-        }
-
-        volumeSliderConstraintWidth.constant = self.frame.size.width / 2
-        volumeSliderConstraintTrailing.constant = -(volumeSliderConstraintWidth.constant / 2) + 15
-        volumeSlider.value = audioSession.outputVolume
-        volumeSlider.tintColor = .white
-        volumeSlider.setThumbImage(UIImage(), for: .normal)
-        volumeSlider.maximumValueImage = getSpeakerImage()
-        volumeSlider.isHidden = true
-        volumeSlider.addTarget(self, action: #selector(volumeValChanged(slider:event:)), for: .valueChanged)
-
-        // let panGestureRecognizerVolume = UIPanGestureRecognizer(target: self, action: #selector(didPanWith(gestureRecognizer:)))
-        // volumeView.addGestureRecognizer(panGestureRecognizerVolume)
-
         // Normally hide
         self.alpha = 0
         self.isHidden = true
     }
 
-    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
-
-        if keyPath == "outputVolume"{
-            volumeSlider.value = audioSession.outputVolume
-            volumeSlider.maximumValueImage = getSpeakerImage()
-        }
-    }
-
     required init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
     }
 
     deinit {
 
-        audioSession.removeObserver(self, forKeyPath: "outputVolume")
         print("deinit NCPlayerToolBar")
     }
 
@@ -198,23 +165,6 @@ class NCPlayerToolBar: UIView {
 
     // MARK: -
 
-    func getSpeakerImage() -> UIImage {
-
-        let volume = audioSession.outputVolume
-
-        if volume == 0 {
-            return NCUtility.shared.loadImage(named: "speaker0", color: .white, size: 20, renderingMode: .automatic)
-        } else if volume > 0 && volume <= 0.5 {
-            return NCUtility.shared.loadImage(named: "speaker1", color: .white, size: 20, renderingMode: .automatic)
-        } else if volume > 0.5 && volume < 1 {
-            return NCUtility.shared.loadImage(named: "speaker2", color: .white, size: 20, renderingMode: .automatic)
-        } else {
-            return NCUtility.shared.loadImage(named: "speaker3", color: .white, size: 20, renderingMode: .automatic)
-        }
-    }
-
-    // MARK: -
-
     public func show() {
 
         UIView.animate(withDuration: 0.3, animations: {
@@ -273,32 +223,6 @@ class NCPlayerToolBar: UIView {
         }
     }
 
-    @objc func volumeValChanged(slider: UISlider, event: UIEvent) {
-
-    }
-
-    @objc func didPanWith(gestureRecognizer: UIPanGestureRecognizer) {
-
-        let velocity = gestureRecognizer.velocity(in: volumeView)
-        let currentLocation = gestureRecognizer.translation(in: volumeView)
-        let step = volumeView.frame.height * 0.05
-        var add: Float = -(Float(Int(currentLocation.y / step)) / 10) * 100
-
-        if gestureRecognizer.state == .began {
-            if abs(velocity.x) > abs(velocity.y) {
-                gestureRecognizer.state = .cancelled
-            }
-        }
-
-        if gestureRecognizer.state == .changed {
-            if add > 0 {
-
-            } else if add < 0 {
-
-            }
-        }
-    }
-
     // MARK: - Action
 
     @objc func tapTopToolBarWith(gestureRecognizer: UITapGestureRecognizer) { }

+ 0 - 27
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.xib

@@ -45,25 +45,6 @@
                     </subviews>
                     <directionalEdgeInsets key="directionalLayoutMargins" top="5" leading="5" bottom="5" trailing="5"/>
                 </stackView>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UlI-V1-Wz3">
-                    <rect key="frame" x="331" y="103" width="83" height="681"/>
-                    <subviews>
-                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="Jec-GX-2dX">
-                            <rect key="frame" x="31" y="325.5" width="54" height="31"/>
-                            <constraints>
-                                <constraint firstAttribute="width" constant="50" id="tyN-ZD-51M"/>
-                            </constraints>
-                            <userDefinedRuntimeAttributes>
-                                <userDefinedRuntimeAttribute type="string" keyPath="layer.transform.rotation.z" value="-1.570795"/>
-                            </userDefinedRuntimeAttributes>
-                        </slider>
-                    </subviews>
-                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                    <constraints>
-                        <constraint firstAttribute="trailing" secondItem="Jec-GX-2dX" secondAttribute="trailing" id="pwZ-O5-ybP"/>
-                        <constraint firstItem="Jec-GX-2dX" firstAttribute="centerY" secondItem="UlI-V1-Wz3" secondAttribute="centerY" id="qND-ic-m70"/>
-                    </constraints>
-                </view>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="85m-50-8yp">
                     <rect key="frame" x="10" y="794" width="394" height="58"/>
                     <subviews>
@@ -153,15 +134,11 @@
             <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <constraints>
-                <constraint firstItem="85m-50-8yp" firstAttribute="top" secondItem="UlI-V1-Wz3" secondAttribute="bottom" constant="10" id="2mJ-aK-dch"/>
                 <constraint firstItem="85m-50-8yp" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="10" id="5H2-Gg-PEb"/>
                 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="85m-50-8yp" secondAttribute="trailing" constant="10" id="BXT-Qo-qFl"/>
                 <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="85m-50-8yp" secondAttribute="bottom" constant="10" id="N7Q-PF-7lb"/>
-                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="UlI-V1-Wz3" secondAttribute="trailing" id="dmY-RB-YLe"/>
                 <constraint firstItem="XfW-XC-eMf" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="10" id="fq3-6h-kkx"/>
                 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="XfW-XC-eMf" secondAttribute="trailing" constant="10" id="uYG-Ai-CGv"/>
-                <constraint firstItem="UlI-V1-Wz3" firstAttribute="top" secondItem="XfW-XC-eMf" secondAttribute="bottom" constant="10" id="zFs-be-FCU"/>
-                <constraint firstItem="UlI-V1-Wz3" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" multiplier="0.2" id="zVc-qr-lZr"/>
             </constraints>
             <connections>
                 <outlet property="audioButton" destination="sMY-qo-4CE" id="R7Q-de-Dsv"/>
@@ -174,10 +151,6 @@
                 <outlet property="playerToolBarView" destination="85m-50-8yp" id="eZK-p1-v65"/>
                 <outlet property="playerTopToolBarView" destination="XfW-XC-eMf" id="Qdp-IW-YhT"/>
                 <outlet property="subtitleButton" destination="qqZ-QN-TsW" id="XCP-hb-eZB"/>
-                <outlet property="volumeSlider" destination="Jec-GX-2dX" id="p6t-7N-Cfr"/>
-                <outlet property="volumeSliderConstraintTrailing" destination="pwZ-O5-ybP" id="ry2-tb-qrt"/>
-                <outlet property="volumeSliderConstraintWidth" destination="tyN-ZD-51M" id="Jgs-Kj-QQ7"/>
-                <outlet property="volumeView" destination="UlI-V1-Wz3" id="x2N-4V-o1N"/>
             </connections>
             <point key="canvasLocation" x="137.68115942028987" y="152.67857142857142"/>
         </view>